mirror of
https://github.com/YspCoder/clawgo.git
synced 2026-04-14 19:37:31 +08:00
webui chat: lock to main agent, remove session picker, load full persisted history
This commit is contained in:
@@ -188,6 +188,21 @@ func gatewayCmd() {
|
||||
}
|
||||
return agentLoop.ProcessDirect(cctx, content, sessionKey)
|
||||
})
|
||||
registryServer.SetChatHistoryHandler(func(sessionKey string) []map[string]interface{} {
|
||||
h := agentLoop.GetSessionHistory(sessionKey)
|
||||
out := make([]map[string]interface{}, 0, len(h))
|
||||
for _, m := range h {
|
||||
entry := map[string]interface{}{"role": m.Role, "content": m.Content}
|
||||
if strings.TrimSpace(m.ToolCallID) != "" {
|
||||
entry["tool_call_id"] = m.ToolCallID
|
||||
}
|
||||
if len(m.ToolCalls) > 0 {
|
||||
entry["tool_calls"] = m.ToolCalls
|
||||
}
|
||||
out = append(out, entry)
|
||||
}
|
||||
return out
|
||||
})
|
||||
registryServer.SetConfigAfterHook(func() {
|
||||
_ = syscall.Kill(os.Getpid(), syscall.SIGHUP)
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user