Files
gochat/backend
Rogee 31238476b1 fix(captain): 修复 playground 500 — GetConfig nil pointer panic + 清理重复 buildSystemPrompt
根因:captain_assistants.config 中 temperature 字段为字符串 "0.5",
json.Unmarshal 到 float64 字段失败,GetConfig() 返回 nil,
调用方吞掉错误后 BuildAssistantPrompt 解引用 nil cfg 导致 panic。

修复:
- GetConfig() unmarshal 失败时返回空 &cfg{} 而非 nil,防止 nil dereference
- 删除 captain_assistant_service.go 中重复的 buildSystemPrompt 函数,
  统一使用 SystemPromptBuilder.BuildAssistantPrompt
- generatePlaygroundLLMResponse / GenerateResponse 增加
  ErrProviderNotConfigured 检查,返回 fallback 消息而非 500
2026-08-01 17:21:01 +08:00
..