Merge pull request #60 from johnbenac/main

This commit is contained in:
Cohee
2023-06-22 08:49:52 +03:00
committed by GitHub

View File

@@ -809,7 +809,7 @@ def chromadb_export():
ids = collection_content.get('ids', [])
metadatas = collection_content.get('metadatas', [])
content = [
unsorted_content = [
{
"id": ids[i],
"metadata": metadatas[i],
@@ -817,13 +817,14 @@ def chromadb_export():
}
for i in range(len(ids))
]
sorted_content = sorted(unsorted_content, key=lambda x: x['metadata']['date'])
export = {
"chat_id": data["chat_id"],
"content": content
"chat_id": data["chat_id"],
"content": sorted_content
}
return jsonify(export)
@app.route("/api/chromadb/import", methods=["POST"])