The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(desktop): browsed downloads get a real button and live progress
emozilla7ad1670506ae
diff --git a/apps/desktop/src/app/settings/local-models-settings.test.tsx b/apps/desktop/src/app/settings/local-models-settings.test.tsxindex 792c24a1659..bdc23a75124 100644--- a/apps/desktop/src/app/settings/local-models-settings.test.tsx+++ b/apps/desktop/src/app/settings/local-models-settings.test.tsx@@ -318,10 +318,19 @@ describe('BrowseSection', () => {await vi.runOnlyPendingTimersAsync()})expect(screen.getByText('Q4_K_M')).toBeTruthy()- // The too-big quant's download button is disabled; fits-gpu is live.- const buttons = screen.getAllByRole('button', { name: /GB/ })- expect(buttons.some(b => (b as HTMLButtonElement).disabled)).toBe(true)- expect(buttons.some(b => !(b as HTMLButtonElement).disabled)).toBe(true)+ // Each tile has an explicit download button; the too-big quant's is+ // disabled, the fitting one is live and starts the download.+ const q4Btn = screen.getByRole('button', { name: 'Download Q4_K_M' })+ const f16Btn = screen.getByRole('button', { name: 'Download F16' })+ expect((f16Btn as HTMLButtonElement).disabled).toBe(true)+ expect((q4Btn as HTMLButtonElement).disabled).toBe(false)++ vi.mocked(hermes.downloadBrowsedModel).mockResolvedValue({ job_id: 'j1', model_id: 'Qwen3.8-27B-Q4_K_M' })+ fireEvent.click(q4Btn)+ await act(async () => {+ await vi.runOnlyPendingTimersAsync()+ })+ expect(hermes.downloadBrowsedModel).toHaveBeenCalledWith('unsloth/Qwen3.8-27B-GGUF', ['Qwen3.8-27B-Q4_K_M.gguf'])} finally {vi.useRealTimers()}diff --git a/apps/desktop/src/app/settings/local-models-settings.tsx b/apps/desktop/src/app/settings/local-models-settings.tsxindex e9e76f89264..b7aed251118 100644--- a/apps/desktop/src/app/settings/local-models-settings.tsx+++ b/apps/desktop/src/app/settings/local-models-settings.tsx@@ -600,9 +600,18 @@ function fitTone(fit: HFFileGroup['fit']): 'destructive' | 'muted' | 'success' |return 'muted'}+function browsedModelId(group: HFFileGroup): string {+ // Mirrors the backend's derivation: first file's name, split-part+ // suffix stripped — the id the download job carries.+ const first = group.paths[0].split('/').pop() ?? group.paths[0]++ return first.replace(/-\d{5}-of-\d{5}\.gguf$/i, '').replace(/\.gguf$/i, '')+}+function BrowseSection({ onChanged }: { onChanged: () => void }) {const { t } = useI18n()const copy = t.settings.localModels+ const jobs = useStore($localRuntimeJobs)const [query, setQuery] = useState('')const [hits, setHits] = useState<HFSearchHit[]>([])const [searching, setSearching] = useState(false)@@ -666,13 +675,24 @@ function BrowseSection({ onChanged }: { onChanged: () => void }) {.then(r => {if (r.already_downloaded) {notify({ durationMs: 3_000, kind: 'info', message: copy.browseAlreadyDownloaded, title: copy.browseTitle })++ return}+ // Same feedback loop as catalog downloads: the job store polls+ // and the tile renders live progress from it.+ watchLocalRuntimeJobs()+ notify({+ durationMs: 3_000,+ kind: 'info',+ message: copy.browseDownloadStarted.replace('{name}', r.model_id),+ title: copy.browseTitle+ })onChanged()}).catch((e: Error) => notifyError(e, copy.browseTitle))},- [copy.browseAlreadyDownloaded, copy.browseTitle, onChanged]+ [copy.browseAlreadyDownloaded, copy.browseDownloadStarted, copy.browseTitle, onChanged])const sideload = useCallback(() => {@@ -761,43 +781,62 @@ function BrowseSection({ onChanged }: { onChanged: () => void }) {<p className="col-span-full py-1 text-[0.75rem] text-muted-foreground">{copy.browseNoGguf}</p>)}- {files.map(group => (- <button- className={cn(- 'flex flex-col items-start gap-1 rounded-md border border-(--ui-border) px-2.5 py-1.5 text-left transition-colors',- group.fit === 'too-big'- ? 'cursor-not-allowed opacity-45'- : 'hover:border-primary hover:bg-(--ui-bg-secondary)'- )}- disabled={group.fit === 'too-big'}- key={group.label}- onClick={() => startBrowsedDownload(hit.repo, group)}- type="button"- >- <span className="flex w-full items-baseline justify-between gap-2">- <span className="truncate font-mono text-[0.75rem]">- {group.label}- {group.paths.length > 1 ? ` ×${group.paths.length}` : ''}- </span>+ {files.map(group => {+ const dJob = runningDownloadFor(jobs, browsedModelId(group))++ return (+ <div+ className={cn(+ 'flex flex-col gap-1 rounded-md border border-(--ui-border) px-2.5 py-1.5',+ group.fit === 'too-big' && 'opacity-45'+ )}+ key={group.label}+ >+ <span className="flex w-full items-center justify-between gap-2">+ <span className="truncate font-mono text-[0.75rem]">+ {group.label}+ {group.paths.length > 1 ? ` ×${group.paths.length}` : ''}+ </span>- <span className="flex shrink-0 items-center gap-1 text-[0.7rem] text-muted-foreground">- <Download className="size-3" />- {gbLabel(group.total_bytes)}+ <Button+ aria-label={copy.browseDownloadAria.replace('{name}', group.label)}+ className="h-6 shrink-0 px-2"+ disabled={group.fit === 'too-big' || Boolean(dJob)}+ onClick={() => startBrowsedDownload(hit.repo, group)}+ size="sm"+ variant="ghost"+ >+ {dJob ? <Loader2 className="size-3.5 animate-spin" /> : <Download className="size-3.5" />}+ </Button></span>- </span>- <Pill tone={fitTone(group.fit)}>- <Cpu className="mr-1 size-3" />- {group.fit === 'fits-gpu'- ? copy.pillFitsGpu- : group.fit === 'needs-ram'- ? copy.pillUsesRam- : group.fit === 'too-big'- ? copy.pillTooBig- : copy.browseFitUnknown}- </Pill>- </button>- ))}+ {dJob ? (+ <>+ <ProgressBar percent={dJob.percent} />++ <span className="text-[0.68rem] text-muted-foreground">+ {copy.downloadProgress(gbLabel(dJob.done_bytes), gbLabel(dJob.total_bytes))}+ </span>+ </>+ ) : (+ <span className="flex items-center justify-between gap-2">+ <Pill tone={fitTone(group.fit)}>+ <Cpu className="mr-1 size-3" />+ {group.fit === 'fits-gpu'+ ? copy.pillFitsGpu+ : group.fit === 'needs-ram'+ ? copy.pillUsesRam+ : group.fit === 'too-big'+ ? copy.pillTooBig+ : copy.browseFitUnknown}+ </Pill>++ <span className="shrink-0 text-[0.7rem] text-muted-foreground">{gbLabel(group.total_bytes)}</span>+ </span>+ )}+ </div>+ )+ })}</div>)}</div>diff --git a/apps/desktop/src/i18n/en.ts b/apps/desktop/src/i18n/en.tsindex 169c28c220e..01fac6f816c 100644--- a/apps/desktop/src/i18n/en.ts+++ b/apps/desktop/src/i18n/en.ts@@ -1116,6 +1116,8 @@ export const en: Translations = {browseNoGguf: 'No model files this app can run were found in this listing.',browseFitUnknown: 'Fit unknown',browseAlreadyDownloaded: 'That model is already downloaded.',+ browseDownloadStarted: 'Downloading {name} — progress shows on its tile.',+ browseDownloadAria: 'Download {name}',sideloadButton: 'Add model file',sideloadTitle: 'Choose a GGUF model file',sideloadDone: '{name} added — it will appear in your models list.',diff --git a/apps/desktop/src/i18n/ja.ts b/apps/desktop/src/i18n/ja.tsindex 9c17f7e1d65..a8851eec2dd 100644--- a/apps/desktop/src/i18n/ja.ts+++ b/apps/desktop/src/i18n/ja.ts@@ -1038,6 +1038,8 @@ export const ja = defineLocale({browseNoGguf: 'このリポジトリには本アプリで実行できるモデルファイルがありません。',browseFitUnknown: '適合状況は不明',browseAlreadyDownloaded: 'そのモデルはダウンロード済みです。',+ browseDownloadStarted: '{name} をダウンロード中 — 進捗はタイルに表示されます。',+ browseDownloadAria: '{name} をダウンロード',sideloadButton: 'モデルファイルを追加',sideloadTitle: 'GGUF モデルファイルを選択',sideloadDone: '{name} を追加しました — モデル一覧に表示されます。',diff --git a/apps/desktop/src/i18n/types.ts b/apps/desktop/src/i18n/types.tsindex 026ea05f12d..f922a63afe0 100644--- a/apps/desktop/src/i18n/types.ts+++ b/apps/desktop/src/i18n/types.ts@@ -971,6 +971,8 @@ export interface Translations {browseNoGguf: stringbrowseFitUnknown: stringbrowseAlreadyDownloaded: string+ browseDownloadStarted: string+ browseDownloadAria: stringsideloadButton: stringsideloadTitle: stringsideloadDone: stringdiff --git a/apps/desktop/src/i18n/zh-hant.ts b/apps/desktop/src/i18n/zh-hant.tsindex 25dd771bfbd..0302b60a86e 100644--- a/apps/desktop/src/i18n/zh-hant.ts+++ b/apps/desktop/src/i18n/zh-hant.ts@@ -1006,6 +1006,8 @@ export const zhHant = defineLocale({browseNoGguf: '此儲存庫中沒有本應用可執行的模型檔案。',browseFitUnknown: '適配情況未知',browseAlreadyDownloaded: '該模型已下載。',+ browseDownloadStarted: '正在下載 {name}——進度顯示在其卡片上。',+ browseDownloadAria: '下載 {name}',sideloadButton: '新增模型檔案',sideloadTitle: '選擇 GGUF 模型檔案',sideloadDone: '{name} 已新增——它將出現在你的模型清單中。',diff --git a/apps/desktop/src/i18n/zh.ts b/apps/desktop/src/i18n/zh.tsindex 597ba53f324..691246ab71a 100644--- a/apps/desktop/src/i18n/zh.ts+++ b/apps/desktop/src/i18n/zh.ts@@ -1311,6 +1311,8 @@ export const zh: Translations = {browseNoGguf: '此仓库中没有本应用可运行的模型文件。',browseFitUnknown: '适配情况未知',browseAlreadyDownloaded: '该模型已下载。',+ browseDownloadStarted: '正在下载 {name}——进度显示在其卡片上。',+ browseDownloadAria: '下载 {name}',sideloadButton: '添加模型文件',sideloadTitle: '选择 GGUF 模型文件',sideloadDone: '{name} 已添加——它将出现在你的模型列表中。',