| 1234567891011121314151617 |
- import { config } from "../config/index.js";
- import { qdrant } from "./qdrantClient.js";
- export async function ensureCollection({ vectorSize }) {
- const collectionName = config.qdrant.collection;
- const existing = await qdrant.getCollections();
- const has = (existing?.collections ?? []).some((c) => c.name === collectionName);
- if (has) return;
- await qdrant.createCollection(collectionName, {
- vectors: {
- size: vectorSize,
- distance: "Cosine"
- }
- });
- }
|