Skip to content

armgit / jan

Public Imported from GitHub
0

Jan is an open source alternative to ChatGPT that runs 100% offline on your computer.

Merge remote-tracking branch 'upstream/dev' into feat/identify-jan-on-openrouter

Zhiqiang ZHOU9ff3cbe63f69
diff --cc web-app/src/lib/completion.ts
index e14642a26,5ffd4fa4b..4dfa69924
--- a/web-app/src/lib/completion.ts
+++ b/web-app/src/lib/completion.ts
@@@ -129,15 -136,9 +136,17 @@@ export const sendCompletion = async
apiKey: provider.api_key ?? (await invoke('app_token')),
// TODO: Retrieve from extension settings
baseURL: provider.base_url,
+ // Use Tauri's fetch to avoid CORS issues only for openai-compatible provider
+ ...(providerName === 'openai-compatible' && { fetch: fetchTauri }),
+ // OpenRouter identification headers for Jan
+ // ref: https://openrouter.ai/docs/api-reference/overview#headers
+ ...(provider.provider === 'openrouter' && {
+ defaultHeaders: {
+ 'HTTP-Referer': 'https://jan.ai',
+ 'X-Title': 'Jan',
+ },
+ }),
- })
+ } as ExtendedConfigOptions)
if (
thread.model.id &&
!(thread.model.id in Object.values(models).flat()) &&