mirror of
https://gitcode.com/JianFeeeee/HomeAgent.git
synced 2026-09-22 18:08:04 +00:00
feat(cli): /persona 与 /agents 对齐 WebUI(复用已开放的 SDK 面)
- /persona:读写 core.agent.personal_prompt / core.internal.persona_initialized; 插件 SDK 的 Settings() 满足 internal/config.PersonaKV,与 WebUI 同一实现。 GET 等价返回 initialized/current_prompt/file_override;/persona set <mode> [内容] 写。 - /agents:改用 supervisor.ListAgents()(WebUI /agents 同源),此前只回一个 agent_id、驻留子信息全丢。 - waiter 侧 /persona 在 local/remote 两条路都接上,/help 补齐。
This commit is contained in:
@ -47,6 +47,7 @@ Server commands (local 与 remote 行为一致):
|
||||
/adapters remove <name> remove a Lua adapter
|
||||
/network network status + LLM endpoints
|
||||
/runtime scheduler / residents / channel topology
|
||||
/persona show persona (/persona set default|custom|later [text])
|
||||
/agents list agents
|
||||
/chat <text> send to agent
|
||||
|
||||
@ -330,6 +331,28 @@ Any other text is sent to the agent directly.`)
|
||||
}
|
||||
return true
|
||||
|
||||
case cmd == "/persona" || strings.HasPrefix(cmd, "/persona set "):
|
||||
if rc := state.RemoteConn(); rc != nil {
|
||||
if strings.HasPrefix(cmd, "/persona set ") {
|
||||
rest := strings.TrimSpace(cmd[13:])
|
||||
mode := rest
|
||||
content := ""
|
||||
if idx := strings.IndexByte(rest, ' '); idx > 0 {
|
||||
mode = rest[:idx]
|
||||
content = strings.TrimSpace(rest[idx+1:])
|
||||
}
|
||||
body := fmt.Sprintf(`{"mode":%q,"content":%q}`, mode, content)
|
||||
d, _ := rc.DoAPI("POST", "/api/v1/persona", body)
|
||||
printJSON(out, d)
|
||||
} else {
|
||||
d, _ := rc.DoAPI("GET", "/api/v1/persona", "")
|
||||
printJSON(out, d)
|
||||
}
|
||||
} else {
|
||||
state.Send(cmd)
|
||||
}
|
||||
return true
|
||||
|
||||
case cmd == "/runtime":
|
||||
if rc := state.RemoteConn(); rc != nil {
|
||||
d, _ := rc.DoAPI("GET", "/api/v1/runtime", "")
|
||||
|
||||
Reference in New Issue
Block a user