feat: add prompt startup actions and shared vision config
This commit is contained in:
@@ -49,35 +49,89 @@ async def sync_interface_definitions() -> None:
|
||||
|
||||
async def sync_default_tools() -> None:
|
||||
"""Ensure system-provided reusable tools exist without overwriting edits."""
|
||||
async with engine.begin() as conn:
|
||||
await conn.execute(
|
||||
text(
|
||||
"INSERT INTO tools "
|
||||
"(id, name, function_name, type, description, definition, secrets, status) "
|
||||
"VALUES ("
|
||||
":id, :name, :function_name, :type, :description, "
|
||||
"CAST(:definition AS jsonb), CAST(:secrets AS jsonb), :status"
|
||||
") "
|
||||
"ON CONFLICT (function_name) DO NOTHING"
|
||||
),
|
||||
{
|
||||
"id": "tool_end_call_default",
|
||||
"name": "结束对话",
|
||||
"function_name": "end_call",
|
||||
default_tools = [
|
||||
{
|
||||
"id": "tool_end_call_default",
|
||||
"name": "结束对话",
|
||||
"function_name": "end_call",
|
||||
"type": "end_call",
|
||||
"description": "当用户明确要求结束对话,或任务已完成时调用。",
|
||||
"definition": {
|
||||
"schema_version": 1,
|
||||
"type": "end_call",
|
||||
"description": "当用户明确要求结束对话,或任务已完成时调用。",
|
||||
"definition": json.dumps(
|
||||
{
|
||||
"schema_version": 1,
|
||||
"type": "end_call",
|
||||
"config": {
|
||||
"message_type": "none",
|
||||
"custom_message": "",
|
||||
"capture_reason": True,
|
||||
},
|
||||
}
|
||||
),
|
||||
"secrets": "{}",
|
||||
"status": "active",
|
||||
"config": {
|
||||
"message_type": "none",
|
||||
"custom_message": "",
|
||||
"capture_reason": True,
|
||||
},
|
||||
},
|
||||
)
|
||||
},
|
||||
{
|
||||
"id": "tool_show_message_default",
|
||||
"name": "显示确认消息",
|
||||
"function_name": "show_message",
|
||||
"type": "client",
|
||||
"description": "向用户显示必须主动确认的重要消息弹窗。",
|
||||
"definition": {
|
||||
"schema_version": 1,
|
||||
"type": "client",
|
||||
"config": {
|
||||
"allow_interruptions": False,
|
||||
"execution_mode": "immediate",
|
||||
"wait_for_response": True,
|
||||
"response_wait_mode": "session",
|
||||
"timeout_seconds": 3,
|
||||
"parameters": [
|
||||
{
|
||||
"name": "title",
|
||||
"type": "string",
|
||||
"location": "body",
|
||||
"description": "弹窗标题",
|
||||
"required": False,
|
||||
},
|
||||
{
|
||||
"name": "message",
|
||||
"type": "string",
|
||||
"location": "body",
|
||||
"description": "需要用户确认的重要信息",
|
||||
"required": True,
|
||||
},
|
||||
{
|
||||
"name": "actions",
|
||||
"type": "array",
|
||||
"location": "body",
|
||||
"description": "可选操作按钮",
|
||||
"required": False,
|
||||
},
|
||||
{
|
||||
"name": "dismissible",
|
||||
"type": "boolean",
|
||||
"location": "body",
|
||||
"description": "是否允许不选择按钮直接关闭",
|
||||
"required": False,
|
||||
},
|
||||
],
|
||||
"dynamic_variable_assignments": {},
|
||||
},
|
||||
},
|
||||
},
|
||||
]
|
||||
async with engine.begin() as conn:
|
||||
for tool in default_tools:
|
||||
await conn.execute(
|
||||
text(
|
||||
"INSERT INTO tools "
|
||||
"(id, name, function_name, type, description, definition, secrets, status) "
|
||||
"VALUES ("
|
||||
":id, :name, :function_name, :type, :description, "
|
||||
"CAST(:definition AS jsonb), CAST(:secrets AS jsonb), :status"
|
||||
") "
|
||||
"ON CONFLICT (function_name) DO NOTHING"
|
||||
),
|
||||
{
|
||||
**tool,
|
||||
"definition": json.dumps(tool["definition"]),
|
||||
"secrets": "{}",
|
||||
"status": "active",
|
||||
},
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user