-
-
Notifications
You must be signed in to change notification settings - Fork 927
QQ官方机器人增加沙盒模式选项,让本地部署能跳过IP白名单验证 #3087
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
a490077
wants to merge
1
commit into
AstrBotDevs:master
Choose a base branch
from
a490077:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
+6
−10
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
嗨,您好!我已审阅了您的更改,它们看起来很棒!
给AI代理的提示
请处理此代码审查中的评论:
## 独立评论
### 评论 1
<location> `astrbot/core/platform/sources/qqofficial_webhook/qo_webhook_server.py:18` </location>
<code_context>
self.appid = config["appid"]
self.secret = config["secret"]
self.port = config.get("port", 6196)
+ self.is_sandbox = config.get("is_sandbox", False)
self.callback_server_host = config.get("callback_server_host", "0.0.0.0")
</code_context>
<issue_to_address>
**建议:** 考虑验证配置中 'is_sandbox' 的类型。
明确地将 'is_sandbox' 转换为布尔值或进行验证,以防止其值从配置源以字符串形式出现时引发问题。
```suggestion
is_sandbox_raw = config.get("is_sandbox", False)
if isinstance(is_sandbox_raw, str):
self.is_sandbox = is_sandbox_raw.lower() in ("true", "1", "yes", "on")
else:
self.is_sandbox = bool(is_sandbox_raw)
```
</issue_to_address>
### 评论 2
<location> `astrbot/core/config/default.py:163-166` </location>
<code_context>
"enable": False,
"appid": "",
"secret": "",
+ "is_sandbox": False,
"callback_server_host": "0.0.0.0",
"port": 6196,
</code_context>
<issue_to_address>
**建议:** 考虑在配置中记录 'is_sandbox' 的用途。
阐明 'is_sandbox' 如何影响配置将帮助维护人员避免混淆并确保正确使用。
```suggestion
"appid": "",
"secret": "",
# If True, enables sandbox mode for API requests (use for testing/development).
# When set to False, production endpoints and credentials are used.
"is_sandbox": False,
"callback_server_host": "0.0.0.0",
```
</issue_to_address>
帮助我更有用!请点击每个评论旁边的👍或👎,我将使用这些反馈来改进您的评论。
Original comment in English
Hey there - I've reviewed your changes and they look great!
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location> `astrbot/core/platform/sources/qqofficial_webhook/qo_webhook_server.py:18` </location>
<code_context>
self.appid = config["appid"]
self.secret = config["secret"]
self.port = config.get("port", 6196)
+ self.is_sandbox = config.get("is_sandbox", False)
self.callback_server_host = config.get("callback_server_host", "0.0.0.0")
</code_context>
<issue_to_address>
**suggestion:** Consider validating the type of 'is_sandbox' from config.
Explicitly cast or validate 'is_sandbox' as a boolean to prevent issues if its value comes as a string from config sources.
```suggestion
is_sandbox_raw = config.get("is_sandbox", False)
if isinstance(is_sandbox_raw, str):
self.is_sandbox = is_sandbox_raw.lower() in ("true", "1", "yes", "on")
else:
self.is_sandbox = bool(is_sandbox_raw)
```
</issue_to_address>
### Comment 2
<location> `astrbot/core/config/default.py:163-166` </location>
<code_context>
"enable": False,
"appid": "",
"secret": "",
+ "is_sandbox": False,
"callback_server_host": "0.0.0.0",
"port": 6196,
</code_context>
<issue_to_address>
**suggestion:** Consider documenting the purpose of 'is_sandbox' in config.
Clarifying how 'is_sandbox' affects configuration will help maintainers avoid confusion and ensure correct usage.
```suggestion
"appid": "",
"secret": "",
# If True, enables sandbox mode for API requests (use for testing/development).
# When set to False, production endpoints and credentials are used.
"is_sandbox": False,
"callback_server_host": "0.0.0.0",
```
</issue_to_address>
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
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 #3076
Motivation / 动机
QQ官方机器人增加沙盒模式选项,让本地部署能跳过IP白名单验证
Modifications / 改动点
修改qq官方机器人适配器服务
qo_webhook_server.py
:QQOfficialWebhook
类中的BotHttp
实例化传入参数增加默认适配器中的配置选项
default.py
:"is_sandbox": False
Compatibility & Breaking Changes / 兼容性与破坏性变更
Checklist / 检查清单
requirements.txt
和pyproject.toml
文件相应位置。/ I have ensured that no new dependencies are introduced, OR if new dependencies are introduced, they have been added to the appropriate locations inrequirements.txt
andpyproject.toml
.