Merge pull request #2657 from lc6464/fix-deepseek-v4-thinking-history

fix(reasoning): persist canonical history for DeepSeek and web chat
This commit is contained in:
美電球
2026-04-25 15:08:48 +08:00
committed by GitHub
17 changed files with 1172 additions and 73 deletions
+17 -5
View File
@@ -6,6 +6,7 @@ import (
"context"
"encoding/json"
"fmt"
"maps"
"path/filepath"
"strings"
"time"
@@ -478,17 +479,28 @@ func sideQuestionResponseContent(response *providers.LLMResponse) string {
if response == nil {
return ""
}
if response.Content != "" {
if strings.TrimSpace(response.Content) != "" {
return response.Content
}
return response.ReasoningContent
return responseReasoningContent(response)
}
func responseReasoningContent(response *providers.LLMResponse) string {
if response == nil {
return ""
}
if strings.TrimSpace(response.Reasoning) != "" {
return response.Reasoning
}
if strings.TrimSpace(response.ReasoningContent) != "" {
return response.ReasoningContent
}
return ""
}
func shallowCloneLLMOptions(opts map[string]any) map[string]any {
clone := make(map[string]any, len(opts))
for k, v := range opts {
clone[k] = v
}
maps.Copy(clone, opts)
return clone
}