Spaces:
Sleeping
Sleeping
Chuan Hu
commited on
修复减少token功能
Browse files- ChuanhuChatbot.py +2 -3
ChuanhuChatbot.py
CHANGED
@@ -63,7 +63,7 @@ def reduce_token(chatbot, system, context):
|
|
63 |
chatbot.append(("请帮我总结一下上述对话的内容,实现减少tokens的同时,保证对话的质量。", optmz_str))
|
64 |
|
65 |
context = []
|
66 |
-
return chatbot, system, context
|
67 |
|
68 |
def reset_state():
|
69 |
return [], []
|
@@ -101,7 +101,6 @@ with gr.Blocks() as demo:
|
|
101 |
newSystemPrompt.submit(lambda :"", None, newSystemPrompt)
|
102 |
retryBtn.click(retry, [chatbot, systemPrompt, context], [chatbot, context], show_progress=True)
|
103 |
delLastBtn.click(delete_last_conversation, [chatbot, context], [chatbot, context], show_progress=True)
|
104 |
-
reduceTokenBtn.click(reduce_token, [chatbot, systemPrompt, context], [chatbot, systemPrompt, context], show_progress=True)
|
105 |
-
reduceTokenBtn.click(lambda x: x['content'], systemPrompt, systemPromptDisplay)
|
106 |
|
107 |
demo.launch()
|
|
|
63 |
chatbot.append(("请帮我总结一下上述对话的内容,实现减少tokens的同时,保证对话的质量。", optmz_str))
|
64 |
|
65 |
context = []
|
66 |
+
return chatbot, system, context, system['content']
|
67 |
|
68 |
def reset_state():
|
69 |
return [], []
|
|
|
101 |
newSystemPrompt.submit(lambda :"", None, newSystemPrompt)
|
102 |
retryBtn.click(retry, [chatbot, systemPrompt, context], [chatbot, context], show_progress=True)
|
103 |
delLastBtn.click(delete_last_conversation, [chatbot, context], [chatbot, context], show_progress=True)
|
104 |
+
reduceTokenBtn.click(reduce_token, [chatbot, systemPrompt, context], [chatbot, systemPrompt, context, systemPromptDisplay], show_progress=True)
|
|
|
105 |
|
106 |
demo.launch()
|