feat(voice): 每用户 JARVIS——自定义名字/人设 + 自带豆包配置回落 + 语音不串主记忆

把 JARVIS 做成每用户独立:名字(你叫JARVIS别人叫星期五)、人设(与主偏好记忆分开)、
可自带豆包配置(齐全则用用户的,否则回落系统)。

- store/user_jarvis.go: sundynix_user_jarvis(user_id唯一;name/persona/火山creds,APIKey密文)
  + Get/Save(upsert) + AutoMigrate 注册
- voice_config.go resolveJarvis(uid): 火山配置用户优先系统兜底 + 取名字/人设
- voice_task.go: voiceSystemPrompt(name,persona)——简短是硬基线,名字/语气由用户定;
  buildVoiceGraph 带 name+persona;voice.go 会话升级时按用户解析
- dispatcher compose_compiler: 语音任务(useVoice)不拉主偏好记忆,改用用户 persona(保留短期历史)
- jarvis.go + 路由: GET/PUT /api/v1/me/jarvis(用户级,api_key 脱敏/留空沿用)

真机验证:设 name=星期五+干净人设→语音答"我是星期五…"(自称新名、无糙话、4.4s),
has_own_voice=false 用系统豆包。

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Blizzard
2026-07-22 14:05:29 +08:00
parent fb3685532c
commit 99ce07c1b0
12 changed files with 238 additions and 21 deletions
@@ -65,7 +65,9 @@ func (o *Orchestrator) execComposeGraph(ctx context.Context, t *contract.Task, t
// 无图/空图:退化为 compose 单轮对话。
if ferr != nil || flow == nil || len(flow.Nodes) == 0 {
tr.info("task", "system", "无结构化图", "按单轮对话执行(compose")
b.profile = o.fetchMemory(ctx, b.uid, b.query)
if !b.useVoice { // 语音用用户设的 JARVIS persona,不拉主偏好记忆(两者分开,互不污染)
b.profile = o.fetchMemory(ctx, b.uid, b.query)
}
b.history = o.fetchHistory(ctx, b.sid)
o.runComposeConversation(ctx, t.ID, b, plan.System, tr, "agent", "模型流式推理")
return b.answer, refsOf(b), b.fatalErr // 模型失败 → 上抛判 failed(对齐 graph.go
@@ -101,7 +103,9 @@ func (o *Orchestrator) execComposeGraph(ctx context.Context, t *contract.Task, t
}
}
if !hasMemory {
b.profile = o.fetchMemory(ctx, b.uid, b.query)
if !b.useVoice { // 语音不拉主偏好记忆,改用用户为 JARVIS 单设的 persona(系统提示里注入)
b.profile = o.fetchMemory(ctx, b.uid, b.query)
}
b.history = o.fetchHistory(ctx, b.sid)
}
}