[实验] 历史上的今天(高级函数demo)
This commit is contained in:
parent
71d2f01685
commit
e76d8cfbc2
@ -1,16 +1,19 @@
|
|||||||
from predict import predict_no_ui
|
from predict import predict_no_ui_long_connection
|
||||||
from toolbox import CatchException, report_execption, write_results_to_file, predict_no_ui_but_counting_down
|
from toolbox import CatchException, report_execption, write_results_to_file
|
||||||
fast_debug = False
|
import datetime
|
||||||
|
|
||||||
@CatchException
|
@CatchException
|
||||||
def 高阶功能模板函数(txt, top_p, temperature, chatbot, history, systemPromptTxt, WEB_PORT):
|
def 高阶功能模板函数(txt, top_p, temperature, chatbot, history, systemPromptTxt, WEB_PORT):
|
||||||
history = [] # 清空历史,以免输入溢出
|
history = [] # 清空历史,以免输入溢出
|
||||||
for i in range(5):
|
for i in range(3):
|
||||||
i_say = f'我给出一个数字,你给出该数字的平方。我给出数字:{i}'
|
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."))
|
chatbot.append((i_say, "[Local Message] waiting gpt response."))
|
||||||
yield chatbot, history, '正常' # 由于请求gpt需要一段时间,我们先及时地做一次状态显示
|
yield chatbot, history, '正常' # 由于请求gpt需要一段时间,我们先及时地做一次状态显示
|
||||||
|
|
||||||
gpt_say = predict_no_ui(inputs=i_say, top_p=top_p, temperature=temperature) # 请求gpt,需要一段时间
|
# 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.") # 请求gpt,需要一段时间
|
||||||
|
|
||||||
chatbot[-1] = (i_say, gpt_say)
|
chatbot[-1] = (i_say, gpt_say)
|
||||||
history.append(i_say);history.append(gpt_say)
|
history.append(i_say);history.append(gpt_say)
|
||||||
|
@ -33,12 +33,10 @@ def get_crazy_functionals():
|
|||||||
"Color": "stop", # 按钮颜色
|
"Color": "stop", # 按钮颜色
|
||||||
"Function": 批量生成函数注释
|
"Function": 批量生成函数注释
|
||||||
},
|
},
|
||||||
"[实验] 把本项目源代码切换成全英文(多线程)": {
|
"[实验] 把本项目源代码切换成全英文(多线程demo)": {
|
||||||
"Color": "stop", # 按钮颜色
|
|
||||||
"Function": 全项目切换英文
|
"Function": 全项目切换英文
|
||||||
},
|
},
|
||||||
"[实验] 实验功能函数模板": {
|
"[实验] 历史上的今天(高级函数demo)": {
|
||||||
"Color": "stop", # 按钮颜色
|
|
||||||
"Function": 高阶功能模板函数
|
"Function": 高阶功能模板函数
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
1
other_llms/text-generation-webui
Submodule
1
other_llms/text-generation-webui
Submodule
@ -0,0 +1 @@
|
|||||||
|
Subproject commit 46f6536fae8650b4c9f8564c45f4b9f0a46bb8e4
|
Loading…
x
Reference in New Issue
Block a user