Files
EasyFlow/easyflow-ui-admin/app/src/views/ai/model/modelUtils/model-verification.ts
陈子默 567fd12706 feat: 完善模型能力识别与验证
- 自动识别模型类型、视觉、推理和工具能力并保留手动覆盖

- 使用 AgentScope 工具与视觉探测并统一管理端配置反馈
2026-07-27 19:40:23 +08:00

63 lines
1.3 KiB
TypeScript

import type { ModelVerificationData } from '#/api/ai/llm';
export type VerifyButtonStatus =
| 'error'
| 'idle'
| 'loading'
| 'success'
| 'warning';
export interface ModelVerificationFeedback {
dimension?: number;
message: string;
status: 'error' | 'success' | 'warning';
}
interface ModelVerificationResponse {
data?: ModelVerificationData;
errorCode: number;
message?: string;
}
export function resolveModelVerificationFeedback(
response: ModelVerificationResponse,
_modelType: string,
): ModelVerificationFeedback {
if (response.errorCode !== 0) {
return {
message: response.message || '验证失败',
status: 'error',
};
}
if (response.data?.status === 'FAILED') {
return {
message: response.data.message || '验证失败',
status: 'error',
};
}
const dimension = response.data?.dimension;
return {
dimension,
message: '验证通过',
status: 'success',
};
}
export function getVerifyButtonText(status: VerifyButtonStatus): string {
if (status === 'loading') {
return '验证中';
}
if (status === 'success') {
return '验证通过';
}
if (status === 'warning') {
return '验证通过';
}
if (status === 'error') {
return '验证失败';
}
return '验证配置';
}