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: show/hide tool correctly along with browser function

Vanalitef010f8b9899a
diff --git a/src-tauri/src/core/mcp/commands.rs b/src-tauri/src/core/mcp/commands.rs
index 7f0df6218..deaa468ba 100644
--- a/src-tauri/src/core/mcp/commands.rs
+++ b/src-tauri/src/core/mcp/commands.rs
@@ -118,6 +118,17 @@ pub async fn deactivate_mcp_server<R: Runtime>(
}
log::info!("Server {name} stopped successfully and marked as deactivated.");
+
+ // Emit mcp-update event so frontend can refresh tools list
+ if let Err(e) = app.emit(
+ "mcp-update",
+ serde_json::json!({
+ "server": name
+ }),
+ ) {
+ log::error!("Failed to emit mcp-update event: {e}");
+ }
+
Ok(())
}
diff --git a/web-app/src/containers/ChatInput.tsx b/web-app/src/containers/ChatInput.tsx
index 4647419db..9a72ac7e2 100644
--- a/web-app/src/containers/ChatInput.tsx
+++ b/web-app/src/containers/ChatInput.tsx
@@ -256,7 +256,7 @@ const ChatInput = ({
}, [selectedModel, selectedModel?.capabilities, selectedProvider, serviceHub])
// Check if there are active MCP servers
- const hasActiveMCPServers = tools.length > 0
+ const hasActiveMCPServers = tools.filter((tool) => tool.server !== 'Jan Browser MCP').length > 0
// Get MCP extension and its custom component
const extensionManager = ExtensionManager.getInstance()
diff --git a/web-app/src/containers/SetupScreen.tsx b/web-app/src/containers/SetupScreen.tsx
index d184ae2ee..2203371ba 100644
--- a/web-app/src/containers/SetupScreen.tsx
+++ b/web-app/src/containers/SetupScreen.tsx
@@ -100,10 +100,10 @@ function SetupScreen() {
const [supportedVariants, setSupportedVariants] = useState<
Map<string, 'RED' | 'YELLOW' | 'GREEN' | 'GREY'>
>(new Map())
- const [isSupportCheckComplete, setIsSupportCheckComplete] = useState(false)
const [metadataFetchFailed, setMetadataFetchFailed] = useState(false)
const supportCheckInProgress = useRef(false)
const checkedModelId = useRef<string | null>(null)
+ const [isSupportCheckComplete, setIsSupportCheckComplete] = useState(false)
const fetchJanModel = useCallback(async () => {
if (!isQuickStartAvailable) return
@@ -185,8 +185,8 @@ function SetupScreen() {
}
setSupportedVariants(variantSupportMap)
- setIsSupportCheckComplete(true)
supportCheckInProgress.current = false
+ setIsSupportCheckComplete(true)
}
checkModelSupport()
@@ -286,7 +286,7 @@ function SetupScreen() {
const handleQuickStart = useCallback(() => {
// If metadata is still loading, queue the download
- if (!defaultVariant || !janModelV2) {
+ if (!defaultVariant || !janModelV2 || !isSupportCheckComplete) {
setQuickStartQueued(true)
setQuickStartInitiated(true)
return
@@ -310,13 +310,14 @@ function SetupScreen() {
}, [
defaultVariant,
janModelV2,
+ isSupportCheckComplete,
addLocalDownloadingModel,
serviceHub,
])
// Process queued quick start when metadata becomes available
useEffect(() => {
- if (quickStartQueued && defaultVariant && janModelV2) {
+ if (quickStartQueued && defaultVariant && janModelV2 && isSupportCheckComplete) {
setQuickStartQueued(false)
addLocalDownloadingModel(defaultVariant.model_id)
serviceHub
@@ -333,7 +334,7 @@ function SetupScreen() {
true
)
}
- }, [quickStartQueued, defaultVariant, janModelV2, addLocalDownloadingModel, serviceHub])
+ }, [quickStartQueued, defaultVariant, janModelV2, isSupportCheckComplete, addLocalDownloadingModel, serviceHub])
// Handle error when quick start is queued but metadata fetch fails
useEffect(() => {