Skip to content

Commit cba7deb

Browse files
committed
fix: run in development should use built-in fetch
1 parent 9bb9404 commit cba7deb

File tree

4 files changed

+4
-2
lines changed

4 files changed

+4
-2
lines changed

src-tauri/tauri.conf.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"build": {
77
"frontendDist": "../web-app/dist",
88
"devUrl": "http://localhost:1420",
9-
"beforeDevCommand": "cross-env IS_TAURI=true yarn dev:web",
9+
"beforeDevCommand": "cross-env IS_TAURI=true IS_DEV=true yarn dev:web",
1010
"beforeBuildCommand": "cross-env IS_TAURI=true yarn build:web"
1111
},
1212
"app": {

web-app/src/lib/completion.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ export const sendCompletion = async (
174174
// TODO: Retrieve from extension settings
175175
baseURL: provider.base_url,
176176
// Use Tauri's fetch to avoid CORS issues only for openai-compatible provider
177-
fetch: getServiceHub().providers().fetch(),
177+
fetch: IS_DEV ? fetch : getServiceHub().providers().fetch(),
178178
// OpenRouter identification headers for Jan
179179
// ref: https://openrouter.ai/docs/api-reference/overview#headers
180180
...(provider.provider === 'openrouter' && {

web-app/src/types/global.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ declare global {
2222
declare const MODEL_CATALOG_URL: string
2323
declare const AUTO_UPDATER_DISABLED: boolean
2424
declare const GA_MEASUREMENT_ID: string
25+
declare const IS_DEV: boolean
2526
interface Window {
2627
core: AppCore | undefined
2728
gtag?: (...args: unknown[]) => void

web-app/vite.config.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ export default defineConfig(({ mode }) => {
4040
},
4141
define: {
4242
IS_TAURI: JSON.stringify(process.env.IS_TAURI),
43+
IS_DEV: JSON.stringify(process.env.IS_DEV),
4344
IS_WEB_APP: JSON.stringify(false),
4445
IS_MACOS: JSON.stringify(
4546
process.env.TAURI_ENV_PLATFORM?.includes('darwin') ?? false

0 commit comments

Comments
 (0)