mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-17 17:00:15 +01:00
* style: all landing page components * chore: converted all slate to gray, since slate doesnt work * style: assistant panel * style: basic UI components, userprovided, preset * style: update in multiple components * fix(PluginStoreDialog): justify-center * fixed some minor Ui styles * style(MultiSearch): update dark bg * style: update Convo styling * style: lower textarea max height slightly --------- Co-authored-by: Danny Avila <messagedaniel@protonmail.com>
107 lines
2.9 KiB
TypeScript
107 lines
2.9 KiB
TypeScript
import { EModelEndpoint } from 'librechat-data-provider';
|
|
import { useFormContext, Controller } from 'react-hook-form';
|
|
import InputWithLabel from './InputWithLabel';
|
|
|
|
const OpenAIConfig = ({
|
|
endpoint,
|
|
userProvideURL,
|
|
}: {
|
|
endpoint: EModelEndpoint | string;
|
|
userProvideURL?: boolean | null;
|
|
}) => {
|
|
const { control } = useFormContext();
|
|
const isAzure = endpoint === EModelEndpoint.azureOpenAI;
|
|
return (
|
|
<form className="flex-wrap">
|
|
{!isAzure && (
|
|
<Controller
|
|
name="apiKey"
|
|
control={control}
|
|
render={({ field }) => (
|
|
<InputWithLabel
|
|
id="apiKey"
|
|
{...field}
|
|
label={`${isAzure ? 'Azure q' : ''}OpenAI API Key`}
|
|
labelClassName="mb-1"
|
|
inputClassName="mb-2"
|
|
/>
|
|
)}
|
|
/>
|
|
)}
|
|
{isAzure && (
|
|
<>
|
|
<Controller
|
|
name="azureOpenAIApiKey"
|
|
control={control}
|
|
render={({ field }) => (
|
|
<InputWithLabel
|
|
id="azureOpenAIApiKey"
|
|
{...field}
|
|
label={'Azure OpenAI API Key'}
|
|
labelClassName="mb-1"
|
|
/>
|
|
)}
|
|
/>
|
|
<div className="mt-3"></div>
|
|
<Controller
|
|
name="azureOpenAIApiInstanceName"
|
|
control={control}
|
|
render={({ field }) => (
|
|
<InputWithLabel
|
|
id="azureOpenAIApiInstanceName"
|
|
{...field}
|
|
label={'Azure OpenAI Instance Name'}
|
|
labelClassName="mb-1"
|
|
/>
|
|
)}
|
|
/>
|
|
<div className="mt-3"></div>
|
|
<Controller
|
|
name="azureOpenAIApiDeploymentName"
|
|
control={control}
|
|
render={({ field }) => (
|
|
<InputWithLabel
|
|
id="azureOpenAIApiDeploymentName"
|
|
{...field}
|
|
label={'Azure OpenAI Deployment Name'}
|
|
labelClassName="mb-1"
|
|
/>
|
|
)}
|
|
/>
|
|
<div className="mt-3"></div>
|
|
<Controller
|
|
name="azureOpenAIApiVersion"
|
|
control={control}
|
|
render={({ field }) => (
|
|
<InputWithLabel
|
|
id="azureOpenAIApiVersion"
|
|
{...field}
|
|
label={'Azure OpenAI API Version'}
|
|
labelClassName="mb-1"
|
|
/>
|
|
)}
|
|
/>
|
|
</>
|
|
)}
|
|
{userProvideURL && (
|
|
<div className="mt-3">
|
|
<Controller
|
|
name="baseURL"
|
|
control={control}
|
|
render={({ field }) => (
|
|
<InputWithLabel
|
|
id="baseURL"
|
|
{...field}
|
|
label={'API Base URL'}
|
|
subLabel={'(Optional)'}
|
|
labelClassName="mb-1"
|
|
/>
|
|
)}
|
|
/>
|
|
</div>
|
|
)}
|
|
</form>
|
|
);
|
|
};
|
|
|
|
export default OpenAIConfig;
|