feat: /v1/messages端点适配codex账号池

This commit is contained in:
shaw
2026-03-06 22:39:33 +08:00
parent afbe8bf001
commit 921599948b
7 changed files with 341 additions and 297 deletions

View File

@@ -670,8 +670,14 @@ func (h *OpenAIGatewayHandler) anthropicStreamingAwareError(c *gin.Context, stat
if streamStarted {
flusher, ok := c.Writer.(http.Flusher)
if ok {
errorEvent := "event: error\ndata: " + `{"type":"error","error":{"type":` + strconv.Quote(errType) + `,"message":` + strconv.Quote(message) + `}}` + "\n\n"
fmt.Fprint(c.Writer, errorEvent) //nolint:errcheck
errPayload, _ := json.Marshal(gin.H{
"type": "error",
"error": gin.H{
"type": errType,
"message": message,
},
})
fmt.Fprintf(c.Writer, "event: error\ndata: %s\n\n", errPayload) //nolint:errcheck
flusher.Flush()
}
return