059b6cee6d
1、修复服务器ip配置,配置页没替换问题; 2、修复开启状态偶尔没对齐问题; 3、修复关闭时关闭按钮停留在关闭中问题; 4、修复星座读取错误问题; 5、修复刷新重复提醒开启问题; 6、新增是否进行语音合成的选择; 7、文字沟通接口加入“观察描述”; 8、聊天记录时间改为毫秒级; 9、补充数字人和远程音频的连接状态显示; 10、修复备注填写无法保存问题。
37 lines
1.2 KiB
Python
37 lines
1.2 KiB
Python
"""
|
||
这是对于清华智谱VisualGLM-6B的代码,在使用前请先安装并启动好VisualGLM-6B.
|
||
https://github.com/THUDM/VisualGLM-6B
|
||
"""
|
||
import json
|
||
import requests
|
||
import uuid
|
||
import os
|
||
import cv2
|
||
from ai_module import yolov8
|
||
|
||
# Initialize an empty history list
|
||
communication_history = []
|
||
|
||
def question(cont, uid=0, observation=""):
|
||
if not yolov8.new_instance().get_status():
|
||
return "请先启动“Fay Eyes”"
|
||
content = {
|
||
"text":cont,
|
||
"history":communication_history}
|
||
img = yolov8.new_instance().get_img()
|
||
if yolov8.new_instance().get_status() and img is not None:
|
||
filename = str(uuid.uuid4()) + ".jpg"
|
||
current_working_directory = os.getcwd()
|
||
filepath = os.path.join(current_working_directory, "data", filename)
|
||
cv2.imwrite(filepath, img)
|
||
content["image"] = filepath
|
||
url = "http://127.0.0.1:8080"
|
||
print(content)
|
||
req = json.dumps(content)
|
||
headers = {'content-type': 'application/json'}
|
||
r = requests.post(url, headers=headers, data=req)
|
||
|
||
# Save this conversation to history
|
||
communication_history.append([cont, r.text])
|
||
|
||
return r.text + "\n(相片:" + filepath + ")" |