import { get, post, put, del } from '@/utils/request' // ===== Types ===== export interface VectorStoreEntity { id?: string name: string engine_type: string connection_config: Record index_config: Record source: 'env' | 'user' readonly: boolean tenant_id?: number created_at?: string updated_at?: string } export interface VectorStoreTypeInfo { type: string display_name: string connection_fields: FieldSchema[] index_fields: FieldSchema[] } export interface FieldSchema { name: string type: 'string' | 'number' | 'boolean' required: boolean sensitive?: boolean description?: string default?: any } // ===== API Functions ===== export function listVectorStoreTypes(): Promise { return get('/api/v1/vector-stores/types').then((res: any) => { return res.success && res.data ? res.data : [] }) } export function listVectorStores(): Promise<{ success: boolean; data: VectorStoreEntity[] }> { return get('/api/v1/vector-stores') } export function createVectorStore(data: Partial) { return post('/api/v1/vector-stores', data) } export function updateVectorStore(id: string, data: Partial) { return put(`/api/v1/vector-stores/${id}`, data) } export function deleteVectorStore(id: string) { return del(`/api/v1/vector-stores/${id}`) } export function testVectorStoreRaw(data: { engine_type: string; connection_config: any }): Promise { return post('/api/v1/vector-stores/test', data) } export function testVectorStoreById(id: string): Promise { return post(`/api/v1/vector-stores/${id}/test`, {}) }