mirror of
https://github.com/open-webui/open-webui
synced 2025-03-17 02:48:52 +00:00
fix
This commit is contained in:
parent
89c77f05a8
commit
741230bcdb
@ -130,7 +130,10 @@ class ChromaClient:
|
|||||||
|
|
||||||
def upsert(self, collection_name: str, items: list[VectorItem]):
|
def upsert(self, collection_name: str, items: list[VectorItem]):
|
||||||
# Update the items in the collection, if the items are not present, insert them. If the collection does not exist, it will be created.
|
# Update the items in the collection, if the items are not present, insert them. If the collection does not exist, it will be created.
|
||||||
collection = self.client.get_or_create_collection(name=collection_name)
|
collection = self.client.get_or_create_collection(
|
||||||
|
name=collection_name,
|
||||||
|
metadata={"hnsw:space": "cosine"}
|
||||||
|
)
|
||||||
|
|
||||||
ids = [item["id"] for item in items]
|
ids = [item["id"] for item in items]
|
||||||
documents = [item["text"] for item in items]
|
documents = [item["text"] for item in items]
|
||||||
|
@ -49,15 +49,6 @@
|
|||||||
});
|
});
|
||||||
return acc;
|
return acc;
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
$: if (_citations.every((citation) => citation.distances !== undefined)) {
|
|
||||||
// Sort citations by distance (relevance)
|
|
||||||
_citations = _citations.sort((a, b) => {
|
|
||||||
const aMinDistance = Math.min(...(a.distances ?? []));
|
|
||||||
const bMinDistance = Math.min(...(b.distances ?? []));
|
|
||||||
return aMinDistance - bMinDistance;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<CitationsModal bind:show={showCitationModal} citation={selectedCitation} />
|
<CitationsModal bind:show={showCitationModal} citation={selectedCitation} />
|
||||||
|
Loading…
Reference in New Issue
Block a user