Spaces:
Runtime error
Runtime error
backwards compat
Browse files
app.py
CHANGED
|
@@ -178,10 +178,15 @@ def import_history(history, file):
|
|
| 178 |
# Deserialize the JSON content
|
| 179 |
import_data = json.loads(content)
|
| 180 |
|
| 181 |
-
|
| 182 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 183 |
|
| 184 |
-
return
|
| 185 |
|
| 186 |
with gr.Blocks() as demo:
|
| 187 |
gr.Markdown("# Anthropic™️ Claude™️ Chat (Nils' Version™️)")
|
|
|
|
| 178 |
# Deserialize the JSON content
|
| 179 |
import_data = json.loads(content)
|
| 180 |
|
| 181 |
+
# Check if 'history' key exists for backward compatibility
|
| 182 |
+
if 'history' in import_data:
|
| 183 |
+
history = import_data['history']
|
| 184 |
+
system_prompt.value = import_data.get('system_prompt', '') # Set default if not present
|
| 185 |
+
else:
|
| 186 |
+
# Assume it's an old format with only history data
|
| 187 |
+
history = import_data
|
| 188 |
|
| 189 |
+
return history, system_prompt.value # Return system prompt value to be set in the UI
|
| 190 |
|
| 191 |
with gr.Blocks() as demo:
|
| 192 |
gr.Markdown("# Anthropic™️ Claude™️ Chat (Nils' Version™️)")
|