fix: add CSRF token to streaming fetch request

This commit is contained in:
Agent Zero
2026-07-17 01:43:52 +02:00
parent 561d1919f5
commit da8d0ce818
+2
View File
@@ -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 }),