feat: 增强智能体模型调用兼容能力

- 增加模型流式开关和 HTTP 传输策略配置

- 使用 AgentScope 执行基础连接、流式与 VLM 双阶段验证

- 固定多模态校验图片并统一验证状态展示
This commit is contained in:
2026-07-17 19:57:06 +08:00
parent ba21f861f4
commit 791649c7d5
22 changed files with 1492 additions and 107 deletions

View File

@@ -6,7 +6,14 @@ import { computed, reactive, ref, watch } from 'vue';
import { EasyFlowFormModal } from '@easyflow/common-ui';
import { IconifyIcon } from '@easyflow/icons';
import { ElForm, ElFormItem, ElInput, ElMessage } from 'element-plus';
import {
ElForm,
ElFormItem,
ElInput,
ElMessage,
ElOption,
ElSelect,
} from 'element-plus';
import { api } from '#/api/request';
import { $t } from '#/locales';
@@ -19,6 +26,13 @@ import {
resetModelAbility,
} from '#/views/ai/model/modelUtils/model-ability-utils';
type AgentHttpVersionPolicy = 'AUTO' | 'HTTP_1_1' | 'HTTP_2_PREFERRED';
interface ModelOptions {
agentHttpVersionPolicy: AgentHttpVersionPolicy;
[key: string]: unknown;
}
interface FormData {
id?: string;
modelType: string;
@@ -39,6 +53,7 @@ interface FormData {
supportVideo: boolean;
supportImageB64Only: boolean;
supportToolMessage: boolean;
options: ModelOptions;
}
const props = defineProps({
@@ -85,8 +100,39 @@ const formData = reactive<FormData>({
supportVideo: false,
supportImageB64Only: false,
supportToolMessage: true,
options: {
agentHttpVersionPolicy: 'AUTO',
},
});
const agentHttpVersionOptions = [
{ label: '自动', value: 'AUTO' },
{ label: 'HTTP/1.1 兼容', value: 'HTTP_1_1' },
{ label: 'HTTP/2 优先', value: 'HTTP_2_PREFERRED' },
] as const;
const normalizeAgentHttpVersionPolicy = (
value?: unknown,
): AgentHttpVersionPolicy => {
if (value === 'HTTP_1_1' || value === 'HTTP_2_PREFERRED') {
return value;
}
return 'AUTO';
};
const normalizeModelOptions = (options?: unknown): ModelOptions => {
const source =
options && typeof options === 'object' && !Array.isArray(options)
? (options as Record<string, unknown>)
: {};
return {
...source,
agentHttpVersionPolicy: normalizeAgentHttpVersionPolicy(
source.agentHttpVersionPolicy,
),
};
};
const modelAbility = ref<ModelAbilityItem[]>(getDefaultModelAbility());
const visibleModelAbility = computed(() =>
modelAbility.value.filter(
@@ -189,6 +235,7 @@ const resetFormData = () => {
supportImageB64Only: false,
supportFree: false,
supportToolMessage: true,
options: normalizeModelOptions(),
});
};
@@ -231,6 +278,7 @@ defineExpose({
supportFree: item.supportFree || false,
supportToolMessage:
item.supportToolMessage === undefined ? true : item.supportToolMessage,
options: normalizeModelOptions(item.options),
});
selectedModelType.value = normalizeSelectableModelType(item.modelType);
if (selectedModelType.value) {
@@ -386,6 +434,20 @@ const save = async () => {
</div>
</div>
</ElFormItem>
<ElFormItem v-if="!hasSpecialModelType" label="Agent HTTP 传输">
<ElSelect
v-model="formData.options.agentHttpVersionPolicy"
aria-label="Agent HTTP 传输"
>
<ElOption
v-for="item in agentHttpVersionOptions"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</ElSelect>
</ElFormItem>
</div>
</ElForm>
</div>