Spaces:
Running
Running
File size: 1,183 Bytes
2e0eaa2 f586f77 2e0eaa2 f586f77 2e0eaa2 f586f77 2e0eaa2 f586f77 2e0eaa2 f586f77 2e0eaa2 f586f77 2e0eaa2 f586f77 cf8ab7a f586f77 cf8ab7a 6c17bbb 2e0eaa2 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 | import {
Dropdown,
InputSection,
ParamControls,
} from "@elvis/ui";
import { MODELS } from "./models";
import type { ModelSettings } from "./types";
interface SidebarProps {
modelSettings: ModelSettings;
setModelSettings: (settings: ModelSettings) => void;
}
export default function Sidebar({
modelSettings,
setModelSettings,
}: SidebarProps) {
const active = MODELS.find((model) => model.id === modelSettings.type) ?? MODELS[0];
return (
<InputSection label="Model">
<Dropdown
label="Type"
options={MODELS.map((model) => model.label)}
activeOption={active.label}
onChange={(label: string) => {
const model = MODELS.find((m) => m.label === label) ?? MODELS[0];
setModelSettings({ type: model.id, params: {} });
}}
/>
<ParamControls
model={active}
values={modelSettings.params}
onChange={(params) => setModelSettings({ ...modelSettings, params })}
showQuickSettings={false}
/>
</InputSection>
)
}
|