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.

fix: improve abort signal handling for fetch requests in mlx and llamacpp extensions

since-2017-hub01c14a5a8cd7
diff --git a/src-tauri/src/lib.rs b/src-tauri/src/lib.rs
index ece861362..3ee491903 100644
--- a/src-tauri/src/lib.rs
+++ b/src-tauri/src/lib.rs
@@ -456,6 +456,13 @@ pub fn run() {
}
}
+ // Clean up Claude Code env vars from shell config on exit
+ if let Err(e) = crate::core::system::commands::clear_claude_code_env() {
+ log::warn!("Failed to clear Claude Code env vars: {}", e);
+ } else {
+ log::info!("Claude Code env vars cleaned up successfully");
+ }
+
log::info!("App cleanup completed");
});
});
diff --git a/web-app/src/routes/settings/local-api-server.tsx b/web-app/src/routes/settings/local-api-server.tsx
index 9b5657aed..526a7a391 100644
--- a/web-app/src/routes/settings/local-api-server.tsx
+++ b/web-app/src/routes/settings/local-api-server.tsx
@@ -21,6 +21,7 @@ import { ApiKeyInput } from '@/containers/ApiKeyInput'
import { useEffect, useState } from 'react'
import { toast } from 'sonner'
import { getModelToStart } from '@/utils/getModelToStart'
+import { invoke } from '@tauri-apps/api/core'
import { LogViewer } from '@/components/LogViewer'
import {
Popover,
@@ -210,12 +211,24 @@ function LocalAPIServerContent() {
setServerStatus('pending')
window.core?.api
?.stopServer()
- .then(() => {
+ .then(async () => {
setServerStatus('stopped')
+ // Clean up Claude Code env vars from shell config when server stops
+ try {
+ await invoke('clear_claude_code_env')
+ } catch (e) {
+ console.warn('Failed to clear Claude Code env vars:', e)
+ }
})
- .catch((error: unknown) => {
+ .catch(async (error: unknown) => {
console.error('Error stopping server:', error)
setServerStatus('stopped')
+ // Still try to clean up env vars even if stop had an error
+ try {
+ await invoke('clear_claude_code_env')
+ } catch (e) {
+ console.warn('Failed to clear Claude Code env vars:', e)
+ }
})
}
}