fix: cold start issue and acp integration tests

This commit is contained in:
mingholy.lmh 2026-01-08 18:03:08 +08:00
parent 85bc0833b4
commit 2b511d0b83
4 changed files with 27 additions and 6 deletions

View file

@ -219,10 +219,12 @@ export function ModelDialog({ onClose }: ModelDialogProps): React.JSX.Element {
{ isActive: true },
);
const initialIndex = useMemo(
() => MODEL_OPTIONS.findIndex((option) => option.value === preferredKey),
[MODEL_OPTIONS, preferredKey],
);
const initialIndex = useMemo(() => {
const index = MODEL_OPTIONS.findIndex(
(option) => option.value === preferredKey,
);
return index === -1 ? 0 : index;
}, [MODEL_OPTIONS, preferredKey]);
const handleSelect = useCallback(
async (selected: string) => {