Merge branch 'nightly' into feature/canvas-lab

This commit is contained in:
Shine1i 2026-02-23 21:54:35 +01:00
commit 8739a01f56
76 changed files with 629 additions and 382 deletions

View file

@ -26,25 +26,22 @@ import {
type FC,
type PropsWithChildren,
useEffect,
useMemo,
useState,
} from "react";
import { useShallow } from "zustand/shallow";
const useFileSrc = (file: File | undefined): string | undefined => {
const objectUrl = useMemo(
() => (file ? URL.createObjectURL(file) : undefined),
[file],
);
const [objectUrl, setObjectUrl] = useState<string | undefined>(undefined);
useEffect(() => {
if (!objectUrl) {
return undefined;
if (!file) {
setObjectUrl(undefined);
return;
}
return () => {
URL.revokeObjectURL(objectUrl);
};
}, [objectUrl]);
const url = URL.createObjectURL(file);
setObjectUrl(url);
return () => URL.revokeObjectURL(url);
}, [file]);
return objectUrl;
};

View file

@ -151,12 +151,9 @@ export function HubModelPicker({
const metricsById = useMemo(
() =>
new Map(
results.map((result) => [
result.id,
result.totalParams
? formatCompact(result.totalParams)
: `${formatCompact(result.downloads)}`,
]),
results
.filter((result) => result.totalParams)
.map((result) => [result.id, formatCompact(result.totalParams!)]),
),
[results],
);
@ -167,11 +164,7 @@ export function HubModelPicker({
{ est: number; status: VramFitStatus | null; detail: string | null }
>();
for (const r of results) {
const detail = r.totalParams
? formatCompact(r.totalParams)
: r.downloads != null
? `${formatCompact(r.downloads)}`
: null;
const detail = r.totalParams ? formatCompact(r.totalParams) : null;
if (r.totalParams) {
const est = estimateLoadingVram(r.totalParams, "qlora");
const status = gpu.available