add CoT
Browse files- MyRecipeChatbot.py +2 -2
- modules/chat_func.py +10 -10
MyRecipeChatbot.py
CHANGED
@@ -104,9 +104,9 @@ with gr.Blocks(css=customCSS, theme=small_and_beautiful_theme) as demo:
|
|
104 |
systemPromptTxt = gr.Textbox(
|
105 |
show_label=True,
|
106 |
placeholder=f"在这里输入System Prompt...",
|
107 |
-
label="System prompt",
|
108 |
value=initial_prompt,
|
109 |
-
lines=
|
110 |
).style(container=False)
|
111 |
with gr.Accordion(label="加载Prompt模板", open=True):
|
112 |
with gr.Column():
|
|
|
104 |
systemPromptTxt = gr.Textbox(
|
105 |
show_label=True,
|
106 |
placeholder=f"在这里输入System Prompt...",
|
107 |
+
# label="System prompt",
|
108 |
value=initial_prompt,
|
109 |
+
lines=5,
|
110 |
).style(container=False)
|
111 |
with gr.Accordion(label="加载Prompt模板", open=True):
|
112 |
with gr.Column():
|
modules/chat_func.py
CHANGED
@@ -233,14 +233,14 @@ def predict_all(
|
|
233 |
# 将response中的店铺和菜名提取出来
|
234 |
import re
|
235 |
|
236 |
-
text = """
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
|
245 |
pattern = r'店铺名称:(.+?) 推荐菜品:(.+)。'
|
246 |
|
@@ -285,7 +285,7 @@ def predict_all(
|
|
285 |
|
286 |
response_ingredient = get_response(
|
287 |
openai_api_key,
|
288 |
-
"",
|
289 |
history_ingredient,
|
290 |
temperature,
|
291 |
top_p,
|
@@ -311,7 +311,7 @@ def predict_all(
|
|
311 |
|
312 |
response = get_response(
|
313 |
openai_api_key,
|
314 |
-
"",
|
315 |
history_rec,
|
316 |
temperature,
|
317 |
top_p,
|
|
|
233 |
# 将response中的店铺和菜名提取出来
|
234 |
import re
|
235 |
|
236 |
+
# text = """
|
237 |
+
# 好的,针对您想吃韩式烤肉的需求,我向您推荐以下店铺和菜品:
|
238 |
+
#
|
239 |
+
# 店铺名称:“青年烤肉店” 推荐菜品:烤牛肉、烤猪肉、烤羊肉
|
240 |
+
#
|
241 |
+
# 店铺名称:“西西里烤肉店” 推荐菜品:烤牛肉串、烤排骨、烤鸡肉
|
242 |
+
#
|
243 |
+
# 店铺名称:“韩式烤肉店” 推荐菜品:石锅拌饭、铁板烧、烤牛舌"""
|
244 |
|
245 |
pattern = r'店铺名称:(.+?) 推荐菜品:(.+)。'
|
246 |
|
|
|
285 |
|
286 |
response_ingredient = get_response(
|
287 |
openai_api_key,
|
288 |
+
"你是一个营养分析专家",
|
289 |
history_ingredient,
|
290 |
temperature,
|
291 |
top_p,
|
|
|
311 |
|
312 |
response = get_response(
|
313 |
openai_api_key,
|
314 |
+
"你是一个美食推荐家",
|
315 |
history_rec,
|
316 |
temperature,
|
317 |
top_p,
|