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 'origin/main' into release/v0.7.8

Vanalite318d49a711f8
diff --cc src-tauri/src/lib.rs
index 94be650bc,3ee491903..8961f39f2
--- a/src-tauri/src/lib.rs
+++ b/src-tauri/src/lib.rs
@@@ -457,48 -456,13 +457,55 @@@ pub fn run()
}
}
+ // OpenClaw gateway cleanup
+ {
+ use crate::core::openclaw::sandbox::Sandbox;
+ use crate::core::openclaw::OpenClawState;
+ let openclaw_state = app_handle.state::<OpenClawState>();
+ let openclaw_future = async {
+ let sandbox_guard = openclaw_state.sandbox.lock().await;
+ match sandbox_guard.as_ref() {
+ Some(sandbox) => {
+ crate::core::openclaw::lifecycle::stop_openclaw(
+ sandbox.as_ref(),
+ &openclaw_state,
+ )
+ .await
+ }
+ None => {
+ let direct =
+ crate::core::openclaw::sandbox_direct::DirectProcessSandbox;
+ let mut handle =
+ crate::core::openclaw::sandbox::SandboxHandle::Named(
+ "exit-cleanup".to_string(),
+ );
+ direct.stop(&mut handle).await
+ }
+ }
+ };
+ match tokio::time::timeout(
+ tokio::time::Duration::from_secs(10),
+ openclaw_future,
+ )
+ .await
+ {
+ Ok(Ok(_)) => {
+ log::info!("OpenClaw cleanup completed successfully")
+ }
+ Ok(Err(e)) => log::warn!("OpenClaw cleanup failed: {}", e),
+ Err(_) => {
+ log::warn!("OpenClaw cleanup timed out after 10 seconds")
+ }
+ }
+ }
+
+ // 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 --cc web-app/src/routes/settings/local-api-server.tsx
index 3fcd7d962,aa0dd4097..08481d69e
--- a/web-app/src/routes/settings/local-api-server.tsx
+++ b/web-app/src/routes/settings/local-api-server.tsx
@@@ -20,8 -20,10 +20,9 @@@ import { cn } from '@/lib/utils
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 { EngineManager } from '@janhq/core'
+import { ensureModelForServer } from '@/utils/ensureModelForServer'
import {
Popover,