← 返回 Skills 市场
lilitong9607

baidu qianfan agent chat

作者 David Li · GitHub ↗ · v1.0.0 · MIT-0
cross-platform ✓ 安全检测通过
186
总下载
0
收藏
0
当前安装
1
版本数
在 OpenClaw 中安装
/install baidu-qianfan-agent-chat
功能描述
千帆AI应用对话接口调用技能。用于调用百度千帆平台的对话API进行AI对话交互。支持流式和非流式响应、Function Call工具调用、文件上传等功能。触发场景:(1) 用户需要调用千帆对话API;(2) 用户提到"千帆"、"qianfan"、"百度AI对话";(3) 需要与千帆应用进行对话交互。
使用说明 (SKILL.md)

千帆对话技能

调用百度千帆平台的对话API,与千帆AI应用进行对话交互。

初始化配置

⚠️ 必须设置环境变量 QIANFAN_API_KEY

export QIANFAN_API_KEY="your-api-key-here"

API Key 可从 千帆平台 获取。

默认配置

配置项 默认值 说明
app_id e52a2419-4327-48e8-b9dc-9bf037199fc2 应用ID,可在调用时通过 --app-id 覆盖
stream false 流式返回

接口详情

详细的请求/响应参数、错误码、curl 示例等,请参阅 API 参考文档


基本用法

发起对话

使用 scripts/chat.py 脚本调用:

python3 scripts/chat.py --query "你好,请介绍一下自己"

参数说明

参数 说明 默认值
--query 用户提问内容(必选) -
--app-id 应用ID e52a2419-4327-48e8-b9dc-9bf037199fc2
--stream 是否流式返回 true
--conversation-id 会话ID(多轮对话时传入) -
--file-ids 文件ID列表,逗号分隔 -

多轮对话

会话状态自动管理:

  • 首次调用不传 conversation_id,API返回后会自动保存
  • 后续调用自动使用已保存的 conversation_id
  • 使用 --new-session 开始新会话
# 首次对话(自动保存 conversation_id)
python3 scripts/chat.py --query "你好"
# 输出: [conversation_id: xxx-xxx-xxx]

# 后续对话(自动使用已保存的 conversation_id)
python3 scripts/chat.py --query "刚才我们聊了什么"
# 输出: [使用已保存的会话: xxx-xxx-xxx]

# 开始新会话
python3 scripts/chat.py --query "新话题" --new-session

手动指定会话ID:

python3 scripts/chat.py --query "继续" --conversation-id "xxx-xxx-xxx"

非流式响应

python3 scripts/chat.py --query "你好" --stream false

高级功能

Function Call

定义工具并上报结果:

python3 scripts/chat.py --query "今天北京天气" --tools-file tools/weather.json

注意事项

  1. 确保 QIANFAN_API_KEY 环境变量已设置
  2. 首次对话不需要 conversation_id,后续多轮对话需传入
  3. 流式模式下,响应以 data: 开头,以 data: [DONE] 结束
安全使用建议
This skill appears to do exactly what it claims: call Baidu 千帆 conversation API using QIANFAN_API_KEY. Before installing, consider: (1) only provide a QIANFAN_API_KEY you trust to this skill — the key is sent to qianfan.baidubce.com; (2) ensure the runtime has python3 and the 'requests' Python package installed (the script imports requests but does not install it); (3) the script will create a local file state/session.json in the skill directory to store conversation_id — if you need no local state, run with --new-session or remove the file; (4) the skill performs network calls to the Baidu endpoint, so run it in an environment where outbound network access is acceptable; (5) if you want extra assurance, inspect or run the included scripts/chat.py manually before enabling autonomous invocation. Overall the components are internally consistent and proportionate to the described purpose.
功能分析
Type: OpenClaw Skill Name: baidu-qianfan-agent-chat Version: 1.0.0 The skill bundle is a legitimate implementation for interacting with the Baidu Qianfan AI platform. The core logic in `scripts/chat.py` facilitates API calls to the official Baidu endpoint (qianfan.baidubce.com), handles session persistence through a local JSON state file, and supports standard features like streaming and function calling. No evidence of data exfiltration, malicious execution, or prompt injection was found; the requirement for the `QIANFAN_API_KEY` environment variable is consistent with the stated purpose of the skill.
能力评估
Purpose & Capability
Name/description state the skill calls Baidu 千帆 conversation API and the included script posts to https://qianfan.baidubce.com/v2/app/conversation/runs using an API key; required binary (python3) and required env var (QIANFAN_API_KEY) are consistent with this purpose.
Instruction Scope
SKILL.md and scripts/chat.py stay within the claimed scope: they only read QIANFAN_API_KEY, accept user-provided arguments (query, file ids, tools file, etc.), call the Qianfan API, and save a local session_id to a state file in the skill folder. There are no instructions to read unrelated system files or additional environment variables.
Install Mechanism
No install spec (instruction-only) — low install risk. One usability note: the script imports the third-party 'requests' library but the skill metadata does not declare installing it; the runtime environment must already have requests installed or the script will fail. This is an operational omission, not an overt security issue.
Credentials
Only a single credential (QIANFAN_API_KEY) is required, which is appropriate for calling the documented API. The skill does write a small session file under the skill directory (state/session.json) to remember conversation_id — this is expected behavior for multi-turn sessions.
Persistence & Privilege
always:false and no special privileges requested. The skill persists only its own session state file under the skill directory and does not modify other skills or system-wide agent settings.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install baidu-qianfan-agent-chat
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /baidu-qianfan-agent-chat 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.0.0
Initial release of baidu-qianfan-agent-chat skill. - Provides API integration for Baidu Qianfan AI chat platform, supporting both streaming and non-streaming responses. - Supports Function Call tool invocation and file upload. - Includes scripts for initiating chat, managing sessions, and using advanced features like tool reporting. - Session state is auto-managed, with options for manual control. - Requires environment variable QIANFAN_API_KEY for authentication.
元数据
Slug baidu-qianfan-agent-chat
版本 1.0.0
许可证 MIT-0
累计安装 0
当前安装数 0
历史版本数 1
常见问题

baidu qianfan agent chat 是什么?

千帆AI应用对话接口调用技能。用于调用百度千帆平台的对话API进行AI对话交互。支持流式和非流式响应、Function Call工具调用、文件上传等功能。触发场景:(1) 用户需要调用千帆对话API;(2) 用户提到"千帆"、"qianfan"、"百度AI对话";(3) 需要与千帆应用进行对话交互。 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 186 次。

如何安装 baidu qianfan agent chat?

在 OpenClaw 或 Claude Code 对话框中运行命令「/install baidu-qianfan-agent-chat」即可一键安装,无需额外配置。

baidu qianfan agent chat 是免费的吗?

是的,baidu qianfan agent chat 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。

baidu qianfan agent chat 支持哪些平台?

baidu qianfan agent chat 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。

谁开发了 baidu qianfan agent chat?

由 David Li(@lilitong9607)开发并维护,当前版本 v1.0.0。

💬 留言讨论