BettaFish
BettaFish copied to clipboard
[Insight Engine Streamlit App] 研究过程中发生错误: Your request was blocked.
错误信息
研究过程中发生错误: Your request was blocked.
错误详情
Traceback (most recent call last):
File "/app/SingleEngineApp/insight_engine_streamlit_app.py", line 149, in execute_research
agent._generate_report_structure(query)
File "/app/SingleEngineApp/../InsightEngine/agent.py", line 417, in _generate_report_structure
self.state = report_structure_node.mutate_state(state=self.state)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/app/SingleEngineApp/../InsightEngine/nodes/report_structure_node.py", line 204, in mutate_state
raise e
File "/app/SingleEngineApp/../InsightEngine/nodes/report_structure_node.py", line 185, in mutate_state
report_structure = self.run(input_data, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/app/SingleEngineApp/../InsightEngine/nodes/report_structure_node.py", line 65, in run
raise e
File "/app/SingleEngineApp/../InsightEngine/nodes/report_structure_node.py", line 55, in run
response = self.llm_client.stream_invoke_to_string(SYSTEM_PROMPT_REPORT_STRUCTURE, self.query)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/app/SingleEngineApp/../InsightEngine/llms/base.py", line 148, in stream_invoke_to_string
for chunk in self.stream_invoke(system_prompt, user_prompt, **kwargs):
File "/app/SingleEngineApp/../InsightEngine/llms/base.py", line 132, in stream_invoke
raise e
File "/app/SingleEngineApp/../InsightEngine/llms/base.py", line 118, in stream_invoke
stream = self.client.chat.completions.create(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/openai/_utils/_utils.py", line 286, in wrapper
return func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/openai/resources/chat/completions/completions.py", line 1156, in create
return self._post(
^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/openai/_base_client.py", line 1259, in post
return cast(ResponseT, self.request(cast_to, opts, stream=stream, stream_cls=stream_cls))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/openai/_base_client.py", line 1047, in request
raise self._make_status_error_from_response(err.response) from None
openai.APIStatusError: Your request was blocked.
环境信息
- 应用: Insight Engine Streamlit App
- 时间: 2025-11-19 05:27:10
这个 “Your request was blocked” 错误通常和 OpenAI API 配置有关,比如 API key 无效、模型名或 base URL 配置错误、API 账号被限流/封禁,或者网络无法访问 API。常见排查方法如下:
- 检查
.env或环境变量里的 INSIGHT_ENGINE_API_KEY、INSIGHT_ENGINE_MODEL_NAME、INSIGHT_ENGINE_BASE_URL 是否填写正确,base URL 不能带/chat/completions等多余路径,只能是https://api.openai.com/v1这类根路径,否则会被 API 拒绝请求(参考)。 - 确认 API key 有效且有权限访问目标模型,部分模型需要专门申请权限(参考)。
- 检查是否触发了并发/频率限制,比如同一个 key 被多个 agent 并发使用,或者组织额度用尽,都会导致请求被 block(参考)。
- 如果你在国内,确认网络能正常访问 base URL,有时需要代理/VPN(参考)。
- 配置修改后务必重启服务,确保新参数生效。
可以在日志里加一行 print(self.llm_client.get_model_info()),确认实际用的模型和 API base 是你期望的。如果配置没问题,也可以用 curl 或 Postman 手动请求 base URL,看能否返回 200,进一步定位是网络、配置还是服务商问题。
如果近期刚升级过 BettaFish,注意新版 LLM 接口已切换为流式调用,部分错误会直接抛出并记录日志,便于定位(相关代码实现)。
To reply, just mention @dosu.
How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other
可能是被API供应商封了,例如在不受许可的地区访问openai的api。openai和cluade都有严重的地区政策。