Merge pull request #809 from alfadb/feature/openai-messages

feat(openai): 添加 /v1/messages 端点和 API 兼容层
This commit is contained in:
Wesley Liddick
2026-03-06 20:16:06 +08:00
committed by GitHub
11 changed files with 2840 additions and 5 deletions

View File

@@ -5429,6 +5429,11 @@ func extractUpstreamErrorMessage(body []byte) string {
return m
}
// ChatGPT 内部 API 风格:{"detail":"..."}
if d := gjson.GetBytes(body, "detail").String(); strings.TrimSpace(d) != "" {
return d
}
// 兜底:尝试顶层 message
return gjson.GetBytes(body, "message").String()
}