feat: organize tools and enable qwen realtime calls
This commit is contained in:
+8
-30
@@ -10,7 +10,6 @@ import json
|
||||
|
||||
import settings
|
||||
from services.interface_catalog import INTERFACE_DEFINITIONS
|
||||
from services.system_tools import SYSTEM_TOOL_SPECS
|
||||
from sqlalchemy import text
|
||||
from sqlalchemy.ext.asyncio import (
|
||||
AsyncSession,
|
||||
@@ -43,39 +42,19 @@ async def sync_interface_definitions() -> None:
|
||||
"interface_type": definition["interface_type"],
|
||||
"name": definition["name"],
|
||||
"capability": definition["capability"],
|
||||
"field_schema": json.dumps({"fields": definition["fields"]}),
|
||||
"field_schema": json.dumps(
|
||||
{
|
||||
"fields": definition["fields"],
|
||||
"features": definition.get("features", {}),
|
||||
}
|
||||
),
|
||||
},
|
||||
)
|
||||
|
||||
|
||||
async def sync_default_tools() -> None:
|
||||
"""Ensure system-provided reusable tools exist without overwriting edits."""
|
||||
default_system_tools = []
|
||||
for kind, spec in SYSTEM_TOOL_SPECS.items():
|
||||
config: dict[str, object] = {"kind": kind}
|
||||
if kind == "end_conversation":
|
||||
config.update(
|
||||
{
|
||||
"message_type": "none",
|
||||
"custom_message": "",
|
||||
"capture_reason": True,
|
||||
"allow_end_interruption": False,
|
||||
}
|
||||
)
|
||||
default_system_tools.append(
|
||||
{
|
||||
**spec,
|
||||
"type": "system",
|
||||
"definition": {
|
||||
"schema_version": 1,
|
||||
"type": "system",
|
||||
"config": config,
|
||||
},
|
||||
}
|
||||
)
|
||||
|
||||
"""Ensure workspace-owned reusable external tools exist."""
|
||||
default_tools = [
|
||||
*default_system_tools,
|
||||
{
|
||||
"id": "tool_show_message_default",
|
||||
"name": "显示确认消息",
|
||||
@@ -83,7 +62,7 @@ async def sync_default_tools() -> None:
|
||||
"type": "client",
|
||||
"description": "向用户显示必须主动确认的重要消息弹窗。",
|
||||
"definition": {
|
||||
"schema_version": 1,
|
||||
"schema_version": 2,
|
||||
"type": "client",
|
||||
"config": {
|
||||
"allow_interruptions": False,
|
||||
@@ -121,7 +100,6 @@ async def sync_default_tools() -> None:
|
||||
"required": False,
|
||||
},
|
||||
],
|
||||
"dynamic_variable_assignments": {},
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user