balibabu
commited on
Commit
·
aafe599
1
Parent(s):
85f1528
fix: Add Model Providers:Azure-OpenAI error #1402 (#1512)
Browse files### 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)
web/src/pages/user-setting/setting-model/api-key-modal/index.tsx
CHANGED
|
@@ -16,6 +16,8 @@ type FieldType = {
|
|
| 16 |
base_url?: string;
|
| 17 |
};
|
| 18 |
|
|
|
|
|
|
|
| 19 |
const ApiKeyModal = ({
|
| 20 |
visible,
|
| 21 |
hideModal,
|
|
@@ -33,18 +35,6 @@ const ApiKeyModal = ({
|
|
| 33 |
return onOk(ret.api_key, ret.base_url);
|
| 34 |
};
|
| 35 |
|
| 36 |
-
const handleCancel = () => {
|
| 37 |
-
hideModal();
|
| 38 |
-
};
|
| 39 |
-
|
| 40 |
-
const onFinish = (values: any) => {
|
| 41 |
-
console.log('Success:', values);
|
| 42 |
-
};
|
| 43 |
-
|
| 44 |
-
const onFinishFailed = (errorInfo: any) => {
|
| 45 |
-
console.log('Failed:', errorInfo);
|
| 46 |
-
};
|
| 47 |
-
|
| 48 |
useEffect(() => {
|
| 49 |
if (visible) {
|
| 50 |
form.setFieldValue('api_key', initialValue);
|
|
@@ -56,7 +46,7 @@ const ApiKeyModal = ({
|
|
| 56 |
title={t('modify')}
|
| 57 |
open={visible}
|
| 58 |
onOk={handleOk}
|
| 59 |
-
onCancel={
|
| 60 |
okButtonProps={{ loading }}
|
| 61 |
confirmLoading={loading}
|
| 62 |
>
|
|
@@ -65,8 +55,6 @@ const ApiKeyModal = ({
|
|
| 65 |
labelCol={{ span: 6 }}
|
| 66 |
wrapperCol={{ span: 18 }}
|
| 67 |
style={{ maxWidth: 600 }}
|
| 68 |
-
onFinish={onFinish}
|
| 69 |
-
onFinishFailed={onFinishFailed}
|
| 70 |
autoComplete="off"
|
| 71 |
form={form}
|
| 72 |
>
|
|
@@ -78,7 +66,7 @@ const ApiKeyModal = ({
|
|
| 78 |
>
|
| 79 |
<Input />
|
| 80 |
</Form.Item>
|
| 81 |
-
{
|
| 82 |
<Form.Item<FieldType>
|
| 83 |
label={t('baseUrl')}
|
| 84 |
name="base_url"
|
|
|
|
| 16 |
base_url?: string;
|
| 17 |
};
|
| 18 |
|
| 19 |
+
const modelsWithBaseUrl = ['OpenAI', 'Azure-OpenAI'];
|
| 20 |
+
|
| 21 |
const ApiKeyModal = ({
|
| 22 |
visible,
|
| 23 |
hideModal,
|
|
|
|
| 35 |
return onOk(ret.api_key, ret.base_url);
|
| 36 |
};
|
| 37 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 38 |
useEffect(() => {
|
| 39 |
if (visible) {
|
| 40 |
form.setFieldValue('api_key', initialValue);
|
|
|
|
| 46 |
title={t('modify')}
|
| 47 |
open={visible}
|
| 48 |
onOk={handleOk}
|
| 49 |
+
onCancel={hideModal}
|
| 50 |
okButtonProps={{ loading }}
|
| 51 |
confirmLoading={loading}
|
| 52 |
>
|
|
|
|
| 55 |
labelCol={{ span: 6 }}
|
| 56 |
wrapperCol={{ span: 18 }}
|
| 57 |
style={{ maxWidth: 600 }}
|
|
|
|
|
|
|
| 58 |
autoComplete="off"
|
| 59 |
form={form}
|
| 60 |
>
|
|
|
|
| 66 |
>
|
| 67 |
<Input />
|
| 68 |
</Form.Item>
|
| 69 |
+
{modelsWithBaseUrl.some((x) => x === llmFactory) && (
|
| 70 |
<Form.Item<FieldType>
|
| 71 |
label={t('baseUrl')}
|
| 72 |
name="base_url"
|
web/src/pages/user-setting/setting-model/volcengine-model/index.tsx
CHANGED
|
@@ -4,7 +4,11 @@ import { IAddLlmRequestBody } from '@/interfaces/request/llm';
|
|
| 4 |
import { Flex, Form, Input, Modal, Select, Space, Switch } from 'antd';
|
| 5 |
import omit from 'lodash/omit';
|
| 6 |
|
| 7 |
-
type FieldType = IAddLlmRequestBody & {
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8 |
|
| 9 |
const { Option } = Select;
|
| 10 |
|
|
@@ -13,7 +17,7 @@ const VolcEngineModal = ({
|
|
| 13 |
hideModal,
|
| 14 |
onOk,
|
| 15 |
loading,
|
| 16 |
-
llmFactory
|
| 17 |
}: IModalProps<IAddLlmRequestBody> & { llmFactory: string }) => {
|
| 18 |
const [form] = Form.useForm<FieldType>();
|
| 19 |
|
|
|
|
| 4 |
import { Flex, Form, Input, Modal, Select, Space, Switch } from 'antd';
|
| 5 |
import omit from 'lodash/omit';
|
| 6 |
|
| 7 |
+
type FieldType = IAddLlmRequestBody & {
|
| 8 |
+
vision: boolean;
|
| 9 |
+
volc_ak: string;
|
| 10 |
+
volc_sk: string;
|
| 11 |
+
};
|
| 12 |
|
| 13 |
const { Option } = Select;
|
| 14 |
|
|
|
|
| 17 |
hideModal,
|
| 18 |
onOk,
|
| 19 |
loading,
|
| 20 |
+
llmFactory,
|
| 21 |
}: IModalProps<IAddLlmRequestBody> & { llmFactory: string }) => {
|
| 22 |
const [form] = Form.useForm<FieldType>();
|
| 23 |
|