This commit is contained in:
2026-02-02 00:59:25 +08:00
parent f93cec6f0b
commit ad7676753c
2 changed files with 3 additions and 3 deletions

View File

@@ -4,7 +4,7 @@
* Validates: Requirements 12.1-12.6 * Validates: Requirements 12.1-12.6
*/ */
import api, { API_BASE_URL } from './api'; import api, { API_BASE_URL, getAccessToken } from './api';
import type { import type {
ApiResponse, ApiResponse,
AIChatResponse, AIChatResponse,
@@ -105,7 +105,7 @@ export async function streamChatMessage(
onChunk: (text: string) => void onChunk: (text: string) => void
): Promise<AIChatResponse> { ): Promise<AIChatResponse> {
const sessionId = existingSessionId || getSessionId(); const sessionId = existingSessionId || getSessionId();
const token = localStorage.getItem('token'); // Assuming auth token is stored here const token = getAccessToken(); // Get token from shared storage logic
// Use fetch directly for streaming support // Use fetch directly for streaming support
const response = await fetch(`${API_BASE_URL}/ai/chat/stream`, { const response = await fetch(`${API_BASE_URL}/ai/chat/stream`, {

View File

@@ -25,7 +25,7 @@ interface RequestOptions extends RequestInit {
/** /**
* Get access token from storage * Get access token from storage
*/ */
function getAccessToken(): string | null { export function getAccessToken(): string | null {
return localStorage.getItem(ACCESS_TOKEN_KEY); return localStorage.getItem(ACCESS_TOKEN_KEY);
} }