feat: display error on selection of invalid model (#594)

Up-to-date of #78 

Fixes #32

addressed requested changes @tibo-openai :) made sense to me


though, previous rationale with passing the state up was assuming there
could be a future need to have a shared state with all available models
being available to the parent
This commit is contained in:
sooraj
2025-04-25 05:26:00 +05:30
committed by GitHub
parent bb2d411043
commit 36a5a02d5c
3 changed files with 153 additions and 3 deletions

View File

@@ -19,7 +19,7 @@ type Props = {
currentProvider?: string;
hasLastResponse: boolean;
providers?: Record<string, { name: string; baseURL: string; envKey: string }>;
onSelect: (model: string) => void;
onSelect: (allModels: Array<string>, model: string) => void;
onSelectProvider?: (provider: string) => void;
onExit: () => void;
};
@@ -153,7 +153,12 @@ export default function ModelOverlay({
}
initialItems={items}
currentValue={currentModel}
onSelect={onSelect}
onSelect={() =>
onSelect(
items?.map((m) => m.value),
currentModel,
)
}
onExit={onExit}
/>
);