Skip to content

Commit

Permalink
add provider setting in settings modeal
Browse files Browse the repository at this point in the history
  • Loading branch information
zombierantcasey committed Mar 9, 2024
1 parent a2c212c commit 7fdf560
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/components/SettingsModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ export function SettingsModal({ children }: { children: ReactElement }) {
const [auth, setAuth] = useState(config.defaultAuth);
const [base, setBase] = useState("");
const [version, setVersion] = useState("");
const [provider, setProvider] = useState('openai'); // default value can be 'openai' or 'onerocket.ai'

const settings = useLiveQuery(async () => {
return db.settings.where({ id: "general" }).first();
Expand All @@ -53,13 +54,26 @@ export function SettingsModal({ children }: { children: ReactElement }) {
if (settings?.openAiApiVersion) {
setVersion(settings.openAiApiVersion);
}
if (settings?.provider) {
setProvider(settings.provider);
}
}, [settings]);

return (
<>
{cloneElement(children, { onClick: open })}
<Modal opened={opened} onClose={close} title="Settings" size="lg">
<Stack>
<Select
label="Provider"
value={provider}
onChange={(value) => setProvider(value)}
data={[
{ value: 'openai', label: 'OpenAI' },
{ value: 'onerocket.ai', label: 'Onerocket.ai' },
]}
mb="md"
/>
<form
onSubmit={async (event) => {
try {
Expand Down

0 comments on commit 7fdf560

Please sign in to comment.