From 4c8556a3d2a07d99301fc350746d8a7276a778e1 Mon Sep 17 00:00:00 2001 From: Aaron Nelson Date: Sun, 26 Apr 2026 11:39:53 -0400 Subject: [PATCH] =?UTF-8?q?Fix=20double=20/api/=20=E2=80=94=20remove=20pre?= =?UTF-8?q?fix=20from=20paths,=20request=20function=20adds=20it?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/api.ts | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/lib/api.ts b/lib/api.ts index cc35a58..0227c8f 100644 --- a/lib/api.ts +++ b/lib/api.ts @@ -12,30 +12,30 @@ async function request(path: string, options?: RequestInit): Promise { } export const api = { - getSettings: () => request('/api/settings'), + getSettings: () => request('/settings'), updateSettings: (s: Partial) => - request('/api/settings', { method: 'POST', body: JSON.stringify(s) }), - getConversations: () => request('/api/conversations'), + request('/settings', { method: 'POST', body: JSON.stringify(s) }), + getConversations: () => request('/conversations'), newConversation: (title = 'New conversation') => - request('/api/conversations', { method: 'POST', body: JSON.stringify({ title }) }), - getMessages: (id: string) => request(`/api/conversations/${id}/messages`), + request('/conversations', { method: 'POST', body: JSON.stringify({ title }) }), + getMessages: (id: string) => request(`/conversations/${id}/messages`), renameConversation: (id: string, title: string) => - request(`/api/conversations/${id}`, { method: 'PATCH', body: JSON.stringify({ title }) }), + request(`/conversations/${id}`, { method: 'PATCH', body: JSON.stringify({ title }) }), deleteConversation: (id: string) => - request<{ deleted: string }>(`/api/conversations/${id}`, { method: 'DELETE' }), + request<{ deleted: string }>(`/conversations/${id}`, { method: 'DELETE' }), clearAllConversations: () => - request<{ cleared: boolean }>('/api/conversations', { method: 'DELETE' }), + request<{ cleared: boolean }>('/conversations', { method: 'DELETE' }), sendMessage: (message: string, conversation_id: string) => - request('/api/chat', { method: 'POST', body: JSON.stringify({ message, conversation_id }) }), - getMemory: () => request<{ content: string }>('/api/memory'), + request('/chat', { method: 'POST', body: JSON.stringify({ message, conversation_id }) }), + getMemory: () => request<{ content: string }>('/memory'), updateMemory: (content: string) => - request<{ saved: boolean }>('/api/memory', { method: 'POST', body: JSON.stringify({ content }) }), - getStatus: () => request('/api/status'), - reindex: () => request<{ started: boolean }>('/api/reindex', { method: 'POST' }), + request<{ saved: boolean }>('/memory', { method: 'POST', body: JSON.stringify({ content }) }), + getStatus: () => request('/status'), + reindex: () => request<{ started: boolean }>('/reindex', { method: 'POST' }), transcribe: async (audio: Blob): Promise<{ text: string }> => { const form = new FormData(); form.append('audio', audio, 'recording.webm'); - const url = API_BASE ? `${API_BASE}/api/transcribe` : '/api/transcribe'; + const url = '/api/transcribe'; const res = await fetch(url, { method: 'POST', credentials: 'include', body: form }); if (!res.ok) throw new Error(`Transcribe error: ${res.status}`); return res.json(); @@ -46,7 +46,7 @@ export const api = { if (data.image) form.append('image', data.image); if (data.text) form.append('text', data.text); if (data.project) form.append('project', data.project); - const url = API_BASE ? `${API_BASE}/api/capture` : '/api/capture'; + const url = '/api/capture'; const res = await fetch(url, { method: 'POST', credentials: 'include', body: form }); if (!res.ok) throw new Error(`Capture error: ${res.status}`); return res.json();