mirror of
https://github.com/xinnan-tech/xiaozhi-esp32-server.git
synced 2026-11-29 05:09:46 +01:00
更新VL视觉识别消息协议
目前的形式为:
vl_message = {
"type": "VL",
"image": base64(你的图片)
"text":你的描述
"version": 1,
"transport": "websocket",
"audio_params": {
"format": "opus",
"sample_rate": 16000,
"channels": 1,
"frame_duration": 60
}
15 lines
575 B
Python
15 lines
575 B
Python
import json
|
|
from config.logger import setup_logging
|
|
|
|
logger = setup_logging()
|
|
|
|
async def handleVLMessage(conn, mesage):
|
|
#print(text)
|
|
messages =[]
|
|
if conn.config["LLM"][conn.config["selected_module"]["LLM"]]['type']=='openai':
|
|
print('当前openai接口协议LLM')
|
|
messages = [
|
|
{"type": "image_url", "image_url": {"url": f"data:image/png;base64,{mesage['image']}"}, },
|
|
{"type": "text", "text": "图中描绘的是什么景象,请细致查看并描述"+mesage['text']},
|
|
]
|
|
conn.executor.submit(conn.chat, messages)
|