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: Hub behavior issues

Vanalite7ef307cebbe1
diff --git a/web-app/src/containers/DownloadButton.tsx b/web-app/src/containers/DownloadButton.tsx
index ab1fecd73..de934ce73 100644
--- a/web-app/src/containers/DownloadButton.tsx
+++ b/web-app/src/containers/DownloadButton.tsx
@@ -96,7 +96,7 @@ export function DownloadButtonPlaceholder({
return (
<div className="flex items-center gap-2">
<a
- href={`https://huggingface.co/${model.model_name}`}
+ href={`https://huggingface.co/${model.developer ? `${model.developer}/` : ''}${model.model_name}`}
target="_blank"
rel="noopener noreferrer"
>
diff --git a/web-app/src/routes/hub/index.tsx b/web-app/src/routes/hub/index.tsx
index 834bb549b..300ebd347 100644
--- a/web-app/src/routes/hub/index.tsx
+++ b/web-app/src/routes/hub/index.tsx
@@ -552,19 +552,20 @@ function HubContent() {
</div>
<div className="shrink-0 space-x-3 flex items-center">
<span className="text-muted-foreground font-medium text-xs">
- {
- (
- filteredModels[
- virtualItem.index
- ].quants?.find((m) =>
- DEFAULT_MODEL_QUANTIZATIONS.some((e) =>
- m.model_id.toLowerCase().includes(e)
- )
- ) ??
- filteredModels[virtualItem.index]
- .quants?.[0]
- )?.file_size
- }
+ {filteredModels[virtualItem.index].is_mlx
+ ? filteredModels[virtualItem.index]
+ .safetensors_files?.[0]?.file_size
+ : (
+ filteredModels[
+ virtualItem.index
+ ].quants?.find((m) =>
+ DEFAULT_MODEL_QUANTIZATIONS.some((e) =>
+ m.model_id.toLowerCase().includes(e)
+ )
+ ) ??
+ filteredModels[virtualItem.index]
+ .quants?.[0]
+ )?.file_size}
</span>
<ModelInfoHoverCard
model={filteredModels[virtualItem.index]}
@@ -636,17 +637,31 @@ function HubContent() {
.downloads || 0}
</span>
</div>
- <div className="flex items-center gap-1">
- <IconFileCode
- size={20}
- className="text-muted-foreground"
- title={t('hub:variants')}
- />
- <span className="text-foreground">
- {filteredModels[virtualItem.index].quants
- ?.length || 0}
- </span>
- </div>
+ {!filteredModels[virtualItem.index].is_mlx && (
+ <div className="flex items-center gap-1">
+ <IconFileCode
+ size={20}
+ className="text-muted-foreground"
+ title={t('hub:variants')}
+ />
+ <span className="text-foreground">
+ {filteredModels[virtualItem.index].quants
+ ?.length || 0}
+ </span>
+ </div>
+ )}
+ {filteredModels[virtualItem.index].is_mlx && (
+ <Tooltip>
+ <TooltipTrigger asChild>
+ <span className="text-xs font-medium px-1.5 py-0.5 rounded bg-secondary text-muted-foreground">
+ MLX
+ </span>
+ </TooltipTrigger>
+ <TooltipContent>
+ <p>Requires MLX engine (Apple Silicon only)</p>
+ </TooltipContent>
+ </Tooltip>
+ )}
<div className="flex gap-1.5 items-center">
{(filteredModels[virtualItem.index].num_mmproj ?? 0) >
0 && (
diff --git a/web-app/src/services/models/default.ts b/web-app/src/services/models/default.ts
index 8ed5ba89a..8d50fdc6d 100644
--- a/web-app/src/services/models/default.ts
+++ b/web-app/src/services/models/default.ts
@@ -281,15 +281,25 @@ export class DefaultModelsService implements ModelsService {
}
// Call the original pullModel with the fetched metadata
- return this.pullModel(
- id,
- modelPath,
- modelSha256,
- modelSize,
- mmprojPath,
- mmprojSha256,
- mmprojSize
- )
+ try {
+ return await this.pullModel(
+ id,
+ modelPath,
+ modelSha256,
+ modelSize,
+ mmprojPath,
+ mmprojSha256,
+ mmprojSize
+ )
+ } catch (error) {
+ // Emit download error event so the UI can clean up the stale downloading state
+ events.emit(DownloadEvent.onFileDownloadError, {
+ modelId: id,
+ downloadType: 'Model',
+ error: error instanceof Error ? error.message : String(error),
+ })
+ throw error
+ }
}
async abortDownload(id: string): Promise<void> {