Update main.py
Browse filesAdd timestamp heristics
main.py
CHANGED
@@ -311,7 +311,8 @@ async def save_data(
|
|
311 |
"query": [],
|
312 |
"retrieved_text": [],
|
313 |
"model_type": [],
|
314 |
-
"reaction": []
|
|
|
315 |
}
|
316 |
|
317 |
# Add each item to the data dict
|
@@ -322,6 +323,7 @@ async def save_data(
|
|
322 |
data["retrieved_text"].append(item.retrieved_text)
|
323 |
data["model_type"].append(item.model_type)
|
324 |
data["reaction"].append(item.reaction)
|
|
|
325 |
|
326 |
try:
|
327 |
# Load existing dataset and merge
|
@@ -334,7 +336,7 @@ async def save_data(
|
|
334 |
# Add new data
|
335 |
for key in data:
|
336 |
if key not in existing_data:
|
337 |
-
existing_data[key] = ["" if key in ["
|
338 |
existing_data[key].extend(data[key])
|
339 |
|
340 |
except Exception as e:
|
|
|
311 |
"query": [],
|
312 |
"retrieved_text": [],
|
313 |
"model_type": [],
|
314 |
+
"reaction": [],
|
315 |
+
"timestamp": []
|
316 |
}
|
317 |
|
318 |
# Add each item to the data dict
|
|
|
323 |
data["retrieved_text"].append(item.retrieved_text)
|
324 |
data["model_type"].append(item.model_type)
|
325 |
data["reaction"].append(item.reaction)
|
326 |
+
data["timestamp"].append(timestamp or datetime.now(timezone.utc).isoformat().replace('+00:00', 'Z'))
|
327 |
|
328 |
try:
|
329 |
# Load existing dataset and merge
|
|
|
336 |
# Add new data
|
337 |
for key in data:
|
338 |
if key not in existing_data:
|
339 |
+
existing_data[key] = ["" if key in ["timestamp"] else None] * len(next(iter(existing_data.values())))
|
340 |
existing_data[key].extend(data[key])
|
341 |
|
342 |
except Exception as e:
|