diff --git a/studio/frontend/src/components/web/update-banner.tsx b/studio/frontend/src/components/web/update-banner.tsx index 9c0cf882d6..0e3b0c541a 100644 --- a/studio/frontend/src/components/web/update-banner.tsx +++ b/studio/frontend/src/components/web/update-banner.tsx @@ -10,7 +10,9 @@ import { type ReactElement, useEffect, useRef, useState } from "react"; const STUDIO_UPDATE_UNIX_CMD = "curl -fsSL https://unsloth.ai/install.sh | sh"; const STUDIO_UPDATE_WINDOWS_CMD = "irm https://unsloth.ai/install.ps1 | iex"; -const STUDIO_UPDATE_COPY_CMD = `${STUDIO_UPDATE_UNIX_CMD}\n${STUDIO_UPDATE_WINDOWS_CMD}`; +// Match "windows" (every Windows UA carries "Windows NT") rather than "win", +// which also matches "Darwin" and would mis-detect macOS as Windows. +const WINDOWS_UA_RE = /windows/i; const RELEASE_NOTES_URL = "https://unsloth.ai/docs/new/changelog"; const EASE_OUT_QUART: [number, number, number, number] = [0.165, 0.84, 0.44, 1]; @@ -38,7 +40,15 @@ export function WebUpdateBanner({ } async function handleCopyCommand() { - if (!(await copyToClipboard(STUDIO_UPDATE_COPY_CMD))) { + // Copy only the command for the user's OS: pasting both (Unix + PowerShell) + // into a single terminal runs the wrong one and errors out. + const isWindows = + typeof navigator !== "undefined" && + WINDOWS_UA_RE.test(navigator.userAgent || ""); + const command = isWindows + ? STUDIO_UPDATE_WINDOWS_CMD + : STUDIO_UPDATE_UNIX_CMD; + if (!(await copyToClipboard(command))) { return; } setCopiedVersion(status?.latestVersion ?? null); diff --git a/studio/frontend/src/features/settings/components/update-studio-instructions.tsx b/studio/frontend/src/features/settings/components/update-studio-instructions.tsx index 94f4ae6408..7bbdd524c3 100644 --- a/studio/frontend/src/features/settings/components/update-studio-instructions.tsx +++ b/studio/frontend/src/features/settings/components/update-studio-instructions.tsx @@ -230,23 +230,6 @@ export function UpdateStudioInstructions({ animate={fadeAnimate} exit={fadeExit} transition={fadeTransition} - > - - - -

- {t("settings.about.update.localInstallerFallback")} -

- - diff --git a/studio/frontend/src/i18n/locales/en.ts b/studio/frontend/src/i18n/locales/en.ts index 0290d75790..97412e967d 100644 --- a/studio/frontend/src/i18n/locales/en.ts +++ b/studio/frontend/src/i18n/locales/en.ts @@ -307,8 +307,6 @@ export const en = { "Pull latest changes from your Unsloth repo checkout, then update Studio locally:", gitPullCommand: "git pull command", localUpdateCommand: "local update command", - localInstallerFallback: - "If the Studio update command is unavailable, run the local installer from that checkout:", localInstallerCommand: "local installer command", sourceInstallDetected: "This looks like a source or VCS package install. Reinstall from the original local path or Git URL you used.", diff --git a/studio/frontend/src/i18n/locales/zh-CN.ts b/studio/frontend/src/i18n/locales/zh-CN.ts index 6e0762f283..bc0e24028b 100644 --- a/studio/frontend/src/i18n/locales/zh-CN.ts +++ b/studio/frontend/src/i18n/locales/zh-CN.ts @@ -288,8 +288,6 @@ export const zhCN = { "从你的 Unsloth 仓库 checkout 拉取最新变更,然后本地更新 Studio:", gitPullCommand: "git pull 命令", localUpdateCommand: "本地更新命令", - localInstallerFallback: - "如果 Studio 更新命令不可用,请从该 checkout 运行本地安装器:", localInstallerCommand: "本地安装器命令", sourceInstallDetected: "这看起来是源码或 VCS 包安装。请从最初使用的本地路径或 Git URL 重新安装。",