Merge remote-tracking branch 'origin/feature/workflow' into feature/workflow
This commit is contained in:
@@ -167,7 +167,7 @@ export interface CreateModelParams {
|
||||
firstFrame?: string;
|
||||
lastFrame?: string;
|
||||
responseMapping?: Record<string, unknown>;
|
||||
responseBody?: Record<string, unknown>;
|
||||
responseBody?: string;
|
||||
extendMapping?: Record<string, unknown>;
|
||||
responseTokenField?: string;
|
||||
tokenConfig?: Record<string, unknown>;
|
||||
|
||||
@@ -38,7 +38,15 @@
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col v-if="props.isSuperAdmin || state.ruleForm.isPrivate === 1" :xs="24" :sm="24" :md="24" :lg="24" :xl="24" class="mb20 provider-section-col">
|
||||
<el-col
|
||||
v-if="props.isSuperAdmin || state.ruleForm.isPrivate === 1"
|
||||
:xs="24"
|
||||
:sm="24"
|
||||
:md="24"
|
||||
:lg="24"
|
||||
:xl="24"
|
||||
class="mb20 provider-section-col"
|
||||
>
|
||||
<div class="provider-section-title">服务商模型配置</div>
|
||||
</el-col>
|
||||
<el-col v-if="!props.isSuperAdmin" :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
|
||||
@@ -74,7 +82,7 @@
|
||||
<el-select v-model="state.ruleForm.callMode" placeholder="请选择调用模式" clearable style="width: 100%">
|
||||
<el-option label="同步" :value="0"></el-option>
|
||||
<el-option label="异步" :value="1"></el-option>
|
||||
<el-option label="流式" :value="2"></el-option>
|
||||
<el-option label="流式(待定)" :value="2"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
@@ -83,10 +91,8 @@
|
||||
<el-button @click="showAsyncQueryConfigDialog = true" style="width: 100%">配置查询/回调</el-button>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col v-if="state.ruleForm.callMode === 2" :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
|
||||
<el-form-item label="流式配置" prop="streamConfig">
|
||||
<el-button @click="showStreamConfigDialog = true" style="width: 100%">配置流式参数</el-button>
|
||||
</el-form-item>
|
||||
<el-col v-if="state.ruleForm.callMode === 2" :xs="24" :sm="24" :md="24" :lg="24" :xl="24" class="mb20">
|
||||
<el-alert type="warning" :closable="false" title="流式执行模式暂未配置独立表单,当前仅保留模式标记,不提交流式专用配置。" />
|
||||
</el-col>
|
||||
<el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
|
||||
<el-form-item label="请求头绑定" prop="headMsg">
|
||||
@@ -225,58 +231,6 @@
|
||||
</template>
|
||||
</el-dialog>
|
||||
|
||||
<!-- 流式配置弹窗 -->
|
||||
<el-dialog v-model="showStreamConfigDialog" title="配置流式参数" width="760px" :close-on-click-modal="false">
|
||||
<el-form ref="streamConfigDialogFormRef" :model="streamConfigForm" :rules="streamConfigRules" label-width="0" class="stream-dialog-form">
|
||||
<div class="stream-dialog-panel">
|
||||
<div class="stream-dialog-panel__row stream-dialog-panel__row--single">
|
||||
<div class="stream-dialog-panel__label required">内容路径</div>
|
||||
<el-form-item prop="targetContentPath" class="stream-dialog-panel__item stream-dialog-panel__item--full">
|
||||
<el-input v-model="streamConfigForm.targetContentPath" placeholder="如 messages.0.content" clearable></el-input>
|
||||
</el-form-item>
|
||||
</div>
|
||||
</div>
|
||||
<div class="stream-config-container">
|
||||
<div v-for="templateKey in streamAttachmentTemplateKeys" :key="templateKey" class="stream-template-card">
|
||||
<div class="stream-template-card__header">
|
||||
<span class="stream-template-card__title">{{ templateKey }} 附件模板</span>
|
||||
</div>
|
||||
<div class="stream-template-grid">
|
||||
<div class="stream-template-grid__label required">type</div>
|
||||
<el-form-item
|
||||
:prop="`${templateKey}Type`"
|
||||
class="stream-template-grid__item stream-template-grid__item--full"
|
||||
>
|
||||
<el-input
|
||||
v-model="streamConfigForm.attachmentTemplates[templateKey].type"
|
||||
placeholder="请输入 type"
|
||||
clearable
|
||||
></el-input>
|
||||
</el-form-item>
|
||||
<div class="stream-template-grid__label required stream-template-grid__label--top">body</div>
|
||||
<div class="stream-template-grid__item stream-template-grid__item--full">
|
||||
<div class="stream-body-list">
|
||||
<div v-for="(field, index) in streamConfigForm.attachmentTemplates[templateKey].bodyFields" :key="index" class="stream-body-row">
|
||||
<el-input v-model="field.key" placeholder="请输入 body key" clearable class="stream-body-row__input"></el-input>
|
||||
<span class="stream-body-row__separator">=</span>
|
||||
<el-input v-model="field.value" placeholder="请输入 body value" clearable class="stream-body-row__input"></el-input>
|
||||
<el-button type="danger" link class="stream-body-row__delete" @click="removeStreamBodyField(templateKey, index)">删除</el-button>
|
||||
</div>
|
||||
<el-button type="primary" link class="stream-body-list__add" @click="addStreamBodyField(templateKey)">+ 添加 body 字段</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<span class="dialog-footer">
|
||||
<el-button @click="showStreamConfigDialog = false" size="default">取 消</el-button>
|
||||
<el-button type="primary" @click="validateAndConfirmStreamConfig" size="default">确 定</el-button>
|
||||
</span>
|
||||
</template>
|
||||
</el-dialog>
|
||||
|
||||
<!-- 请求头配置弹窗 -->
|
||||
<el-dialog v-model="showHeaderDialog" title="配置请求头" width="600px" :close-on-click-modal="false">
|
||||
<div class="header-config-container">
|
||||
@@ -430,7 +384,13 @@
|
||||
<el-dialog v-model="showRequestMappingDialog" title="配置请求映射" width="860px" :close-on-click-modal="false">
|
||||
<div class="mapping-config-container">
|
||||
<div v-for="(field, index) in state.requestMappingFields" :key="index" class="mapping-field-item">
|
||||
<el-input v-model="field.key" placeholder="请输入字段名 (Key)" style="width: 18%" clearable @input="syncRequestSpecialFieldsOnKeyChange(index)"></el-input>
|
||||
<el-input
|
||||
v-model="field.key"
|
||||
placeholder="请输入字段名 (Key)"
|
||||
style="width: 18%"
|
||||
clearable
|
||||
@input="syncRequestSpecialFieldsOnKeyChange(index)"
|
||||
></el-input>
|
||||
<span class="separator">=</span>
|
||||
<el-input v-model="field.value" placeholder="请输入字段值 (Value)" style="width: 18%" clearable></el-input>
|
||||
<el-button :type="field.required ? 'success' : 'primary'" :plain="!field.required" @click="toggleRequiredField(index)" size="small">
|
||||
@@ -486,19 +446,48 @@
|
||||
</el-dialog>
|
||||
|
||||
<!-- 附加映射配置 -->
|
||||
<el-dialog v-model="showExtendMappingDialog" title="配置附加映射" width="600px" :close-on-click-modal="false">
|
||||
<div class="mapping-config-container">
|
||||
<div v-for="(field, index) in state.extendMappingFields" :key="index" class="mapping-field-item">
|
||||
<el-input v-model="field.key" placeholder="请输入字段名 (Key)" style="width: 40%" clearable></el-input>
|
||||
<span class="separator">=</span>
|
||||
<el-input v-model="field.value" placeholder="请输入字段值 (Value)" style="width: 40%" clearable></el-input>
|
||||
<el-button type="danger" link @click="state.extendMappingFields.splice(index, 1)">删除</el-button>
|
||||
<el-dialog v-model="showExtendMappingDialog" title="配置附加映射" width="760px" :close-on-click-modal="false">
|
||||
<el-form ref="extendMappingDialogFormRef" :model="streamConfigForm" :rules="streamConfigRules" label-width="0" class="stream-dialog-form">
|
||||
<div class="stream-dialog-panel">
|
||||
<div class="stream-dialog-panel__row stream-dialog-panel__row--single">
|
||||
<div class="stream-dialog-panel__label required">内容路径</div>
|
||||
<el-form-item prop="targetContentPath" class="stream-dialog-panel__item stream-dialog-panel__item--full">
|
||||
<el-input v-model="streamConfigForm.targetContentPath" placeholder="如 messages.0.content" clearable></el-input>
|
||||
</el-form-item>
|
||||
</div>
|
||||
</div>
|
||||
<el-button type="primary" link @click="state.extendMappingFields.push({ key: '', value: '' })" style="margin-top: 10px">+ 添加字段</el-button>
|
||||
</div>
|
||||
<template #footer
|
||||
><span class="dialog-footer"><el-button @click="showExtendMappingDialog = false">确 定</el-button></span></template
|
||||
>
|
||||
<div class="stream-config-container">
|
||||
<div v-for="templateKey in streamAttachmentTemplateKeys" :key="templateKey" class="stream-template-card">
|
||||
<div class="stream-template-card__header">
|
||||
<span class="stream-template-card__title">{{ templateKey }} 附件模板</span>
|
||||
</div>
|
||||
<div class="stream-template-grid">
|
||||
<div class="stream-template-grid__label required">type</div>
|
||||
<el-form-item :prop="`${templateKey}Type`" class="stream-template-grid__item stream-template-grid__item--full">
|
||||
<el-input v-model="streamConfigForm.attachmentTemplates[templateKey].type" placeholder="请输入 type" clearable></el-input>
|
||||
</el-form-item>
|
||||
<div class="stream-template-grid__label required stream-template-grid__label--top">body</div>
|
||||
<div class="stream-template-grid__item stream-template-grid__item--full">
|
||||
<div class="stream-body-list">
|
||||
<div v-for="(field, index) in streamConfigForm.attachmentTemplates[templateKey].bodyFields" :key="index" class="stream-body-row">
|
||||
<el-input v-model="field.key" placeholder="请输入 body key" clearable class="stream-body-row__input"></el-input>
|
||||
<span class="stream-body-row__separator">=</span>
|
||||
<el-input v-model="field.value" placeholder="请输入 body value" clearable class="stream-body-row__input"></el-input>
|
||||
<el-button type="danger" link class="stream-body-row__delete" @click="removeStreamBodyField(templateKey, index)">删除</el-button>
|
||||
</div>
|
||||
<el-button type="primary" link class="stream-body-list__add" @click="addStreamBodyField(templateKey)">+ 添加 body 字段</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<span class="dialog-footer">
|
||||
<el-button @click="showExtendMappingDialog = false" size="default">取 消</el-button>
|
||||
<el-button type="primary" @click="validateAndConfirmExtendMapping" size="default">确 定</el-button>
|
||||
</span>
|
||||
</template>
|
||||
</el-dialog>
|
||||
|
||||
<!-- Token计算配置 -->
|
||||
@@ -625,11 +614,10 @@ const typeOptionValue = (id: number | string): number | string => {
|
||||
};
|
||||
|
||||
const editModuleFormRef = ref();
|
||||
const streamConfigDialogFormRef = ref();
|
||||
const extendMappingDialogFormRef = ref();
|
||||
const emit = defineEmits(['refresh']);
|
||||
const showHeaderDialog = ref(false);
|
||||
const showAsyncQueryConfigDialog = ref(false);
|
||||
const showStreamConfigDialog = ref(false);
|
||||
const showFormDialog = ref(false);
|
||||
const showRequestMappingDialog = ref(false);
|
||||
const showResponseMappingDialog = ref(false);
|
||||
@@ -662,9 +650,9 @@ const createEmptyStreamConfigForm = (): StreamConfigForm => ({
|
||||
const streamConfigForm = reactive<StreamConfigForm>(createEmptyStreamConfigForm());
|
||||
const streamConfigRules = {
|
||||
targetContentPath: [{ required: true, message: '请输入内容路径', trigger: 'blur' }],
|
||||
audioType: [{ required: true, message: '请输入 Audio 附件模板 type', trigger: 'blur' }],
|
||||
imageType: [{ required: true, message: '请输入 Image 附件模板 type', trigger: 'blur' }],
|
||||
videoType: [{ required: true, message: '请输入 Video 附件模板 type', trigger: 'blur' }],
|
||||
// audioType: [{ required: true, message: '请输入 Audio 附件模板 type', trigger: 'blur' }],
|
||||
// imageType: [{ required: true, message: '请输入 Image 附件模板 type', trigger: 'blur' }],
|
||||
// videoType: [{ required: true, message: '请输入 Video 附件模板 type', trigger: 'blur' }],
|
||||
};
|
||||
const streamAttachmentTemplateKeys: Array<keyof StreamConfigForm['attachmentTemplates']> = ['audio', 'image', 'video'];
|
||||
|
||||
@@ -765,42 +753,6 @@ const state = reactive({
|
||||
streamConfig: [
|
||||
{
|
||||
validator: (_rule: unknown, _value: unknown, callback: (e?: Error) => void) => {
|
||||
if (Number(state.ruleForm.callMode) !== 2) {
|
||||
callback();
|
||||
return;
|
||||
}
|
||||
if (!String(streamConfigForm.targetContentPath || '').trim()) {
|
||||
callback(new Error('流式执行时,请填写内容路径'));
|
||||
return;
|
||||
}
|
||||
const missingTemplateType = Object.entries(streamConfigForm.attachmentTemplates).some(
|
||||
([, template]) => !String(template.type || '').trim()
|
||||
);
|
||||
if (missingTemplateType) {
|
||||
callback(new Error('流式执行时,请完整填写所有附件模板 type'));
|
||||
return;
|
||||
}
|
||||
const hasEmptyBodyTemplate = Object.entries(streamConfigForm.attachmentTemplates).some(([, template]) => {
|
||||
const validRows = template.bodyFields.filter(
|
||||
(item) => String(item.key || '').trim() !== '' && String(item.value || '').trim() !== ''
|
||||
);
|
||||
return validRows.length === 0;
|
||||
});
|
||||
if (hasEmptyBodyTemplate) {
|
||||
callback(new Error('流式执行时,每个附件模板至少需要一个 body 字段'));
|
||||
return;
|
||||
}
|
||||
const hasInvalidBodyField = Object.entries(streamConfigForm.attachmentTemplates).some(([, template]) =>
|
||||
template.bodyFields.some(
|
||||
(item) =>
|
||||
(String(item.key || '').trim() === '' && String(item.value || '').trim() !== '') ||
|
||||
(String(item.key || '').trim() !== '' && String(item.value || '').trim() === '')
|
||||
)
|
||||
);
|
||||
if (hasInvalidBodyField) {
|
||||
callback(new Error('附件模板 body 的键和值都必须完整填写'));
|
||||
return;
|
||||
}
|
||||
callback();
|
||||
},
|
||||
trigger: 'change',
|
||||
@@ -903,9 +855,34 @@ const state = reactive({
|
||||
extendMapping: [
|
||||
{
|
||||
validator: (_rule: unknown, _value: unknown, callback: (e?: Error) => void) => {
|
||||
const emptyKeys = state.extendMappingFields.filter((x) => String(x.key || '').trim() === '' && String(x.value || '').trim() !== '');
|
||||
if (emptyKeys.length > 0) {
|
||||
callback(new Error('附加映射字段名不能为空'));
|
||||
if (!String(streamConfigForm.targetContentPath || '').trim()) {
|
||||
callback(new Error('附加映射时,请填写内容路径'));
|
||||
return;
|
||||
}
|
||||
const missingTemplateType = Object.entries(streamConfigForm.attachmentTemplates).some(
|
||||
([, template]) => !String(template.type || '').trim()
|
||||
);
|
||||
if (missingTemplateType) {
|
||||
callback(new Error('附加映射时,请完整填写所有附件模板 type'));
|
||||
return;
|
||||
}
|
||||
const hasEmptyBodyTemplate = Object.entries(streamConfigForm.attachmentTemplates).some(([, template]) => {
|
||||
const validRows = template.bodyFields.filter((item) => String(item.key || '').trim() !== '' && String(item.value || '').trim() !== '');
|
||||
return validRows.length === 0;
|
||||
});
|
||||
if (hasEmptyBodyTemplate) {
|
||||
callback(new Error('附加映射时,每个附件模板至少需要一个 body 字段'));
|
||||
return;
|
||||
}
|
||||
const hasInvalidBodyField = Object.entries(streamConfigForm.attachmentTemplates).some(([, template]) =>
|
||||
template.bodyFields.some(
|
||||
(item) =>
|
||||
(String(item.key || '').trim() === '' && String(item.value || '').trim() !== '') ||
|
||||
(String(item.key || '').trim() !== '' && String(item.value || '').trim() === '')
|
||||
)
|
||||
);
|
||||
if (hasInvalidBodyField) {
|
||||
callback(new Error('附件模板 body 的键和值都必须完整填写'));
|
||||
return;
|
||||
}
|
||||
callback();
|
||||
@@ -1145,10 +1122,10 @@ const removeAsyncQueryStatusValueField = (index: number) => {
|
||||
asyncQueryConfigForm.statusValueFields.splice(index, 1);
|
||||
};
|
||||
|
||||
const validateAndConfirmStreamConfig = async () => {
|
||||
await streamConfigDialogFormRef.value?.validate?.();
|
||||
await editModuleFormRef.value?.validateField?.('streamConfig');
|
||||
showStreamConfigDialog.value = false;
|
||||
const validateAndConfirmExtendMapping = async () => {
|
||||
await extendMappingDialogFormRef.value?.validate?.();
|
||||
await editModuleFormRef.value?.validateField?.('extendMapping');
|
||||
showExtendMappingDialog.value = false;
|
||||
};
|
||||
|
||||
const objectToFields = (obj: Record<string, unknown>) => {
|
||||
@@ -1198,10 +1175,7 @@ const buildStreamAttachmentTemplate = (template: StreamAttachmentTemplateForm) =
|
||||
body: fieldsToUnknownObject(template.bodyFields.filter((item) => String(item.key || '').trim() !== '')),
|
||||
});
|
||||
|
||||
const buildStreamConfig = () => {
|
||||
if (Number(state.ruleForm.callMode) !== 2) {
|
||||
return undefined;
|
||||
}
|
||||
const buildExtendMappingPayload = () => {
|
||||
return {
|
||||
target_content_path: String(streamConfigForm.targetContentPath || '').trim(),
|
||||
attachment_templates: {
|
||||
@@ -1441,6 +1415,8 @@ const unwrapModelDetailPayload = (data: unknown): Record<string, unknown> | null
|
||||
};
|
||||
|
||||
const fillFormFromDetailRow = (row: Record<string, unknown>) => {
|
||||
resetStreamConfigForm();
|
||||
state.mainBodyIndex = -1;
|
||||
const timeoutSeconds =
|
||||
row.timeoutSeconds != null && row.timeoutSeconds !== ''
|
||||
? Number(row.timeoutSeconds)
|
||||
@@ -1458,7 +1434,7 @@ const fillFormFromDetailRow = (row: Record<string, unknown>) => {
|
||||
} else {
|
||||
ruleFormHeadMsg = '';
|
||||
}
|
||||
state.ruleForm = {
|
||||
Object.assign(state.ruleForm, {
|
||||
id: row.id as string,
|
||||
modelName: String(row.modelName ?? ''),
|
||||
modelType: row.modelType !== undefined && row.modelType !== null ? typeOptionValue(row.modelType as number | string) : null,
|
||||
@@ -1470,7 +1446,7 @@ const fillFormFromDetailRow = (row: Record<string, unknown>) => {
|
||||
apiKey: isPrivate === 1 ? String(row.apiKey ?? '') : '',
|
||||
enabled: Number(row.enabled ?? 1),
|
||||
isChatModel: row.isChatModel !== undefined && row.isChatModel !== null ? Number(row.isChatModel) : 0,
|
||||
callMode: row.callMode !== undefined && row.callMode !== null ? Number(row.callMode) : row.isAsync !== undefined && row.isAsync !== null ? Number(row.isAsync) : 0,
|
||||
callMode: Number(row.callMode ?? 0),
|
||||
firstFrame: String(row.firstFrame || ''),
|
||||
lastFrame: String(row.lastFrame || ''),
|
||||
requiredFields: Array.isArray(row.requiredFields) ? row.requiredFields.map((item) => String(item || '').trim()).filter(Boolean) : [],
|
||||
@@ -1481,7 +1457,7 @@ const fillFormFromDetailRow = (row: Record<string, unknown>) => {
|
||||
extendMapping: '{}',
|
||||
responseTokenField: String(row.responseTokenField || ''),
|
||||
tokenConfig: '{}',
|
||||
};
|
||||
});
|
||||
state.headers = ensureKeyValueRows(parseHeaders(row.headMsg), () => ({ key: '', value: '' }));
|
||||
state.formFields = parseFormFieldsUnified(row.form);
|
||||
state.requestMappingFields = ensureKeyValueRows(parseRequestMappingFields(row.requestMapping) as RequestMappingField[], () => ({
|
||||
@@ -1505,7 +1481,7 @@ const fillFormFromDetailRow = (row: Record<string, unknown>) => {
|
||||
}));
|
||||
state.extendMappingFields = ensureKeyValueRows(parseFieldsUnified(row.extendMapping), () => ({ key: '', value: '' }));
|
||||
state.tokenConfigFields = ensureKeyValueRows(parseFieldsUnified(row.tokenConfig), () => ({ key: '', value: '' }));
|
||||
|
||||
applyStreamConfig(row.extendMapping);
|
||||
// 根据 responseTokenField 字段设置计费字段标记(单选)
|
||||
const tokenFieldKey = String(row.responseTokenField || '').trim();
|
||||
if (tokenFieldKey) {
|
||||
@@ -1515,15 +1491,12 @@ const fillFormFromDetailRow = (row: Record<string, unknown>) => {
|
||||
}
|
||||
}
|
||||
// 根据 responseBody 字段设置返回主体标记(单选)
|
||||
if (row.responseBody && typeof row.responseBody === 'object' && !Array.isArray(row.responseBody)) {
|
||||
const bodyKeys = Object.keys(row.responseBody);
|
||||
if (bodyKeys.length > 0) {
|
||||
const bodyKey = bodyKeys[0];
|
||||
const bodyFieldIndex = state.responseMappingFields.findIndex((f) => String(f.key || '').trim() === bodyKey);
|
||||
if (bodyFieldIndex !== -1) {
|
||||
state.responseMappingFields[bodyFieldIndex].isMainBody = true;
|
||||
state.mainBodyIndex = bodyFieldIndex;
|
||||
}
|
||||
const responseBodyKey = String(row.responseBody || '').trim();
|
||||
if (responseBodyKey) {
|
||||
const bodyFieldIndex = state.responseMappingFields.findIndex((f) => String(f.key || '').trim() === responseBodyKey);
|
||||
if (bodyFieldIndex !== -1) {
|
||||
state.responseMappingFields[bodyFieldIndex].isMainBody = true;
|
||||
state.mainBodyIndex = bodyFieldIndex;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1535,7 +1508,10 @@ const fillFormFromDetailRow = (row: Record<string, unknown>) => {
|
||||
asyncQueryConfigForm.resultPath = String(qc.result_path || '');
|
||||
asyncQueryConfigForm.statusPath = String(qc.status_path || '');
|
||||
asyncQueryConfigForm.intervalSeconds = Number(qc.interval_seconds ?? 2) || 2;
|
||||
asyncQueryConfigForm.statusValueFields = ensureKeyValueRows(objectToFields((qc.status_values as Record<string, unknown>) || {}), () => ({ key: '', value: '' }));
|
||||
asyncQueryConfigForm.statusValueFields = ensureKeyValueRows(objectToFields((qc.status_values as Record<string, unknown>) || {}), () => ({
|
||||
key: '',
|
||||
value: '',
|
||||
}));
|
||||
} else {
|
||||
asyncQueryConfigForm.url = '';
|
||||
asyncQueryConfigForm.method = 'POST';
|
||||
@@ -1545,8 +1521,6 @@ const fillFormFromDetailRow = (row: Record<string, unknown>) => {
|
||||
asyncQueryConfigForm.intervalSeconds = 2;
|
||||
asyncQueryConfigForm.statusValueFields = [{ key: '', value: '' }];
|
||||
}
|
||||
|
||||
applyStreamConfig(row.streamConfig);
|
||||
};
|
||||
// 打开弹窗(编辑时会请求 /model/getModel 详情)
|
||||
const openDialog = async (type: string, row?: Record<string, unknown>) => {
|
||||
@@ -1653,9 +1627,7 @@ const onSubmit = () => {
|
||||
if (Number(state.ruleForm.callMode) === 1) {
|
||||
await editModuleFormRef.value?.validateField?.('asyncQueryConfig');
|
||||
}
|
||||
if (Number(state.ruleForm.callMode) === 2) {
|
||||
await editModuleFormRef.value?.validateField?.('streamConfig');
|
||||
}
|
||||
await editModuleFormRef.value?.validateField?.('extendMapping');
|
||||
|
||||
// 验证响应映射(如果有配置)
|
||||
const validResponseFields = state.responseMappingFields.filter((x) => String(x.key || '').trim() !== '');
|
||||
@@ -1679,9 +1651,9 @@ const onSubmit = () => {
|
||||
state.ruleForm.requiredFields = requiredFields;
|
||||
const responseMapping = fieldsToObject(state.responseMappingFields.filter((f) => String(f.key || '').trim() !== ''));
|
||||
|
||||
// 获取被设置为返回主体的字段 {key: value}
|
||||
// 获取被设置为返回主体的字段 key
|
||||
const responseBodyField = state.responseMappingFields.find((f) => f.isMainBody && String(f.key || '').trim() !== '');
|
||||
const responseBody = responseBodyField ? { [responseBodyField.key.trim()]: responseBodyField.value } : {};
|
||||
const responseBody = responseBodyField ? responseBodyField.key.trim() : '';
|
||||
|
||||
// 获取计费字段(可选)
|
||||
const responseTokenField =
|
||||
@@ -1742,11 +1714,11 @@ const onSubmit = () => {
|
||||
timeoutSeconds: state.ruleForm.timeoutSeconds,
|
||||
retryTimes: state.ruleForm.retryTimes,
|
||||
autoCleanSeconds: state.ruleForm.autoCleanSeconds,
|
||||
extendMapping: fieldsToUnknownObject(state.extendMappingFields.filter((f) => String(f.key || '').trim() !== '')),
|
||||
extendMapping: buildExtendMappingPayload(),
|
||||
responseTokenField,
|
||||
tokenConfig: fieldsToUnknownObject(state.tokenConfigFields.filter((f) => String(f.key || '').trim() !== '')),
|
||||
queryConfig: buildQueryConfig(),
|
||||
streamConfig: buildStreamConfig(),
|
||||
streamConfig: undefined,
|
||||
};
|
||||
|
||||
if (state.dialog.type === 'edit') {
|
||||
|
||||
Reference in New Issue
Block a user