Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
|
@@ -135,24 +135,12 @@ def add_memory():
|
|
| 135 |
return jsonify({"error": "No content provided"}), 400
|
| 136 |
|
| 137 |
try:
|
| 138 |
-
# FIX: Use keyword argument 'text'
|
| 139 |
-
# The SDK supports: .put(text="...") OR .put(file="path/to.pdf")
|
| 140 |
-
# It likely accepts 'tags' or 'metadata' as well
|
| 141 |
db.put(text=content)
|
| 142 |
-
|
| 143 |
-
# If the SDK supports tags, it typically looks like this:
|
| 144 |
-
# db.put(text=content, tags=tags)
|
| 145 |
-
|
| 146 |
-
# Check for explicit commit if needed
|
| 147 |
-
if hasattr(db, 'commit'):
|
| 148 |
-
db.commit()
|
| 149 |
-
|
| 150 |
-
# Sync back to cloud
|
| 151 |
sync_to_hub()
|
| 152 |
|
| 153 |
return jsonify({"success": True, "message": "Memory added and synced to cloud."})
|
| 154 |
except Exception as e:
|
| 155 |
-
# Print error to logs for easier debugging
|
| 156 |
print(f"Error adding memory: {e}")
|
| 157 |
return jsonify({"error": str(e)}), 500
|
| 158 |
|
|
|
|
| 135 |
return jsonify({"error": "No content provided"}), 400
|
| 136 |
|
| 137 |
try:
|
|
|
|
|
|
|
|
|
|
| 138 |
db.put(text=content)
|
| 139 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 140 |
sync_to_hub()
|
| 141 |
|
| 142 |
return jsonify({"success": True, "message": "Memory added and synced to cloud."})
|
| 143 |
except Exception as e:
|
|
|
|
| 144 |
print(f"Error adding memory: {e}")
|
| 145 |
return jsonify({"error": str(e)}), 500
|
| 146 |
|