package org.dromara.knowledge.vectorstore;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

@Component
public class VectorStoreManager {
    private final VectorStoreService dbService;
    private final QdrantVectorStoreService qdrantService;
    private final WeaviateVectorStoreService weaviateService;
    @Value("${ruoyi.ai.knowledge.vector-store.type:db}")
    private String type;

    public VectorStoreManager(DbVectorStoreService dbService, QdrantVectorStoreService qdrantService, WeaviateVectorStoreService weaviateService) {
        this.dbService = dbService;
        this.qdrantService = qdrantService;
        this.weaviateService = weaviateService;
    }

    public VectorStoreService current() {
        if ("qdrant".equalsIgnoreCase(type)) return qdrantService;
        if ("weaviate".equalsIgnoreCase(type)) return weaviateService;
        return dbService;
    }
}
