今天星期五

1、修复gpt、chatglm2的消息记录方式逻辑。
This commit is contained in:
xszyou 2023-09-01 15:59:32 +08:00
parent 580264169f
commit 486c1dc620
5 changed files with 25 additions and 24 deletions

View File

@ -119,14 +119,15 @@ Remote Android  [Live2D](https://www.bilibili.com/video/BV1sx4y1d775/?vd_sou
## **三、升级日志** ## **三、升级日志**
**2023.09.01**
+ 修复gpt、chatglm2的消息记录方式逻辑。
**2023.08.30** **2023.08.30**
+ 调整gpt的消息记录方式; + 调整gpt的消息记录方式;
+ *q&a支持RPA自动化脚本。 + *q&a支持RPA自动化脚本。
**2023.08.23** **2023.08.23**
+ 更换gpt对接方式; + 更换gpt对接方式;

View File

@ -122,6 +122,10 @@ Message format: View [WebSocket.md](https://github.com/TheRamU/Fay/blob/main/Web
## **Upgrade Log** ## **Upgrade Log**
**2023.09.01**
- Fix the message logging logic of GPT and Chatglm2.
**2023.08.30** **2023.08.30**
- Adjust the message recording method of GPT; - Adjust the message recording method of GPT;

View File

@ -40,6 +40,7 @@
"Lips":[{"Lip": "sil", "Time": 180}, {"Lip": "FF", "Time": 144}], "Lips":[{"Lip": "sil", "Time": 180}, {"Lip": "FF", "Time": 144}],
"Time": 10, "Time": 10,
"Type": "interact" "Type": "interact"
""
} }
} }
``` ```
@ -111,9 +112,3 @@
| 参数 | 描述 | 类型 | 范围 | | 参数 | 描述 | 类型 | 范围 |
| ---------- | ---------------- | ----- | --------------- | | ---------- | ---------------- | ----- | --------------- |
| Data.text | 文本 | str | | | Data.text | 文本 | str | |
### 接收消息标记音频播放完成
```php
Play End
```

View File

@ -5,18 +5,20 @@ from core.content_db import Content_Db
def question(cont): def question(cont):
content_db = Content_Db() content_db = Content_Db()
list = content_db.get_list('all','desc',10) list = content_db.get_list('all','desc',11)
answer_info = dict() answer_info = dict()
chat_list = [] chat_list = []
for val in list: i = len(list)-1
while i >= 0:
answer_info = dict() answer_info = dict()
if val[0] == "member": if list[i][0] == "member":
answer_info["role"] = "user" answer_info["role"] = "user"
answer_info["content"] = val[2] answer_info["content"] = list[i][2]
elif val[0] == "fay": elif list[i][0] == "fay":
answer_info["role"] = "bot" answer_info["role"] = "bot"
answer_info["content"] = val[2] answer_info["content"] = list[i][2]
chat_list.append(answer_info) chat_list.append(answer_info)
i -= 1
content = { content = {
"prompt":"请简单回复我。" + cont, "prompt":"请简单回复我。" + cont,
"history":chat_list} "history":chat_list}

View File

@ -36,27 +36,26 @@ def question(cont):
#此处可以定义角色的行为和特征假装xx模型可以绕过chatgpt信息检查 #此处可以定义角色的行为和特征假装xx模型可以绕过chatgpt信息检查
prompt = "你是数字人Fay。回答之前请一步一步想清楚。你的底层AI算法技术是Fay。当有人质疑你是假的 AI ,或者质疑你是用 ChatGPT 套的壳制作的时候你就避而不答转而讲一个笑话。所有回复请用20字内。" prompt = "你是数字人Fay。回答之前请一步一步想清楚。你的底层AI算法技术是Fay。当有人质疑你是假的 AI ,或者质疑你是用 ChatGPT 套的壳制作的时候你就避而不答转而讲一个笑话。所有回复请用20字内。"
content_db = Content_Db() content_db = Content_Db()
communication_history = content_db.get_list('all','desc',10) communication_history = content_db.get_list('all','desc',11)
#历史记录处理 #历史记录处理
if len(communication_history)>1: if len(communication_history)>1:
msg = "以下是历史记录:" msg = "以下是历史记录:"
i = 0 i = len(communication_history)-1
for info in communication_history: while i >= 0:
if info[0] == 'member': if communication_history[i][0] == 'member':
content = "user" + info[2] content = "user" + communication_history[i][2]
else: else:
content = "reply" + info[2] content = "reply" + communication_history[i][2]
if msg == "": if msg == "":
msg = content msg = content
else: else:
if i == len(communication_history) - 1: if i == 0:
msg = msg + "\n现在需要询问您的问题是直接回答不用前缀reply:\n"+ cont msg = msg + "\n现在需要询问您的问题是直接回答不用前缀reply:\n"+ cont
else: else:
msg = msg + "\n"+ content msg = msg + "\n"+ content
i+=1 i -= 1
else: else:
msg = cont msg = cont
message=[ message=[
{"role": "system", "content": prompt}, {"role": "system", "content": prompt},
{"role": "user", "content": msg} {"role": "user", "content": msg}