Add voice_choice_prompt and text_choice_prompt tools to API and UI. Implement state management and parameter definitions for user selection prompts, enhancing user interaction and experience.
This commit is contained in:
@@ -109,6 +109,67 @@ TOOL_REGISTRY = {
|
||||
"required": ["msg"]
|
||||
}
|
||||
},
|
||||
"voice_choice_prompt": {
|
||||
"name": "语音选项提示",
|
||||
"description": "播报问题并展示可选项,等待用户选择后回传结果",
|
||||
"parameters": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"question": {"type": "string", "description": "向用户展示的问题文本"},
|
||||
"options": {
|
||||
"type": "array",
|
||||
"description": "可选项(字符串或含 id/label/value 的对象)",
|
||||
"minItems": 2,
|
||||
"items": {
|
||||
"anyOf": [
|
||||
{"type": "string"},
|
||||
{
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"id": {"type": "string"},
|
||||
"label": {"type": "string"},
|
||||
"value": {"type": "string"}
|
||||
},
|
||||
"required": ["label"]
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"voice_text": {"type": "string", "description": "可选,单独指定播报文本;为空则播报 question"}
|
||||
},
|
||||
"required": ["question", "options"]
|
||||
}
|
||||
},
|
||||
"text_choice_prompt": {
|
||||
"name": "文本选项提示",
|
||||
"description": "显示文本选项弹窗并等待用户选择后回传结果",
|
||||
"parameters": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"question": {"type": "string", "description": "向用户展示的问题文本"},
|
||||
"options": {
|
||||
"type": "array",
|
||||
"description": "可选项(字符串或含 id/label/value 的对象)",
|
||||
"minItems": 2,
|
||||
"items": {
|
||||
"anyOf": [
|
||||
{"type": "string"},
|
||||
{
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"id": {"type": "string"},
|
||||
"label": {"type": "string"},
|
||||
"value": {"type": "string"}
|
||||
},
|
||||
"required": ["label"]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"required": ["question", "options"]
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
TOOL_CATEGORY_MAP = {
|
||||
@@ -121,6 +182,8 @@ TOOL_CATEGORY_MAP = {
|
||||
"decrease_volume": "system",
|
||||
"voice_message_prompt": "system",
|
||||
"text_msg_prompt": "system",
|
||||
"voice_choice_prompt": "system",
|
||||
"text_choice_prompt": "system",
|
||||
}
|
||||
|
||||
TOOL_ICON_MAP = {
|
||||
@@ -133,6 +196,8 @@ TOOL_ICON_MAP = {
|
||||
"decrease_volume": "Volume2",
|
||||
"voice_message_prompt": "Volume2",
|
||||
"text_msg_prompt": "Terminal",
|
||||
"voice_choice_prompt": "Volume2",
|
||||
"text_choice_prompt": "Terminal",
|
||||
}
|
||||
|
||||
TOOL_HTTP_DEFAULTS = {
|
||||
@@ -145,6 +210,8 @@ TOOL_PARAMETER_DEFAULTS = {
|
||||
|
||||
TOOL_WAIT_FOR_RESPONSE_DEFAULTS = {
|
||||
"text_msg_prompt": True,
|
||||
"voice_choice_prompt": True,
|
||||
"text_choice_prompt": True,
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user