"src/git@developer.sourcefind.cn:chenpangpang/open-webui.git" did not exist on "099b1d066bd593b3119fb7b0e850627b95548711"
Commit 8ec39345 authored by Timothy J. Baek's avatar Timothy J. Baek
Browse files

fix: memory

parent 0d07d10b
...@@ -264,12 +264,14 @@ ...@@ -264,12 +264,14 @@
}); });
if (res) { if (res) {
userContext = res.documents.reduce((acc, doc, index) => { if (res.documents[0].length > 0) {
const createdAtTimestamp = res.metadatas[index][0].created_at; userContext = res.documents.reduce((acc, doc, index) => {
const createdAtDate = new Date(createdAtTimestamp * 1000).toISOString().split('T')[0]; const createdAtTimestamp = res.metadatas[index][0].created_at;
acc.push(`${index + 1}. [${createdAtDate}]. ${doc[0]}`); const createdAtDate = new Date(createdAtTimestamp * 1000).toISOString().split('T')[0];
return acc; acc.push(`${index + 1}. [${createdAtDate}]. ${doc[0]}`);
}, []); return acc;
}, []);
}
console.log(userContext); console.log(userContext);
} }
......
...@@ -270,12 +270,14 @@ ...@@ -270,12 +270,14 @@
}); });
if (res) { if (res) {
userContext = res.documents.reduce((acc, doc, index) => { if (res.documents[0].length > 0) {
const createdAtTimestamp = res.metadatas[index][0].created_at; userContext = res.documents.reduce((acc, doc, index) => {
const createdAtDate = new Date(createdAtTimestamp * 1000).toISOString().split('T')[0]; const createdAtTimestamp = res.metadatas[index][0].created_at;
acc.push(`${index + 1}. [${createdAtDate}]. ${doc[0]}`); const createdAtDate = new Date(createdAtTimestamp * 1000).toISOString().split('T')[0];
return acc; acc.push(`${index + 1}. [${createdAtDate}]. ${doc[0]}`);
}, []); return acc;
}, []);
}
console.log(userContext); console.log(userContext);
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment