diff --git a/frontend/src/lib/sse.ts b/frontend/src/lib/sse.ts index ffe7baff..7d5933ea 100644 --- a/frontend/src/lib/sse.ts +++ b/frontend/src/lib/sse.ts @@ -1,5 +1,5 @@ import type { ResearchEvent, SSEEvent } from '../types'; -import { getBase } from './api'; +import { getBase, authHeaders } from './api'; export interface ChatRequest { model: string; @@ -16,7 +16,7 @@ export async function* streamChat( const base = getBase(); const response = await fetch(`${base}/v1/chat/completions`, { method: 'POST', - headers: { 'Content-Type': 'application/json' }, + headers: authHeaders({ 'Content-Type': 'application/json' }), body: JSON.stringify(request), signal, }); @@ -67,7 +67,7 @@ export async function* streamResearch( const base = getBase().replace(/\/v1\/?$/, ''); const response = await fetch(`${base}/api/research`, { method: 'POST', - headers: { 'Content-Type': 'application/json' }, + headers: authHeaders({ 'Content-Type': 'application/json' }), body: JSON.stringify({ query }), signal, }); @@ -106,3 +106,4 @@ export async function* streamResearch( reader.releaseLock(); } } +