From a8883905a7cbcd496e78c44e695bcb49a10cbc98 Mon Sep 17 00:00:00 2001 From: balibabu Date: Mon, 29 Sep 2025 12:44:18 +0800 Subject: [PATCH] Feat: Add baseUrl to the Tongyi Qianwen model configuration modal #10340 (#10357) ### 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) --- .../setting-model/api-key-modal/index.tsx | 25 ++++++++++++------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/web/src/pages/user-setting/setting-model/api-key-modal/index.tsx b/web/src/pages/user-setting/setting-model/api-key-modal/index.tsx index 999f422c2..b0c5e1451 100644 --- a/web/src/pages/user-setting/setting-model/api-key-modal/index.tsx +++ b/web/src/pages/user-setting/setting-model/api-key-modal/index.tsx @@ -2,7 +2,7 @@ import { IModalManagerChildrenProps } from '@/components/modal-manager'; import { LLMFactory } from '@/constants/llm'; import { useTranslate } from '@/hooks/common-hooks'; import { Form, Input, Modal } from 'antd'; -import { useEffect } from 'react'; +import { KeyboardEventHandler, useCallback, useEffect } from 'react'; import { ApiKeyPostBody } from '../../interface'; interface IProps extends Omit { @@ -20,7 +20,11 @@ type FieldType = { group_id?: string; }; -const modelsWithBaseUrl = [LLMFactory.OpenAI, LLMFactory.AzureOpenAI]; +const modelsWithBaseUrl = [ + LLMFactory.OpenAI, + LLMFactory.AzureOpenAI, + LLMFactory.TongYiQianWen, +]; const ApiKeyModal = ({ visible, @@ -34,17 +38,20 @@ const ApiKeyModal = ({ const [form] = Form.useForm(); const { t } = useTranslate('setting'); - const handleOk = async () => { + const handleOk = useCallback(async () => { const ret = await form.validateFields(); return onOk(ret); - }; + }, [form, onOk]); - const handleKeyDown = async (e) => { - if (e.key === 'Enter') { - await handleOk(); - } - }; + const handleKeyDown: KeyboardEventHandler = useCallback( + async (e) => { + if (e.key === 'Enter') { + await handleOk(); + } + }, + [handleOk], + ); useEffect(() => { if (visible) {