mirror of
https://github.com/Wei-Shaw/sub2api.git
synced 2026-09-24 16:05:44 +08:00
fix: satisfy errcheck for reasoning content conversion
This commit is contained in:
@@ -150,12 +150,10 @@ func chatUserToResponses(m ChatMessage) ([]ResponsesInputItem, error) {
|
||||
// empty/nil and there are tool_calls, only function_call items are emitted.
|
||||
func chatAssistantToResponses(m ChatMessage) ([]ResponsesInputItem, error) {
|
||||
var items []ResponsesInputItem
|
||||
var content strings.Builder
|
||||
content := ""
|
||||
|
||||
if m.ReasoningContent != "" {
|
||||
content.WriteString("<thinking>")
|
||||
content.WriteString(m.ReasoningContent)
|
||||
content.WriteString("</thinking>")
|
||||
content = "<thinking>" + m.ReasoningContent + "</thinking>"
|
||||
}
|
||||
|
||||
// Emit assistant message with output_text if content is non-empty.
|
||||
@@ -165,15 +163,15 @@ func chatAssistantToResponses(m ChatMessage) ([]ResponsesInputItem, error) {
|
||||
return nil, err
|
||||
}
|
||||
if s != "" {
|
||||
if content.Len() > 0 {
|
||||
content.WriteByte('\n')
|
||||
if content != "" {
|
||||
content += "\n"
|
||||
}
|
||||
content.WriteString(s)
|
||||
content += s
|
||||
}
|
||||
}
|
||||
|
||||
if content.Len() > 0 {
|
||||
parts := []ResponsesContentPart{{Type: "output_text", Text: content.String()}}
|
||||
if content != "" {
|
||||
parts := []ResponsesContentPart{{Type: "output_text", Text: content}}
|
||||
partsJSON, err := json.Marshal(parts)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
||||
Reference in New Issue
Block a user