用于查看和修改 Knot 平台智能体配置的工具集。
scripts/)#所有能力均已封装为独立 Python 脚本,通过 terminal 工具调用:
脚本功能get_current_draft.py查看当前对话智能体的草稿配置get_agent_draft.py查看指定 agent_id 的草稿配置list_agents.py查询名下有管理权限的 Agent 列表list_models.py查看指定 Agent 可用的大模型列表new_draft.py基于最新版本重新生成 Agent 草稿modify_draft.py修改 Agent 草稿的指定字段publish_draft.py将草稿发布为正式版本(高危)common.py公共模块(认证、JWT 解析等,不直接调用)
脚本路径: {SKILL_DIR}/scripts/<script_name>.py
bash
python {SKILL_DIR}/scripts/get_current_draft.py
自动从 JWT 解析当前 agent_id,展示草稿的名称、描述、欢迎语、系统提示词、模型、知识库等完整配置。
注意:
is_stale=true 表示草稿已过期,发布将覆盖最新改动,需提示用户can_edit=false 表示无编辑权限bash
python {SKILL_DIR}/scripts/get_agent_draft.py <agent_id>
agent_id:必填,目标 Agent 的 ID(可通过 list_agents.py 获取)示例:
bash
python {SKILL_DIR}/scripts/get_agent_draft.py 877c45a6f2f542e0b3dadb089f6ef532
bash
python {SKILL_DIR}/scripts/list_agents.py [--agent_id <id>] [--keyword <关键字>]
--agent_id:可选,按 agent_id 精确查询--keyword:可选,按名称/描述关键字过滤bash
python {SKILL_DIR}/scripts/list_models.py [agent_id]
agent_id:可选,不传则使用当前对话的 agent_idmodel_namebash
python {SKILL_DIR}/scripts/new_draft.py [agent_id]
yes 执行)bash
# 修改名称和描述
python {SKILL_DIR}/scripts/modify_draft.py --name "新名称" --desc "新描述"
# 修改系统提示词(直接传值)
python {SKILL_DIR}/scripts/modify_draft.py --system_prompt "你是一个专业助手..."
# 修改系统提示词(从文件读取,适合长提示词)
python {SKILL_DIR}/scripts/modify_draft.py --system_prompt @/path/to/prompt.txt
# 修改默认模型(model_name 从 list_models.py 获取)
python {SKILL_DIR}/scripts/modify_draft.py --model claude-3-5-sonnet
# 指定 agent_id(不指定则使用当前对话 agent)
python {SKILL_DIR}/scripts/modify_draft.py agent_xxx --name "新名称"
支持的参数: --name、 --desc、 --welcome_msg、 --system_prompt、 --model
修改完成后必须提示用户:草稿修改仅在页面调试时生效,若需正式对话生效请将草稿发布成正式版本。
bash
python {SKILL_DIR}/scripts/publish_draft.py [agent_id]
is_stale,并在终端提示二次确认(输入 yes 执行)is_stale=true,脚本会显示红色警告,建议先运行 new_draft.py