chore: evaluate error message
This commit is contained in:
@@ -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: '
|
||||
};
|
||||
|
||||
@@ -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 ==========
|
||||
|
||||
@@ -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 ==========
|
||||
|
||||
@@ -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': '评估过程中发生了错误:'
|
||||
};
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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 (
|
||||
<ul className={`${error ? 'error-msg' : ''}`}>
|
||||
{messageList.map((item, index) => (
|
||||
<li key={index} className={`${!error ? 'normal' : 'error'}`}>
|
||||
{item}
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
);
|
||||
};
|
||||
|
||||
const IncompatiableInfo: React.FC<IncompatiableInfoProps> = (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<IncompatiableInfoProps> = (props) => {
|
||||
if (!data || data?.compatible) {
|
||||
return null;
|
||||
}
|
||||
const messageList = [
|
||||
...(compatibility_messages || []),
|
||||
...(scheduling_messages || []),
|
||||
...(error_message ? [error_message] : [])
|
||||
];
|
||||
return (
|
||||
<TooltipOverlayScroller
|
||||
maxHeight={200}
|
||||
title={
|
||||
<IncompatibleInfo>
|
||||
<SMTitle $isTitle={true}>
|
||||
{intl.formatMessage({ id: 'models.form.incompatible' })}
|
||||
{error
|
||||
? intl.formatMessage({ id: 'models.search.evaluate.error' })
|
||||
: intl.formatMessage({ id: 'models.form.incompatible' })}
|
||||
</SMTitle>
|
||||
{
|
||||
<ul>
|
||||
{data?.compatibility_messages.map((item, index) => (
|
||||
<li key={index}>{item}</li>
|
||||
))}
|
||||
{data?.scheduling_messages.map((item, index) => (
|
||||
<li key={index}>{item}</li>
|
||||
))}
|
||||
</ul>
|
||||
}
|
||||
<MessageList messageList={messageList} error={error}></MessageList>
|
||||
</IncompatibleInfo>
|
||||
}
|
||||
>
|
||||
<CompatibleTag
|
||||
icon={<WarningOutlined />}
|
||||
color="warning"
|
||||
color={error ? 'error' : 'warning'}
|
||||
bordered={false}
|
||||
></CompatibleTag>
|
||||
</TooltipOverlayScroller>
|
||||
|
||||
@@ -195,7 +195,7 @@ const SearchModel: React.FC<SearchInputProps> = (props) => {
|
||||
token: checkTokenRef.current?.token
|
||||
}
|
||||
);
|
||||
return evaluations.results || [];
|
||||
return evaluations.results;
|
||||
} catch (error) {
|
||||
return [];
|
||||
}
|
||||
|
||||
@@ -218,6 +218,8 @@ export interface EvaluateResult {
|
||||
compatibility_messages: string[];
|
||||
scheduling_messages: string[];
|
||||
default_spec: Record<string, any>;
|
||||
error?: boolean;
|
||||
error_message?: string;
|
||||
resource_claim?: {
|
||||
ram: number;
|
||||
vram: number;
|
||||
|
||||
@@ -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 = {
|
||||
|
||||
@@ -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<MessageProps> = forwardRef((props, ref) => {
|
||||
</div>
|
||||
</>
|
||||
</div>
|
||||
{tokenResult && (
|
||||
{tokenResult && !loading && (
|
||||
<div style={{ height: 40 }}>
|
||||
<ReferenceParams usage={tokenResult}></ReferenceParams>
|
||||
</div>
|
||||
|
||||
@@ -260,7 +260,9 @@ const ModelItem: React.FC<ModelItemProps> = forwardRef((props, ref) => {
|
||||
}}
|
||||
></Select>
|
||||
</span>
|
||||
<ReferenceParams usage={tokenResult} scaleable></ReferenceParams>
|
||||
{tokenResult && !loading && (
|
||||
<ReferenceParams usage={tokenResult} scaleable></ReferenceParams>
|
||||
)}
|
||||
<span className="action">
|
||||
<Dropdown
|
||||
menu={{
|
||||
|
||||
Reference in New Issue
Block a user