Create xiaozhi_gradio.py
Browse files- xiaozhi_gradio.py +12 -0
xiaozhi_gradio.py
ADDED
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from src.application import Application
|
2 |
+
|
3 |
+
class XiaozhiClient:
|
4 |
+
def __init__(self):
|
5 |
+
# 初始化单例 Application
|
6 |
+
self.app = Application.get_instance()
|
7 |
+
self.app.run(mode='cli', protocol='websocket') # 不使用 gui 模式
|
8 |
+
|
9 |
+
def chat(self, text):
|
10 |
+
# 伪代码:你需要在这里调用实际的小智对话逻辑
|
11 |
+
# 示例:return self.app.send_message(text)
|
12 |
+
return f"你说的是:{text}"
|