mirror of
https://github.com/infiniflow/ragflow.git
synced 2025-12-08 20:42:30 +08:00
### What problem does this PR solve? Feat: Add baseUrl to the Tongyi Qianwen model configuration modal #10340 ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue)
This commit is contained in:
@ -2,7 +2,7 @@ import { IModalManagerChildrenProps } from '@/components/modal-manager';
|
|||||||
import { LLMFactory } from '@/constants/llm';
|
import { LLMFactory } from '@/constants/llm';
|
||||||
import { useTranslate } from '@/hooks/common-hooks';
|
import { useTranslate } from '@/hooks/common-hooks';
|
||||||
import { Form, Input, Modal } from 'antd';
|
import { Form, Input, Modal } from 'antd';
|
||||||
import { useEffect } from 'react';
|
import { KeyboardEventHandler, useCallback, useEffect } from 'react';
|
||||||
import { ApiKeyPostBody } from '../../interface';
|
import { ApiKeyPostBody } from '../../interface';
|
||||||
|
|
||||||
interface IProps extends Omit<IModalManagerChildrenProps, 'showModal'> {
|
interface IProps extends Omit<IModalManagerChildrenProps, 'showModal'> {
|
||||||
@ -20,7 +20,11 @@ type FieldType = {
|
|||||||
group_id?: string;
|
group_id?: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
const modelsWithBaseUrl = [LLMFactory.OpenAI, LLMFactory.AzureOpenAI];
|
const modelsWithBaseUrl = [
|
||||||
|
LLMFactory.OpenAI,
|
||||||
|
LLMFactory.AzureOpenAI,
|
||||||
|
LLMFactory.TongYiQianWen,
|
||||||
|
];
|
||||||
|
|
||||||
const ApiKeyModal = ({
|
const ApiKeyModal = ({
|
||||||
visible,
|
visible,
|
||||||
@ -34,17 +38,20 @@ const ApiKeyModal = ({
|
|||||||
const [form] = Form.useForm();
|
const [form] = Form.useForm();
|
||||||
const { t } = useTranslate('setting');
|
const { t } = useTranslate('setting');
|
||||||
|
|
||||||
const handleOk = async () => {
|
const handleOk = useCallback(async () => {
|
||||||
const ret = await form.validateFields();
|
const ret = await form.validateFields();
|
||||||
|
|
||||||
return onOk(ret);
|
return onOk(ret);
|
||||||
};
|
}, [form, onOk]);
|
||||||
|
|
||||||
const handleKeyDown = async (e) => {
|
const handleKeyDown: KeyboardEventHandler<HTMLInputElement> = useCallback(
|
||||||
|
async (e) => {
|
||||||
if (e.key === 'Enter') {
|
if (e.key === 'Enter') {
|
||||||
await handleOk();
|
await handleOk();
|
||||||
}
|
}
|
||||||
};
|
},
|
||||||
|
[handleOk],
|
||||||
|
);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (visible) {
|
if (visible) {
|
||||||
|
|||||||
Reference in New Issue
Block a user