fix: Add Model Providers:Azure-OpenAI error #1402 (#1512)

### What problem does this PR solve?

fix: Add Model Providers:Azure-OpenAI error #1402
### Type of change

- [x] Bug Fix (non-breaking change which fixes an issue)
This commit is contained in:
balibabu 2024-07-15 15:55:04 +08:00 committed by GitHub
parent c2693d2f46
commit fdc21ec853
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 10 additions and 18 deletions

View File

@ -16,6 +16,8 @@ type FieldType = {
base_url?: string;
};
const modelsWithBaseUrl = ['OpenAI', 'Azure-OpenAI'];
const ApiKeyModal = ({
visible,
hideModal,
@ -33,18 +35,6 @@ const ApiKeyModal = ({
return onOk(ret.api_key, ret.base_url);
};
const handleCancel = () => {
hideModal();
};
const onFinish = (values: any) => {
console.log('Success:', values);
};
const onFinishFailed = (errorInfo: any) => {
console.log('Failed:', errorInfo);
};
useEffect(() => {
if (visible) {
form.setFieldValue('api_key', initialValue);
@ -56,7 +46,7 @@ const ApiKeyModal = ({
title={t('modify')}
open={visible}
onOk={handleOk}
onCancel={handleCancel}
onCancel={hideModal}
okButtonProps={{ loading }}
confirmLoading={loading}
>
@ -65,8 +55,6 @@ const ApiKeyModal = ({
labelCol={{ span: 6 }}
wrapperCol={{ span: 18 }}
style={{ maxWidth: 600 }}
onFinish={onFinish}
onFinishFailed={onFinishFailed}
autoComplete="off"
form={form}
>
@ -78,7 +66,7 @@ const ApiKeyModal = ({
>
<Input />
</Form.Item>
{llmFactory === 'OpenAI' && (
{modelsWithBaseUrl.some((x) => x === llmFactory) && (
<Form.Item<FieldType>
label={t('baseUrl')}
name="base_url"

View File

@ -4,7 +4,11 @@ import { IAddLlmRequestBody } from '@/interfaces/request/llm';
import { Flex, Form, Input, Modal, Select, Space, Switch } from 'antd';
import omit from 'lodash/omit';
type FieldType = IAddLlmRequestBody & { vision: boolean };
type FieldType = IAddLlmRequestBody & {
vision: boolean;
volc_ak: string;
volc_sk: string;
};
const { Option } = Select;
@ -13,7 +17,7 @@ const VolcEngineModal = ({
hideModal,
onOk,
loading,
llmFactory
llmFactory,
}: IModalProps<IAddLlmRequestBody> & { llmFactory: string }) => {
const [form] = Form.useForm<FieldType>();