[GH-ISSUE #318] 哥你看看ai说的 #226

Closed
opened 2026-02-27 07:18:34 +03:00 by kerem · 1 comment
Owner

Originally created by @Tik30 on GitHub (Feb 11, 2026).
Original GitHub issue: https://github.com/justlovemaki/AIClient-2-API/issues/318

我们在 2026-02-11 对 AIClient-2-API 做了源码和线上日志双重排查,结论是:

这是主项目的已存在 bug,不是 usage-management 插件导致。
问题点在 handleModelListRequest 的变量作用域:
common.js (line 790):toProvider 在 try 内定义。
common.js (line 815):catch 中使用 toProvider,当 try 前半段报错时会触发 ReferenceError: toProvider is not defined。
上游一致性证据

GitHub 仓库:justlovemaki/AIClient-2-API
main 与 tag v2.9.3.1 都指向同一 commit:7d414cd5ac62a2d51448e19517f1b489fe5923d8。
对比 common.jsv2.9.3.1..main 为 NO_DIFF,说明上游当前版本同样存在该代码路径问题。
可看位置:
https://github.com/justlovemaki/AIClient-2-API/blob/v2.9.3.1/src/utils/common.js#L790
https://github.com/justlovemaki/AIClient-2-API/blob/v2.9.3.1/src/utils/common.js#L815
线上日志证据(同一请求链路)

日志中同一请求 Req:bc6f4cf7 先出现原始错误(模型列表初始化失败),随后二次抛出:
Could not discover a valid Google Cloud Project ID(触发点在 common.js (line 797)
紧接着 Request failed (500): toProvider is not defined
栈顶定位 common.js:815:55)
为什么不是插件导致

插件只拦截 usage_ 前缀 key:
key-manager.js (line 13)
middleware.js (line 23)
非 usage_ key 请求会直接放行:
index.js (line 142)
因此该 500 与插件链路无直接因果关系。

Originally created by @Tik30 on GitHub (Feb 11, 2026). Original GitHub issue: https://github.com/justlovemaki/AIClient-2-API/issues/318 我们在 2026-02-11 对 AIClient-2-API 做了源码和线上日志双重排查,结论是: 这是主项目的已存在 bug,不是 usage-management 插件导致。 问题点在 handleModelListRequest 的变量作用域: [common.js (line 790)](https://file+.vscode-resource.vscode-cdn.net/Users/zhijin/.vscode/extensions/openai.chatgpt-0.4.71-darwin-arm64/webview/#):toProvider 在 try 内定义。 [common.js (line 815)](https://file+.vscode-resource.vscode-cdn.net/Users/zhijin/.vscode/extensions/openai.chatgpt-0.4.71-darwin-arm64/webview/#):catch 中使用 toProvider,当 try 前半段报错时会触发 ReferenceError: toProvider is not defined。 上游一致性证据 GitHub 仓库:justlovemaki/AIClient-2-API main 与 tag v2.9.3.1 都指向同一 commit:7d414cd5ac62a2d51448e19517f1b489fe5923d8。 对比 [common.js](https://file+.vscode-resource.vscode-cdn.net/Users/zhijin/.vscode/extensions/openai.chatgpt-0.4.71-darwin-arm64/webview/#),[v2.9.3.1..main](https://file+.vscode-resource.vscode-cdn.net/Users/zhijin/.vscode/extensions/openai.chatgpt-0.4.71-darwin-arm64/webview/#) 为 NO_DIFF,说明上游当前版本同样存在该代码路径问题。 可看位置: https://github.com/justlovemaki/AIClient-2-API/blob/v2.9.3.1/src/utils/common.js#L790 https://github.com/justlovemaki/AIClient-2-API/blob/v2.9.3.1/src/utils/common.js#L815 线上日志证据(同一请求链路) 日志中同一请求 Req:bc6f4cf7 先出现原始错误(模型列表初始化失败),随后二次抛出: Could not discover a valid Google Cloud Project ID(触发点在 [common.js (line 797)](https://file+.vscode-resource.vscode-cdn.net/Users/zhijin/.vscode/extensions/openai.chatgpt-0.4.71-darwin-arm64/webview/#)) 紧接着 Request failed (500): toProvider is not defined 栈顶定位 [common.js:815:55)](https://file+.vscode-resource.vscode-cdn.net/Users/zhijin/.vscode/extensions/openai.chatgpt-0.4.71-darwin-arm64/webview/#) 为什么不是插件导致 插件只拦截 usage_ 前缀 key: [key-manager.js (line 13)](https://file+.vscode-resource.vscode-cdn.net/Users/zhijin/.vscode/extensions/openai.chatgpt-0.4.71-darwin-arm64/webview/#) [middleware.js (line 23)](https://file+.vscode-resource.vscode-cdn.net/Users/zhijin/.vscode/extensions/openai.chatgpt-0.4.71-darwin-arm64/webview/#) 非 usage_ key 请求会直接放行: [index.js (line 142)](https://file+.vscode-resource.vscode-cdn.net/Users/zhijin/.vscode/extensions/openai.chatgpt-0.4.71-darwin-arm64/webview/#) 因此该 500 与插件链路无直接因果关系。
kerem closed this issue 2026-02-27 07:18:34 +03:00
Author
Owner

@justlovemaki commented on GitHub (Feb 11, 2026):

toProvider is not defined ,toProvider 你看看是啥吧
Could not discover a valid Google Cloud Project ID,需要手动设置Project ID
如果你都不知道是啥,去看看文档

<!-- gh-comment-id:3881855985 --> @justlovemaki commented on GitHub (Feb 11, 2026): toProvider is not defined ,toProvider 你看看是啥吧 Could not discover a valid Google Cloud Project ID,需要手动设置Project ID 如果你都不知道是啥,去看看文档
Sign in to join this conversation.
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/AIClient-2-API-justlovemaki#226
No description provided.