diff --git a/src/locales/en-US/models.ts b/src/locales/en-US/models.ts index d2e7d15c..557d7325 100644 --- a/src/locales/en-US/models.ts +++ b/src/locales/en-US/models.ts @@ -147,5 +147,6 @@ export default { 'models.table.apiAccessInfo.openaiCompatible': 'OpenAI Compatible', 'models.table.apiAccessInfo.jinaCompatible': 'Jina Compatible', 'models.table.apiAccessInfo.gotoCreate': 'Go to Create', - 'models.search.parts': '{n} parts' + 'models.search.parts': '{n} parts', + 'models.search.evaluate.error': 'An error occurred during evaluation: ' }; diff --git a/src/locales/ja-JP/models.ts b/src/locales/ja-JP/models.ts index f26c3430..66157770 100644 --- a/src/locales/ja-JP/models.ts +++ b/src/locales/ja-JP/models.ts @@ -144,7 +144,8 @@ export default { 'models.table.apiAccessInfo.openaiCompatible': 'OpenAI Compatible', 'models.table.apiAccessInfo.jinaCompatible': 'Jina Compatible', 'models.table.apiAccessInfo.gotoCreate': 'Go to Create', - 'models.search.parts': '{n} parts' + 'models.search.parts': '{n} parts', + 'models.search.evaluate.error': 'An error occurred during evaluation: ' }; // ========== To-Do: Translate Keys (Remove After Translation) ========== @@ -176,5 +177,6 @@ export default { // 26. 'models.form.backend.vllm', // 27. 'models.form.backend.voxbox', // 28. 'models.form.backend.mindie', -// 29. 'models.search.parts' +// 29. 'models.search.parts', +// 30. 'models.search.evaluate.error', // ========== End of To-Do List ========== diff --git a/src/locales/ru-RU/models.ts b/src/locales/ru-RU/models.ts index 30a146d8..a55f34d0 100644 --- a/src/locales/ru-RU/models.ts +++ b/src/locales/ru-RU/models.ts @@ -148,9 +148,10 @@ export default { 'models.table.apiAccessInfo.openaiCompatible': 'Совместимо с OpenAI', 'models.table.apiAccessInfo.jinaCompatible': 'Совместимо с Jina', 'models.table.apiAccessInfo.gotoCreate': 'Перейти к созданию', - 'models.search.parts': '{n} частей' + 'models.search.parts': '{n} частей', + 'models.search.evaluate.error': 'An error occurred during evaluation: ' }; // ========== To-Do: Translate Keys (Remove After Translation) ========== - +// 1. 'models.search.evaluate.error' // ========== End of To-Do List ========== diff --git a/src/locales/zh-CN/models.ts b/src/locales/zh-CN/models.ts index 1ad76bd1..1faef89c 100644 --- a/src/locales/zh-CN/models.ts +++ b/src/locales/zh-CN/models.ts @@ -140,5 +140,6 @@ export default { 'models.table.apiAccessInfo.openaiCompatible': 'OpenAI 兼容', 'models.table.apiAccessInfo.jinaCompatible': 'Jina 兼容', 'models.table.apiAccessInfo.gotoCreate': '去创建', - 'models.search.parts': '{n} 个文件' + 'models.search.parts': '{n} 个文件', + 'models.search.evaluate.error': '评估过程中发生了错误:' }; diff --git a/src/pages/llmodels/components/compatible-alert.tsx b/src/pages/llmodels/components/compatible-alert.tsx index c4e531d3..06208be8 100644 --- a/src/pages/llmodels/components/compatible-alert.tsx +++ b/src/pages/llmodels/components/compatible-alert.tsx @@ -37,7 +37,7 @@ const DivWrapper = styled.div` const CloseWrapper = styled.div` display: none; position: absolute; - top: 14px; + top: 16px; right: 28px; line-height: 1; cursor: pointer; diff --git a/src/pages/llmodels/components/incompatiable-info.tsx b/src/pages/llmodels/components/incompatiable-info.tsx index fe767613..06c04bae 100644 --- a/src/pages/llmodels/components/incompatiable-info.tsx +++ b/src/pages/llmodels/components/incompatiable-info.tsx @@ -19,12 +19,6 @@ const CompatibleTag = styled(Tag)` padding-inline: 0; `; -const ClaimTag = styled(Tag)` - margin: 0; - opacity: 0.7; - border-radius: var(--border-radius-base); -`; - const IncompatibleInfo = styled.div` display: flex; flex-direction: column; @@ -35,10 +29,13 @@ const IncompatibleInfo = styled.div` padding-left: 16px; color: var(--color-white-secondary); list-style: none; + &.error-msg { + padding-left: 0; + } li { position: relative; } - li::before { + li.normal::before { position: absolute; content: ''; display: inline-block; @@ -56,8 +53,29 @@ const SMTitle = styled.div<{ $isTitle?: boolean }>` font-weight: ${(props) => (props.$isTitle ? 'bold' : 'normal')}; font-size: var(--font-size-small); `; + +const MessageList = ({ + messageList, + error +}: { + messageList: string[]; + error?: boolean; +}) => { + return ( + + ); +}; + const IncompatiableInfo: React.FC = (props) => { const { data, isEvaluating } = props; + const { error, error_message, compatibility_messages, scheduling_messages } = + data || {}; const intl = useIntl(); if (isEvaluating) { @@ -72,30 +90,28 @@ const IncompatiableInfo: React.FC = (props) => { if (!data || data?.compatible) { return null; } + const messageList = [ + ...(compatibility_messages || []), + ...(scheduling_messages || []), + ...(error_message ? [error_message] : []) + ]; return ( - {intl.formatMessage({ id: 'models.form.incompatible' })} + {error + ? intl.formatMessage({ id: 'models.search.evaluate.error' }) + : intl.formatMessage({ id: 'models.form.incompatible' })} - { -
    - {data?.compatibility_messages.map((item, index) => ( -
  • {item}
  • - ))} - {data?.scheduling_messages.map((item, index) => ( -
  • {item}
  • - ))} -
- } + } > } - color="warning" + color={error ? 'error' : 'warning'} bordered={false} >
diff --git a/src/pages/llmodels/components/search-model.tsx b/src/pages/llmodels/components/search-model.tsx index 23089996..9f5de275 100644 --- a/src/pages/llmodels/components/search-model.tsx +++ b/src/pages/llmodels/components/search-model.tsx @@ -195,7 +195,7 @@ const SearchModel: React.FC = (props) => { token: checkTokenRef.current?.token } ); - return evaluations.results || []; + return evaluations.results; } catch (error) { return []; } diff --git a/src/pages/llmodels/config/types.ts b/src/pages/llmodels/config/types.ts index eb52387a..109807f4 100644 --- a/src/pages/llmodels/config/types.ts +++ b/src/pages/llmodels/config/types.ts @@ -218,6 +218,8 @@ export interface EvaluateResult { compatibility_messages: string[]; scheduling_messages: string[]; default_spec: Record; + error?: boolean; + error_message?: string; resource_claim?: { ram: number; vram: number; diff --git a/src/pages/llmodels/hooks/index.ts b/src/pages/llmodels/hooks/index.ts index 1ce8a268..a2163a8a 100644 --- a/src/pages/llmodels/hooks/index.ts +++ b/src/pages/llmodels/hooks/index.ts @@ -292,9 +292,21 @@ export const useCheckCompatibility = () => { compatible, compatibility_messages = [], scheduling_messages = [], - resource_claim + resource_claim, + error, + error_message } = evaluateResult || {}; + // error message + if (error) { + return { + show: true, + type: 'danger', + title: intl.formatMessage({ id: 'models.search.evaluate.error' }), + message: error_message || '' + }; + } + const hasClaim = !!resource_claim?.ram || !!resource_claim?.vram; let msgData = { diff --git a/src/pages/playground/components/ground-left.tsx b/src/pages/playground/components/ground-left.tsx index fef291b1..53319bc5 100644 --- a/src/pages/playground/components/ground-left.tsx +++ b/src/pages/playground/components/ground-left.tsx @@ -2,7 +2,7 @@ import { useIntl } from '@umijs/max'; import { Spin } from 'antd'; import classNames from 'classnames'; import 'overlayscrollbars/overlayscrollbars.css'; -import { +import React, { forwardRef, useImperativeHandle, useMemo, @@ -144,7 +144,7 @@ const GroundLeft: React.FC = forwardRef((props, ref) => { - {tokenResult && ( + {tokenResult && !loading && (
diff --git a/src/pages/playground/components/multiple-chat/model-item.tsx b/src/pages/playground/components/multiple-chat/model-item.tsx index abcb78a2..9c47b455 100644 --- a/src/pages/playground/components/multiple-chat/model-item.tsx +++ b/src/pages/playground/components/multiple-chat/model-item.tsx @@ -260,7 +260,9 @@ const ModelItem: React.FC = forwardRef((props, ref) => { }} > - + {tokenResult && !loading && ( + + )}