(apiUrl: string)
| 29 | * the server reads the session cookie from the request. |
| 30 | */ |
| 31 | export function getChatClient(apiUrl: string): AppClient { |
| 32 | if (cachedClient && cachedBaseURL === apiUrl) return cachedClient; |
| 33 | cachedBaseURL = apiUrl; |
| 34 | cachedClient = createClient<ChatApp>({ |
| 35 | baseURL: `${apiUrl}/ai/agents`, |
| 36 | fetch: (input, init) => |
| 37 | fetch(input, { ...init, credentials: 'include' }), |
| 38 | }); |
| 39 | return cachedClient; |
| 40 | } |
no test coverage detected