Repository navigation
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #8712
多协议 API key 账号实际走原生 Anthropic
/v1/messages时,三条转发入口没有更新运行时的上游端点。遇到网络、HTTP 或响应读取错误后,错误日志使用的GetUpstreamEndpoint可能读到先前的/v1/chat/completions或按入站路径推导的端点;例如没有 native Responses 的 adaptive Messages 账号会出现此问题。三条原生入口现在各调用一次现有
SetActualOpenAIUpstreamEndpoint,在解析和发送请求前将所选上游端点记为/v1/messages,供没有成功转发结果的诊断路径读取。回归通过公开的
OpenAIGatewayService转发入口,先核验实际发出的 HTTP 路径,再检查错误日志与无结果用量记录采用的 handler 端点 reader。覆盖 Kimi 的 Messages、Chat Completions、Responses 三入口,报告中的 Zhipu adaptive Messages/no-native-Responses,流式/非流式,以及网络错误、HTTP 拒绝、响应读取错误和成功对照。同一组 32 个场景在未修改的main@530c5e3a4全部因运行时端点断言失败,修复后全部通过。验证(Go 1.27.3 / macOS arm64):
go test -p=1 -tags=unit ./... -count=1:26,912 个测试/子测试通过,41 条件跳过。go test -p=2 -tags=integration ./... -count=1:16,143 个测试/子测试通过,16 条件跳过。golangci-lint v2.14.0全后端检查及带unit标记的增量 handler lint:均为0 issues;gofmt与git diff --check通过。首轮
-p=2完整 unit 曾在未修改的TestInflightEstimate_AccountMappingNoDBAndBoundedMemory(全局堆内存阈值)和TestRefreshIfNeeded_LateSuccessAfterDeadlineDoesNotPersist(10 ms deadline)各失败一次。原样 main 后端的两项隔离对照各跑 20 次均通过,完整 service 包对照为 18,759 通过/10 跳过;同一修复源码的上述完整-p=1unit 也通过。没有修改这两处实现或断言,本轮未确认首次失败根因,原始结果已保留。使用合成 HTTP/SSE 响应,未调用真实供应商或写入生产错误日志。上游 Go 1.27.3 安全基线升级仍由 #8670 单独处理。实现与验证由 AI agent 完成。