Spaces:
Runtime error
Runtime error
de-shit-itself-ination 1
Browse files
app.py
CHANGED
@@ -130,10 +130,11 @@ def import_chat(custom_format_string):
|
|
130 |
|
131 |
def export_chat(history, system_prompt):
|
132 |
export_data = f"<|system|> {system_prompt}\n\n"
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
|
|
137 |
return export_data
|
138 |
|
139 |
def stop_generation_func():
|
@@ -189,13 +190,13 @@ with gr.Blocks(theme='gradio/monochrome') as demo:
|
|
189 |
stop_generation.clear()
|
190 |
|
191 |
def regenerate_response(history, system_prompt, temperature, top_p, top_k, frequency_penalty, presence_penalty, repetition_penalty, max_tokens):
|
192 |
-
if history
|
193 |
last_user_message = history[-1][0]
|
194 |
history[-1][1] = None
|
195 |
for new_history in bot(history, system_prompt, temperature, top_p, top_k, frequency_penalty, presence_penalty, repetition_penalty, max_tokens):
|
196 |
yield new_history
|
197 |
else:
|
198 |
-
yield []
|
199 |
|
200 |
def import_chat_wrapper(custom_format_string):
|
201 |
imported_history, imported_system_prompt = import_chat(custom_format_string)
|
|
|
130 |
|
131 |
def export_chat(history, system_prompt):
|
132 |
export_data = f"<|system|> {system_prompt}\n\n"
|
133 |
+
if history is not None:
|
134 |
+
for user_msg, assistant_msg in history:
|
135 |
+
export_data += f"<|user|> {user_msg}\n\n"
|
136 |
+
if assistant_msg:
|
137 |
+
export_data += f"<|assistant|> {assistant_msg}\n\n"
|
138 |
return export_data
|
139 |
|
140 |
def stop_generation_func():
|
|
|
190 |
stop_generation.clear()
|
191 |
|
192 |
def regenerate_response(history, system_prompt, temperature, top_p, top_k, frequency_penalty, presence_penalty, repetition_penalty, max_tokens):
|
193 |
+
if history and len(history) > 0:
|
194 |
last_user_message = history[-1][0]
|
195 |
history[-1][1] = None
|
196 |
for new_history in bot(history, system_prompt, temperature, top_p, top_k, frequency_penalty, presence_penalty, repetition_penalty, max_tokens):
|
197 |
yield new_history
|
198 |
else:
|
199 |
+
yield []
|
200 |
|
201 |
def import_chat_wrapper(custom_format_string):
|
202 |
imported_history, imported_system_prompt = import_chat(custom_format_string)
|