webui chat: lock to main agent, remove session picker, load full persisted history

This commit is contained in:
DBT
2026-02-26 02:04:54 +00:00
parent 6b6c0e9ef3
commit 2f5cf6338f
4 changed files with 113 additions and 88 deletions

View File

@@ -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)
})