feat: organize tools and enable qwen realtime calls
This commit is contained in:
@@ -5,6 +5,7 @@ from types import SimpleNamespace
|
||||
|
||||
from fastapi import HTTPException
|
||||
from routes.assistants import _validate_startup_actions
|
||||
from models import RuntimeToolBinding
|
||||
from schemas import AssistantUpsert
|
||||
from services.config_resolver import _runtime_tool_ids
|
||||
|
||||
@@ -18,25 +19,28 @@ def startup_body(
|
||||
name="启动动作测试",
|
||||
type="prompt",
|
||||
runtimeMode="pipeline",
|
||||
toolIds=["tool_message"] if bind_tool else [],
|
||||
toolBindings=(
|
||||
[{"toolId": "tool_message", "argumentBindings": {}}]
|
||||
if bind_tool
|
||||
else []
|
||||
),
|
||||
startup={
|
||||
"executionMode": "sequential",
|
||||
"actions": [
|
||||
{
|
||||
"id": "opening_message",
|
||||
"phase": phase,
|
||||
"toolId": "tool_message",
|
||||
"arguments": {
|
||||
"title": "重要提示",
|
||||
"message": "请确认已阅读。",
|
||||
"actions": [
|
||||
{
|
||||
"id": "confirmed",
|
||||
"label": "确认",
|
||||
"style": "primary",
|
||||
}
|
||||
],
|
||||
"dismissible": False,
|
||||
"toolBinding": {
|
||||
"toolId": "tool_message",
|
||||
"argumentBindings": {
|
||||
"title": {"source": "literal", "value": "重要提示"},
|
||||
"message": {"source": "literal", "value": "请确认已阅读。"},
|
||||
"actions": {
|
||||
"source": "literal",
|
||||
"value": [{"id": "confirmed", "label": "确认", "style": "primary"}],
|
||||
},
|
||||
"dismissible": {"source": "literal", "value": False},
|
||||
},
|
||||
},
|
||||
"required": True,
|
||||
}
|
||||
@@ -57,11 +61,14 @@ class StartupActionValidationTests(unittest.IsolatedAsyncioTestCase):
|
||||
def test_runtime_pool_includes_bound_and_startup_only_tools(self):
|
||||
self.assertEqual(
|
||||
_runtime_tool_ids(
|
||||
["conversation_tool", "shared_tool"],
|
||||
[
|
||||
RuntimeToolBinding(tool_id="conversation_tool"),
|
||||
RuntimeToolBinding(tool_id="shared_tool"),
|
||||
],
|
||||
{
|
||||
"actions": [
|
||||
{"tool_id": "opening_tool"},
|
||||
{"toolId": "shared_tool"},
|
||||
{"toolBinding": {"toolId": "opening_tool"}},
|
||||
{"toolBinding": {"toolId": "shared_tool"}},
|
||||
]
|
||||
},
|
||||
),
|
||||
@@ -129,7 +136,7 @@ class StartupActionValidationTests(unittest.IsolatedAsyncioTestCase):
|
||||
|
||||
body = startup_body(bind_tool=False)
|
||||
await _validate_startup_actions(FakeSession(tool), body)
|
||||
self.assertEqual(body.tool_ids, [])
|
||||
self.assertEqual(body.tool_bindings, [])
|
||||
|
||||
async def test_show_message_requires_session_wait(self):
|
||||
tool = SimpleNamespace(
|
||||
|
||||
Reference in New Issue
Block a user