Spaces:
Sleeping
Sleeping
[实验] 历史上的今天(高级函数demo)
Browse files- crazy_functions/高级功能函数模板.py +9 -6
- functional_crazy.py +2 -4
- other_llms/text-generation-webui +1 -0
crazy_functions/高级功能函数模板.py
CHANGED
@@ -1,16 +1,19 @@
|
|
1 |
-
from predict import
|
2 |
-
from toolbox import CatchException, report_execption, write_results_to_file
|
3 |
-
|
4 |
|
5 |
@CatchException
|
6 |
def 高阶功能模板函数(txt, top_p, temperature, chatbot, history, systemPromptTxt, WEB_PORT):
|
7 |
history = [] # 清空历史,以免输入溢出
|
8 |
-
for i in range(
|
9 |
-
|
|
|
|
|
10 |
chatbot.append((i_say, "[Local Message] waiting gpt response."))
|
11 |
yield chatbot, history, '正常' # 由于请求gpt需要一段时间,我们先及时地做一次状态显示
|
12 |
|
13 |
-
|
|
|
14 |
|
15 |
chatbot[-1] = (i_say, gpt_say)
|
16 |
history.append(i_say);history.append(gpt_say)
|
|
|
1 |
+
from predict import predict_no_ui_long_connection
|
2 |
+
from toolbox import CatchException, report_execption, write_results_to_file
|
3 |
+
import datetime
|
4 |
|
5 |
@CatchException
|
6 |
def 高阶功能模板函数(txt, top_p, temperature, chatbot, history, systemPromptTxt, WEB_PORT):
|
7 |
history = [] # 清空历史,以免输入溢出
|
8 |
+
for i in range(3):
|
9 |
+
currentMonth = (datetime.date.today() + datetime.timedelta(days=i)).month
|
10 |
+
currentDay = (datetime.date.today() + datetime.timedelta(days=i)).day
|
11 |
+
i_say = f'今天是{currentMonth}月{currentDay}日,历史中的{currentMonth}月{currentDay}日发生了哪些大事?'
|
12 |
chatbot.append((i_say, "[Local Message] waiting gpt response."))
|
13 |
yield chatbot, history, '正常' # 由于请求gpt需要一段时间,我们先及时地做一次状态显示
|
14 |
|
15 |
+
# history = [] 每次询问不携带之前的询问历史
|
16 |
+
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,需要一段时间
|
17 |
|
18 |
chatbot[-1] = (i_say, gpt_say)
|
19 |
history.append(i_say);history.append(gpt_say)
|
functional_crazy.py
CHANGED
@@ -33,12 +33,10 @@ def get_crazy_functionals():
|
|
33 |
"Color": "stop", # 按钮颜色
|
34 |
"Function": 批量生成函数注释
|
35 |
},
|
36 |
-
"[实验]
|
37 |
-
"Color": "stop", # 按钮颜色
|
38 |
"Function": 全项目切换英文
|
39 |
},
|
40 |
-
"[实验]
|
41 |
-
"Color": "stop", # 按钮颜色
|
42 |
"Function": 高阶功能模板函数
|
43 |
},
|
44 |
}
|
|
|
33 |
"Color": "stop", # 按钮颜色
|
34 |
"Function": 批量生成函数注释
|
35 |
},
|
36 |
+
"[实验] 把本项目源代码切换成全英文(多线程demo)": {
|
|
|
37 |
"Function": 全项目切换英文
|
38 |
},
|
39 |
+
"[实验] 历史上的今天(高级函数demo)": {
|
|
|
40 |
"Function": 高阶功能模板函数
|
41 |
},
|
42 |
}
|
other_llms/text-generation-webui
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
Subproject commit 46f6536fae8650b4c9f8564c45f4b9f0a46bb8e4
|