mirror of
https://github.com/xinnan-tech/xiaozhi-esp32-server.git
synced 2026-11-29 05:09:46 +01:00
视觉识别添加是否是Openai协议的判断
视觉识别添加是否是Openai协议的判断,当前测试openai全系使用无问题
This commit is contained in:
parent
48f11b4799
commit
ab45342349
2 changed files with 15 additions and 8 deletions
11
config.yaml
11
config.yaml
|
|
@ -58,6 +58,8 @@ prompt: |
|
||||||
请注意,要像一个人一样说话,请不要回复表情符号、代码、和xml标签。
|
请注意,要像一个人一样说话,请不要回复表情符号、代码、和xml标签。
|
||||||
当前时间是:{date_time},现在我正在和你进行语音聊天,我们开始吧。
|
当前时间是:{date_time},现在我正在和你进行语音聊天,我们开始吧。
|
||||||
如果用户希望结束对话,请在最后说“拜拜”或“再见”。
|
如果用户希望结束对话,请在最后说“拜拜”或“再见”。
|
||||||
|
如果用户希望打开摄像头,等操作时等类型的要求时,你只需要回复正在打开
|
||||||
|
如果用户希望识别画面,识别图片,识别场景在干什么等类型的要求时 你只需要回复正在识别
|
||||||
# 使用完声音文件后删除文件(Delete the sound file when you are done using it)
|
# 使用完声音文件后删除文件(Delete the sound file when you are done using it)
|
||||||
delete_audio: true
|
delete_audio: true
|
||||||
|
|
||||||
|
|
@ -77,7 +79,7 @@ selected_module:
|
||||||
ASR: FunASR
|
ASR: FunASR
|
||||||
VAD: SileroVAD
|
VAD: SileroVAD
|
||||||
# 将根据配置名称对应的type调用实际的LLM适配器
|
# 将根据配置名称对应的type调用实际的LLM适配器
|
||||||
LLM: AliLLM
|
LLM: ChatGLMLLM
|
||||||
# TTS将根据配置名称对应的type调用实际的TTS适配器
|
# TTS将根据配置名称对应的type调用实际的TTS适配器
|
||||||
TTS: EdgeTTS
|
TTS: EdgeTTS
|
||||||
|
|
||||||
|
|
@ -106,7 +108,7 @@ LLM:
|
||||||
# 可在这里找到你的 api_key https://bailian.console.aliyun.com/?apiKey=1#/api-key
|
# 可在这里找到你的 api_key https://bailian.console.aliyun.com/?apiKey=1#/api-key
|
||||||
#qwen-omni-turbo 可使用一系列阿里的视觉识别模型
|
#qwen-omni-turbo 可使用一系列阿里的视觉识别模型
|
||||||
base_url: https://dashscope.aliyuncs.com/compatible-mode/v1
|
base_url: https://dashscope.aliyuncs.com/compatible-mode/v1
|
||||||
model_name: qwen-turbo
|
model_name: qwen-omni-turbo
|
||||||
api_key: 你的deepseek api key
|
api_key: 你的deepseek api key
|
||||||
DeepSeekLLM:
|
DeepSeekLLM:
|
||||||
# 定义LLM API类型
|
# 定义LLM API类型
|
||||||
|
|
@ -119,10 +121,11 @@ LLM:
|
||||||
# 定义LLM API类型
|
# 定义LLM API类型
|
||||||
type: openai
|
type: openai
|
||||||
# glm-4-flash 是免费的,但是还是需要注册填写api_key的
|
# glm-4-flash 是免费的,但是还是需要注册填写api_key的
|
||||||
|
# glm-4v-plus 是视觉识别模型
|
||||||
# 可在这里找到你的api key https://bigmodel.cn/usercenter/proj-mgmt/apikeys
|
# 可在这里找到你的api key https://bigmodel.cn/usercenter/proj-mgmt/apikeys
|
||||||
model_name: glm-4-flash
|
model_name: glm-4v-plus
|
||||||
url: https://open.bigmodel.cn/api/paas/v4/
|
url: https://open.bigmodel.cn/api/paas/v4/
|
||||||
api_key: 你的chat-glm api key
|
api_key: 你的deepseek api key
|
||||||
OllamaLLM:
|
OllamaLLM:
|
||||||
# 定义LLM API类型
|
# 定义LLM API类型
|
||||||
type: ollama
|
type: ollama
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,10 @@ from config.logger import setup_logging
|
||||||
logger = setup_logging()
|
logger = setup_logging()
|
||||||
|
|
||||||
async def handleVLMessage(conn, text):
|
async def handleVLMessage(conn, text):
|
||||||
|
#print(text)
|
||||||
|
messages =[]
|
||||||
|
if conn.config["LLM"][conn.config["selected_module"]["LLM"]]['type']=='openai':
|
||||||
|
#print('当前openai接口协议LLM')
|
||||||
messages = [
|
messages = [
|
||||||
{"type": "image_url", "image_url": {"url": f"data:image/png;base64,{text}"}, },
|
{"type": "image_url", "image_url": {"url": f"data:image/png;base64,{text}"}, },
|
||||||
{"type": "text", "text": "图中描绘的是什么景象,请细致查看并描述"},
|
{"type": "text", "text": "图中描绘的是什么景象,请细致查看并描述"},
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue