feat(go-models): migrate batch 1 model drivers to unified handlers (#17696)

## Summary

Relate to #17284

Migrate 10 OpenAI-compatible drivers (`302ai`, `aliyun`, `astraflow`,
`avian`, `azure_openai`, `baichuan`, `baidu`, `cometapi`, `deepinfra`,
`futurmix`) to use the unified response handlers
(`HandleNonStreamingResponse` / `HandleStreamingResponse`), following
the same pattern established by `deepseek` in #17634.

- Cut ~150 lines per driver (1507 lines removed, 144 added across 10
files).
- No functional changes — pure deduplication of HTTP plumbing.
- Each driver now routes through `baseModel.doRequest()` and
`HandleNonStreamingResponse()`.

---------

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
jay77721
2026-08-03 12:13:43 +08:00
committed by GitHub
parent 5aa60cbb67
commit 194f75f401
13 changed files with 150 additions and 1568 deletions

View File

@@ -191,12 +191,17 @@ func extractContentAndChoices(result map[string]any) (*string, *string, []map[st
}
var reasonContent *string
if rc, ok := messageMap["reasoning_content"].(string); ok {
if rc, ok := messageMap["reasoning_content"].(string); ok && rc != "" {
reason := rc
if reason != "" && reason[0] == '\n' {
if reason[0] == '\n' {
reason = reason[1:]
}
reasonContent = &reason
} else if rc, ok := messageMap["reasoning"].(string); ok && rc != "" {
// Some providers (e.g. Avian) report reasoning under a top-level
// "reasoning" field instead of "reasoning_content".
reason := rc
reasonContent = &reason
} else {
// Always return a non-nil pointer so callers can rely on it.
empty := ""