mirror of
https://github.com/xinnan-tech/xiaozhi-esp32-server.git
synced 2026-11-23 03:19:41 +00:00
Compare commits
8 commits
1af91d7594
...
db2b86e997
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
db2b86e997 | ||
|
|
4b1a54a41c | ||
|
|
dd367c9e43 | ||
|
|
b4e144afef | ||
|
|
744ff26932 | ||
|
|
0d5f304eb0 | ||
|
|
533a49a0bd | ||
|
|
1cc06169f2 |
2 changed files with 29 additions and 36 deletions
|
|
@ -37,30 +37,28 @@ docker logs -f mcp-endpoint-server
|
|||
|
||||
此时,日志里会输出类似以下的日志
|
||||
```
|
||||
250705 INFO-=====下面的地址分别是智控台/单模块MCP接入点地址====
|
||||
250705 INFO-智控台MCP参数配置: http://172.22.0.2:8004/mcp_endpoint/health?key=abc
|
||||
250705 INFO-单模块部署MCP接入点: ws://172.22.0.2:8004/mcp_endpoint/mcp/?token=def
|
||||
250705 INFO-=====请根据具体部署选择使用,请勿泄露给任何人======
|
||||
250705 13:04:20[0.0.7][src.server]-INFO-=====下面的地址分别是智控台/多模块MCP接入点地址====
|
||||
250705 13:04:20[0.0.7][src.server]-INFO-智控台MCP参数配置: http://172.22.0.2:8004/mcp_endpoint/health?key=abc
|
||||
250705 13:04:20[0.0.7][src.server]-INFO-单模块部署MCP接入点: ws://172.22.0.2:8004/mcp_endpoint/mcp/?token=abc
|
||||
250705 13:04:20[0.0.7][src.server]-INFO-=====请根据具体部署选择使用,请勿泄露给任何人======
|
||||
```
|
||||
|
||||
上面第一行(`=====下面的地址分别是…====`)的措辞跟着 mcp-endpoint-server 的镜像版本走,不同版本可能不一样,以你实际看到的输出为准。
|
||||
|
||||
请你把两个接口地址复制出来:
|
||||
|
||||
由于你是docker部署,切不可直接使用上面的地址!
|
||||
|
||||
由于你是docker部署,切不可直接使用上面的地址!
|
||||
|
||||
由于你是docker部署,切不可直接使用上面的地址!
|
||||
|
||||
你先把地址复制出来,放在一个草稿里,你要知道你的电脑的局域网ip是什么,例如我的电脑局域网ip是`192.168.1.25`,那么
|
||||
原来我的接口地址
|
||||
```
|
||||
智控台MCP参数配置: http://172.22.0.2:8004/mcp_endpoint/health?key=abc
|
||||
单模块部署MCP接入点: ws://172.22.0.2:8004/mcp_endpoint/mcp/?token=def
|
||||
单模块部署MCP接入点: ws://172.22.0.2:8004/mcp_endpoint/mcp/?token=abc
|
||||
```
|
||||
就要改成
|
||||
```
|
||||
智控台MCP参数配置: http://192.168.1.25:8004/mcp_endpoint/health?key=abc
|
||||
单模块部署MCP接入点: ws://192.168.1.25:8004/mcp_endpoint/mcp/?token=def
|
||||
单模块部署MCP接入点: ws://192.168.1.25:8004/mcp_endpoint/mcp/?token=abc
|
||||
```
|
||||
|
||||
改好后,请使用浏览器直接访问`智控台MCP参数配置`。当浏览器出现类似这样的代码,说明是成功了。
|
||||
|
|
@ -87,7 +85,7 @@ docker logs -f mcp-endpoint-server
|
|||
```
|
||||
server:
|
||||
websocket: ws://你的ip或者域名:端口号/xiaozhi/v1/
|
||||
http_port: 8002
|
||||
http_port: 8003
|
||||
log:
|
||||
log_level: INFO
|
||||
|
||||
|
|
@ -100,26 +98,26 @@ mcp_endpoint: 你的接入点websocket地址
|
|||
```
|
||||
server:
|
||||
websocket: ws://你的ip或者域名:端口号/xiaozhi/v1/
|
||||
http_port: 8002
|
||||
http_port: 8003
|
||||
log:
|
||||
log_level: INFO
|
||||
|
||||
# 此处可能还更多配置
|
||||
|
||||
mcp_endpoint: ws://192.168.1.25:8004/mcp_endpoint/mcp/?token=def
|
||||
mcp_endpoint: ws://192.168.1.25:8004/mcp_endpoint/mcp/?token=abc
|
||||
```
|
||||
|
||||
配置好后,启动单模块会输出如下的日志。
|
||||
```
|
||||
250705[__main__]-INFO-初始化组件: vad成功 SileroVAD
|
||||
250705[__main__]-INFO-初始化组件: asr成功 FunASRServer
|
||||
250705[__main__]-INFO-OTA接口是 http://192.168.1.25:8002/xiaozhi/ota/
|
||||
250705[__main__]-INFO-视觉分析接口是 http://192.168.1.25:8002/mcp/vision/explain
|
||||
250705[__main__]-INFO-mcp接入点是 ws://192.168.1.25:8004/mcp_endpoint/mcp/?token=abc
|
||||
250705[__main__]-INFO-Websocket地址是 ws://192.168.1.25:8000/xiaozhi/v1/
|
||||
250705[__main__]-INFO-=======上面的地址是websocket协议地址,请勿用浏览器访问=======
|
||||
250705[__main__]-INFO-如想测试websocket请启动digital-human模块,打开浏览器交互测试
|
||||
250705[__main__]-INFO-=============================================================
|
||||
250705 13:04:20[0.9.8_00000000000000][core.utils.modules_initialize]-INFO-初始化组件: vad成功 SileroVAD
|
||||
250705 13:04:20[0.9.8_00000000000000][core.utils.modules_initialize]-INFO-初始化组件: asr成功 FunASRServer
|
||||
250705 13:04:20[0.9.8_00000000000000][__main__]-INFO-OTA接口是 http://192.168.1.25:8003/xiaozhi/ota/
|
||||
250705 13:04:20[0.9.8_00000000000000][__main__]-INFO-视觉分析接口是 http://192.168.1.25:8003/mcp/vision/explain
|
||||
250705 13:04:20[0.9.8_00000000000000][__main__]-INFO-mcp接入点是 ws://192.168.1.25:8004/mcp_endpoint/mcp/?token=abc
|
||||
250705 13:04:20[0.9.8_00000000000000][__main__]-INFO-Websocket地址是 ws://192.168.1.25:8000/xiaozhi/v1/
|
||||
250705 13:04:20[0.9.8_00000000000000][__main__]-INFO-=======上面的地址是websocket协议地址,请勿用浏览器访问=======
|
||||
250705 13:04:20[0.9.8_00000000000000][__main__]-INFO-如想测试websocket请启动digital-human模块,打开浏览器交互测试
|
||||
250705 13:04:20[0.9.8_00000000000000][__main__]-INFO-=============================================================
|
||||
```
|
||||
|
||||
如上,如果能输出类似的`mcp接入点是`中`ws://192.168.1.25:8004/mcp_endpoint/mcp/?token=abc`说明配置成功了。
|
||||
|
|
|
|||
|
|
@ -121,13 +121,10 @@ async def handle_hass_get_state(conn: "ConnectionHandler", entity_id):
|
|||
+ str(response.json()["attributes"]["media_title"])
|
||||
+ " "
|
||||
)
|
||||
if "volume_level" in response.json()["attributes"]:
|
||||
responsetext = (
|
||||
responsetext
|
||||
+ "音量是:"
|
||||
+ str(response.json()["attributes"]["volume_level"])
|
||||
+ " "
|
||||
)
|
||||
volume_level = response.json()["attributes"].get("volume_level")
|
||||
if isinstance(volume_level, (int, float)):
|
||||
# volume_level 量程 0~1,换算成百分比(同 volume_set 的 1~100)
|
||||
responsetext = responsetext + "音量是:" + f"{round(volume_level * 100)}%" + " "
|
||||
if "color_temp_kelvin" in response.json()["attributes"]:
|
||||
responsetext = (
|
||||
responsetext
|
||||
|
|
@ -142,13 +139,11 @@ async def handle_hass_get_state(conn: "ConnectionHandler", entity_id):
|
|||
+ str(response.json()["attributes"]["rgb_color"])
|
||||
+ " "
|
||||
)
|
||||
if "brightness" in response.json()["attributes"]:
|
||||
responsetext = (
|
||||
responsetext
|
||||
+ "亮度是:"
|
||||
+ str(response.json()["attributes"]["brightness"])
|
||||
+ " "
|
||||
)
|
||||
brightness = response.json()["attributes"].get("brightness")
|
||||
if isinstance(brightness, (int, float)):
|
||||
# brightness 量程 0~255,换算成百分比(同 brightness_pct 的 1~100),开灯最低报 1%
|
||||
percent = max(1, round(brightness * 100 / 255)) if brightness > 0 else 0
|
||||
responsetext = responsetext + "亮度是:" + f"{percent}%" + " "
|
||||
logger.bind(tag=TAG).info(f"查询返回内容: {responsetext}")
|
||||
return responsetext
|
||||
else:
|
||||
|
|
|
|||
Loading…
Reference in a new issue