mirror of
https://github.com/koala73/worldmonitor.git
synced 2026-04-25 17:14:57 +02:00
fix(llm): pin LLM edge functions to US/EU regions to prevent geo-block 403s (#2541)
OpenRouter returns 403 'This model is not available in your region' when Vercel routes through edge nodes in regions where Google Gemini is blocked. Pin chat-analyst, news, and intelligence edge functions to iad1/lhr1/fra1/sfo1. Also improves error logging in callLlmReasoningStream to include model name and full response body on non-2xx for easier future diagnosis.
This commit is contained in:
@@ -11,7 +11,7 @@
|
|||||||
* data: {"error":"..."} — on auth/llm failure
|
* data: {"error":"..."} — on auth/llm failure
|
||||||
*/
|
*/
|
||||||
|
|
||||||
export const config = { runtime: 'edge' };
|
export const config = { runtime: 'edge', regions: ['iad1', 'lhr1', 'fra1', 'sfo1'] };
|
||||||
|
|
||||||
// @ts-expect-error — JS module, no declaration file
|
// @ts-expect-error — JS module, no declaration file
|
||||||
import { getCorsHeaders } from './_cors.js';
|
import { getCorsHeaders } from './_cors.js';
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
export const config = { runtime: 'edge' };
|
export const config = { runtime: 'edge', regions: ['iad1', 'lhr1', 'fra1', 'sfo1'] };
|
||||||
|
|
||||||
import { createDomainGateway, serverOptions } from '../../../server/gateway';
|
import { createDomainGateway, serverOptions } from '../../../server/gateway';
|
||||||
import { createIntelligenceServiceRoutes } from '../../../src/generated/server/worldmonitor/intelligence/v1/service_server';
|
import { createIntelligenceServiceRoutes } from '../../../src/generated/server/worldmonitor/intelligence/v1/service_server';
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
export const config = { runtime: 'edge' };
|
export const config = { runtime: 'edge', regions: ['iad1', 'lhr1', 'fra1', 'sfo1'] };
|
||||||
|
|
||||||
import { createDomainGateway, serverOptions } from '../../../server/gateway';
|
import { createDomainGateway, serverOptions } from '../../../server/gateway';
|
||||||
import { createNewsServiceRoutes } from '../../../src/generated/server/worldmonitor/news/v1/service_server';
|
import { createNewsServiceRoutes } from '../../../src/generated/server/worldmonitor/news/v1/service_server';
|
||||||
|
|||||||
@@ -293,7 +293,8 @@ export function callLlmReasoningStream(opts: LlmStreamOptions): ReadableStream<U
|
|||||||
|
|
||||||
if (!resp.ok || !resp.body) {
|
if (!resp.ok || !resp.body) {
|
||||||
clearTimeout(timeoutId);
|
clearTimeout(timeoutId);
|
||||||
console.warn(`[llm-stream:${providerName}] HTTP ${resp.status}`);
|
const errBody = resp.body ? await resp.text().catch(() => '') : '';
|
||||||
|
console.warn(`[llm-stream:${providerName}] HTTP ${resp.status} model=${creds.model} body=${errBody.slice(0, 300)}`);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user