mirror of
https://github.com/router-for-me/CLIProxyAPI.git
synced 2026-02-19 04:40:52 +08:00
**fix(translator): simplify string handling in Gemini responses**
This commit is contained in:
@@ -691,14 +691,10 @@ func extractReasoningTexts(node gjson.Result) []string {
|
|||||||
|
|
||||||
switch node.Type {
|
switch node.Type {
|
||||||
case gjson.String:
|
case gjson.String:
|
||||||
if text := strings.TrimSpace(node.String()); text != "" {
|
texts = append(texts, node.String())
|
||||||
texts = append(texts, text)
|
|
||||||
}
|
|
||||||
case gjson.JSON:
|
case gjson.JSON:
|
||||||
if text := node.Get("text"); text.Exists() {
|
if text := node.Get("text"); text.Exists() {
|
||||||
if trimmed := strings.TrimSpace(text.String()); trimmed != "" {
|
texts = append(texts, text.String())
|
||||||
texts = append(texts, trimmed)
|
|
||||||
}
|
|
||||||
} else if raw := strings.TrimSpace(node.Raw); raw != "" && !strings.HasPrefix(raw, "{") && !strings.HasPrefix(raw, "[") {
|
} else if raw := strings.TrimSpace(node.Raw); raw != "" && !strings.HasPrefix(raw, "{") && !strings.HasPrefix(raw, "[") {
|
||||||
texts = append(texts, raw)
|
texts = append(texts, raw)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user