fix: 修复Vercel部署的云函数无法使用获取QQ昵称功能的问题#916
Merged
Merged
Conversation
Contributor
审阅者指南(在小型 PR 上默认折叠)审阅者指南通过将新的 GET_QQ_NICK 动作连接到专用处理程序,并在其中使用 QQ_API_KEY 调用 getQQNick 并返回标准化响应,为 Vercel 无服务器 API 添加缺失的 QQ 昵称获取支持。 通过 Vercel API 执行 GET_QQ_NICK 以获取 QQ 昵称的时序图sequenceDiagram
actor User
participant Frontend
participant VercelApi as Vercel_api_handler
participant QQNickHandler as qqNickGet
participant QQService as getQQNick
participant QQApi as QQ_nickname_API
User ->> Frontend: Trigger_get_QQ_nickname
Frontend ->> VercelApi: POST { action: GET_QQ_NICK, qq }
VercelApi ->> QQNickHandler: qqNickGet(event)
QQNickHandler ->> QQService: getQQNick(qq, QQ_API_KEY)
QQService ->> QQApi: HTTP_request_with_qq_and_key
QQApi -->> QQService: nickname_response
QQService -->> QQNickHandler: nick
QQNickHandler -->> VercelApi: { code: SUCCESS, nick }
VercelApi -->> Frontend: JSON_response
Frontend -->> User: Display_nickname_or_error
Vercel API 处理程序与 QQ 昵称获取函数的类图classDiagram
class VercelApiHandler {
+handleRequest(request, response) Promise
-config
-RES_CODE
}
class QQNickHandler {
+qqNickGet(event) Promise
-validate(event, requiredFields)
}
class QQService {
+getQQNick(qq, qqApiKey) Promise
}
class Config {
+QQ_API_KEY
}
VercelApiHandler o-- QQNickHandler : calls_qqNickGet_on_GET_QQ_NICK
QQNickHandler ..> QQService : calls_getQQNick
QQNickHandler ..> Config : reads_QQ_API_KEY
VercelApiHandler ..> Config : uses_config_for_other_actions
文件级变更
提示与命令与 Sourcery 交互
自定义你的体验进入你的 仪表盘 以:
获取帮助Original review guide in EnglishReviewer's guide (collapsed on small PRs)Reviewer's GuideAdds missing QQ nickname retrieval support to the Vercel serverless API by wiring a new GET_QQ_NICK action to a dedicated handler that calls getQQNick with QQ_API_KEY and returns a standardized response. Sequence diagram for GET_QQ_NICK QQ nickname retrieval via Vercel APIsequenceDiagram
actor User
participant Frontend
participant VercelApi as Vercel_api_handler
participant QQNickHandler as qqNickGet
participant QQService as getQQNick
participant QQApi as QQ_nickname_API
User ->> Frontend: Trigger_get_QQ_nickname
Frontend ->> VercelApi: POST { action: GET_QQ_NICK, qq }
VercelApi ->> QQNickHandler: qqNickGet(event)
QQNickHandler ->> QQService: getQQNick(qq, QQ_API_KEY)
QQService ->> QQApi: HTTP_request_with_qq_and_key
QQApi -->> QQService: nickname_response
QQService -->> QQNickHandler: nick
QQNickHandler -->> VercelApi: { code: SUCCESS, nick }
VercelApi -->> Frontend: JSON_response
Frontend -->> User: Display_nickname_or_error
Class diagram for Vercel API handler and QQ nickname retrieval functionclassDiagram
class VercelApiHandler {
+handleRequest(request, response) Promise
-config
-RES_CODE
}
class QQNickHandler {
+qqNickGet(event) Promise
-validate(event, requiredFields)
}
class QQService {
+getQQNick(qq, qqApiKey) Promise
}
class Config {
+QQ_API_KEY
}
VercelApiHandler o-- QQNickHandler : calls_qqNickGet_on_GET_QQ_NICK
QQNickHandler ..> QQService : calls_getQQNick
QQNickHandler ..> Config : reads_QQ_API_KEY
VercelApiHandler ..> Config : uses_config_for_other_actions
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Contributor
There was a problem hiding this comment.
Hey - 我发现了 1 个问题
给 AI 智能体的提示
请根据本次代码审查中的评论进行修改:
## 单条评论
### 评论 1
<location path="src/server/vercel/api/index.js" line_range="149-150" />
<code_context>
case 'UPLOAD_IMAGE': // >= 1.5.0
res = await uploadImage(event, config)
break
+ case 'GET_QQ_NICK': // >= 1.7.0
+ res = await qqNickGet(event)
+ break
case 'COMMENT_EXPORT_FOR_ADMIN': // >= 1.6.13
</code_context>
<issue_to_address>
**issue (bug_risk):** 将 `config` 传入 `qqNickGet`,以避免使用超出作用域的变量。
`qqNickGet` 会引用 `config.QQ_API_KEY`,但在该函数内部 `config` 不在作用域内。为避免运行时错误,请在调用时传入 `config`(`qqNickGet(event, config)`),并更新函数签名,使其接受 `config` 作为参数。
</issue_to_address>帮我变得更有用!请在每条评论上点 👍 或 👎,我会根据你的反馈改进后续审查。
Original comment in English
Hey - I've found 1 issue
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location path="src/server/vercel/api/index.js" line_range="149-150" />
<code_context>
case 'UPLOAD_IMAGE': // >= 1.5.0
res = await uploadImage(event, config)
break
+ case 'GET_QQ_NICK': // >= 1.7.0
+ res = await qqNickGet(event)
+ break
case 'COMMENT_EXPORT_FOR_ADMIN': // >= 1.6.13
</code_context>
<issue_to_address>
**issue (bug_risk):** Pass `config` into `qqNickGet` to avoid using an out-of-scope variable.
`qqNickGet` references `config.QQ_API_KEY`, but `config` isn’t in scope inside that function. To prevent a runtime error, pass `config` into the call (`qqNickGet(event, config)`) and update the function signature to accept `config` as a parameter.
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
imaegoo
approved these changes
May 5, 2026
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.
当前的 twikoo-vercel 没有添加用于获取QQ昵称的路由,即使更新到最新版v1.7.7的 Vercel 云函数、配置了 QQ_API_KEY 也无法使用获取QQ昵称功能,提示“请更新 Twikoo 云函数至最新版本”,参考腾讯云函数添加获取QQ昵称的路由后恢复正常
修复前
修复后
Summary by Sourcery
Bug Fixes:
GET_QQ_NICK动作连接到 QQ 昵称获取逻辑,修复并恢复在 Vercel 部署中的 QQ 昵称查询功能。Original summary in English
Summary by Sourcery
Bug Fixes: