| 2 | import { get, post, put, del } from '../utils/http' |
| 3 | |
| 4 | export class FetchAssistantAdapter implements AssistantServiceAdapter { |
| 5 | async getAll(): Promise<AssistantSummary[]> { |
| 6 | return get<AssistantSummary[]>('/ai/assistants') |
| 7 | } |
| 8 | |
| 9 | async getConfig(id: string): Promise<AssistantConfig | null> { |
| 10 | try { |
| 11 | return await get<AssistantConfig>(`/ai/assistants/${id}`) |
| 12 | } catch { |
| 13 | return null |
| 14 | } |
| 15 | } |
| 16 | |
| 17 | async create(config: Omit<AssistantConfig, 'id'>) { |
| 18 | return post<{ success: boolean; id?: string; error?: string }>('/ai/assistants', config) |
| 19 | } |
| 20 | |
| 21 | async update(id: string, updates: Partial<AssistantConfig>) { |
| 22 | return put<{ success: boolean; error?: string }>(`/ai/assistants/${id}`, updates) |
| 23 | } |
| 24 | |
| 25 | async delete(id: string) { |
| 26 | return del<{ success: boolean; error?: string }>(`/ai/assistants/${id}`) |
| 27 | } |
| 28 | |
| 29 | async reset(id: string) { |
| 30 | return post<{ success: boolean; error?: string }>(`/ai/assistants/${id}/reset`, {}) |
| 31 | } |
| 32 | |
| 33 | async importFromMd(rawMd: string) { |
| 34 | return post<{ success: boolean; error?: string }>('/ai/assistants/import', { rawMd }) |
| 35 | } |
| 36 | |
| 37 | /** @deprecated Local builtin catalog is empty; kept for backward compatibility */ |
| 38 | async getBuiltinCatalog(): Promise<BuiltinAssistantInfo[]> { |
| 39 | return [] |
| 40 | } |
| 41 | |
| 42 | async importBuiltin(builtinId: string) { |
| 43 | return post<{ success: boolean; error?: string }>('/ai/assistants/import-builtin', { builtinId }) |
| 44 | } |
| 45 | |
| 46 | async reimport(id: string) { |
| 47 | return post<{ success: boolean; error?: string }>(`/ai/assistants/${id}/reimport`, {}) |
| 48 | } |
| 49 | |
| 50 | async getBuiltinToolCatalog(): Promise<Array<{ name: string; category: 'core' | 'analysis' }>> { |
| 51 | return get<Array<{ name: string; category: 'core' | 'analysis' }>>('/ai/tools/catalog') |
| 52 | } |
| 53 | } |
nothing calls this directly
no outgoing calls
no test coverage detected