fix: add CSRF token to streaming fetch request
This commit is contained in:
@@ -156,10 +156,12 @@ export async function* streamChat(
|
||||
content: string,
|
||||
agentId?: string
|
||||
): AsyncGenerator<StreamEvent> {
|
||||
const csrfToken = sessionStorage.getItem('leocrm_csrf_token');
|
||||
const response = await fetch(`/api/v1/ai/sessions/${sessionId}/stream`, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
...(csrfToken ? { 'X-CSRF-Token': csrfToken } : {}),
|
||||
},
|
||||
credentials: 'include',
|
||||
body: JSON.stringify({ content, agent_id: agentId }),
|
||||
|
||||
Reference in New Issue
Block a user