Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -103,8 +103,14 @@ def resolve_uploaded_file(uploaded_file_value, state_value):
|
|
| 103 |
if conversation_id:
|
| 104 |
previous_settings = state_value["conversation_contexts"].get(
|
| 105 |
conversation_id, {}).get("settings", {})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 106 |
if uploaded_file_value:
|
| 107 |
return load_context_file(uploaded_file_value)
|
|
|
|
| 108 |
return previous_settings.get("uploaded_file")
|
| 109 |
|
| 110 |
|
|
|
|
| 103 |
if conversation_id:
|
| 104 |
previous_settings = state_value["conversation_contexts"].get(
|
| 105 |
conversation_id, {}).get("settings", {})
|
| 106 |
+
# If it's already parsed (dict with content), reuse it instead of reloading
|
| 107 |
+
if uploaded_file_value and isinstance(uploaded_file_value, dict) and "content" in uploaded_file_value:
|
| 108 |
+
return uploaded_file_value
|
| 109 |
+
|
| 110 |
+
# Otherwise load from actual file input
|
| 111 |
if uploaded_file_value:
|
| 112 |
return load_context_file(uploaded_file_value)
|
| 113 |
+
|
| 114 |
return previous_settings.get("uploaded_file")
|
| 115 |
|
| 116 |
|