feat(gateway): 对所有请求(包括 Codex CLI)应用模型映射
- 移除 Codex CLI 的模型映射跳过逻辑 - 添加详细的模型映射日志,包含账号名称和请求类型 - 确保所有 OpenAI 请求都能正确应用账号配置的模型映射
This commit is contained in:
@@ -545,14 +545,12 @@ func (s *OpenAIGatewayService) Forward(ctx context.Context, c *gin.Context, acco
|
|||||||
|
|
||||||
isCodexCLI := openai.IsCodexCLIRequest(c.GetHeader("User-Agent"))
|
isCodexCLI := openai.IsCodexCLIRequest(c.GetHeader("User-Agent"))
|
||||||
|
|
||||||
// Apply model mapping (skip for Codex CLI for transparent forwarding)
|
// Apply model mapping for all requests (including Codex CLI)
|
||||||
mappedModel := reqModel
|
mappedModel := account.GetMappedModel(reqModel)
|
||||||
if !isCodexCLI {
|
if mappedModel != reqModel {
|
||||||
mappedModel = account.GetMappedModel(reqModel)
|
log.Printf("[OpenAI] Model mapping applied: %s -> %s (account: %s, isCodexCLI: %v)", reqModel, mappedModel, account.Name, isCodexCLI)
|
||||||
if mappedModel != reqModel {
|
reqBody["model"] = mappedModel
|
||||||
reqBody["model"] = mappedModel
|
bodyModified = true
|
||||||
bodyModified = true
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if account.Type == AccountTypeOAuth && !isCodexCLI {
|
if account.Type == AccountTypeOAuth && !isCodexCLI {
|
||||||
|
|||||||
Reference in New Issue
Block a user