-
-
Notifications
You must be signed in to change notification settings - Fork 174
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
restore support for model select dropdown from ollama api in provider
- Loading branch information
1 parent
0392530
commit 375531e
Showing
6 changed files
with
158 additions
and
73 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import { VSCodeDropdown } from '@vscode/webview-ui-toolkit/react' | ||
|
||
import { getModelShortName } from './utils' | ||
import { ApiModel } from '../common/types' | ||
|
||
interface Props { | ||
model: string | undefined | ||
setModel: (model: string) => void | ||
models: ApiModel[] | undefined | ||
} | ||
|
||
export const ModelSelect = ({ model, models, setModel }: Props) => { | ||
const handleOnChange = (e: unknown): void => { | ||
const event = e as React.ChangeEvent<HTMLSelectElement> | ||
const selectedValue = event?.target.value || '' | ||
setModel(selectedValue) | ||
} | ||
|
||
return ( | ||
<div> | ||
<div> | ||
<label htmlFor="modelName">Model name*</label> | ||
</div> | ||
<VSCodeDropdown onChange={handleOnChange} value={model}> | ||
{models?.map((model, index) => { | ||
return ( | ||
<option value={model.name} key={`${index}`}> | ||
{getModelShortName(model.name)} | ||
</option> | ||
) | ||
})} | ||
</VSCodeDropdown> | ||
</div> | ||
) | ||
} |
Oops, something went wrong.