diff --git a/src/pages/llmodels/components/advance-config.tsx b/src/pages/llmodels/components/advance-config.tsx index cddb017d..27ae63cd 100644 --- a/src/pages/llmodels/components/advance-config.tsx +++ b/src/pages/llmodels/components/advance-config.tsx @@ -163,7 +163,6 @@ const AdvanceConfig: React.FC = (props) => { }, []); const handleBackendParametersOnBlur = () => { - const backendParams = form.getFieldValue('backend_parameters'); onValuesChange?.({}, form.getFieldsValue()); }; diff --git a/src/pages/llmodels/hooks/index.ts b/src/pages/llmodels/hooks/index.ts index 1ededf10..065c65aa 100644 --- a/src/pages/llmodels/hooks/index.ts +++ b/src/pages/llmodels/hooks/index.ts @@ -108,16 +108,21 @@ export const useGenerateFormEditInitialValues = () => { if (gpu_ids.length === 0) { return []; } - const gpuids: string[][] = []; + const valueMap = new Map(); gpuOptions?.forEach((item) => { item.children?.forEach((child: any) => { - if (gpu_ids.includes(child.value)) { - gpuids.push([item.value, child.value]); - } + valueMap.set(child.value, item.value); }); }); + const gpuids: string[][] = gpu_ids + .map((id: string) => { + const parent = valueMap.get(id); + return parent ? [parent, id] : null; + }) + .filter(Boolean) as string[][]; + return data.backend === backendOptionsMap.voxBox ? gpuids[0] : gpuids; }; diff --git a/src/pages/playground/components/chat-footer.tsx b/src/pages/playground/components/chat-footer.tsx deleted file mode 100644 index 114fee9e..00000000 --- a/src/pages/playground/components/chat-footer.tsx +++ /dev/null @@ -1,127 +0,0 @@ -import IconFont from '@/components/icon-font'; -import HotKeys from '@/config/hotkeys'; -import { platformCall } from '@/utils'; -import { ClearOutlined, EnterOutlined, PlusOutlined } from '@ant-design/icons'; -import { useIntl } from '@umijs/max'; -import { Button, Col, Row, Space } from 'antd'; -import { useHotkeys } from 'react-hotkeys-hook'; -import { Roles } from '../config'; -import '../style/chat-footer.less'; - -interface ChatFooterProps { - onSubmit: () => void; - onStop: () => void; - onClear: () => void; - onNewMessage: () => void; - onView: () => void; - disabled?: boolean; - feedback?: React.ReactNode; - hasTokenResult?: boolean; - selectedModel?: string; -} - -const ChatFooter: React.FC = (props) => { - console.log('chat footer====='); - const platform = platformCall(); - const intl = useIntl(); - const { - onSubmit, - onClear, - onStop, - onNewMessage, - onView, - feedback, - disabled, - hasTokenResult, - selectedModel - } = props; - useHotkeys( - HotKeys.SUBMIT.join(','), - () => { - onSubmit(); - }, - { enabled: !disabled } - ); - - const MessageRoles = [ - { key: Roles.User, label: intl.formatMessage({ id: 'playground.user' }) }, - { - key: Roles.Assistant, - label: intl.formatMessage({ id: 'playground.assistant' }) - } - ]; - - return ( -
- - - - - - - - - {feedback} - - - - {!disabled ? ( - - ) : ( - - )} - - - -
- ); -}; - -export default ChatFooter; diff --git a/src/pages/playground/components/chatContent.tsx b/src/pages/playground/components/chatContent.tsx deleted file mode 100644 index e029ee97..00000000 --- a/src/pages/playground/components/chatContent.tsx +++ /dev/null @@ -1,70 +0,0 @@ -import avatar from '@/assets/images/avatar.png'; -import logo from '@/assets/images/logo.png'; -import { - CopyOutlined, - DislikeOutlined, - EditOutlined, - SyncOutlined -} from '@ant-design/icons'; -import { Button, Space, Tooltip } from 'antd'; -import chatStyle from '../style/chat-style.less'; -import ChatEmpty from './chatEmpty'; - -export type ChatContentProps = { - messageList: any[]; -}; - -const QuestionMessage: React.FC<{ content: string }> = ({ content }) => { - return ( -
- - - - - YOU -
- - - -

{content}

-
-
- ); -}; - -const AnswerMessage: React.FC<{ content: string }> = ({ content }) => { - return ( -
- - - - AI -

{content}

- - - - - - - - - - - -
- ); -}; - -const ChatContent: React.FC = ({ messageList }) => { - if (messageList.length === 0) { - return ; - } - return ( -
- - -
- ); -}; - -export default ChatContent; diff --git a/src/pages/playground/components/chatEmpty.tsx b/src/pages/playground/components/chatEmpty.tsx deleted file mode 100644 index 2f549e82..00000000 --- a/src/pages/playground/components/chatEmpty.tsx +++ /dev/null @@ -1,15 +0,0 @@ -import Logo from '@/assets/images/logo.png'; -import chatStyle from '../style/chat-style.less'; - -const ChatEmpty: React.FC = () => { - return ( -
-
- chat empty -
-

How can I help you today?

-
- ); -}; - -export default ChatEmpty; diff --git a/src/pages/playground/style/chat-footer.less b/src/pages/playground/style/chat-footer.less deleted file mode 100644 index b06c93b9..00000000 --- a/src/pages/playground/style/chat-footer.less +++ /dev/null @@ -1,6 +0,0 @@ -.chat-footer { - // display: flex; - // align-items: center; - padding-block: 10px; - padding-right: 32px; -} diff --git a/src/pages/playground/style/chat-style.less b/src/pages/playground/style/chat-style.less deleted file mode 100644 index 1b4f289b..00000000 --- a/src/pages/playground/style/chat-style.less +++ /dev/null @@ -1,68 +0,0 @@ -.chatEmpty { - display: flex; - justify-content: center; - align-items: center; - margin-top: 200px; - flex-direction: column; - .logo { - height: 60px; - width: 60px; - margin-block: 20px; - img { - width: 100%; - height: 100%; - } - } - .tips { - margin-top: 20px; - } -} - -.chatContent { - width: max(50%, 500px); -} -.chatMessageItem { - margin-bottom: 12px; - position: relative; - display: flex; - flex-direction: column; - align-items: flex-start; - justify-content: flex-start; - padding-inline: 44px 16px; - .name { - padding-block: 8px 16px; - } - .content { - padding: 8px 12px; - border-radius: var(--border-radius-base); - background-color: var(--color-fill-3); - font-size: var(--font-size-base); - } - .contentWrap { - position: relative; - padding-right: 45px; - &:hover .edit { - display: block; - } - .edit { - display: none; - position: absolute; - top: -10px; - right: 0; - padding: 8px; - } - } - .img { - position: absolute; - top: 0; - left: 0; - width: 32px; - height: 32px; - border-radius: 50%; - img { - width: 100%; - height: 100%; - border-radius: 50%; - } - } -}