fix: Bearer token authentication header format
This commit is contained in:
@@ -141,7 +141,10 @@ class AgentCodeGenerator:
|
||||
|
||||
## 重要提示
|
||||
1. 如果 URL 像 `https://r.jina.ai/` 这样需要将参数拼接到路径中(如 `https://r.jina.ai/{{target_url}}`),请正确处理 URL 拼接
|
||||
2. 如果认证是 bearer token,使用环境变量 `TOOL_API_KEY` 获取
|
||||
2. **认证方式处理**:
|
||||
- 如果认证类型是 `bearer`,必须使用 `Authorization: Bearer <token>` 格式的 header(不是 X-API-Key!)
|
||||
- 从环境变量 `TOOL_API_KEY` 获取 token:`os.getenv("TOOL_API_KEY")`
|
||||
- 示例:`headers = {{"Authorization": f"Bearer {{os.getenv('TOOL_API_KEY')}}"}}`
|
||||
3. 函数必须是 async def,返回 JSON 字符串
|
||||
4. 使用 httpx 作为 HTTP 客户端
|
||||
5. 包含完整的错误处理
|
||||
|
||||
Reference in New Issue
Block a user