olivebot/ai_module/nlp_gpt.py
xszyou 3373a9f56f 修复多个bug
1、修复feifei重复创建导致商端口冲突的bug;
2、更换pygame初始化方式;
3、修复chatgpt(彩蛋)多论对话逻辑;
4、修复js "s"未定义bug。
2023-05-23 00:49:31 +08:00

22 lines
652 B
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

from revChatGPT.V1 import Chatbot
from core.content_db import Content_Db
from utils import config_util as cfg
def question(cont):
try:
chatbot = Chatbot(config={
"access_token": cfg.key_gpt_access_token,
"paid": False,
"collect_analytics": True,
"conversation_id":cfg.key_gpt_conversation_id
},conversation_id=cfg.key_gpt_conversation_id,
parent_id=None)
prompt = cont
response = ""
for data in chatbot.ask(prompt):
response = data["message"]
return response
except:
return 'gpt当前繁忙请稍后重试'