feat: 增强智能体模型调用兼容能力
- 增加模型流式开关和 HTTP 传输策略配置 - 使用 AgentScope 执行基础连接、流式与 VLM 双阶段验证 - 固定多模态校验图片并统一验证状态展示
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
<script setup lang="ts">
|
||||
import type { llmType } from '#/api';
|
||||
import type { ModelAbilityItem } from '#/views/ai/model/modelUtils/model-ability';
|
||||
import type { VerifyButtonStatus } from '#/views/ai/model/modelUtils/model-verification';
|
||||
|
||||
import { computed, onMounted, reactive, ref } from 'vue';
|
||||
|
||||
@@ -11,6 +12,7 @@ import {
|
||||
Edit,
|
||||
Loading,
|
||||
Select,
|
||||
Warning,
|
||||
} from '@element-plus/icons-vue';
|
||||
import {
|
||||
ElButton,
|
||||
@@ -31,6 +33,10 @@ import { $t } from '#/locales';
|
||||
import ModelProviderBadge from '#/views/ai/model/ModelProviderBadge.vue';
|
||||
import { getDefaultModelAbility } from '#/views/ai/model/modelUtils/model-ability';
|
||||
import { mapLlmToModelAbility } from '#/views/ai/model/modelUtils/model-ability-utils';
|
||||
import {
|
||||
getVerifyButtonText as getStatusButtonText,
|
||||
resolveModelVerificationFeedback,
|
||||
} from '#/views/ai/model/modelUtils/model-verification';
|
||||
|
||||
interface ProviderOption {
|
||||
id: string;
|
||||
@@ -63,7 +69,6 @@ const isActionLoading = ref(false);
|
||||
const modelRows = ref<llmType[]>([]);
|
||||
const selectedRows = ref<llmType[]>([]);
|
||||
const lastErrorMessage = ref('');
|
||||
type VerifyButtonStatus = 'error' | 'idle' | 'loading' | 'success';
|
||||
const verifyStatusMap = ref<Record<string, VerifyButtonStatus>>({});
|
||||
|
||||
const filterState = reactive<FilterState>({
|
||||
@@ -121,17 +126,7 @@ const setVerifyStatus = (id: string, status: VerifyButtonStatus) => {
|
||||
};
|
||||
const isVerifying = (row: llmType) => getVerifyStatus(row) === 'loading';
|
||||
const getVerifyButtonText = (row: llmType) => {
|
||||
const status = getVerifyStatus(row);
|
||||
if (status === 'loading') {
|
||||
return '验证中';
|
||||
}
|
||||
if (status === 'success') {
|
||||
return '验证成功';
|
||||
}
|
||||
if (status === 'error') {
|
||||
return '验证失败';
|
||||
}
|
||||
return '验证配置';
|
||||
return getStatusButtonText(getVerifyStatus(row));
|
||||
};
|
||||
const getVerifyButtonIcon = (row: llmType) => {
|
||||
const status = getVerifyStatus(row);
|
||||
@@ -141,6 +136,9 @@ const getVerifyButtonIcon = (row: llmType) => {
|
||||
if (status === 'success') {
|
||||
return CircleCheck;
|
||||
}
|
||||
if (status === 'warning') {
|
||||
return Warning;
|
||||
}
|
||||
if (status === 'error') {
|
||||
return CircleClose;
|
||||
}
|
||||
@@ -285,17 +283,16 @@ const handleVerify = async (row: llmType) => {
|
||||
try {
|
||||
const res = await verifyModelConfig(modelId);
|
||||
|
||||
if (res.errorCode === 0) {
|
||||
setVerifyStatus(modelId, 'success');
|
||||
if (row.modelType === 'embeddingModel' && res?.data?.dimension) {
|
||||
ElMessage.success(`验证成功,向量维度:${res.data.dimension}`);
|
||||
} else {
|
||||
ElMessage.success('验证成功');
|
||||
}
|
||||
const feedback = resolveModelVerificationFeedback(res, row.modelType);
|
||||
setVerifyStatus(modelId, feedback.status);
|
||||
|
||||
if (feedback.status === 'success') {
|
||||
ElMessage.success(feedback.message);
|
||||
} else if (feedback.status === 'warning') {
|
||||
ElMessage.warning(feedback.message);
|
||||
} else {
|
||||
setVerifyStatus(modelId, 'error');
|
||||
if (!res.message) {
|
||||
ElMessage.error($t('ui.actionMessage.operationFailed'));
|
||||
ElMessage.error(feedback.message);
|
||||
}
|
||||
}
|
||||
} catch {
|
||||
@@ -717,6 +714,10 @@ defineExpose({
|
||||
color: hsl(var(--success));
|
||||
}
|
||||
|
||||
.active-workspace__verify-btn.is-warning {
|
||||
color: hsl(var(--warning));
|
||||
}
|
||||
|
||||
.active-workspace__verify-btn.is-error {
|
||||
color: hsl(var(--destructive));
|
||||
}
|
||||
@@ -732,6 +733,7 @@ defineExpose({
|
||||
}
|
||||
|
||||
.active-workspace__verify-icon.is-success,
|
||||
.active-workspace__verify-icon.is-warning,
|
||||
.active-workspace__verify-icon.is-error {
|
||||
animation: active-workspace-verify-pop 0.32s ease;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user