mirror of
https://github.com/guohuadeng/app-odoo.git
synced 2025-02-23 04:11:36 +02:00
update app_chatgpt 聊天屏蔽敏感词功能
This commit is contained in:
@@ -96,6 +96,7 @@ GPT-3 A set of models that can understand and generate natural language
|
|||||||
# for rec in res:
|
# for rec in res:
|
||||||
# res = rec['message']['content']
|
# res = rec['message']['content']
|
||||||
res = '\n'.join([x['message']['content'] for x in res['choices']])
|
res = '\n'.join([x['message']['content'] for x in res['choices']])
|
||||||
|
res = self.filter_sensitive_words(res)
|
||||||
return res
|
return res
|
||||||
else:
|
else:
|
||||||
pdata = {
|
pdata = {
|
||||||
@@ -113,6 +114,7 @@ GPT-3 A set of models that can understand and generate natural language
|
|||||||
res = response.json()
|
res = response.json()
|
||||||
if 'choices' in res:
|
if 'choices' in res:
|
||||||
res = '\n'.join([x['text'] for x in res['choices']])
|
res = '\n'.join([x['text'] for x in res['choices']])
|
||||||
|
res = self.filter_sensitive_words(res)
|
||||||
return res
|
return res
|
||||||
|
|
||||||
return "获取结果超时,请重新跟我聊聊。"
|
return "获取结果超时,请重新跟我聊聊。"
|
||||||
|
|||||||
Reference in New Issue
Block a user