fix: switch model caused app crash (#1597)

This commit is contained in:
Louis 2024-01-15 15:45:58 +07:00 committed by GitHub
parent aaa02b53fc
commit 81ad936990
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -77,6 +77,8 @@ export default function DropdownListSidebar() {
const { recommendedModel, downloadedModels } = useRecommendedModel()
const selectedName =
downloadedModels.filter((x) => x.id === selected?.id)[0]?.name ?? ''
/**
* Default value for max_tokens and ctx_len
* Its to avoid OOM issue since a model can set a big number for these settings
@ -208,7 +210,7 @@ export default function DropdownListSidebar() {
<Select value={selected?.id} onValueChange={onValueSelected}>
<SelectTrigger className="w-full">
<SelectValue placeholder="Choose model to start">
{downloadedModels.filter((x) => x.id === selected?.id)[0]?.name}
{selectedName}
</SelectValue>
</SelectTrigger>
<SelectContent className="right-2 block w-full min-w-[450px] pr-0">