8a4c9d7329
+ 重构NLP模块管理逻辑,便于自由扩展; + gpt:拆分为ChatGPT及GPT、更换新的GPT接口、可单独配置代理服务器; + 指定yolov8包版本,解决yolo不兼容问题; + 修复:自言自语bug、接收多个待处理消息bug。
19 lines
491 B
Python
19 lines
491 B
Python
from revChatGPT.V3 import Chatbot
|
||
from utils import config_util as cfg
|
||
import time
|
||
|
||
count = 0
|
||
def question(cont):
|
||
global count
|
||
try:
|
||
chatbot = Chatbot(proxy = cfg.proxy_config, api_key = cfg.key_chatgpt_api_key)
|
||
response = chatbot.ask(cont)
|
||
count = 0
|
||
return response
|
||
except Exception as e:
|
||
count += 1
|
||
if count < 3:
|
||
time.sleep(15)
|
||
return question(cont)
|
||
return 'gpt当前繁忙,请稍后重试' + e
|