fix: 🐛 allow end/home keys to work

This commit is contained in:
Nate Sesti 2023-08-28 23:33:23 -07:00
parent 7e16426d5b
commit 615d30e3dc
2 changed files with 15 additions and 3 deletions

View file

@ -550,6 +550,12 @@ const ComboBox = React.forwardRef((props: ComboBoxProps, ref) => {
postVscMessage("focusEditor", {});
}
}
// Home and end keys
else if (event.key === "Home") {
(event.nativeEvent as any).preventDownshiftDefault = true;
} else if (event.key === "End") {
(event.nativeEvent as any).preventDownshiftDefault = true;
}
},
onClick: () => {
dispatch(setBottomMessage(undefined));

View file

@ -92,8 +92,7 @@ const Select = styled.select`
function ModelSelect(props: {}) {
const client = useContext(GUIClientContext);
const defaultModel = useSelector(
(state: RootStore) =>
(state.serverState.config as any)?.models?.default?.class_name
(state: RootStore) => (state.serverState.config as any)?.models?.default
);
return (
@ -106,7 +105,14 @@ function ModelSelect(props: {}) {
>
{MODEL_INFO.map((model, idx) => {
return (
<option selected={defaultModel === model.class} value={idx}>
<option
selected={
defaultModel?.class_name === model.class &&
(!defaultModel?.model?.startsWith("gpt") ||
defaultModel?.model === model.args.model)
}
value={idx}
>
{model.title}
</option>
);