-
Notifications
You must be signed in to change notification settings - Fork 135
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fixed OpenRouter chat provider support
- Loading branch information
Showing
5 changed files
with
150 additions
and
6 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
import { BasicPage, FormRow, NotUsingAlert } from './common'; | ||
import { TextInput } from '@/components/textInput'; | ||
import { SecretTextInput } from '@/components/secretTextInput'; | ||
import { config, updateConfig } from "@/utils/config"; | ||
|
||
|
||
export function OpenRouterSettings({ | ||
openRouterApiKey, | ||
setOpenRouterApiKey, | ||
openRouterUrl, | ||
setOpenRouterUrl, | ||
openRouterModel, | ||
setOpenRouterModel, | ||
setSettingsUpdated, | ||
}: { | ||
openRouterApiKey: string; | ||
setOpenRouterApiKey: (key: string) => void; | ||
openRouterUrl: string; | ||
setOpenRouterUrl: (url: string) => void; | ||
openRouterModel: string; | ||
setOpenRouterModel: (model: string) => void; | ||
setSettingsUpdated: (updated: boolean) => void; | ||
}) { | ||
const description = <>Configure OpenRouter settings. You can get an API key from <a href="https://openrouter.ai">https://openrouter.ai</a></>; | ||
|
||
return ( | ||
<BasicPage | ||
title="OpenRouter Settings" | ||
description={description} | ||
> | ||
{ config("chatbot_backend") !== "openrouter" && ( | ||
<NotUsingAlert> | ||
You are not currently using OpenRouter as your ChatBot backend. These settings will not be used. | ||
</NotUsingAlert> | ||
) } | ||
<ul role="list" className="divide-y divide-gray-100 max-w-xs"> | ||
<li className="py-4"> | ||
<FormRow label="OpenRouter API Key"> | ||
<SecretTextInput | ||
value={openRouterApiKey} | ||
onChange={(event: React.ChangeEvent<any>) => { | ||
setOpenRouterApiKey(event.target.value); | ||
updateConfig("openrouter_apikey", event.target.value); | ||
setSettingsUpdated(true); | ||
}} | ||
/> | ||
</FormRow> | ||
</li> | ||
<li className="py-4"> | ||
<FormRow label="OpenAI URL"> | ||
<TextInput | ||
value={openRouterUrl} | ||
onChange={(event: React.ChangeEvent<any>) => { | ||
setOpenRouterUrl(event.target.value); | ||
updateConfig("openrouter_url", event.target.value); | ||
setSettingsUpdated(true); | ||
}} | ||
/> | ||
</FormRow> | ||
</li> | ||
<li className="py-4"> | ||
<FormRow label="OpenAI Model"> | ||
<TextInput | ||
value={openRouterModel} | ||
onChange={(event: React.ChangeEvent<any>) => { | ||
setOpenRouterModel(event.target.value); | ||
updateConfig("openrouter_model", event.target.value); | ||
setSettingsUpdated(true); | ||
}} | ||
/> | ||
</FormRow> | ||
</li> | ||
</ul> | ||
</BasicPage> | ||
); | ||
} |
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