Skip to content

Commit dfd2adf

Browse files
committed
fix: loaded model double display, single image review fix
1 parent e11bb15 commit dfd2adf

3 files changed

Lines changed: 47 additions & 64 deletions

File tree

web/src/components/organisms/CaptionDetailPanel.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ export function CaptionDetailPanel() {
5050
const removeTag = useRemoveTag();
5151
const integrity = useIntegrityReview();
5252
const runReview = useRunReview();
53+
const profiles = useProfiles();
5354
const setCaptionTab = useUiStore((state) => state.setCaptionTab);
5455
const setPendingReviewJob = useUiStore((state) => state.setPendingReviewJob);
5556
const openCaptionEditor = useUiStore((state) => state.openCaptionEditor);
@@ -177,8 +178,7 @@ export function CaptionDetailPanel() {
177178
dataset_id: datasetId,
178179
caption_type: captionType,
179180
media_ids: [Number(data.key)],
180-
// null = judge with whatever model is already loaded.
181-
judge_profile_id: null,
181+
judge_profile_id: profiles.data?.judge_id ?? null,
182182
scope: "single",
183183
},
184184
{ onSuccess: (res) => setPendingReviewJob(res.job_id) },

web/src/components/organisms/CaptionLeftPanel.tsx

Lines changed: 0 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -402,54 +402,6 @@ export function CaptionLeftPanel() {
402402
)}
403403
</Section>
404404
</div>
405-
406-
<div
407-
style={{
408-
flex: "none",
409-
display: "flex",
410-
alignItems: "center",
411-
gap: 8,
412-
padding: "10px 14px",
413-
borderTop: `1px solid ${colors.border}`,
414-
background: colors.panel,
415-
}}
416-
title={loaded ? (loadedProfile?.file ?? status.data?.name ?? "") : ""}
417-
>
418-
<span style={{ color: loaded ? colors.ok : colors.textFaint }}>
419-
{loaded ? "●" : "○"}
420-
</span>
421-
<div style={{ flex: 1, minWidth: 0 }}>
422-
<div
423-
style={{
424-
fontSize: 12,
425-
fontWeight: 600,
426-
overflow: "hidden",
427-
textOverflow: "ellipsis",
428-
whiteSpace: "nowrap",
429-
color: loaded ? colors.text : colors.textMuted,
430-
}}
431-
>
432-
{loaded
433-
? (loadedProfile?.name ?? status.data?.name ?? "Model loaded")
434-
: "No model loaded"}
435-
</div>
436-
<div
437-
style={{
438-
fontFamily: font.mono,
439-
fontSize: 9.5,
440-
color: colors.textFaint,
441-
overflow: "hidden",
442-
textOverflow: "ellipsis",
443-
whiteSpace: "nowrap",
444-
}}
445-
>
446-
{loaded
447-
? `${loadedProfile?.file ?? ""} · loaded`
448-
: "unloaded — memory purged"}
449-
</div>
450-
</div>
451-
{modelBusy && <Spinner size={11} />}
452-
</div>
453405
</div>
454406
);
455407
}

web/src/components/organisms/Sidebar.tsx

Lines changed: 45 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,12 @@ import {
1010
Settings as SettingsIcon,
1111
} from "lucide-react";
1212
import type { ReactNode } from "react";
13-
import { useDatasets, useModelStatus, useNavCounts } from "../../api/hooks";
13+
import {
14+
useDatasets,
15+
useModelStatus,
16+
useNavCounts,
17+
useProfiles,
18+
} from "../../api/hooks";
1419
import type { ViewId } from "../../api/types";
1520
import { colors, font } from "../../design/tokens";
1621
import { useUiStore } from "../../store/uiStore";
@@ -49,8 +54,16 @@ export function Sidebar() {
4954
const datasets = useDatasets();
5055
const totals = useNavCounts();
5156
const status = useModelStatus();
57+
const profiles = useProfiles();
5258
const running = useRunningCount();
5359

60+
// The loaded model shown as its profile (name + weights file); a model
61+
// loaded outside profiles falls back to the loader's filename.
62+
const loaded = status.data?.loaded ?? false;
63+
const loadedProfile = profiles.data?.profiles.find(
64+
(p) => p.id === profiles.data.loaded_id,
65+
);
66+
5467
// The Caption badge counts the dataset that tab is actually working on,
5568
// not the library: it is the size of the grid the user is about to see.
5669
const active = datasets.data?.datasets.find((row) => row.id === datasetId);
@@ -135,22 +148,40 @@ export function Sidebar() {
135148
display: "flex",
136149
alignItems: "center",
137150
gap: 8,
138-
fontSize: 11.5,
139-
color: colors.textSecondary,
140151
marginBottom: 10,
141152
}}
153+
title={loaded ? (loadedProfile?.file ?? status.data?.name ?? "") : ""}
142154
>
143-
<Dot color={status.data?.loaded ? colors.ok : colors.textFaint} />
144-
<span
145-
style={{
146-
flex: 1,
147-
overflow: "hidden",
148-
textOverflow: "ellipsis",
149-
whiteSpace: "nowrap",
150-
}}
151-
>
152-
{status.data?.loaded ? status.data.name : "No model loaded"}
153-
</span>
155+
<Dot color={loaded ? colors.ok : colors.textFaint} />
156+
<div style={{ flex: 1, minWidth: 0 }}>
157+
<div
158+
style={{
159+
fontSize: 11.5,
160+
color: colors.textSecondary,
161+
overflow: "hidden",
162+
textOverflow: "ellipsis",
163+
whiteSpace: "nowrap",
164+
}}
165+
>
166+
{loaded
167+
? (loadedProfile?.name ?? status.data?.name ?? "Model loaded")
168+
: "No model loaded"}
169+
</div>
170+
<div
171+
style={{
172+
fontFamily: font.mono,
173+
fontSize: 9,
174+
color: colors.textFaint,
175+
overflow: "hidden",
176+
textOverflow: "ellipsis",
177+
whiteSpace: "nowrap",
178+
}}
179+
>
180+
{loaded
181+
? `${loadedProfile?.file ?? status.data?.name ?? ""} · loaded`
182+
: "unloaded — memory purged"}
183+
</div>
184+
</div>
154185
</div>
155186
<button
156187
onClick={() => toggleJobs()}

0 commit comments

Comments
 (0)