feat(go-models): migrate batch 3 model drivers to unified handlers (#17698)

## Summary

Relate to #17284

Migrate 10 OpenAI-compatible drivers (`minimax`, `mistral`,
`modelscope`, `moonshot`, `n1n`, `novita`, `ollama`, `openai`,
`openai_api_compatible`, `openrouter`) to use the unified response
handlers (`HandleNonStreamingResponse` / `HandleStreamingResponse`),
following the same pattern established by `deepseek` in #17634.

- Cut ~150 lines per driver (1692 lines removed, 172 added across 10
files).
- `openai_api_compatible` gains `ChatWithMessages` +
`ChatStreamlyWithSender` required by the unified handler infrastructure.
- `openai` driver preserves `reasoning_content` extraction for o-series
models.
- All drivers: pure deduplication of HTTP plumbing.

---------

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
jay77721
2026-08-03 15:08:55 +08:00
committed by GitHub
parent bddc941814
commit 1478aa4ced
15 changed files with 447 additions and 1904 deletions

View File

@@ -115,8 +115,15 @@ func HandleStreamingResponse(
accumulateToolCallDeltas(delta, accumulatedToolCalls)
if reasoningContent, ok := delta["reasoning_content"].(string); ok && reasoningContent != "" {
if err := sender(nil, &reasoningContent); err != nil {
// Extract reasoning via the protocol hook so each provider can
// name its reasoning field differently (reasoning_content,
// reasoning, ...) without the shared handler knowing which.
extractReasoning := cfg.ExtractStreamReasoning
if extractReasoning == nil {
extractReasoning = extractDefaultStreamReasoning
}
if reasoning := extractReasoning(delta); reasoning != "" {
if err := sender(nil, &reasoning); err != nil {
return err
}
}