|
from predict import predict_no_ui_long_connection |
|
from toolbox import CatchException, report_execption, write_results_to_file |
|
import datetime |
|
|
|
@CatchException |
|
def 高阶功能模板函数(txt, top_p, temperature, chatbot, history, systemPromptTxt, WEB_PORT): |
|
history = [] |
|
for i in range(3): |
|
currentMonth = (datetime.date.today() + datetime.timedelta(days=i)).month |
|
currentDay = (datetime.date.today() + datetime.timedelta(days=i)).day |
|
i_say = f'今天是{currentMonth}月{currentDay}日,历史中的{currentMonth}月{currentDay}日发生了哪些大事?' |
|
chatbot.append((i_say, "[Local Message] waiting gpt response.")) |
|
yield chatbot, history, '正常' |
|
|
|
|
|
gpt_say = predict_no_ui_long_connection(inputs=i_say, top_p=top_p, temperature=temperature, history=[], sys_prompt="You are a history teacher.") |
|
|
|
chatbot[-1] = (i_say, gpt_say) |
|
history.append(i_say);history.append(gpt_say) |
|
yield chatbot, history, '正常' |