diff --git a/go/internal/distill/engine.go b/go/internal/distill/engine.go index 861a26a..b867092 100644 --- a/go/internal/distill/engine.go +++ b/go/internal/distill/engine.go @@ -280,7 +280,8 @@ func (e *Engine) callLLM5D(content string) (LLMResponse, error) { 内容: %s -只返回JSON: {"decisions": ["决定1", "决定2"], "conclusions": ["结论1"], "actions_taken": ["行动1"], "open_questions": ["问题1"], "entities": ["entity1", "entity2"], "is": 0.X, "su": 0.X, "pa": 0.X, "vd": 0.X, "ru": 0.X}`, truncate(content, 1000)) +只返回JSON: {"decisions": ["决定1", "决定2"], "conclusions": ["结论1"], "actions_taken": ["行动1"], "open_questions": ["问题1"], "entities": ["entity1", "entity2"], "is": 0.8, "su": 0.7, "pa": 0.6, "vd": 0.9, "ru": 0.7} +评分说明:is/su/pa/vd/ru 是 0.0 到 1.0 之间的浮点数(越高越好),不要用 0-10 整数。`, truncate(content, 1000)) body := map[string]interface{}{ "model": e.LLMModel, @@ -318,6 +319,8 @@ func (e *Engine) callLLM5D(content string) (LLMResponse, error) { Message struct { Content string `json:"content"` ReasoningContent string `json:"reasoning_content"` + // OpenAI 系 reasoning 模型(gpt-oss 等)用 "reasoning" 字段,不是 "reasoning_content" + Reasoning string `json:"reasoning"` } `json:"message"` } `json:"choices"` } @@ -335,6 +338,15 @@ func (e *Engine) callLLM5D(content string) (LLMResponse, error) { if llmContent == "" { llmContent = result.Choices[0].Message.ReasoningContent } + if llmContent == "" { + llmContent = result.Choices[0].Message.Reasoning + } + // 剥离 markdown code fence(minimax 等模型习惯用 ```json 包裹) + llmContent = strings.TrimSpace(llmContent) + llmContent = strings.TrimPrefix(llmContent, "```json") + llmContent = strings.TrimPrefix(llmContent, "```") + llmContent = strings.TrimSuffix(llmContent, "```") + llmContent = strings.TrimSpace(llmContent) if err := json.Unmarshal([]byte(llmContent), &llmResp); err != nil { log.Printf("[distill] LLM JSON parse error: %v | content=%q", err, truncate(llmContent, 200)) return LLMResponse{}, fmt.Errorf("parse score: %w", err)