diff --git a/sundynix-dispatcher/internal/eino/orchestrator.go b/sundynix-dispatcher/internal/eino/orchestrator.go index a3f0712..3a8bfcb 100644 --- a/sundynix-dispatcher/internal/eino/orchestrator.go +++ b/sundynix-dispatcher/internal/eino/orchestrator.go @@ -172,8 +172,18 @@ func (o *Orchestrator) emitUsage(t *contract.Task, b *harness.Budget) { } uid, _ := t.Meta[contract.MetaUserID].(string) tid, _ := t.Meta[contract.MetaTenantID].(string) + // 记录本任务**实际所用模型**(语音任务=语音池,其余=工作池),让计费按真实模型定价, + // 别把语音快模型的账记到工作模型头上(否则 SaveUsageEvent 会拿激活 chat 模型兜底,错价)。 + pool := o.pool + if meta(t, contract.MetaModelProfile) == contract.ModelProfileVoice && o.voicePool != nil && o.voicePool.Ready() { + pool = o.voicePool + } + model := "" + if mn, ok := pool.(interface{ ModelName() string }); ok { + model = mn.ModelName() + } if err := o.usageSink.PublishUsage(&contract.UsageEvent{ - TaskID: t.ID, UserID: uid, TenantID: tid, PromptTok: p, CompTok: c, TotalTok: total, + TaskID: t.ID, UserID: uid, TenantID: tid, Model: model, PromptTok: p, CompTok: c, TotalTok: total, Exceeded: b.Exceeded(), TS: time.Now().UnixMilli(), }); err != nil { log.Printf("[usage] 回写用量失败 task=%s: %v", t.ID, err) diff --git a/sundynix-gateway/sim_answer.wav b/sundynix-gateway/sim_answer.wav index 40f0d15..326e983 100644 Binary files a/sundynix-gateway/sim_answer.wav and b/sundynix-gateway/sim_answer.wav differ diff --git a/sundynix-gateway/sim_question.wav b/sundynix-gateway/sim_question.wav index e31409b..cfa0c72 100644 Binary files a/sundynix-gateway/sim_question.wav and b/sundynix-gateway/sim_question.wav differ