fix: satisfy errcheck for reasoning content conversion
This commit is contained in:
parent
6082d02d22
commit
fe3283a1d5
@ -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
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user