Spaces:
Running
Running
fix: remove escaped quotes SyntaxError in api/files.py
Browse files- api/files.py +8 -8
api/files.py
CHANGED
|
@@ -137,20 +137,20 @@ import os
|
|
| 137 |
VFS_OFFLOAD_THRESHOLD_BYTES = 512 * 1024
|
| 138 |
|
| 139 |
async def _offload_to_hf(content: str, filename: str) -> str:
|
| 140 |
-
|
| 141 |
from .hf_storage import hf_append_record
|
| 142 |
record = {
|
| 143 |
-
|
| 144 |
-
|
| 145 |
-
|
| 146 |
-
|
| 147 |
}
|
| 148 |
# Usiamo hf_append_record per salvare il file nel dataset
|
| 149 |
-
success = await hf_append_record(
|
| 150 |
if success:
|
| 151 |
# Nota: In produzione qui genereremmo un URL diretto R2 o HF
|
| 152 |
-
return f
|
| 153 |
-
return
|
| 154 |
|
| 155 |
|
| 156 |
@router.post('/api/files')
|
|
|
|
| 137 |
VFS_OFFLOAD_THRESHOLD_BYTES = 512 * 1024
|
| 138 |
|
| 139 |
async def _offload_to_hf(content: str, filename: str) -> str:
|
| 140 |
+
"""Carica il contenuto su HF Storage e restituisce l'URL."""
|
| 141 |
from .hf_storage import hf_append_record
|
| 142 |
record = {
|
| 143 |
+
"filename": filename,
|
| 144 |
+
"content_preview": content[:1000],
|
| 145 |
+
"full_content": content,
|
| 146 |
+
"offloaded_at": int(time.time() * 1000)
|
| 147 |
}
|
| 148 |
# Usiamo hf_append_record per salvare il file nel dataset
|
| 149 |
+
success = await hf_append_record("offloaded_files.jsonl", record)
|
| 150 |
if success:
|
| 151 |
# Nota: In produzione qui genereremmo un URL diretto R2 o HF
|
| 152 |
+
return f"https://huggingface.co/datasets/{os.getenv('HF_DATASET_REPO', 'Arjanit98/agent-memory')}/raw/main/offloaded_files.jsonl"
|
| 153 |
+
return ""
|
| 154 |
|
| 155 |
|
| 156 |
@router.post('/api/files')
|