fix(mcp): make responses compliant to OpenAI APIs (#6436)

The result is enclosed in the Message field.

Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
This commit is contained in:
Ettore Di Giacinto
2025-10-11 16:58:11 +02:00
committed by GitHub
parent fa6bbd9fa2
commit 69d565e55d

View File

@@ -122,7 +122,7 @@ func MCPCompletionEndpoint(cl *config.ModelConfigLoader, ml *model.ModelLoader,
ID: id,
Created: created,
Model: input.Model, // we have to return what the user sent here, due to OpenAI spec.
Choices: []schema.Choice{{Text: f.LastMessage().Content}},
Choices: []schema.Choice{{Message: &schema.Message{Role: "assistant", Content: &f.LastMessage().Content}}},
Object: "text_completion",
}