feat(shipping-notice): 添加订单抽取功能,支持异步运行和管理,优化相关数据模型和处理逻辑
This commit is contained in:
1 parent
34d489a2d1
commit
ce26d6d0c4
144 files changed
+12241
-4233
No files matched your search
@@ -409,6 +409,7 @@ export interface AdminAgentRegistrySchema {
|
||||
runtime_providers: string[];
|
||||
conversation_modes: string[];
|
||||
dify_app_types: string[];
|
||||
exposure_modes: string[];
|
||||
suggested_questions_styles: string[];
|
||||
default_capabilities: Record<string, boolean>;
|
||||
tool_run_progress_defaults: {
|
||||
@@ -430,6 +431,13 @@ export interface AdminAgentRegistrySchema {
|
||||
default_intent_routes?: string[];
|
||||
progress_contract?: Record<string, unknown> | null;
|
||||
handler_config_schema?: Record<string, unknown>;
|
||||
required_runtime_capabilities?: Record<string, {
|
||||
label?: string;
|
||||
required?: boolean;
|
||||
allowed_runtime_providers?: string[];
|
||||
allowed_dify_app_types?: string[];
|
||||
allowed_exposure_modes?: string[];
|
||||
}>;
|
||||
}>;
|
||||
handler_config_schemas: Record<string, unknown>;
|
||||
content_profile_keys: string[];
|
||||
@@ -477,6 +485,18 @@ export const createAdminAgent = (payload: Record<string, unknown>) =>
|
||||
requestJson('/api/admin/agents', { method: 'POST', ...jsonAuth(), body: JSON.stringify(payload) });
|
||||
export const updateAdminAgent = (id: number, payload: Record<string, unknown>) =>
|
||||
requestJson(`/api/admin/agents/${id}`, { method: 'PUT', ...jsonAuth(), body: JSON.stringify(payload) });
|
||||
export const listAdminAgentRuntimeBindings = (agentId: number) =>
|
||||
requestJson<import('@/features/admin/types/agent.types').AgentRuntimeBindingRow[]>(
|
||||
`/api/admin/agents/${agentId}/runtime-bindings`, auth(),
|
||||
);
|
||||
export const saveAdminAgentRuntimeBinding = (
|
||||
agentId: number,
|
||||
capabilityCode: string,
|
||||
payload: { provider_agent_id: number; enabled: boolean; config: Record<string, number> },
|
||||
) => requestJson<import('@/features/admin/types/agent.types').AgentRuntimeBindingRow>(
|
||||
`/api/admin/agents/${agentId}/runtime-bindings/${capabilityCode}`,
|
||||
{ method: 'PUT', ...jsonAuth(), body: JSON.stringify(payload) },
|
||||
);
|
||||
export const deleteAdminAgent = (id: number) =>
|
||||
requestJson(`/api/admin/agents/${id}`, { method: 'DELETE', ...auth() });
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* features/admin/api/shipping-identity-rules.api.ts
|
||||
* 用途:调用货代可配置客户识别定义和规则集管理 API。
|
||||
* 依赖:requestJson、认证请求头、规则 DTO。
|
||||
* 逻辑:所有写入由后端校验来源适配器、版本锁和自动化风险上限。
|
||||
* 逻辑:所有写入由后端校验已发布上下文字段、版本锁和自动化风险上限。
|
||||
*/
|
||||
|
||||
import { requestJson } from '@/shared/api/client';
|
||||
|
||||
@@ -31,8 +31,13 @@ export const initializeShippingOrderSchema = (payload: { display_name: string; d
|
||||
method: 'POST', body: JSON.stringify(payload), ...jsonAuth(),
|
||||
});
|
||||
|
||||
type ShippingOrderFieldIdentityInput = Pick<
|
||||
ShippingOrderField,
|
||||
'field_code' | 'scope' | 'value_type' | 'field_category' | 'collection_mode'
|
||||
>;
|
||||
|
||||
/** 创建稳定订单字段身份。 */
|
||||
export const createShippingOrderField = (payload: Pick<ShippingOrderField, 'field_code' | 'scope' | 'value_type'>) =>
|
||||
export const createShippingOrderField = (payload: ShippingOrderFieldIdentityInput) =>
|
||||
requestJson<ShippingOrderField>('/api/admin/shipping-order-schema/fields', {
|
||||
method: 'POST', body: JSON.stringify(payload), ...jsonAuth(),
|
||||
});
|
||||
@@ -40,7 +45,7 @@ export const createShippingOrderField = (payload: Pick<ShippingOrderField, 'fiel
|
||||
/** 更新字段系统标识;服务端仍锁定已发布字段的位置和数据格式。 */
|
||||
export const updateShippingOrderField = (
|
||||
fieldId: string,
|
||||
payload: Pick<ShippingOrderField, 'field_code' | 'scope' | 'value_type'>,
|
||||
payload: ShippingOrderFieldIdentityInput,
|
||||
) => requestJson<ShippingOrderField>(`/api/admin/shipping-order-schema/fields/${fieldId}`, {
|
||||
method: 'PUT', body: JSON.stringify(payload), ...jsonAuth(),
|
||||
});
|
||||
|
||||
@@ -66,6 +66,16 @@ const directoryMemberSearch = ref('');
|
||||
|
||||
const showDifyFields = computed(() => props.form.runtime_provider === 'dify' || props.form.runtime_provider === 'hybrid');
|
||||
const showIframeFields = computed(() => props.form.runtime_provider === 'iframe');
|
||||
const orderExtractionCapability = computed(() => (
|
||||
currentCatalogEntry.value?.required_runtime_capabilities?.['shipping.order_extraction']
|
||||
));
|
||||
const orderExtractionProviderOptions = computed(() => props.agentOptions.filter((agent) => (
|
||||
agent.id !== props.form.id
|
||||
&& agent.is_active
|
||||
&& agent.runtime_provider === 'dify'
|
||||
&& agent.dify_app_type === 'workflow'
|
||||
&& agent.exposure_mode === 'internal'
|
||||
)));
|
||||
const showToolRunProgress = computed(() => (
|
||||
showDifyFields.value
|
||||
&& props.form.dify_app_type !== 'workflow'
|
||||
@@ -302,6 +312,14 @@ const handleTrainingQuestionTypeChange = (form: AgentFormState, index: number) =
|
||||
</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="space-y-2">
|
||||
<label class="text-xs font-bold text-muted uppercase tracking-wider">{{ t('admin.agent.runtimeBinding.exposureMode') }}</label>
|
||||
<select v-model="form.exposure_mode" class="w-full input-field text-sm">
|
||||
<option value="workspace">{{ t('admin.agent.runtimeBinding.exposureWorkspace') }}</option>
|
||||
<option value="internal">{{ t('admin.agent.runtimeBinding.exposureInternal') }}</option>
|
||||
</select>
|
||||
<p class="text-xs text-muted">{{ t('admin.agent.runtimeBinding.exposureHint') }}</p>
|
||||
</div>
|
||||
|
||||
<template v-if="showDifyFields">
|
||||
<div class="space-y-2">
|
||||
@@ -334,6 +352,39 @@ const handleTrainingQuestionTypeChange = (form: AgentFormState, index: number) =
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<div v-if="orderExtractionCapability" class="col-span-1 md:col-span-2 rounded-xl border border-default bg-surface-soft p-4">
|
||||
<div class="mb-4">
|
||||
<h4 class="text-sm font-semibold text-primary">{{ t('admin.agent.runtimeBinding.title') }}</h4>
|
||||
<p class="mt-1 text-xs text-muted">{{ t('admin.agent.runtimeBinding.subtitle') }}</p>
|
||||
</div>
|
||||
<div class="grid grid-cols-1 gap-4 md:grid-cols-2">
|
||||
<label class="flex items-center gap-2 text-sm text-secondary">
|
||||
<input v-model="form.order_extraction_binding_enabled" type="checkbox" />
|
||||
{{ t('admin.agent.runtimeBinding.enabled') }}
|
||||
</label>
|
||||
<div class="space-y-2">
|
||||
<label class="text-xs font-bold text-muted uppercase tracking-wider">{{ t('admin.agent.runtimeBinding.provider') }}</label>
|
||||
<select v-model="form.order_extraction_provider_agent_id" class="w-full input-field text-sm">
|
||||
<option :value="null">{{ t('admin.agent.runtimeBinding.selectProvider') }}</option>
|
||||
<option v-for="agent in orderExtractionProviderOptions" :key="agent.id" :value="agent.id">
|
||||
{{ agent.name }} (Workflow #{{ agent.id }})
|
||||
</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="space-y-2">
|
||||
<label class="text-xs font-bold text-muted uppercase tracking-wider">{{ t('admin.agent.runtimeBinding.timeout') }}</label>
|
||||
<input v-model.number="form.order_extraction_timeout_seconds" type="number" min="30" max="3600" class="w-full input-field text-sm" />
|
||||
</div>
|
||||
<div class="space-y-2">
|
||||
<label class="text-xs font-bold text-muted uppercase tracking-wider">{{ t('admin.agent.runtimeBinding.maxAttempts') }}</label>
|
||||
<input v-model.number="form.order_extraction_max_attempts" type="number" min="1" max="10" class="w-full input-field text-sm" />
|
||||
</div>
|
||||
</div>
|
||||
<p v-if="!orderExtractionProviderOptions.length" class="mt-3 text-xs text-amber-700">
|
||||
{{ t('admin.agent.runtimeBinding.noProvider') }}
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<template v-if="showIframeFields">
|
||||
<div class="col-span-1 md:col-span-2 space-y-2">
|
||||
<label class="text-xs font-bold text-muted uppercase tracking-wider">{{ t('admin.agent.fields.iframeUrl') }}</label>
|
||||
|
||||
@@ -17,6 +17,7 @@ import {
|
||||
listAdminContentProfiles,
|
||||
listAdminIntentRoutes,
|
||||
listAdminAgents,
|
||||
listAdminAgentRuntimeBindings,
|
||||
listAdminUsers,
|
||||
saveAdminAgentPermissions,
|
||||
testAdminAgent,
|
||||
@@ -389,6 +390,18 @@ export function useAgentsAdmin() {
|
||||
}
|
||||
isEditing.value = true;
|
||||
void loadTrainingExamPdfGuides(agent.id);
|
||||
if (catalogEntry?.required_runtime_capabilities?.['shipping.order_extraction']) {
|
||||
void listAdminAgentRuntimeBindings(agent.id).then((bindings) => {
|
||||
if (selectedAgentId.value !== agent.id) return;
|
||||
const binding = bindings.find((item) => item.capability_code === 'shipping.order_extraction');
|
||||
form.value.order_extraction_binding_enabled = binding?.enabled !== false;
|
||||
form.value.order_extraction_provider_agent_id = binding?.provider_agent_id ?? null;
|
||||
form.value.order_extraction_timeout_seconds = Number(binding?.config?.timeout_seconds || 900);
|
||||
form.value.order_extraction_max_attempts = Number(binding?.config?.max_attempts || 3);
|
||||
}).catch((error) => {
|
||||
console.error('Error loading Agent runtime bindings:', error);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
const openDeleteConfirm = (
|
||||
@@ -489,6 +502,21 @@ export function useAgentsAdmin() {
|
||||
trainingExtraPatch: {},
|
||||
typeCatalog: typeCatalog.value,
|
||||
});
|
||||
if (catalogEntry?.required_runtime_capabilities?.['shipping.order_extraction']) {
|
||||
if (!form.value.order_extraction_provider_agent_id) {
|
||||
msg.warning(t('admin.agent.runtimeBinding.providerRequired'));
|
||||
isSaving.value = false;
|
||||
return false;
|
||||
}
|
||||
registryPayload.order_extraction_runtime_binding = {
|
||||
provider_agent_id: form.value.order_extraction_provider_agent_id,
|
||||
enabled: form.value.order_extraction_binding_enabled,
|
||||
config: {
|
||||
timeout_seconds: form.value.order_extraction_timeout_seconds,
|
||||
max_attempts: form.value.order_extraction_max_attempts,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
try {
|
||||
const editingId = isEditing.value ? Number(form.value.id) : null;
|
||||
|
||||
@@ -47,6 +47,13 @@ export interface AgentTypeCatalogEntry {
|
||||
progress_contract?: ProgressContract | null;
|
||||
|
||||
handler_config_schema?: Record<string, unknown>;
|
||||
required_runtime_capabilities?: Record<string, {
|
||||
label?: string;
|
||||
required?: boolean;
|
||||
allowed_runtime_providers?: string[];
|
||||
allowed_dify_app_types?: string[];
|
||||
allowed_exposure_modes?: string[];
|
||||
}>;
|
||||
|
||||
}
|
||||
|
||||
@@ -386,6 +393,7 @@ export function mapAgentRowToForm(
|
||||
conversation_mode: agent.conversation_mode || 'chat',
|
||||
|
||||
dify_app_type: agent.dify_app_type === 'workflow' ? 'workflow' : 'chatflow',
|
||||
exposure_mode: agent.exposure_mode === 'internal' ? 'internal' : 'workspace',
|
||||
|
||||
api_base_url: agent.api_base_url || '',
|
||||
|
||||
@@ -533,6 +541,7 @@ export function buildAgentRegistryPayload(
|
||||
conversation_mode: form.conversation_mode,
|
||||
|
||||
dify_app_type: form.dify_app_type,
|
||||
exposure_mode: form.exposure_mode,
|
||||
|
||||
dify_app_id: form.dify_app_id,
|
||||
|
||||
|
||||
+14
-38
@@ -1,8 +1,8 @@
|
||||
<!--
|
||||
features/admin/modules/shipping-identity-rules/ShippingIdentityRulesPage.vue
|
||||
用途:维护来源适配器绑定的客户/送货站点业务识别定义,并发布不可变规则集。
|
||||
用途:维护引用已发布订单上下文字段的客户/送货站点识别定义,并发布不可变规则集。
|
||||
依赖:规则 API、Vue Composition API、Vue I18n。
|
||||
逻辑:平台只提供来源适配器目录;管理员创建业务定义,订单字段仅能选择服务端提供的已发布 Header 字段。
|
||||
逻辑:管理员只能选择服务端提供的已发布识别字段,运行时只消费该字段的已裁决值。
|
||||
-->
|
||||
<script setup lang="ts">
|
||||
import { computed, onMounted, reactive, ref, watch } from 'vue';
|
||||
@@ -31,44 +31,28 @@ const selectedDefinitionIds = ref<string[]>([]);
|
||||
const loading = ref(false);
|
||||
const saving = ref(false);
|
||||
const form = reactive({
|
||||
display_name: '', description: '', evidence_label: '', target_type: 'customer', order_field_id: '',
|
||||
source_adapter_key: 'email_metadata', source_projection: 'email', default_weight: 100,
|
||||
display_name: '', description: '', evidence_label: '', target_type: 'customer', context_field_id: '',
|
||||
default_weight: 100,
|
||||
});
|
||||
|
||||
const selectedDefinitionCount = computed(() => selectedDefinitionIds.value.length);
|
||||
const activeDefinitions = computed(() => catalog.value?.definitions.filter((item) => item.status === 'active') || []);
|
||||
const publishedRuleSet = computed(() => ruleSets.value.find((item) => item.status === 'published') || null);
|
||||
const isOrderFieldSource = computed(() => form.source_adapter_key === 'order_field');
|
||||
const isEmailSource = computed(() => form.source_adapter_key === 'email_metadata');
|
||||
const isTemplateSource = computed(() => form.source_adapter_key === 'document_template');
|
||||
const selectedAutomation = computed(() => {
|
||||
const adapter = catalog.value?.catalog.source_adapters.find((item) => item.key === form.source_adapter_key);
|
||||
const option = isEmailSource.value ? form.source_projection : isTemplateSource.value ? 'template' : '';
|
||||
return option ? adapter?.options[option]?.max_automation || 'none' : 'none';
|
||||
const field = catalog.value?.context_fields.find((item) => item.field_id === form.context_field_id);
|
||||
return field?.field_category === 'general_context' && form.target_type === 'customer' ? 'conditional' : 'none';
|
||||
});
|
||||
|
||||
/** 说明当前来源实际从何处取值和自动化边界,帮助管理员在提交前理解选择结果。 */
|
||||
const selectedSourceHint = computed(() => {
|
||||
const adapter = catalog.value?.catalog.source_adapters.find((item) => item.key === form.source_adapter_key);
|
||||
return adapter?.description || '';
|
||||
const field = catalog.value?.context_fields.find((item) => item.field_id === form.context_field_id);
|
||||
return field ? `${field.display_name} (${field.field_code})` : t('admin.shippingIdentityRules.selectFieldHint');
|
||||
});
|
||||
|
||||
const sourceDisplay = (definition: { source_adapter_key: string; source_selector: Record<string, unknown>; order_field?: { field_code: string; display_name?: string } | null }): string => {
|
||||
const adapter = catalog.value?.catalog.source_adapters.find((item) => item.key === definition.source_adapter_key);
|
||||
if (definition.source_adapter_key === 'order_field') return definition.order_field?.display_name || definition.order_field?.field_code || adapter?.display_name || '';
|
||||
if (definition.source_adapter_key === 'email_metadata') {
|
||||
const option = adapter?.options[String(definition.source_selector.projection)];
|
||||
return option?.display_name || adapter?.display_name || '';
|
||||
}
|
||||
return adapter?.options.template?.display_name || adapter?.display_name || '';
|
||||
const sourceDisplay = (definition: { context_field?: { field_code: string; display_name?: string } | null }): string => {
|
||||
return definition.context_field?.display_name || definition.context_field?.field_code || '';
|
||||
};
|
||||
|
||||
watch(() => form.source_adapter_key, (adapter) => {
|
||||
if (adapter === 'email_metadata') Object.assign(form, { target_type: 'customer', source_projection: 'email', order_field_id: '' });
|
||||
if (adapter === 'document_template') Object.assign(form, { target_type: 'customer', order_field_id: '' });
|
||||
if (adapter === 'order_field') Object.assign(form, { target_type: 'site' });
|
||||
});
|
||||
|
||||
watch(selectedRuleSet, (ruleSet) => {
|
||||
selectedDefinitionIds.value = ruleSet?.definition?.definitions.map((item) => item.id) || [];
|
||||
}, { immediate: true });
|
||||
@@ -94,12 +78,7 @@ const load = async (): Promise<void> => {
|
||||
const saveDefinition = async (): Promise<void> => {
|
||||
saving.value = true;
|
||||
try {
|
||||
const source_selector = isOrderFieldSource.value
|
||||
? { order_field_id: form.order_field_id }
|
||||
: isEmailSource.value
|
||||
? { attribute: 'email.from', projection: form.source_projection }
|
||||
: { document: 'primary' };
|
||||
await saveShippingIdentityDefinition({ ...form, source_selector });
|
||||
await saveShippingIdentityDefinition({ ...form });
|
||||
Object.assign(form, { display_name: '', description: '', evidence_label: '' });
|
||||
await load();
|
||||
message.success(t('admin.shippingIdentityRules.definitionSaved'));
|
||||
@@ -215,15 +194,12 @@ onMounted(() => { void load(); });
|
||||
<div class="identity-form-title"><Plus class="h-4 w-4" /><strong>{{ t('admin.shippingIdentityRules.addDefinition') }}</strong></div>
|
||||
<p class="identity-form-guide">{{ t('admin.shippingIdentityRules.formGuide') }}</p>
|
||||
<label><span>{{ t('admin.shippingIdentityRules.displayName') }}</span><input v-model="form.display_name" required class="input-field" :placeholder="t('admin.shippingIdentityRules.displayNamePlaceholder')"></label>
|
||||
<label><span>{{ t('admin.shippingIdentityRules.source') }}</span><select v-model="form.source_adapter_key" class="input-field"><option v-for="adapter in catalog?.catalog.source_adapters" :key="adapter.key" :value="adapter.key">{{ adapter.display_name }}</option></select></label>
|
||||
<label><span>{{ t('admin.shippingIdentityRules.target') }}</span><select v-model="form.target_type" class="input-field" :disabled="!isOrderFieldSource"><option value="customer">{{ t('admin.shippingIdentityRules.targets.customer') }}</option><option value="site">{{ t('admin.shippingIdentityRules.targets.site') }}</option></select></label>
|
||||
<label v-if="isEmailSource"><span>{{ t('admin.shippingIdentityRules.emailType') }}</span><select v-model="form.source_projection" class="input-field"><option value="email">{{ catalog?.catalog.source_adapters.find((item) => item.key === 'email_metadata')?.options.email?.display_name }}</option><option value="domain">{{ catalog?.catalog.source_adapters.find((item) => item.key === 'email_metadata')?.options.domain?.display_name }}</option></select></label>
|
||||
<label v-if="isOrderFieldSource"><span>{{ t('admin.shippingIdentityRules.selectField') }}</span><select v-model="form.order_field_id" required class="input-field"><option value="">{{ t('admin.shippingIdentityRules.selectField') }}</option><option v-for="field in catalog?.order_fields" :key="field.field_id" :value="field.field_id">{{ field.display_name }}</option></select></label>
|
||||
<label v-if="isTemplateSource"><span>{{ t('admin.shippingIdentityRules.source') }}</span><div class="identity-static-field">{{ t('admin.shippingIdentityRules.templateValue') }}</div></label>
|
||||
<label><span>{{ t('admin.shippingIdentityRules.selectField') }}</span><select v-model="form.context_field_id" required class="input-field"><option value="">{{ t('admin.shippingIdentityRules.selectField') }}</option><option v-for="field in catalog?.context_fields" :key="field.field_id" :value="field.field_id">{{ field.display_name }}</option></select></label>
|
||||
<label><span>{{ t('admin.shippingIdentityRules.target') }}</span><select v-model="form.target_type" class="input-field"><option value="customer">{{ t('admin.shippingIdentityRules.targets.customer') }}</option><option value="site">{{ t('admin.shippingIdentityRules.targets.site') }}</option></select></label>
|
||||
<label><span>{{ t('admin.shippingIdentityRules.evidenceLabel') }}</span><input v-model="form.evidence_label" required class="input-field" :placeholder="t('admin.shippingIdentityRules.evidenceLabelPlaceholder')"></label>
|
||||
<label><span>{{ t('admin.shippingIdentityRules.description') }}</span><input v-model="form.description" class="input-field" :placeholder="t('admin.shippingIdentityRules.descriptionPlaceholder')"></label>
|
||||
<div class="identity-source-help"><strong>{{ t('admin.shippingIdentityRules.selectionResult') }}</strong><span>{{ selectedSourceHint }}</span><small>{{ t(`admin.shippingIdentityRules.automations.${selectedAutomation}`) }}</small></div>
|
||||
<button type="submit" class="btn-primary identity-definition-form__submit" :disabled="saving || (isOrderFieldSource && !form.order_field_id)"><Plus class="h-4 w-4" />{{ t('admin.shippingIdentityRules.addDefinition') }}</button>
|
||||
<button type="submit" class="btn-primary identity-definition-form__submit" :disabled="saving || !form.context_field_id"><Plus class="h-4 w-4" />{{ t('admin.shippingIdentityRules.addDefinition') }}</button>
|
||||
</form>
|
||||
</section>
|
||||
|
||||
|
||||
+118
-32
@@ -32,6 +32,7 @@ import SchemaVersionHistoryDrawer from '@/features/admin/modules/shipping-order-
|
||||
import SchemaVersionDiffDrawer from '@/features/admin/modules/shipping-order-schema/components/SchemaVersionDiffDrawer.vue';
|
||||
import SchemaVersionUsageDrawer from '@/features/admin/modules/shipping-order-schema/components/SchemaVersionUsageDrawer.vue';
|
||||
import SchemaExtractionAuditDrawer from '@/features/admin/modules/shipping-order-schema/components/SchemaExtractionAuditDrawer.vue';
|
||||
import { contextOptionLabelKey, fieldShapeForCategory } from './shippingOrderField.utils';
|
||||
import type {
|
||||
ShippingOrderField,
|
||||
ShippingOrderFieldConfig,
|
||||
@@ -44,7 +45,7 @@ import type {
|
||||
} from '@/features/admin/types/shipping-order-schema.types';
|
||||
|
||||
type DraftFieldEditor = ShippingOrderFieldConfig & { enabled: boolean };
|
||||
type FieldScope = 'header' | 'line';
|
||||
type FieldCategory = ShippingOrderField['field_category'];
|
||||
|
||||
const { t } = useI18n();
|
||||
const message = useMessage();
|
||||
@@ -54,7 +55,10 @@ defineProps<{ embedded?: boolean }>();
|
||||
const state = ref<ShippingOrderSchemaState | null>(null);
|
||||
const loading = ref(false);
|
||||
const saving = ref(false);
|
||||
const fieldForm = reactive({ field_code: '', scope: 'line' as 'header' | 'line', value_type: 'string' as const });
|
||||
const fieldForm = reactive({
|
||||
field_code: '', field_category: 'order_line' as FieldCategory,
|
||||
value_type: 'string' as ShippingOrderField['value_type'], context_provider_option_id: null as number | null,
|
||||
});
|
||||
const schemaForm = reactive({ display_name: '发货订单字段', description: '' });
|
||||
const draftFields = ref<DraftFieldEditor[]>([]);
|
||||
const changeNote = ref('');
|
||||
@@ -63,7 +67,9 @@ const editingFieldCode = ref('');
|
||||
const pendingRemoval = ref<{ field: ShippingOrderField; index: number } | null>(null);
|
||||
const fieldSearch = ref('');
|
||||
const showNewFieldForm = ref(false);
|
||||
const expandedGroups = reactive<Record<FieldScope, boolean>>({ header: false, line: false });
|
||||
const expandedGroups = reactive<Record<FieldCategory, boolean>>({
|
||||
general_context: false, order_header: false, order_line: false,
|
||||
});
|
||||
const groupExpansionInitialized = ref(false);
|
||||
const historyOpen = ref(false);
|
||||
const historyLoading = ref(false);
|
||||
@@ -98,8 +104,20 @@ const selectedPublishedField = computed(() => (
|
||||
const selectedRuleConfig = computed(() => draft.value ? selectedDraftField.value : selectedPublishedField.value);
|
||||
const isReadOnly = computed(() => !draft.value);
|
||||
const comparisonTarget = computed(() => draft.value || published.value || null);
|
||||
const activeContextOptions = computed(() => (state.value?.context_providers || [])
|
||||
.filter((provider) => provider.status === 'active')
|
||||
.flatMap((provider) => provider.options
|
||||
.filter((option) => option.status === 'active' && option.registered)
|
||||
.map((option) => ({ ...option, provider_key: provider.provider_key }))));
|
||||
const selectedIsContext = computed(() => selectedField.value?.field_category === 'general_context');
|
||||
const selectedContextOption = computed(() => activeContextOptions.value.find(
|
||||
(item) => item.id === contextOptionId(selectedRuleConfig.value || {} as ShippingOrderFieldConfig),
|
||||
) || null);
|
||||
const selectedExposurePolicies = computed(() => (
|
||||
selectedContextOption.value?.allowed_dify_exposure_policies || ['never']
|
||||
));
|
||||
|
||||
/** 左侧字段字典按显示名称和字段编号搜索,并保持订单信息/货品明细分组。 */
|
||||
/** 左侧字段字典按显示名称和字段编号搜索,并保持通用上下文/订单信息/货品明细分组。 */
|
||||
const groupedFields = computed(() => {
|
||||
const query = fieldSearch.value.trim().toLocaleLowerCase();
|
||||
const fields = (state.value?.fields || []).filter((field) => {
|
||||
@@ -108,26 +126,27 @@ const groupedFields = computed(() => {
|
||||
return label.includes(query) || field.field_code.toLocaleLowerCase().includes(query);
|
||||
});
|
||||
return [
|
||||
{ scope: 'header' as const, fields: fields.filter((field) => field.scope === 'header') },
|
||||
{ scope: 'line' as const, fields: fields.filter((field) => field.scope === 'line') },
|
||||
{ category: 'general_context' as const, fields: fields.filter((field) => field.field_category === 'general_context') },
|
||||
{ category: 'order_header' as const, fields: fields.filter((field) => field.field_category === 'order_header') },
|
||||
{ category: 'order_line' as const, fields: fields.filter((field) => field.field_category === 'order_line') },
|
||||
].filter((group) => group.fields.length);
|
||||
});
|
||||
|
||||
/** 搜索期间自动展开命中分组;清空搜索后自然恢复用户原来的展开状态。 */
|
||||
const groupIsExpanded = (scope: FieldScope): boolean => Boolean(fieldSearch.value.trim()) || expandedGroups[scope];
|
||||
const groupIsExpanded = (category: FieldCategory): boolean => Boolean(fieldSearch.value.trim()) || expandedGroups[category];
|
||||
|
||||
/** 独立切换字段分组;搜索期间保持结果展开,避免隐藏匹配项。 */
|
||||
const toggleGroup = (scope: FieldScope): void => {
|
||||
const toggleGroup = (category: FieldCategory): void => {
|
||||
if (fieldSearch.value.trim()) return;
|
||||
expandedGroups[scope] = !expandedGroups[scope];
|
||||
expandedGroups[category] = !expandedGroups[category];
|
||||
};
|
||||
|
||||
/** 折叠标题提示当前选中字段位于该组,避免用户误以为选择已经丢失。 */
|
||||
const groupHasSelectedField = (scope: FieldScope): boolean => selectedField.value?.scope === scope;
|
||||
const groupHasSelectedField = (category: FieldCategory): boolean => selectedField.value?.field_category === category;
|
||||
|
||||
watch(selectedField, (field) => {
|
||||
editingFieldCode.value = field?.field_code || '';
|
||||
if (field) expandedGroups[field.scope] = true;
|
||||
if (field) expandedGroups[field.field_category] = true;
|
||||
}, { immediate: true });
|
||||
|
||||
/** 展示 API 层已本地化的错误,并为未知错误提供页面级兜底。 */
|
||||
@@ -296,6 +315,38 @@ const defaultRule = (field: ShippingOrderField): Pick<ShippingOrderFieldConfig,
|
||||
comparator_key: state.value?.catalog.type_comparators[field.value_type]?.[0] || 'normalized_text',
|
||||
});
|
||||
|
||||
/** 为确定性上下文字段恢复版本来源 ID,旧快照只读时仍保留来源展示信息。 */
|
||||
const contextOptionId = (config: ShippingOrderFieldConfig): number | undefined =>
|
||||
config.context_provider_option_id || config.context_source?.provider_option_id;
|
||||
|
||||
/** 优先使用四语言来源名称,未来新增来源未补文案时才回退数据库展示名。 */
|
||||
const contextOptionLabel = (providerKey: string, optionKey: string, fallback: string): string => {
|
||||
const key = contextOptionLabelKey(providerKey, optionKey);
|
||||
return key ? t(key) : fallback;
|
||||
};
|
||||
|
||||
/** 从不可变版本快照展示来源;即使数据库目录后来停用,也不能让历史配置显示为空。 */
|
||||
const contextSourceDisplay = (config: ShippingOrderFieldConfig): string => {
|
||||
const source = config.context_source;
|
||||
if (!source) return t('admin.shippingOrderSchema.selectContextSource');
|
||||
return contextOptionLabel(source.provider_key, source.option_key, source.source_key);
|
||||
};
|
||||
|
||||
/** 判断草稿快照来源是否仍在当前可用目录,失效来源只作为不可选旧值保留。 */
|
||||
const contextSourceIsActive = (config: ShippingOrderFieldConfig): boolean => {
|
||||
const optionId = contextOptionId(config);
|
||||
return optionId !== undefined && activeContextOptions.value.some((item) => item.id === optionId);
|
||||
};
|
||||
|
||||
/** 切换确定性来源时同步校正暴露策略,禁止页面提交后端未声明的组合。 */
|
||||
const syncContextExposurePolicy = (config: ShippingOrderFieldConfig): void => {
|
||||
const option = activeContextOptions.value.find((item) => item.id === contextOptionId(config));
|
||||
const allowed = option?.allowed_dify_exposure_policies || ['never'];
|
||||
if (!config.dify_exposure_policy || !allowed.includes(config.dify_exposure_policy)) {
|
||||
config.dify_exposure_policy = option?.default_dify_exposure_policy || 'never';
|
||||
}
|
||||
};
|
||||
|
||||
/** 将草稿字段配置同步到本地编辑状态,并保留未纳入版本的 active 字段供管理员选择。 */
|
||||
const syncDraftFields = (): void => {
|
||||
const existing = draft.value?.definition?.fields || [];
|
||||
@@ -320,7 +371,11 @@ const syncDraftFields = (): void => {
|
||||
},
|
||||
relation_role: null,
|
||||
extraction_instruction: '',
|
||||
sensitivity_level: field.field_category === 'general_context' ? 'low' : 'confidential',
|
||||
dify_exposure_policy: 'never',
|
||||
available_for_customer_identity: false,
|
||||
}),
|
||||
context_provider_option_id: contextOptionId(byId.get(field.id) || {} as ShippingOrderFieldConfig),
|
||||
enabled: byId.has(field.id) ? byId.get(field.id)?.enabled !== false : false,
|
||||
}));
|
||||
changeNote.value = draft.value?.change_note || '';
|
||||
@@ -328,10 +383,11 @@ const syncDraftFields = (): void => {
|
||||
selectedDraftFieldId.value = draftFields.value[0]?.field_id || null;
|
||||
}
|
||||
if (!groupExpansionInitialized.value) {
|
||||
expandedGroups.header = false;
|
||||
expandedGroups.line = false;
|
||||
const initialScope = state.value?.fields.find((item) => item.id === selectedDraftFieldId.value)?.scope;
|
||||
if (initialScope) expandedGroups[initialScope] = true;
|
||||
expandedGroups.general_context = false;
|
||||
expandedGroups.order_header = false;
|
||||
expandedGroups.order_line = false;
|
||||
const initialCategory = state.value?.fields.find((item) => item.id === selectedDraftFieldId.value)?.field_category;
|
||||
if (initialCategory) expandedGroups[initialCategory] = true;
|
||||
groupExpansionInitialized.value = true;
|
||||
}
|
||||
};
|
||||
@@ -368,26 +424,43 @@ const saveField = async (): Promise<void> => {
|
||||
saving.value = true;
|
||||
try {
|
||||
const fieldCode = fieldForm.field_code.trim().toLowerCase();
|
||||
const payload = {
|
||||
const isContext = fieldForm.field_category === 'general_context';
|
||||
const shape = fieldShapeForCategory(fieldForm.field_category);
|
||||
const payload: Pick<
|
||||
ShippingOrderField,
|
||||
'field_code' | 'scope' | 'value_type' | 'field_category' | 'collection_mode'
|
||||
> = {
|
||||
field_code: fieldCode,
|
||||
scope: fieldForm.scope,
|
||||
value_type: fieldForm.value_type,
|
||||
scope: shape.scope,
|
||||
value_type: isContext ? shape.value_type : fieldForm.value_type,
|
||||
field_category: fieldForm.field_category,
|
||||
collection_mode: shape.collection_mode,
|
||||
};
|
||||
const savedField = await createShippingOrderField(payload);
|
||||
if (!draft.value) {
|
||||
await createShippingOrderSchemaDraft({ copy_from_version_id: published.value?.id });
|
||||
await load();
|
||||
}
|
||||
// Reload the catalog before editing the new config; an existing draft does not contain the field yet.
|
||||
await load();
|
||||
selectedDraftFieldId.value = savedField.id;
|
||||
const savedConfig = draftFields.value.find((item) => item.field_id === savedField.id);
|
||||
if (savedConfig) {
|
||||
savedConfig.display_name = fieldCode;
|
||||
savedConfig.enabled = true;
|
||||
if (isContext && fieldForm.context_provider_option_id) {
|
||||
const option = activeContextOptions.value.find((item) => item.id === fieldForm.context_provider_option_id);
|
||||
savedConfig.context_provider_option_id = fieldForm.context_provider_option_id;
|
||||
savedConfig.aliases = [];
|
||||
savedConfig.extraction_instruction = null;
|
||||
savedConfig.evidence_policy.required = false;
|
||||
savedConfig.evidence_policy.source_precedence = [];
|
||||
savedConfig.dify_exposure_policy = option?.default_dify_exposure_policy || 'never';
|
||||
}
|
||||
await saveDraft();
|
||||
}
|
||||
await load();
|
||||
selectedDraftFieldId.value = savedField.id;
|
||||
Object.assign(fieldForm, { field_code: '', scope: 'line', value_type: 'string' });
|
||||
Object.assign(fieldForm, { field_code: '', field_category: 'order_line', value_type: 'string', context_provider_option_id: null });
|
||||
showNewFieldForm.value = false;
|
||||
message.success(t('admin.shippingOrderSchema.fieldCreated'));
|
||||
} catch (error) {
|
||||
@@ -409,6 +482,8 @@ const saveFieldCode = async (): Promise<void> => {
|
||||
field_code: fieldCode,
|
||||
scope: field.scope,
|
||||
value_type: field.value_type,
|
||||
field_category: field.field_category,
|
||||
collection_mode: field.collection_mode,
|
||||
});
|
||||
Object.assign(field, savedField);
|
||||
editingFieldCode.value = savedField.field_code;
|
||||
@@ -618,7 +693,8 @@ onMounted(async () => {
|
||||
</div>
|
||||
<form v-if="showNewFieldForm" class="new-field-form" @submit.prevent="saveField">
|
||||
<label><span>{{ t('admin.shippingOrderSchema.businessFieldName') }}</span><input v-model="fieldForm.field_code" required :placeholder="t('admin.shippingOrderSchema.businessFieldNamePlaceholder')"><small>{{ t('admin.shippingOrderSchema.businessFieldNameHint') }}</small></label>
|
||||
<div class="form-grid"><label><span>{{ t('admin.shippingOrderSchema.businessFieldPlacement') }}</span><select v-model="fieldForm.scope"><option value="header">{{ t('admin.shippingOrderSchema.placementHeader') }}</option><option value="line">{{ t('admin.shippingOrderSchema.placementLine') }}</option></select></label><label><span>{{ t('admin.shippingOrderSchema.businessFieldFormat') }}</span><select v-model="fieldForm.value_type"><option v-for="item in state.catalog.field_types" :key="item" :value="item">{{ t(`admin.shippingOrderSchema.fieldType.${item}`) }}</option></select></label></div>
|
||||
<div class="form-grid"><label><span>{{ t('admin.shippingOrderSchema.fieldCategory') }}</span><select v-model="fieldForm.field_category"><option value="general_context">{{ t('admin.shippingOrderSchema.fieldCategoryOption.general_context') }}</option><option value="order_header">{{ t('admin.shippingOrderSchema.fieldCategoryOption.order_header') }}</option><option value="order_line">{{ t('admin.shippingOrderSchema.fieldCategoryOption.order_line') }}</option></select></label><label><span>{{ t('admin.shippingOrderSchema.businessFieldFormat') }}</span><select v-model="fieldForm.value_type" :disabled="fieldForm.field_category === 'general_context'"><option v-for="item in state.catalog.field_types" :key="item" :value="item">{{ t(`admin.shippingOrderSchema.fieldType.${item}`) }}</option></select></label></div>
|
||||
<label v-if="fieldForm.field_category === 'general_context'"><span>{{ t('admin.shippingOrderSchema.contextSource') }}</span><select v-model="fieldForm.context_provider_option_id" required><option :value="null" disabled>{{ t('admin.shippingOrderSchema.selectContextSource') }}</option><option v-for="item in activeContextOptions" :key="item.id" :value="item.id">{{ contextOptionLabel(item.provider_key, item.option_key, item.display_name) }}</option></select><small>{{ t('admin.shippingOrderSchema.contextSourceHint') }}</small></label>
|
||||
<div class="form-actions"><button :disabled="saving" class="primary-button">{{ t('admin.shippingOrderSchema.addField') }}</button></div>
|
||||
</form>
|
||||
<div class="field-search">
|
||||
@@ -626,17 +702,17 @@ onMounted(async () => {
|
||||
<span>{{ t('admin.shippingOrderSchema.fieldCount', { count: state.fields.length }) }}</span>
|
||||
</div>
|
||||
<div class="field-list">
|
||||
<section v-for="group in groupedFields" :key="group.scope" class="field-group">
|
||||
<section v-for="group in groupedFields" :key="group.category" class="field-group">
|
||||
<button
|
||||
type="button"
|
||||
class="field-group-toggle"
|
||||
:aria-expanded="groupIsExpanded(group.scope)"
|
||||
@click="toggleGroup(group.scope)"
|
||||
:aria-expanded="groupIsExpanded(group.category)"
|
||||
@click="toggleGroup(group.category)"
|
||||
>
|
||||
<span class="field-group-title"><i :class="{ expanded: groupIsExpanded(group.scope) }">›</i>{{ t(`admin.shippingOrderSchema.placement.${group.scope}`) }}</span>
|
||||
<span class="field-group-summary"><b v-if="!groupIsExpanded(group.scope) && groupHasSelectedField(group.scope)">{{ t('admin.shippingOrderSchema.selectedInGroup') }}</b><em>{{ group.fields.length }}</em></span>
|
||||
<span class="field-group-title"><i :class="{ expanded: groupIsExpanded(group.category) }">›</i>{{ t(`admin.shippingOrderSchema.fieldCategoryOption.${group.category}`) }}</span>
|
||||
<span class="field-group-summary"><b v-if="!groupIsExpanded(group.category) && groupHasSelectedField(group.category)">{{ t('admin.shippingOrderSchema.selectedInGroup') }}</b><em>{{ group.fields.length }}</em></span>
|
||||
</button>
|
||||
<div v-if="groupIsExpanded(group.scope)" class="field-group-items">
|
||||
<div v-if="groupIsExpanded(group.category)" class="field-group-items">
|
||||
<div v-for="(field, index) in group.fields" :key="field.id" class="field-item" :class="{ selected: selectedDraftFieldId === field.id, retired: field.status !== 'active' }">
|
||||
<button type="button" class="field-select" :disabled="field.status !== 'active'" @click="selectedDraftFieldId = field.id">
|
||||
<span class="field-identity"><strong>{{ displayNameForField(field, index) }}</strong><code :title="field.field_code">{{ field.field_code }}</code></span>
|
||||
@@ -667,12 +743,20 @@ onMounted(async () => {
|
||||
<div class="rule-basics">
|
||||
<label><span>{{ t('admin.shippingOrderSchema.displayName') }}</span><input v-model="selectedRuleConfig.display_name" :disabled="isReadOnly"></label>
|
||||
<label><span>{{ t('admin.shippingOrderSchema.fieldName') }}</span><input v-model="editingFieldCode" :disabled="isReadOnly" @change="saveFieldCode"></label>
|
||||
<label><span>{{ t('admin.shippingOrderSchema.businessPurpose') }}</span><select v-model="selectedRuleConfig.business_purpose" :disabled="isReadOnly || !selectedDraftField?.enabled || fieldFor(selectedRuleConfig)?.scope !== 'line'"><option v-for="item in ['general', 'part_number', 'quantity', 'reservation_id', 'inventory_source_hint']" :key="item" :value="item">{{ t(`admin.shippingOrderSchema.businessPurposeOption.${item}`) }}</option></select></label>
|
||||
<label class="span-two"><span>{{ t('admin.shippingOrderSchema.aliases') }}</span><input :value="selectedRuleConfig.aliases.join(', ')" :disabled="isReadOnly || !selectedDraftField?.enabled" @input="!isReadOnly && (selectedRuleConfig.aliases = splitValues(($event.target as HTMLInputElement).value))"></label>
|
||||
<label class="span-two"><span>{{ t('admin.shippingOrderSchema.extractionInstruction') }}</span><textarea v-model="selectedRuleConfig.extraction_instruction" :disabled="isReadOnly || !selectedDraftField?.enabled" :placeholder="t('admin.shippingOrderSchema.extractionInstructionPlaceholder')"></textarea></label>
|
||||
<template v-if="selectedIsContext">
|
||||
<label class="span-two"><span>{{ t('admin.shippingOrderSchema.contextSource') }}</span><input v-if="isReadOnly" :value="contextSourceDisplay(selectedRuleConfig)" disabled><select v-else v-model="selectedRuleConfig.context_provider_option_id" @change="syncContextExposurePolicy(selectedRuleConfig)"><option v-if="contextOptionId(selectedRuleConfig) && !contextSourceIsActive(selectedRuleConfig)" :value="contextOptionId(selectedRuleConfig)" disabled>{{ contextSourceDisplay(selectedRuleConfig) }}</option><option v-for="item in activeContextOptions" :key="item.id" :value="item.id">{{ contextOptionLabel(item.provider_key, item.option_key, item.display_name) }}</option></select></label>
|
||||
<div class="span-two context-field-note"><strong>{{ t('admin.shippingOrderSchema.deterministicCollection') }}</strong><span>{{ t('admin.shippingOrderSchema.deterministicCollectionHint') }}</span></div>
|
||||
<label class="span-two"><span>{{ t('admin.shippingOrderSchema.difyExposurePolicy') }}</span><select v-model="selectedRuleConfig.dify_exposure_policy" :disabled="isReadOnly"><option v-for="policy in selectedExposurePolicies" :key="policy" :value="policy">{{ t(`admin.shippingOrderSchema.difyExposurePolicyOption.${policy}`) }}</option></select><small>{{ t(`admin.shippingOrderSchema.difyExposurePolicyHint.${selectedRuleConfig.dify_exposure_policy || 'never'}`) }}</small></label>
|
||||
<label class="span-two"><input v-model="selectedRuleConfig.available_for_customer_identity" :disabled="isReadOnly" type="checkbox"><span>{{ t('admin.shippingOrderSchema.availableForCustomerIdentity') }}</span></label>
|
||||
</template>
|
||||
<template v-else>
|
||||
<label><span>{{ t('admin.shippingOrderSchema.businessPurpose') }}</span><select v-model="selectedRuleConfig.business_purpose" :disabled="isReadOnly || !selectedDraftField?.enabled || fieldFor(selectedRuleConfig)?.scope !== 'line'"><option v-for="item in ['general', 'part_number', 'quantity', 'reservation_id', 'inventory_source_hint']" :key="item" :value="item">{{ t(`admin.shippingOrderSchema.businessPurposeOption.${item}`) }}</option></select></label>
|
||||
<label class="span-two"><span>{{ t('admin.shippingOrderSchema.aliases') }}</span><input :value="selectedRuleConfig.aliases.join(', ')" :disabled="isReadOnly || !selectedDraftField?.enabled" @input="!isReadOnly && (selectedRuleConfig.aliases = splitValues(($event.target as HTMLInputElement).value))"></label>
|
||||
<label class="span-two"><span>{{ t('admin.shippingOrderSchema.extractionInstruction') }}</span><textarea v-model="selectedRuleConfig.extraction_instruction" :disabled="isReadOnly || !selectedDraftField?.enabled" :placeholder="t('admin.shippingOrderSchema.extractionInstructionPlaceholder')"></textarea></label>
|
||||
</template>
|
||||
</div>
|
||||
<div class="rule-switches"><label><input v-model="selectedRuleConfig.required" :disabled="isReadOnly || !selectedDraftField?.enabled" type="checkbox"><span><strong>{{ t('admin.shippingOrderSchema.required') }}</strong></span></label><label><input v-model="selectedRuleConfig.evidence_policy.required" :disabled="isReadOnly || !selectedDraftField?.enabled" type="checkbox"><span><strong>{{ t('admin.shippingOrderSchema.evidenceRequired') }}</strong></span></label><label><input v-model="selectedRuleConfig.evidence_policy.allow_single_source" :disabled="isReadOnly || !selectedDraftField?.enabled" type="checkbox"><span><strong>{{ t('admin.shippingOrderSchema.allowSingleSource') }}</strong></span></label></div>
|
||||
<details class="advanced-rules"><summary>{{ t('admin.shippingOrderSchema.advancedRules') }}</summary><div class="advanced-content"><div class="rule-grid"><label><span>{{ t('admin.shippingOrderSchema.normalizer') }}</span><select v-model="selectedRuleConfig.normalizer_key" :disabled="isReadOnly || !selectedDraftField?.enabled"><option v-for="item in compatibleRules(selectedRuleConfig, 'type_normalizers')" :key="item" :value="item">{{ ruleLabel(item) }}</option></select></label><label><span>{{ t('admin.shippingOrderSchema.comparator') }}</span><select v-model="selectedRuleConfig.comparator_key" :disabled="isReadOnly || !selectedDraftField?.enabled"><option v-for="item in compatibleRules(selectedRuleConfig, 'type_comparators')" :key="item" :value="item">{{ ruleLabel(item) }}</option></select></label><label><span>{{ t('admin.shippingOrderSchema.relationRole') }}</span><select v-model="selectedRuleConfig.relation_role" :disabled="isReadOnly || !selectedDraftField?.enabled"><option :value="null">{{ t('admin.shippingOrderSchema.notSet') }}</option><option v-for="item in state.catalog.relation_roles" :key="item" :value="item">{{ ruleLabel(item) }}</option></select></label><label><span>{{ t('admin.shippingOrderSchema.conflictPolicy') }}</span><select v-model="selectedRuleConfig.evidence_policy.conflict_policy" :disabled="isReadOnly || !selectedDraftField?.enabled"><option v-for="item in state.catalog.conflict_policies" :key="item" :value="item">{{ ruleLabel(item) }}</option></select></label></div><fieldset><legend>{{ t('admin.shippingOrderSchema.validators') }}</legend><div class="check-row"><label v-for="item in compatibleRules(selectedRuleConfig, 'type_validators')" :key="item"><input :checked="selectedRuleConfig.validator_keys.includes(item)" :disabled="isReadOnly || !selectedDraftField?.enabled" type="checkbox" @change="!isReadOnly && (selectedRuleConfig.validator_keys = toggleValue(selectedRuleConfig.validator_keys, item))">{{ ruleLabel(item) }}</label></div></fieldset><fieldset><legend>{{ t('admin.shippingOrderSchema.sourcePrecedence') }}</legend><div class="check-row"><label v-for="item in state.catalog.source_types" :key="item"><input :checked="selectedRuleConfig.evidence_policy.source_precedence.includes(item)" :disabled="isReadOnly || !selectedDraftField?.enabled" type="checkbox" @change="!isReadOnly && (selectedRuleConfig.evidence_policy.source_precedence = toggleValue(selectedRuleConfig.evidence_policy.source_precedence, item))">{{ sourceLabel(item) }}</label></div></fieldset></div></details>
|
||||
<template v-if="!selectedIsContext"><div class="rule-switches"><label><input v-model="selectedRuleConfig.required" :disabled="isReadOnly || !selectedDraftField?.enabled" type="checkbox"><span><strong>{{ t('admin.shippingOrderSchema.required') }}</strong></span></label><label><input v-model="selectedRuleConfig.evidence_policy.required" :disabled="isReadOnly || !selectedDraftField?.enabled" type="checkbox"><span><strong>{{ t('admin.shippingOrderSchema.evidenceRequired') }}</strong></span></label><label><input v-model="selectedRuleConfig.evidence_policy.allow_single_source" :disabled="isReadOnly || !selectedDraftField?.enabled" type="checkbox"><span><strong>{{ t('admin.shippingOrderSchema.allowSingleSource') }}</strong></span></label></div>
|
||||
<details class="advanced-rules"><summary>{{ t('admin.shippingOrderSchema.advancedRules') }}</summary><div class="advanced-content"><div class="rule-grid"><label><span>{{ t('admin.shippingOrderSchema.normalizer') }}</span><select v-model="selectedRuleConfig.normalizer_key" :disabled="isReadOnly || !selectedDraftField?.enabled"><option v-for="item in compatibleRules(selectedRuleConfig, 'type_normalizers')" :key="item" :value="item">{{ ruleLabel(item) }}</option></select></label><label><span>{{ t('admin.shippingOrderSchema.comparator') }}</span><select v-model="selectedRuleConfig.comparator_key" :disabled="isReadOnly || !selectedDraftField?.enabled"><option v-for="item in compatibleRules(selectedRuleConfig, 'type_comparators')" :key="item" :value="item">{{ ruleLabel(item) }}</option></select></label><label><span>{{ t('admin.shippingOrderSchema.relationRole') }}</span><select v-model="selectedRuleConfig.relation_role" :disabled="isReadOnly || !selectedDraftField?.enabled"><option :value="null">{{ t('admin.shippingOrderSchema.notSet') }}</option><option v-for="item in state.catalog.relation_roles" :key="item" :value="item">{{ ruleLabel(item) }}</option></select></label><label><span>{{ t('admin.shippingOrderSchema.conflictPolicy') }}</span><select v-model="selectedRuleConfig.evidence_policy.conflict_policy" :disabled="isReadOnly || !selectedDraftField?.enabled"><option v-for="item in state.catalog.conflict_policies" :key="item" :value="item">{{ ruleLabel(item) }}</option></select></label></div><fieldset><legend>{{ t('admin.shippingOrderSchema.validators') }}</legend><div class="check-row"><label v-for="item in compatibleRules(selectedRuleConfig, 'type_validators')" :key="item"><input :checked="selectedRuleConfig.validator_keys.includes(item)" :disabled="isReadOnly || !selectedDraftField?.enabled" type="checkbox" @change="!isReadOnly && (selectedRuleConfig.validator_keys = toggleValue(selectedRuleConfig.validator_keys, item))">{{ ruleLabel(item) }}</label></div></fieldset><fieldset><legend>{{ t('admin.shippingOrderSchema.sourcePrecedence') }}</legend><div class="check-row"><label v-for="item in state.catalog.source_types" :key="item"><input :checked="selectedRuleConfig.evidence_policy.source_precedence.includes(item)" :disabled="isReadOnly || !selectedDraftField?.enabled" type="checkbox" @change="!isReadOnly && (selectedRuleConfig.evidence_policy.source_precedence = toggleValue(selectedRuleConfig.evidence_policy.source_precedence, item))">{{ sourceLabel(item) }}</label></div></fieldset></div></details></template>
|
||||
</div>
|
||||
<footer v-if="!isReadOnly" class="rule-footer"><label><span>{{ t('admin.shippingOrderSchema.changeNote') }}</span><input v-model="changeNote" :placeholder="t('admin.shippingOrderSchema.changeNotePlaceholder')"></label><button :disabled="saving" class="text-danger" @click="deleteDraft">{{ t('admin.shippingOrderSchema.deleteDraft') }}</button></footer>
|
||||
</template>
|
||||
@@ -807,6 +891,8 @@ onMounted(async () => {
|
||||
.rule-body { display: grid; min-height: 0; flex: 1 1 auto; align-content: start; gap: 18px; overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain; padding: 22px 24px 30px; scrollbar-gutter: stable; }
|
||||
.rule-basics { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 18px; border: 1px solid #edf1f5; border-radius: 9px; background: #fcfdff; padding: 18px; }
|
||||
.rule-basics .span-two { grid-column: 1 / -1; }
|
||||
.context-field-note { display: grid; gap: 5px; border: 1px solid #bae6fd; border-radius: 8px; background: #f0f9ff; padding: 12px; color: #475569; font-size: 12px; line-height: 1.5; }
|
||||
.context-field-note strong { color: #0369a1; font-weight: 650; }
|
||||
.rule-body textarea { min-height: 78px; resize: vertical; }
|
||||
.rule-switches { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
|
||||
.rule-switches label { display: flex; min-height: 48px; align-items: center; gap: 9px; border: 1px solid #e5ebf1; border-radius: 8px; background: #fff; padding: 10px 12px; color: #475569; cursor: pointer; }
|
||||
|
||||
+2
-1
@@ -31,10 +31,11 @@ const changeLabel = (change: ShippingOrderSchemaFieldChange): string => {
|
||||
return translated === key ? change.key : translated;
|
||||
};
|
||||
|
||||
/** 标量和集合变更使用同一紧凑文本格式,避免渲染原始 JSON。 */
|
||||
/** 标量和集合使用紧凑文本;结构化来源使用稳定 JSON,避免退化为 [object Object]。 */
|
||||
const valueText = (value: unknown): string => {
|
||||
if (value === null || value === undefined || value === '') return t('admin.shippingOrderSchema.diffEmpty');
|
||||
if (Array.isArray(value)) return value.join(', ') || t('admin.shippingOrderSchema.diffEmpty');
|
||||
if (typeof value === 'object') return JSON.stringify(value, null, 2);
|
||||
return String(value);
|
||||
};
|
||||
</script>
|
||||
|
||||
+6
-1
@@ -47,6 +47,10 @@ const formatDate = (value?: string | null): string => {
|
||||
const statusLabel = (status: ShippingOrderSchemaVersion['status']): string =>
|
||||
t(`admin.shippingOrderSchema.historyStatus.${status}`);
|
||||
|
||||
/** 历史通用字段直接展示冻结来源键,不依赖当前可能已停用或改名的来源目录。 */
|
||||
const contextSourceLabel = (field: NonNullable<ShippingOrderSchemaVersion['definition']>['fields'][number]): string =>
|
||||
field.context_source?.source_key || '-';
|
||||
|
||||
/** 历史详情只展示快照中的完整字段,不回读当前字段目录。 */
|
||||
const fields = computed(() => props.selectedVersion?.definition?.fields || []);
|
||||
|
||||
@@ -108,7 +112,8 @@ const close = (): void => emit('update:modelValue', false);
|
||||
<article v-for="field in fields" :key="field.field_id" class="snapshot-field" :class="{ excluded: field.enabled === false }">
|
||||
<div class="snapshot-field-title"><strong>{{ field.display_name }}</strong><code>{{ field.field_code }}</code><span v-if="field.enabled === false">{{ t('admin.shippingOrderSchema.historyExcluded') }}</span></div>
|
||||
<p>{{ field.scope === 'header' ? t('admin.shippingOrderSchema.placementHeader') : t('admin.shippingOrderSchema.placementLine') }} · {{ t(`admin.shippingOrderSchema.fieldType.${field.value_type}`) }}</p>
|
||||
<dl><div><dt>{{ t('admin.shippingOrderSchema.aliases') }}</dt><dd>{{ field.aliases.join(', ') || '-' }}</dd></div><div><dt>{{ t('admin.shippingOrderSchema.extractionInstruction') }}</dt><dd>{{ field.extraction_instruction || '-' }}</dd></div></dl>
|
||||
<dl v-if="field.field_category === 'general_context'"><div><dt>{{ t('admin.shippingOrderSchema.contextSource') }}</dt><dd>{{ contextSourceLabel(field) }}</dd></div><div><dt>{{ t('admin.shippingOrderSchema.deterministicCollection') }}</dt><dd>{{ t('admin.shippingOrderSchema.deterministicCollectionHint') }}</dd></div></dl>
|
||||
<dl v-else><div><dt>{{ t('admin.shippingOrderSchema.aliases') }}</dt><dd>{{ field.aliases.join(', ') || '-' }}</dd></div><div><dt>{{ t('admin.shippingOrderSchema.extractionInstruction') }}</dt><dd>{{ field.extraction_instruction || '-' }}</dd></div></dl>
|
||||
</article>
|
||||
<SchemaAuditTimeline
|
||||
:events="auditEvents"
|
||||
|
||||
+26
@@ -0,0 +1,26 @@
|
||||
/**
|
||||
* features/admin/modules/shipping-order-schema/shippingOrderField.utils.spec.ts
|
||||
* 用途:验证三类订单上下文字段的稳定形态及受控来源文案映射。
|
||||
* 依赖:Vitest、shippingOrderField.utils。
|
||||
* 逻辑:阻止通用字段误提交为 Line/LLM/数值字段,并避免页面泄露内部来源键。
|
||||
*/
|
||||
import { describe, expect, it } from 'vitest';
|
||||
import { contextOptionLabelKey, fieldShapeForCategory } from './shippingOrderField.utils';
|
||||
|
||||
describe('shipping order field category helpers', () => {
|
||||
it('forces general context fields to deterministic header text', () => {
|
||||
expect(fieldShapeForCategory('general_context')).toEqual({
|
||||
scope: 'header', collection_mode: 'deterministic_context', value_type: 'string',
|
||||
});
|
||||
});
|
||||
|
||||
it('maps order header and line fields to LLM extraction', () => {
|
||||
expect(fieldShapeForCategory('order_header').scope).toBe('header');
|
||||
expect(fieldShapeForCategory('order_line')).toMatchObject({ scope: 'line', collection_mode: 'llm_extraction' });
|
||||
});
|
||||
|
||||
it('maps registered From options to localized labels', () => {
|
||||
expect(contextOptionLabelKey('mail_header', 'from_email')).toContain('mail_header_from_email');
|
||||
expect(contextOptionLabelKey('json_path', 'selector')).toBeNull();
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,28 @@
|
||||
/**
|
||||
* features/admin/modules/shipping-order-schema/shippingOrderField.utils.ts
|
||||
* 用途:集中计算订单上下文字段分类对应的稳定身份和受控来源文案键。
|
||||
* 依赖:shipping-order-schema.types。
|
||||
* 逻辑:Schema 页面创建字段与展示来源时共享纯函数,避免模板分支产生不一致 payload。
|
||||
*/
|
||||
import type { ShippingOrderField } from '@/features/admin/types/shipping-order-schema.types';
|
||||
|
||||
export type ShippingOrderFieldCategory = ShippingOrderField['field_category'];
|
||||
|
||||
/** 将业务分类收敛为后端允许的 scope、collection_mode 和默认 value_type。 */
|
||||
export const fieldShapeForCategory = (category: ShippingOrderFieldCategory): Pick<
|
||||
ShippingOrderField,
|
||||
'scope' | 'collection_mode' | 'value_type'
|
||||
> => ({
|
||||
scope: category === 'order_line' ? 'line' : 'header',
|
||||
collection_mode: category === 'general_context' ? 'deterministic_context' : 'llm_extraction',
|
||||
value_type: 'string',
|
||||
});
|
||||
|
||||
/** 将首批受控邮件来源转换为四语言键;未知扩展项回退数据库展示名称。 */
|
||||
export const contextOptionLabelKey = (providerKey: string, optionKey: string): string | null => {
|
||||
const key = `${providerKey}.${optionKey}`;
|
||||
return {
|
||||
'mail_header.from_email': 'admin.shippingOrderSchema.contextOption.mail_header_from_email',
|
||||
'mail_header.from_domain': 'admin.shippingOrderSchema.contextOption.mail_header_from_domain',
|
||||
}[key] || null;
|
||||
};
|
||||
@@ -7,6 +7,7 @@ import type { TrainingQuestionType } from '@/features/chat/training/training.typ
|
||||
|
||||
export type AgentRuntimeProvider = 'dify' | 'builtin' | 'hybrid' | 'iframe';
|
||||
export type AgentConversationMode = 'chat' | 'task_chat' | 'embedded';
|
||||
export type AgentExposureMode = 'workspace' | 'internal';
|
||||
|
||||
export interface AgentCapabilities {
|
||||
streaming: boolean;
|
||||
@@ -32,6 +33,7 @@ export interface AgentRow {
|
||||
runtime_provider?: AgentRuntimeProvider;
|
||||
conversation_mode?: AgentConversationMode;
|
||||
dify_app_type?: 'chatflow' | 'workflow';
|
||||
exposure_mode?: AgentExposureMode;
|
||||
api_base_url?: string;
|
||||
iframe_url?: string;
|
||||
welcome_message?: string | null;
|
||||
@@ -101,6 +103,7 @@ export interface AgentFormState {
|
||||
runtime_provider: AgentRuntimeProvider;
|
||||
conversation_mode: AgentConversationMode;
|
||||
dify_app_type: 'chatflow' | 'workflow';
|
||||
exposure_mode: AgentExposureMode;
|
||||
api_base_url: string;
|
||||
iframe_url: string;
|
||||
welcome_message: string;
|
||||
@@ -127,6 +130,10 @@ export interface AgentFormState {
|
||||
training_hr_chat_questions_text: string;
|
||||
training_question_bank: AgentTrainingQuestionFormItem[];
|
||||
directory_member_ids: number[];
|
||||
order_extraction_binding_enabled: boolean;
|
||||
order_extraction_provider_agent_id: number | null;
|
||||
order_extraction_timeout_seconds: number;
|
||||
order_extraction_max_attempts: number;
|
||||
}
|
||||
|
||||
export const createEmptyTrainingQuestionForm = (): AgentTrainingQuestionFormItem => ({
|
||||
@@ -150,6 +157,7 @@ export const createEmptyAgentForm = (
|
||||
runtime_provider: 'dify',
|
||||
conversation_mode: 'chat',
|
||||
dify_app_type: 'chatflow',
|
||||
exposure_mode: 'workspace',
|
||||
api_base_url: '',
|
||||
iframe_url: '',
|
||||
welcome_message: '',
|
||||
@@ -185,4 +193,20 @@ export const createEmptyAgentForm = (
|
||||
training_hr_chat_questions_text: '',
|
||||
training_question_bank: [],
|
||||
directory_member_ids: [],
|
||||
order_extraction_binding_enabled: true,
|
||||
order_extraction_provider_agent_id: null,
|
||||
order_extraction_timeout_seconds: 900,
|
||||
order_extraction_max_attempts: 3,
|
||||
});
|
||||
|
||||
export interface AgentRuntimeBindingRow {
|
||||
id: number;
|
||||
owner_agent_id: number;
|
||||
capability_code: string;
|
||||
provider_agent_id: number;
|
||||
enabled: boolean;
|
||||
config: {
|
||||
timeout_seconds?: number;
|
||||
max_attempts?: number;
|
||||
};
|
||||
}
|
||||
@@ -6,7 +6,6 @@
|
||||
*/
|
||||
|
||||
export type ShippingIdentityTargetType = 'customer' | 'site';
|
||||
export type ShippingIdentitySourceAdapterKey = 'email_metadata' | 'document_template' | 'order_field';
|
||||
export type ShippingIdentityAutomation = 'none' | 'conditional';
|
||||
|
||||
export interface ShippingIdentityDefinition {
|
||||
@@ -16,26 +15,17 @@ export interface ShippingIdentityDefinition {
|
||||
description?: string | null;
|
||||
evidence_label: string;
|
||||
target_type: ShippingIdentityTargetType;
|
||||
source_adapter_key: ShippingIdentitySourceAdapterKey;
|
||||
source_selector: Record<string, unknown>;
|
||||
attribute_key: string;
|
||||
order_field_id?: string | null;
|
||||
order_field?: { field_id: string; field_code: string; scope: 'header' | 'line'; value_type: string; status: string; display_name?: string } | null;
|
||||
normalizer_key: string;
|
||||
comparator_key: string;
|
||||
context_field_id: string;
|
||||
context_field?: {
|
||||
field_id: string; field_code: string; scope: 'header' | 'line'; value_type: string; status: string;
|
||||
display_name?: string; field_category: string; collection_mode: string;
|
||||
} | null;
|
||||
field_config?: Record<string, unknown> | null;
|
||||
default_weight: number;
|
||||
max_automation: ShippingIdentityAutomation;
|
||||
status: 'active' | 'retired';
|
||||
}
|
||||
|
||||
export interface ShippingIdentitySourceAdapter {
|
||||
key: ShippingIdentitySourceAdapterKey;
|
||||
display_name: string;
|
||||
description: string;
|
||||
selectors: Record<string, unknown>;
|
||||
options: Record<string, { display_name: string; normalizer_key: string; max_automation: ShippingIdentityAutomation }>;
|
||||
}
|
||||
|
||||
export interface ShippingIdentityRuleSet {
|
||||
id: number;
|
||||
version: number;
|
||||
@@ -49,9 +39,11 @@ export interface ShippingIdentityRuleSet {
|
||||
|
||||
export interface ShippingIdentityRuleCatalog {
|
||||
definitions: ShippingIdentityDefinition[];
|
||||
order_fields: Array<{ field_id: string; field_code: string; display_name: string; scope: 'header' | 'line'; value_type: string }>;
|
||||
context_fields: Array<{
|
||||
field_id: string; field_code: string; display_name: string; scope: 'header' | 'line'; value_type: string;
|
||||
field_category: string; collection_mode: string;
|
||||
}>;
|
||||
catalog: {
|
||||
target_types: ShippingIdentityTargetType[];
|
||||
source_adapters: ShippingIdentitySourceAdapter[];
|
||||
};
|
||||
}
|
||||
@@ -9,6 +9,8 @@ export interface ShippingOrderField {
|
||||
field_code: string;
|
||||
scope: 'header' | 'line';
|
||||
value_type: 'string' | 'decimal' | 'integer' | 'date' | 'boolean' | 'enum';
|
||||
field_category: 'general_context' | 'order_header' | 'order_line';
|
||||
collection_mode: 'deterministic_context' | 'llm_extraction';
|
||||
status: 'active' | 'retired';
|
||||
published_once: boolean;
|
||||
}
|
||||
@@ -19,6 +21,8 @@ export interface ShippingOrderFieldConfig {
|
||||
field_code?: string;
|
||||
scope?: ShippingOrderField['scope'];
|
||||
value_type?: ShippingOrderField['value_type'];
|
||||
field_category?: ShippingOrderField['field_category'];
|
||||
collection_mode?: ShippingOrderField['collection_mode'];
|
||||
display_name: string;
|
||||
description?: string | null;
|
||||
business_purpose?: 'general' | 'part_number' | 'quantity' | 'reservation_id' | 'inventory_source_hint';
|
||||
@@ -36,6 +40,19 @@ export interface ShippingOrderFieldConfig {
|
||||
relation_role?: string | null;
|
||||
comparator_key: string;
|
||||
extraction_instruction?: string | null;
|
||||
context_provider_option_id?: number;
|
||||
context_source?: {
|
||||
provider_id: number;
|
||||
provider_key: string;
|
||||
provider_option_id: number;
|
||||
option_key: string;
|
||||
source_key: string;
|
||||
sensitivity_level: 'low' | 'personal' | 'confidential';
|
||||
default_dify_exposure_policy: 'never' | 'redacted' | 'confirmed_readonly';
|
||||
} | null;
|
||||
sensitivity_level?: 'low' | 'personal' | 'confidential';
|
||||
dify_exposure_policy?: 'never' | 'redacted' | 'confirmed_readonly';
|
||||
available_for_customer_identity?: boolean;
|
||||
sequence?: number;
|
||||
}
|
||||
|
||||
@@ -161,6 +178,8 @@ export interface ShippingOrderSchemaState {
|
||||
catalog: {
|
||||
field_types: string[];
|
||||
field_scopes: string[];
|
||||
field_categories: ShippingOrderField['field_category'][];
|
||||
collection_modes: ShippingOrderField['collection_mode'][];
|
||||
normalizers: string[];
|
||||
validators: string[];
|
||||
comparators: string[];
|
||||
@@ -171,4 +190,23 @@ export interface ShippingOrderSchemaState {
|
||||
type_validators: Record<ShippingOrderField['value_type'], string[]>;
|
||||
type_comparators: Record<ShippingOrderField['value_type'], string[]>;
|
||||
};
|
||||
context_providers: Array<{
|
||||
id: number;
|
||||
provider_key: string;
|
||||
display_name: string;
|
||||
description?: string | null;
|
||||
status: 'active' | 'disabled';
|
||||
options: Array<{
|
||||
id: number;
|
||||
option_key: string;
|
||||
display_name: string;
|
||||
description?: string | null;
|
||||
value_type: ShippingOrderField['value_type'];
|
||||
sensitivity_level: 'low' | 'personal' | 'confidential';
|
||||
default_dify_exposure_policy: 'never' | 'redacted' | 'confirmed_readonly';
|
||||
allowed_dify_exposure_policies: Array<'never' | 'redacted' | 'confirmed_readonly'>;
|
||||
status: 'active' | 'disabled';
|
||||
registered: boolean;
|
||||
}>;
|
||||
}>;
|
||||
}
|
||||
@@ -23,6 +23,8 @@ import type {
|
||||
ShippingTaskPage,
|
||||
ShippingTaskSummary,
|
||||
ShippingCustomerOption,
|
||||
ShippingOrderExtractionRun,
|
||||
ShippingOrderExtractionRunCreateResponse,
|
||||
ShippingTaskUiState,
|
||||
} from '../types/shipping.api.types';
|
||||
|
||||
@@ -152,6 +154,40 @@ export const deleteWorkspaceShippingTasks = (taskNos: string[], reason: string)
|
||||
'/api/workspace/shipping-tasks/batch-delete', jsonPost({ task_nos: taskNos, reason }),
|
||||
);
|
||||
|
||||
/** 创建或幂等复用订单抽取 Run;新聊天可不传 conversation_id,由服务端创建本地会话。 */
|
||||
export const createWorkspaceShippingOrderExtractionRun = (payload: {
|
||||
agent_id: number;
|
||||
conversation_id?: string | null;
|
||||
intake_nos: string[];
|
||||
}) => requestJson<ShippingOrderExtractionRunCreateResponse>(
|
||||
'/api/workspace/shipping-notice/order-extraction-runs',
|
||||
jsonPost(payload),
|
||||
);
|
||||
|
||||
/**
|
||||
* 查询单个订单抽取 Run,供聊天页短轮询。
|
||||
* @param runNo - Run 业务编号。
|
||||
* @param signal - 切会话或超时时取消当前 GET,不取消后台 Run。
|
||||
*/
|
||||
export const getWorkspaceShippingOrderExtractionRun = (runNo: string, signal?: AbortSignal) =>
|
||||
requestJson<ShippingOrderExtractionRun>(
|
||||
`/api/workspace/shipping-notice/order-extraction-runs/${encodeURIComponent(runNo)}`,
|
||||
{ signal },
|
||||
);
|
||||
|
||||
/** 按会话恢复订单抽取 Run,刷新页面后不依赖聊天 SSE 历史。 */
|
||||
export const listWorkspaceShippingOrderExtractionRuns = (
|
||||
conversationId: string,
|
||||
limit = 50,
|
||||
signal?: AbortSignal,
|
||||
) => {
|
||||
const params = new URLSearchParams({ conversation_id: conversationId, limit: String(limit) });
|
||||
return requestJson<{ items: ShippingOrderExtractionRun[] }>(
|
||||
`/api/workspace/shipping-notice/order-extraction-runs?${params.toString()}`,
|
||||
{ signal },
|
||||
);
|
||||
};
|
||||
|
||||
/** 批量归档任务,适用于外部上传中或已上传而禁止平台单方作废的任务。 */
|
||||
export const archiveWorkspaceShippingTasks = (taskNos: string[]) =>
|
||||
requestJson<ShippingTaskBatchDispositionResponse>(
|
||||
|
||||
@@ -1,17 +1,15 @@
|
||||
/**
|
||||
* features/chat/composables/useChat.spec.ts
|
||||
* 用途:验证聊天流的附件快照、货代 UI State 与终态事件过滤。
|
||||
* 用途:验证聊天流对发货通知 UI State 与订单识别生命周期 SSE 的消息级回写行为。
|
||||
* 依赖:vitest、useChat/chat.api 导出的纯函数、chat.types。
|
||||
* 逻辑:覆盖任务状态投影、terminal 后 UI State 放行及用户附件快照。
|
||||
* 逻辑:覆盖任务状态投影、订单识别终态保护、terminal 后事件放行及历史 payload 恢复。
|
||||
*/
|
||||
import { describe, expect, it } from 'vitest';
|
||||
import {
|
||||
applyShippingOrderExtractionStateToMessage,
|
||||
applyShippingUiStateToMessage,
|
||||
createUserChatMessage,
|
||||
isAllowedAfterStreamTerminal,
|
||||
} from './useChat';
|
||||
import { hydrateShippingOrderExtractionState } from '../api/chat.api';
|
||||
import type { ChatMessage } from '../types/chat.types';
|
||||
|
||||
describe('useChat user attachment snapshots', () => {
|
||||
@@ -128,113 +126,11 @@ describe('useChat shipping_ui_state SSE', () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe('useChat shipping_order_extraction_state SSE', () => {
|
||||
it('replaces extracting with persisted facts without overwriting Dify content', () => {
|
||||
const message: ChatMessage = {
|
||||
role: 'assistant',
|
||||
content: 'Dify 最终正文保持不变',
|
||||
payload: { existing_key: 'kept' },
|
||||
};
|
||||
|
||||
applyShippingOrderExtractionStateToMessage(message, {
|
||||
event: 'shipping_order_extraction_state',
|
||||
status: 'extracting',
|
||||
phase: 'llm_extraction',
|
||||
message: '正在识别邮件及附件中的订单',
|
||||
created_count: -1,
|
||||
terminal: false,
|
||||
});
|
||||
expect(message.shipping_order_extraction_state?.status).toBe('extracting');
|
||||
expect(message.shipping_order_extraction_state?.created_count).toBe(0);
|
||||
|
||||
applyShippingOrderExtractionStateToMessage(message, {
|
||||
event: 'shipping_order_extraction_state',
|
||||
status: 'completed',
|
||||
phase: 'result_persisted',
|
||||
message: '已创建 1 个发货任务',
|
||||
created_count: 1,
|
||||
opened_existing_count: 2,
|
||||
pending_count: 0,
|
||||
non_shipping_count: 3,
|
||||
created_with_missing_fields_count: 1,
|
||||
batch_no: 'SB-STATE-001',
|
||||
terminal: true,
|
||||
});
|
||||
|
||||
expect(message.content).toBe('Dify 最终正文保持不变');
|
||||
expect(message.shipping_order_extraction_state).toMatchObject({
|
||||
status: 'completed',
|
||||
created_count: 1,
|
||||
opened_existing_count: 2,
|
||||
non_shipping_count: 3,
|
||||
batch_no: 'SB-STATE-001',
|
||||
terminal: true,
|
||||
});
|
||||
expect((message.payload as Record<string, unknown>).existing_key).toBe('kept');
|
||||
expect((message.payload as { shipping_order_extraction_state?: { created_count?: number } })
|
||||
.shipping_order_extraction_state?.created_count).toBe(1);
|
||||
|
||||
// 关键断言:网络重排导致的迟到进行态不能覆盖已经展示的终态。
|
||||
applyShippingOrderExtractionStateToMessage(message, {
|
||||
status: 'extracting',
|
||||
phase: 'llm_extraction',
|
||||
message: '迟到事件',
|
||||
terminal: false,
|
||||
});
|
||||
expect(message.shipping_order_extraction_state?.status).toBe('completed');
|
||||
});
|
||||
|
||||
it('allows HXOPS domain states after the upstream terminal event', () => {
|
||||
expect(isAllowedAfterStreamTerminal('shipping_order_extraction_state')).toBe(true);
|
||||
describe('useChat terminal event filtering', () => {
|
||||
it('allows only shipping UI state after the upstream terminal event', () => {
|
||||
expect(isAllowedAfterStreamTerminal('shipping_ui_state')).toBe(true);
|
||||
expect(isAllowedAfterStreamTerminal('shipping_order_extraction_state')).toBe(false);
|
||||
expect(isAllowedAfterStreamTerminal('agent_message')).toBe(false);
|
||||
});
|
||||
|
||||
it('clears a generic stream failure after persisted partial completion', () => {
|
||||
const message: ChatMessage = {
|
||||
role: 'assistant',
|
||||
content: '请求失败,请稍后重试。',
|
||||
stream_error: true,
|
||||
};
|
||||
|
||||
applyShippingOrderExtractionStateToMessage(message, {
|
||||
status: 'partially_completed',
|
||||
phase: 'result_persisted',
|
||||
message: '仍有 1 个订单需要补充信息',
|
||||
pending_count: 1,
|
||||
terminal: true,
|
||||
});
|
||||
|
||||
// 关键断言:已保存的订单部分完成结果不得被通用 SSE 断流提示覆盖。
|
||||
expect(message.content).toBe('');
|
||||
expect(message.stream_error).toBe(false);
|
||||
expect(message.shipping_order_extraction_state?.status).toBe('partially_completed');
|
||||
});
|
||||
|
||||
it('hydrates persisted terminal state from ChatLog payload', () => {
|
||||
const message: ChatMessage = {
|
||||
role: 'assistant',
|
||||
content: '订单识别完成',
|
||||
payload: {
|
||||
shipping_order_extraction_state: {
|
||||
status: 'partially_completed',
|
||||
phase: 'result_persisted',
|
||||
message: '仍有 1 个订单需要补充信息',
|
||||
created_count: 1,
|
||||
opened_existing_count: 0,
|
||||
pending_count: 1,
|
||||
non_shipping_count: 0,
|
||||
created_with_missing_fields_count: 0,
|
||||
batch_no: 'SB-HISTORY-001',
|
||||
terminal: true,
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
hydrateShippingOrderExtractionState(message);
|
||||
|
||||
expect(message.shipping_order_extraction_state?.status).toBe('partially_completed');
|
||||
expect(message.shipping_order_extraction_state?.pending_count).toBe(1);
|
||||
expect(message.shipping_order_extraction_state?.batch_no).toBe('SB-HISTORY-001');
|
||||
});
|
||||
});
|
||||
@@ -1,8 +1,8 @@
|
||||
/**
|
||||
* features/chat/composables/useChat.ts
|
||||
* 用途:维护聊天消息、并行 run 与 legacy SSE 流式收发,并投影货代领域状态。
|
||||
* 用途:维护聊天消息、并行 run 与 legacy SSE 流式收发,并投影普通货代 UI 状态。
|
||||
* 依赖:Vue、vue-i18n、useChatTurn、streamErrorMessage、chat/shipping 类型。
|
||||
* 逻辑:页面调用 useChat 发起消息;Dify/HXOPS SSE 被归并到当前助手消息,领域终态可继续在上游终止事件后写入。
|
||||
* 逻辑:页面调用 useChat 发起消息;Dify/HXOPS SSE 被归并到当前助手消息,订单抽取状态由独立 Run API 维护。
|
||||
*/
|
||||
import { ref } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
@@ -13,8 +13,6 @@ import type {
|
||||
ChatMessageAttachment,
|
||||
ChatRun,
|
||||
RetrieverResource,
|
||||
ShippingOrderExtractionState,
|
||||
ShippingOrderExtractionStatus,
|
||||
} from '../types/chat.types';
|
||||
import type { ShippingBatchUiState, ShippingTaskUiState } from '../types/shipping.api.types';
|
||||
import type { ChatMessageSendResult } from '../types/chat-turn.types';
|
||||
@@ -167,85 +165,8 @@ export const applyShippingUiStateToMessage = (msg: ChatMessage, data: Record<str
|
||||
};
|
||||
};
|
||||
|
||||
const SHIPPING_ORDER_EXTRACTION_STATUSES = new Set<ShippingOrderExtractionStatus>([
|
||||
'extracting',
|
||||
'completed',
|
||||
'partially_completed',
|
||||
'failed',
|
||||
]);
|
||||
|
||||
const STREAM_ERROR_FALLBACK_SUFFIXES = [
|
||||
'请求失败,请稍后重试。',
|
||||
'請求失敗,請稍後重試。',
|
||||
'The request failed. Please try again.',
|
||||
'คำขอล้มเหลว โปรดลองใหม่อีกครั้ง',
|
||||
];
|
||||
|
||||
/**
|
||||
* 将未知 SSE payload 规范为订单识别状态。
|
||||
* 核心逻辑:只接受固定状态枚举;计数字段统一约束为非负整数,避免异常上游值破坏卡片布局。
|
||||
* @param data - shipping_order_extraction_state 事件对象。
|
||||
* @returns 合法状态;协议不匹配时返回 undefined。
|
||||
*/
|
||||
const resolveShippingOrderExtractionState = (
|
||||
data: Record<string, unknown>,
|
||||
): ShippingOrderExtractionState | undefined => {
|
||||
const status = String(data.status || '') as ShippingOrderExtractionStatus;
|
||||
if (!SHIPPING_ORDER_EXTRACTION_STATUSES.has(status)) return undefined;
|
||||
const phase = String(data.phase || '');
|
||||
if (!['llm_extraction', 'result_persisted', 'failed'].includes(phase)) return undefined;
|
||||
const count = (value: unknown) => {
|
||||
const parsed = Number(value);
|
||||
return Number.isFinite(parsed) ? Math.max(Math.trunc(parsed), 0) : 0;
|
||||
};
|
||||
return {
|
||||
status,
|
||||
phase: phase as ShippingOrderExtractionState['phase'],
|
||||
message: String(data.message || '').trim(),
|
||||
created_count: count(data.created_count),
|
||||
opened_existing_count: count(data.opened_existing_count),
|
||||
pending_count: count(data.pending_count),
|
||||
non_shipping_count: count(data.non_shipping_count),
|
||||
created_with_missing_fields_count: count(data.created_with_missing_fields_count),
|
||||
batch_no: typeof data.batch_no === 'string' && data.batch_no.trim() ? data.batch_no.trim() : null,
|
||||
terminal: data.terminal === true || status !== 'extracting',
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* 将订单识别领域事件同步到当前助手消息及可持久化 payload。
|
||||
* 核心逻辑:终态不得被迟到的 extracting 覆盖;正文由 Dify 独立维护,本函数只更新结构化状态。
|
||||
* @param msg - 当前助手消息。
|
||||
* @param data - shipping_order_extraction_state SSE 事件。
|
||||
*/
|
||||
export const applyShippingOrderExtractionStateToMessage = (
|
||||
msg: ChatMessage,
|
||||
data: Record<string, unknown>,
|
||||
): void => {
|
||||
const state = resolveShippingOrderExtractionState(data);
|
||||
if (!state) return;
|
||||
if (msg.shipping_order_extraction_state?.terminal && !state.terminal) return;
|
||||
msg.shipping_order_extraction_state = state;
|
||||
if (msg.stream_error && (state.status === 'completed' || state.status === 'partially_completed')) {
|
||||
// 已持久化的订单事实优先于连接层通用断流提示,避免业务成功仍向用户误报失败。
|
||||
const fallbackSuffix = STREAM_ERROR_FALLBACK_SUFFIXES.find((suffix) => msg.content.endsWith(suffix));
|
||||
if (fallbackSuffix) msg.content = msg.content.slice(0, -fallbackSuffix.length).trimEnd();
|
||||
msg.stream_error = false;
|
||||
}
|
||||
msg.payload = {
|
||||
...(msg.payload && typeof msg.payload === 'object' ? msg.payload as Record<string, unknown> : {}),
|
||||
shipping_order_extraction_state: state,
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* 判断上游终态之后仍允许写入当前消息的领域事件。
|
||||
* 核心逻辑:普通 Dify 文本在 terminal 后丢弃,但 HXOPS 的抽取终态和任务 UI State 由 Handler 在 terminal 后生成。
|
||||
* @param eventName - SSE event 字段。
|
||||
* @returns 是否允许继续消费。
|
||||
*/
|
||||
export const isAllowedAfterStreamTerminal = (eventName: string): boolean => (
|
||||
eventName === 'shipping_ui_state' || eventName === 'shipping_order_extraction_state'
|
||||
eventName === 'shipping_ui_state'
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -545,7 +466,7 @@ export function useChat() {
|
||||
| { type: 'image' | 'document' | 'audio' | 'video' | 'custom'; transfer_method: 'local_file'; upload_file_id: string }
|
||||
| { type: 'image' | 'document' | 'audio' | 'video' | 'custom'; transfer_method: 'remote_url'; url: string }
|
||||
>,
|
||||
context?: { task_id?: string; batch_no?: string; shipping_intake_nos?: string[]; shipping_temporary_inventory_asset_no?: string; shipping_temporary_inventory_session_no?: string; display_query?: string },
|
||||
context?: { task_id?: string; batch_no?: string; shipping_temporary_inventory_asset_no?: string; shipping_temporary_inventory_session_no?: string; display_query?: string },
|
||||
hooks?: SendMessageLifecycleHooks,
|
||||
): Promise<ChatMessageSendResult> => {
|
||||
const displayQuery = String(
|
||||
@@ -613,7 +534,6 @@ export function useChat() {
|
||||
files: files && files.length > 0 ? files : undefined,
|
||||
task_id: context?.task_id || undefined,
|
||||
batch_no: context?.batch_no || undefined,
|
||||
shipping_intake_nos: context?.shipping_intake_nos?.length ? context.shipping_intake_nos : undefined,
|
||||
shipping_temporary_inventory_asset_no: context?.shipping_temporary_inventory_asset_no || undefined,
|
||||
shipping_temporary_inventory_session_no: context?.shipping_temporary_inventory_session_no || undefined,
|
||||
display_query: context && Object.prototype.hasOwnProperty.call(context, 'display_query')
|
||||
@@ -685,10 +605,7 @@ export function useChat() {
|
||||
const botMsg = ensureBotMessage();
|
||||
if (!botMsg) continue;
|
||||
applyShippingUiStateToMessage(botMsg, data);
|
||||
} else if (eventName === 'shipping_order_extraction_state') {
|
||||
const botMsg = ensureBotMessage();
|
||||
if (!botMsg) continue;
|
||||
applyShippingOrderExtractionStateToMessage(botMsg, data);
|
||||
|
||||
} else if (eventName === 'message' || eventName === 'agent_message') {
|
||||
if (typeof data.answer === 'string' && data.answer.length > 0) {
|
||||
const botMsg = ensureBotMessage();
|
||||
|
||||
@@ -28,6 +28,7 @@ import {
|
||||
createShippingParseReviewHandlers,
|
||||
createShippingSendHandlers,
|
||||
createShippingUploadHandlers,
|
||||
useShippingOrderExtractionRuns,
|
||||
onNoticeBatchConversationChanging,
|
||||
findLatestShippingTaskId,
|
||||
getShippingMatchResultPayload,
|
||||
@@ -83,7 +84,7 @@ export interface UseChatShippingOptions {
|
||||
isUploadingAttachments: Ref<boolean>;
|
||||
attachmentPolicy: ComputedRef<{ anyEnabled: boolean }>;
|
||||
presetQuestion: ComputedRef<string>;
|
||||
saveLocalMessageToBackend: (msg: ChatMessage, userQuery?: string) => Promise<void>;
|
||||
saveLocalMessageToBackend: (msg: ChatMessage, userQuery?: string) => Promise<boolean>;
|
||||
newLocalMessageId: (prefix: string) => string;
|
||||
stripReasoningPrelude: (text: string) => string;
|
||||
sendMessage: (
|
||||
@@ -91,7 +92,7 @@ export interface UseChatShippingOptions {
|
||||
agentId: number,
|
||||
kb: string,
|
||||
files: ChatUploadFileSpec[],
|
||||
context?: { task_id?: string; batch_no?: string; shipping_intake_nos?: string[]; shipping_temporary_inventory_asset_no?: string; shipping_temporary_inventory_session_no?: string; display_query?: string },
|
||||
context?: { task_id?: string; batch_no?: string; shipping_temporary_inventory_asset_no?: string; shipping_temporary_inventory_session_no?: string; display_query?: string },
|
||||
hooks?: SendMessageLifecycleHooks,
|
||||
) => Promise<ChatMessageSendResult>;
|
||||
startChatTurn: (options: import('../types/chat-turn.types').StartChatTurnOptions) => Promise<boolean>;
|
||||
@@ -639,7 +640,6 @@ export function useChatShipping(options: UseChatShippingOptions) {
|
||||
const getCurrentShippingChatContext = () => ({
|
||||
task_id: getActiveBatchTaskId() || getActiveShippingTaskId(),
|
||||
batch_no: getActiveShippingBatchNo(),
|
||||
shipping_intake_nos: shippingIntakes.getParsedIntakeNos(),
|
||||
});
|
||||
|
||||
const getCurrentShippingChatContextWithDisplay = (displayQuery: string) => ({
|
||||
@@ -862,6 +862,27 @@ export function useChatShipping(options: UseChatShippingOptions) {
|
||||
msg,
|
||||
t,
|
||||
});
|
||||
const shippingOrderExtractionRuns = useShippingOrderExtractionRuns({
|
||||
messages,
|
||||
conversationId,
|
||||
currentAgentId,
|
||||
newLocalMessageId,
|
||||
saveLocalMessageToBackend,
|
||||
refreshNoticeIntakeStatuses: shippingIntakes.refreshStatuses,
|
||||
clearConsumedNoticeAttachments: shippingIntakes.clearConsumedAttachments,
|
||||
syncShippingConversationWorkspace,
|
||||
refreshShippingActions,
|
||||
loadHistory,
|
||||
onConversationResolved: async (resolvedConversationId) => {
|
||||
const currentRouteId = typeof route.query.conversation_id === 'string' ? route.query.conversation_id : '';
|
||||
if (currentRouteId === resolvedConversationId) return;
|
||||
await router.replace({
|
||||
path: route.path,
|
||||
query: { ...route.query, conversation_id: resolvedConversationId },
|
||||
});
|
||||
},
|
||||
t,
|
||||
});
|
||||
|
||||
const showShippingDuplicateDialog = ref(false);
|
||||
const showShippingCustomerDialog = ref(false);
|
||||
@@ -1119,10 +1140,7 @@ export function useChatShipping(options: UseChatShippingOptions) {
|
||||
hasSelectedNoticeCandidates: () => shippingIntakes.getSelectedCandidateNos().length > 0,
|
||||
openShippingDuplicateDialog,
|
||||
getParsedIntakeNos: shippingIntakes.getParsedIntakeNos,
|
||||
markOrderExtractionStarted: shippingIntakes.markOrderExtractionStarted,
|
||||
rollbackOrderExtractionStarted: shippingIntakes.rollbackOrderExtractionStarted,
|
||||
refreshNoticeIntakeStatuses: shippingIntakes.refreshStatuses,
|
||||
clearConsumedNoticeAttachments: shippingIntakes.clearConsumedAttachments,
|
||||
startOrderExtractionRun: shippingOrderExtractionRuns.startRun,
|
||||
applyShippingMessageRecovery,
|
||||
applyShippingBatchSnapshot,
|
||||
syncShippingConversationWorkspace,
|
||||
@@ -1169,8 +1187,10 @@ export function useChatShipping(options: UseChatShippingOptions) {
|
||||
const onConversationIdChanging = (nextId: string, prevId: string | null | undefined) => {
|
||||
onNoticeBatchConversationChanging(nextId, prevId);
|
||||
shippingIntakes.stopPolling();
|
||||
shippingOrderExtractionRuns.stopPolling();
|
||||
if (nextId && nextId !== prevId) {
|
||||
void shippingIntakes.restoreForConversation(nextId);
|
||||
void shippingOrderExtractionRuns.restoreForConversation(nextId);
|
||||
}
|
||||
if (prevId !== nextId) {
|
||||
resolvedShippingTaskId.value = '';
|
||||
|
||||
@@ -9,10 +9,7 @@ import { getAuthHeaders } from '@/shared/utils/auth';
|
||||
import { applyStreamErrorToMessage, type StreamErrorLabels } from '../utils/streamErrorMessage';
|
||||
import type { StartChatTurnOptions } from '../types/chat-turn.types';
|
||||
import type { ChatMessage, ChatRun } from '../types/chat.types';
|
||||
import {
|
||||
applyShippingOrderExtractionStateToMessage,
|
||||
applyShippingUiStateToMessage,
|
||||
} from './useChat';
|
||||
import { applyShippingUiStateToMessage } from './useChat';
|
||||
|
||||
export interface CreateStartChatTurnOptions {
|
||||
messages: Ref<ChatMessage[]>;
|
||||
@@ -172,9 +169,7 @@ export function createStartChatTurn(options: CreateStartChatTurnOptions) {
|
||||
if (eventName === 'shipping_ui_state' || eventName === 'ui_state.updated') {
|
||||
const botMsg = ensureBotMessage();
|
||||
if (botMsg) applyShippingUiStateToMessage(botMsg, data);
|
||||
} else if (eventName === 'shipping_order_extraction_state') {
|
||||
const botMsg = ensureBotMessage();
|
||||
if (botMsg) applyShippingOrderExtractionStateToMessage(botMsg, data);
|
||||
|
||||
} else if (
|
||||
eventName === 'message'
|
||||
|| eventName === 'agent_message'
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
/**
|
||||
* features/chat/page/useChatPageLocalMessage.spec.ts
|
||||
* 用途:验证非 SSE 本地消息的 ID 和持久化结果契约。
|
||||
* 依赖:Vitest、useChatPageLocalMessage、chat.api mock。
|
||||
* 逻辑:成功回写会话/日志并返回 true,且工厂始终返回可调用 helpers。
|
||||
*/
|
||||
import { computed, ref } from 'vue';
|
||||
import { beforeEach, describe, expect, it, vi } from 'vitest';
|
||||
import type { ChatMessage } from '../types/chat.types';
|
||||
|
||||
const api = vi.hoisted(() => ({ saveLocalChatMessage: vi.fn() }));
|
||||
vi.mock('../api/chat.api', () => ({ saveLocalChatMessage: api.saveLocalChatMessage }));
|
||||
|
||||
import { createChatPageLocalMessageApi } from './useChatPageLocalMessage';
|
||||
|
||||
describe('createChatPageLocalMessageApi', () => {
|
||||
beforeEach(() => api.saveLocalChatMessage.mockReset());
|
||||
|
||||
it('returns helpers and reports a successful persisted message', async () => {
|
||||
const conversationId = ref<string | null>(null);
|
||||
api.saveLocalChatMessage.mockResolvedValue({ conversation_id: 'conv-local', chat_log_id: 42 });
|
||||
const helpers = createChatPageLocalMessageApi({ conversationId, currentAgentId: computed(() => 7) });
|
||||
const message: ChatMessage = { role: 'assistant', type: 'text', content: 'done' };
|
||||
|
||||
expect(helpers.newLocalMessageId('local')).toContain('local-');
|
||||
expect(await helpers.saveLocalMessageToBackend(message)).toBe(true);
|
||||
expect(conversationId.value).toBe('conv-local');
|
||||
expect(message.chat_log_id).toBe(42);
|
||||
});
|
||||
});
|
||||
@@ -1,5 +1,8 @@
|
||||
/**
|
||||
* 对话页:本地消息落库(请假/出货等不经过 SSE 的消息)。
|
||||
* features/chat/page/useChatPageLocalMessage.ts
|
||||
* 用途:持久化请假、出货等不经过 SSE 的本地聊天消息。
|
||||
* 依赖:chat.api.saveLocalChatMessage、ChatMessage、Vue refs。
|
||||
* 逻辑:各业务 composable 传入本地消息;本模块绑定当前会话并返回明确保存结果。
|
||||
*/
|
||||
import { saveLocalChatMessage } from '../api/chat.api';
|
||||
import type { ChatMessage } from '../types/chat.types';
|
||||
@@ -13,12 +16,19 @@ export interface ChatPageLocalMessageContext {
|
||||
export function createChatPageLocalMessageApi(ctx: ChatPageLocalMessageContext) {
|
||||
let localMessageCounter = 0;
|
||||
|
||||
const newLocalMessageId = (prefix: string) => {
|
||||
/** 生成组件实例内唯一的本地消息 ID,用于前端渲染和提交前关联。 */
|
||||
const newLocalMessageId = (prefix: string): string => {
|
||||
localMessageCounter += 1;
|
||||
return `${prefix}-${Date.now()}-${localMessageCounter}`;
|
||||
};
|
||||
|
||||
const saveLocalMessageToBackend = async (localMsg: ChatMessage, userQuery: string = '') => {
|
||||
/**
|
||||
* 保存一条本地消息,并把服务端会话与日志主键回写到前端对象。
|
||||
* @param localMsg - 待保存的用户或助手消息。
|
||||
* @param userQuery - 用户消息展示文本;助手消息必须为空。
|
||||
* @returns 服务端确认提交时为 true;网络或业务失败时为 false。
|
||||
*/
|
||||
const saveLocalMessageToBackend = async (localMsg: ChatMessage, userQuery: string = ''): Promise<boolean> => {
|
||||
try {
|
||||
const data = await saveLocalChatMessage({
|
||||
conversation_id: ctx.conversationId.value,
|
||||
@@ -35,8 +45,9 @@ export function createChatPageLocalMessageApi(ctx: ChatPageLocalMessageContext)
|
||||
if (data.chat_log_id) {
|
||||
localMsg.chat_log_id = data.chat_log_id;
|
||||
}
|
||||
} catch (e) {
|
||||
console.error('Failed to save local message', e);
|
||||
return true;
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -54,7 +54,7 @@ export interface ChatPageSendContext {
|
||||
agentId: number,
|
||||
kb: string,
|
||||
files: ChatUploadFileSpec[],
|
||||
context?: { task_id?: string; batch_no?: string; shipping_intake_nos?: string[]; shipping_temporary_inventory_asset_no?: string; shipping_temporary_inventory_session_no?: string; display_query?: string },
|
||||
context?: { task_id?: string; batch_no?: string; shipping_temporary_inventory_asset_no?: string; shipping_temporary_inventory_session_no?: string; display_query?: string },
|
||||
hooks?: SendMessageLifecycleHooks,
|
||||
) => Promise<ChatMessageSendResult>;
|
||||
refreshHistoryAfterSend: () => Promise<void>;
|
||||
@@ -75,7 +75,7 @@ export interface ChatPageSendContext {
|
||||
msg: { warning: (text: string) => void; info: (text: string) => void };
|
||||
t: (key: string) => string;
|
||||
copiedIndex: Ref<number | null>;
|
||||
getChatContext?: () => { task_id?: string; batch_no?: string; shipping_intake_nos?: string[]; shipping_temporary_inventory_asset_no?: string; shipping_temporary_inventory_session_no?: string; display_query?: string };
|
||||
getChatContext?: () => { task_id?: string; batch_no?: string; shipping_temporary_inventory_asset_no?: string; shipping_temporary_inventory_session_no?: string; display_query?: string };
|
||||
onAssistantMessageFinished?: (message: ChatMessage, runMessages: ChatMessage[]) => void | Promise<void>;
|
||||
}
|
||||
|
||||
|
||||
@@ -22,4 +22,5 @@ export * from './useChatShippingDecision';
|
||||
export * from './useChatShippingMenuHandler';
|
||||
export * from './useChatShippingUploadHandler';
|
||||
export * from './useChatShippingSendHandler';
|
||||
export * from './useShippingOrderExtractionRuns';
|
||||
export * from './shippingTurnActions';
|
||||
@@ -13,7 +13,7 @@ import type { Ref } from 'vue';
|
||||
export interface ShippingLocalMessageContext {
|
||||
messages: Ref<ChatMessage[]>;
|
||||
newLocalMessageId: (prefix: string) => string;
|
||||
saveLocalMessageToBackend: (msg: ChatMessage, userQuery?: string) => Promise<void>;
|
||||
saveLocalMessageToBackend: (msg: ChatMessage, userQuery?: string) => Promise<boolean>;
|
||||
}
|
||||
|
||||
/** @deprecated 使用 startChatTurn 替代 */
|
||||
|
||||
@@ -260,7 +260,6 @@ export function sanitizeShippingConversationText(text: string, enabled: boolean)
|
||||
result = result
|
||||
.replace(/\bcreate_task\b/gi, '新建任务')
|
||||
.replace(/\bget_task_status\b/gi, '查询任务状态')
|
||||
.replace(/\bsubmit_order_extraction\b/gi, '提交订单抽取')
|
||||
.replace(/\bsubmit_decision\b/gi, '提交处理结果')
|
||||
.replace(/\bmatch_inventory\b/gi, '匹配库存')
|
||||
.replace(/\bgenerate_excel\b/gi, '生成发货 Excel')
|
||||
|
||||
@@ -21,7 +21,7 @@ export interface ShippingParseReviewContext {
|
||||
messages: Ref<ChatMessage[]>;
|
||||
resolvedShippingTaskId: Ref<string>;
|
||||
newLocalMessageId: (prefix: string) => string;
|
||||
saveLocalMessageToBackend: (msg: ChatMessage, userQuery?: string) => Promise<void>;
|
||||
saveLocalMessageToBackend: (msg: ChatMessage, userQuery?: string) => Promise<boolean>;
|
||||
refreshShippingActions: () => Promise<void>;
|
||||
msg: { warning: (text: string) => void };
|
||||
}
|
||||
|
||||
@@ -51,8 +51,7 @@ const createContext = (
|
||||
handleShippingAutoUploadFile: vi.fn(async () => undefined),
|
||||
handleShippingAutoUploadNoticeBatch: vi.fn(async () => undefined),
|
||||
isShippingNoticeBatchSubmitting: () => isShippingNoticeBatchSubmitting(),
|
||||
markOrderExtractionStarted: vi.fn(),
|
||||
rollbackOrderExtractionStarted: vi.fn(),
|
||||
startOrderExtractionRun: vi.fn(async () => true),
|
||||
syncShippingConversationWorkspace: vi.fn(async () => true),
|
||||
refreshShippingActions: vi.fn(async () => undefined),
|
||||
shippingSuggestedPrompt: computed(() => ''),
|
||||
@@ -116,8 +115,7 @@ describe('useChatShippingSendHandler', () => {
|
||||
expect(ctx.handleShippingAutoUploadNoticeBatch).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('sends parsed intakes to the existing Chatflow without requiring upload-time candidates', async () => {
|
||||
const completionOrder: string[] = [];
|
||||
it('creates a background Run for parsed intakes without calling the Chatflow', async () => {
|
||||
const attachment = {
|
||||
id: 'notice-1',
|
||||
kind: 'shipping_notice' as const,
|
||||
@@ -134,11 +132,6 @@ describe('useChatShippingSendHandler', () => {
|
||||
hasCandidateReviewIssues: () => true,
|
||||
hasSelectedNoticeCandidates: () => true,
|
||||
getParsedIntakeNos: () => ['SNI-1'],
|
||||
applyShippingMessageRecovery: vi.fn(async () => { completionOrder.push('recovery'); return true; }),
|
||||
refreshNoticeIntakeStatuses: vi.fn(async () => { completionOrder.push('intakes'); }),
|
||||
syncShippingConversationWorkspace: vi.fn(async () => { completionOrder.push('workspace'); return true; }),
|
||||
clearConsumedNoticeAttachments: vi.fn(() => { completionOrder.push('clear'); }),
|
||||
refreshShippingActions: vi.fn(async () => { completionOrder.push('actions'); }),
|
||||
});
|
||||
const { tryHandleShippingAttachmentAutoFlow } = createShippingSendHandlers(ctx);
|
||||
|
||||
@@ -146,35 +139,20 @@ describe('useChatShippingSendHandler', () => {
|
||||
|
||||
expect(consumed).toBe(true);
|
||||
expect(ctx.handleShippingAutoUploadNoticeBatch).not.toHaveBeenCalled();
|
||||
expect(ctx.sendMessage).toHaveBeenCalledWith(
|
||||
expect(ctx.startOrderExtractionRun).toHaveBeenCalledWith(
|
||||
'chat.shippingOrderExtractionDefaultPrompt',
|
||||
1,
|
||||
'',
|
||||
[],
|
||||
{
|
||||
shipping_intake_nos: ['SNI-1'],
|
||||
display_query: 'chat.shippingOrderExtractionDefaultPrompt',
|
||||
},
|
||||
expect.objectContaining({
|
||||
userAttachments: [{
|
||||
['SNI-1'],
|
||||
[{
|
||||
id: 'notice-1',
|
||||
name: 'orders.eml',
|
||||
size: 100,
|
||||
extension: 'eml',
|
||||
type: 'document',
|
||||
source: 'shipping_notice',
|
||||
}],
|
||||
onAssistantMessageFinished: expect.any(Function),
|
||||
}),
|
||||
}],
|
||||
);
|
||||
expect(ctx.markOrderExtractionStarted).toHaveBeenCalledWith(['SNI-1']);
|
||||
|
||||
const hooks = vi.mocked(ctx.sendMessage).mock.calls[0]?.[5];
|
||||
const assistantMessage = { role: 'assistant', content: '已打开已有任务' } as const;
|
||||
await hooks?.onAssistantMessageFinished?.(assistantMessage, []);
|
||||
expect(ctx.applyShippingMessageRecovery).toHaveBeenCalledWith(assistantMessage);
|
||||
expect(completionOrder).toEqual(['recovery', 'intakes', 'workspace', 'clear', 'actions']);
|
||||
expect(ctx.syncShippingConversationWorkspace).toHaveBeenCalledWith({ preferLatest: true });
|
||||
expect(ctx.sendMessage).not.toHaveBeenCalled();
|
||||
expect(ctx.attachments.value).toEqual([]);
|
||||
});
|
||||
|
||||
it('uses the user query for full extraction even when no candidate exists before send', async () => {
|
||||
@@ -201,33 +179,21 @@ describe('useChatShippingSendHandler', () => {
|
||||
|
||||
expect(consumed).toBe(true);
|
||||
expect(ctx.handleShippingAutoUploadNoticeBatch).not.toHaveBeenCalled();
|
||||
expect(ctx.sendMessage).toHaveBeenCalledWith(
|
||||
expect(ctx.startOrderExtractionRun).toHaveBeenCalledWith(
|
||||
'请解析这些附件',
|
||||
1,
|
||||
'',
|
||||
[],
|
||||
{
|
||||
shipping_intake_nos: ['SNI-1'],
|
||||
display_query: '请解析这些附件',
|
||||
},
|
||||
expect.objectContaining({
|
||||
userAttachments: [{
|
||||
['SNI-1'],
|
||||
[{
|
||||
id: 'notice-1',
|
||||
name: 'orders.eml',
|
||||
size: 100,
|
||||
extension: 'eml',
|
||||
type: 'document',
|
||||
source: 'shipping_notice',
|
||||
}],
|
||||
onAssistantMessageFinished: expect.any(Function),
|
||||
}),
|
||||
}],
|
||||
);
|
||||
});
|
||||
|
||||
it('retries the conversation workspace once when the first refresh fails', async () => {
|
||||
const syncWorkspace = vi.fn()
|
||||
.mockResolvedValueOnce(false)
|
||||
.mockResolvedValueOnce(true);
|
||||
it('keeps attachments when Run creation reports not started', async () => {
|
||||
const ctx = createContext({
|
||||
attachments: ref([{
|
||||
id: 'notice-retry',
|
||||
@@ -241,22 +207,15 @@ describe('useChatShippingSendHandler', () => {
|
||||
intakeNo: 'SNI-RETRY',
|
||||
}]),
|
||||
getParsedIntakeNos: () => ['SNI-RETRY'],
|
||||
syncShippingConversationWorkspace: syncWorkspace,
|
||||
startOrderExtractionRun: vi.fn(async () => false),
|
||||
});
|
||||
const { tryHandleShippingAttachmentAutoFlow } = createShippingSendHandlers(ctx);
|
||||
|
||||
await tryHandleShippingAttachmentAutoFlow(undefined, '', '');
|
||||
const hooks = vi.mocked(ctx.sendMessage).mock.calls[0]?.[5];
|
||||
await hooks?.onAssistantMessageFinished?.({} as never, []);
|
||||
|
||||
expect(syncWorkspace).toHaveBeenCalledTimes(2);
|
||||
expect(syncWorkspace).toHaveBeenNthCalledWith(1, { preferLatest: true });
|
||||
expect(syncWorkspace).toHaveBeenNthCalledWith(2, { preferLatest: true });
|
||||
expect(ctx.refreshShippingActions).toHaveBeenCalledTimes(1);
|
||||
expect(ctx.attachments.value).toHaveLength(1);
|
||||
});
|
||||
|
||||
it('rolls back the local extracting state when the chat request fails', async () => {
|
||||
const rollback = vi.fn();
|
||||
it('keeps attachments and reports the error when Run creation fails', async () => {
|
||||
const ctx = createContext({
|
||||
attachments: ref([{
|
||||
id: 'notice-failed-send',
|
||||
@@ -270,20 +229,18 @@ describe('useChatShippingSendHandler', () => {
|
||||
intakeNo: 'SNI-FAILED-SEND',
|
||||
}]),
|
||||
getParsedIntakeNos: () => ['SNI-FAILED-SEND'],
|
||||
sendMessage: vi.fn(async () => { throw new Error('network failed'); }),
|
||||
rollbackOrderExtractionStarted: rollback,
|
||||
startOrderExtractionRun: vi.fn(async () => { throw new Error('network failed'); }),
|
||||
});
|
||||
const { tryHandleShippingAttachmentAutoFlow } = createShippingSendHandlers(ctx);
|
||||
|
||||
const consumed = await tryHandleShippingAttachmentAutoFlow(undefined, '', '');
|
||||
|
||||
expect(consumed).toBe(true);
|
||||
expect(rollback).toHaveBeenCalledWith(['SNI-FAILED-SEND']);
|
||||
expect(ctx.msg.warning).toHaveBeenCalledWith('network failed');
|
||||
expect(ctx.attachments.value).toHaveLength(1);
|
||||
});
|
||||
|
||||
it('rolls back extraction state when sendMessage reports a handled stream failure', async () => {
|
||||
const rollback = vi.fn();
|
||||
it('does not call the Chatflow when Run creation is handled as unavailable', async () => {
|
||||
const ctx = createContext({
|
||||
attachments: ref([{
|
||||
id: 'notice-handled-failure',
|
||||
@@ -297,19 +254,18 @@ describe('useChatShippingSendHandler', () => {
|
||||
intakeNo: 'SNI-HANDLED-FAILURE',
|
||||
}]),
|
||||
getParsedIntakeNos: () => ['SNI-HANDLED-FAILURE'],
|
||||
sendMessage: vi.fn(async () => ({ accepted: false, completed: false })),
|
||||
rollbackOrderExtractionStarted: rollback,
|
||||
startOrderExtractionRun: vi.fn(async () => false),
|
||||
});
|
||||
const { tryHandleShippingAttachmentAutoFlow } = createShippingSendHandlers(ctx);
|
||||
|
||||
const consumed = await tryHandleShippingAttachmentAutoFlow(undefined, '', '');
|
||||
|
||||
expect(consumed).toBe(true);
|
||||
expect(rollback).toHaveBeenCalledWith(['SNI-HANDLED-FAILURE']);
|
||||
expect(ctx.loadHistory).not.toHaveBeenCalled();
|
||||
expect(ctx.sendMessage).not.toHaveBeenCalled();
|
||||
expect(ctx.attachments.value).toHaveLength(1);
|
||||
});
|
||||
|
||||
it('removes submitted notice attachments after acceptance even when the assistant stream fails', async () => {
|
||||
it('removes only the Intake set accepted by the background Run', async () => {
|
||||
const submitted = {
|
||||
id: 'notice-accepted-error',
|
||||
kind: 'shipping_notice' as const,
|
||||
@@ -330,15 +286,14 @@ describe('useChatShippingSendHandler', () => {
|
||||
const ctx = createContext({
|
||||
attachments: ref([submitted, retained]),
|
||||
getParsedIntakeNos: () => ['SNI-ACCEPTED-ERROR'],
|
||||
sendMessage: vi.fn(async () => ({ accepted: true, completed: false, chatLogId: 42 })),
|
||||
startOrderExtractionRun: vi.fn(async () => true),
|
||||
});
|
||||
const { tryHandleShippingAttachmentAutoFlow } = createShippingSendHandlers(ctx);
|
||||
|
||||
const consumed = await tryHandleShippingAttachmentAutoFlow(undefined, '', '');
|
||||
|
||||
expect(consumed).toBe(true);
|
||||
expect(ctx.rollbackOrderExtractionStarted).not.toHaveBeenCalled();
|
||||
expect(ctx.attachments.value).toEqual([retained]);
|
||||
expect(ctx.loadHistory).toHaveBeenCalledOnce();
|
||||
expect(ctx.sendMessage).not.toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
@@ -2,7 +2,7 @@
|
||||
* features/chat/shipping/useChatShippingSendHandler.ts
|
||||
* 用途:在聊天发送前拦截发货通知专属意图,如订单抽取、切票、决策文本和附件自动流程。
|
||||
* 依赖:shipping.api、shippingIntents、shippingMenu、shippingDownload、chat.types。
|
||||
* 逻辑:已预处理 Intake 通过普通聊天接口进入现有 Dify Chatflow;其他业务动作经 Chat Turn / handleShippingMenuAction。
|
||||
* 逻辑:已预处理 Intake 创建独立订单抽取 Run;其他业务动作经 Chat Turn / handleShippingMenuAction。
|
||||
*/
|
||||
import {
|
||||
getWorkspaceShippingBatch,
|
||||
@@ -51,7 +51,7 @@ export interface ShippingSendHandlerContext {
|
||||
agentId: number,
|
||||
kb: string,
|
||||
files: ChatUploadFileSpec[],
|
||||
context?: { task_id?: string; batch_no?: string; shipping_intake_nos?: string[]; shipping_temporary_inventory_asset_no?: string; shipping_temporary_inventory_session_no?: string; display_query?: string },
|
||||
context?: { task_id?: string; batch_no?: string; shipping_temporary_inventory_asset_no?: string; shipping_temporary_inventory_session_no?: string; display_query?: string },
|
||||
hooks?: SendMessageLifecycleHooks,
|
||||
) => Promise<ChatMessageSendResult>;
|
||||
buildFileSpecsForSend: () => Promise<ChatUploadFileSpec[]>;
|
||||
@@ -72,10 +72,7 @@ export interface ShippingSendHandlerContext {
|
||||
hasSelectedNoticeCandidates?: () => boolean;
|
||||
openShippingDuplicateDialog?: (attachmentId?: string) => void;
|
||||
getParsedIntakeNos?: () => string[];
|
||||
markOrderExtractionStarted?: (intakeNos: string[]) => void;
|
||||
rollbackOrderExtractionStarted?: (intakeNos: string[]) => void;
|
||||
refreshNoticeIntakeStatuses?: () => Promise<void>;
|
||||
clearConsumedNoticeAttachments?: () => void;
|
||||
startOrderExtractionRun?: (query: string, intakeNos: string[], attachments: ReturnType<typeof createChatMessageAttachmentSnapshots>) => Promise<boolean>;
|
||||
applyShippingMessageRecovery?: (message: ChatMessage) => Promise<boolean>;
|
||||
applyShippingBatchSnapshot?: (message: ChatMessage) => boolean;
|
||||
syncShippingConversationWorkspace: (options?: { preferLatest?: boolean }) => Promise<boolean>;
|
||||
@@ -90,7 +87,7 @@ export interface ShippingSendHandlerContext {
|
||||
/**
|
||||
* 创建发货通知发送拦截器。
|
||||
*
|
||||
* 核心逻辑:已预处理邮件固定 Intake 上下文后调用普通聊天;其余识别切换任务、数字菜单、决策文本、映射文本、上传/导出意图。
|
||||
* 核心逻辑:已预处理邮件固定 Intake 后创建后台 Run;其余识别切换任务、数字菜单、决策文本、映射文本、上传/导出意图。
|
||||
* @param ctx - 发送拦截上下文
|
||||
* @returns 发送前文本与附件自动流程处理函数;返回 true 表示已消费本次发送
|
||||
*/
|
||||
@@ -221,48 +218,16 @@ export function createShippingSendHandlers(ctx: ShippingSendHandlerContext) {
|
||||
const query = trimmed || ctx.t('chat.shippingOrderExtractionDefaultPrompt');
|
||||
ctx.shippingAutoFlowRequested.value = false;
|
||||
if (typeof textOrEvent !== 'string') ctx.input.value = '';
|
||||
ctx.markOrderExtractionStarted?.(intakeNos);
|
||||
try {
|
||||
const sent = await ctx.sendMessage(
|
||||
query,
|
||||
ctx.currentAgentId.value,
|
||||
ctx.selectedKb.value,
|
||||
[],
|
||||
{
|
||||
shipping_intake_nos: intakeNos,
|
||||
display_query: query,
|
||||
},
|
||||
{
|
||||
userAttachments,
|
||||
onAssistantMessageFinished: async (assistantMessage) => {
|
||||
if (ctx.applyShippingMessageRecovery) {
|
||||
await ctx.applyShippingMessageRecovery(assistantMessage);
|
||||
} else {
|
||||
ctx.applyShippingBatchSnapshot?.(assistantMessage);
|
||||
}
|
||||
await ctx.refreshNoticeIntakeStatuses?.();
|
||||
if (!(await ctx.syncShippingConversationWorkspace({ preferLatest: true }))) {
|
||||
await new Promise((resolve) => setTimeout(resolve, 300));
|
||||
await ctx.syncShippingConversationWorkspace({ preferLatest: true });
|
||||
}
|
||||
ctx.clearConsumedNoticeAttachments?.();
|
||||
await ctx.refreshShippingActions();
|
||||
},
|
||||
},
|
||||
);
|
||||
if (!sent.accepted) {
|
||||
ctx.rollbackOrderExtractionStarted?.(intakeNos);
|
||||
return true;
|
||||
}
|
||||
const started = await ctx.startOrderExtractionRun?.(query, intakeNos, userAttachments);
|
||||
if (!started) return true;
|
||||
const submittedIntakes = new Set(intakeNos.map((item) => item.trim().toUpperCase()));
|
||||
ctx.attachments.value = ctx.attachments.value.filter(
|
||||
(item) => item.kind !== 'shipping_notice'
|
||||
|| !item.intakeNo
|
||||
|| !submittedIntakes.has(item.intakeNo.trim().toUpperCase()),
|
||||
);
|
||||
await ctx.loadHistory();
|
||||
} catch (e: unknown) {
|
||||
ctx.rollbackOrderExtractionStarted?.(intakeNos);
|
||||
const errorMessage = e instanceof Error ? e.message : '文件处理失败';
|
||||
ctx.msg.warning(errorMessage);
|
||||
}
|
||||
|
||||
@@ -21,6 +21,18 @@ describe('shipping notice order extraction state', () => {
|
||||
})).toBe(false);
|
||||
});
|
||||
|
||||
it('does not resubmit persisted or active order extraction results', () => {
|
||||
const base = {
|
||||
intakeNo: 'SNI-PERSISTED',
|
||||
parseStatus: 'parsed' as const,
|
||||
parseSummary: undefined,
|
||||
};
|
||||
expect(isOrderExtractionEligibleIntake({ ...base, orderExtractionStatus: 'extracting' })).toBe(false);
|
||||
expect(isOrderExtractionEligibleIntake({ ...base, orderExtractionStatus: 'partially_completed' })).toBe(false);
|
||||
expect(isOrderExtractionEligibleIntake({ ...base, orderExtractionStatus: 'completed' })).toBe(false);
|
||||
expect(isOrderExtractionEligibleIntake({ ...base, orderExtractionStatus: 'failed' })).toBe(true);
|
||||
});
|
||||
|
||||
it('keeps polling after preprocessing is parsed while order extraction is active', () => {
|
||||
expect(shouldPollShippingNoticeIntake({
|
||||
parseStatus: 'parsed',
|
||||
@@ -47,6 +59,7 @@ describe('shipping notice order extraction state', () => {
|
||||
expect(shouldRestoreShippingNoticeIntake('queued')).toBe(true);
|
||||
expect(shouldRestoreShippingNoticeIntake('parsing')).toBe(true);
|
||||
expect(shouldRestoreShippingNoticeIntake('parse_failed')).toBe(true);
|
||||
expect(shouldRestoreShippingNoticeIntake('parsed', 'failed', 0)).toBe(true);
|
||||
expect(shouldRestoreShippingNoticeIntake('parsed', 'partially_completed', 2)).toBe(true);
|
||||
|
||||
// 已完成且没有待审核 Candidate 的文件仅保留在用户消息气泡中。
|
||||
|
||||
@@ -53,6 +53,7 @@ export function shouldRestoreShippingNoticeIntake(
|
||||
const extractionStatus = String(orderExtractionStatus || '').trim().toLowerCase();
|
||||
return ACTIVE_PARSE.has(status)
|
||||
|| status === 'parse_failed'
|
||||
|| extractionStatus === 'failed'
|
||||
|| (extractionStatus === 'partially_completed' && candidateCount > 0);
|
||||
}
|
||||
|
||||
@@ -66,10 +67,12 @@ export function shouldPollShippingNoticeIntake(
|
||||
|
||||
/** 判断附件是否仍可作为新一轮完整订单抽取的输入。 */
|
||||
export function isOrderExtractionEligibleIntake(
|
||||
item: Pick<ShippingNoticePendingAttachment, 'intakeNo' | 'parseStatus' | 'parseSummary'>,
|
||||
item: Pick<ShippingNoticePendingAttachment, 'intakeNo' | 'parseStatus' | 'parseSummary' | 'orderExtractionStatus'>,
|
||||
): boolean {
|
||||
const extractionStatus = String(item.orderExtractionStatus || 'not_started').trim().toLowerCase();
|
||||
return item.parseStatus === 'parsed'
|
||||
&& Boolean(item.intakeNo)
|
||||
&& (extractionStatus === 'not_started' || extractionStatus === 'failed')
|
||||
&& !isShippingNoticeAttachmentParseIncomplete(item.parseSummary);
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,157 @@
|
||||
/**
|
||||
* features/chat/shipping/useShippingOrderExtractionRuns.spec.ts
|
||||
* 用途:验证订单抽取 Run 的状态映射、消息幂等持久化与轮询生命周期。
|
||||
* 依赖:Vitest、Vue refs、shipping.api mock、useShippingOrderExtractionRuns。
|
||||
* 逻辑:覆盖状态契约、新会话启动、无变化轮询、恢复失败及切会话迟到响应。
|
||||
*/
|
||||
import { computed, ref } from 'vue';
|
||||
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
|
||||
import { mapOrderExtractionRunToMessageState, useShippingOrderExtractionRuns } from './useShippingOrderExtractionRuns';
|
||||
import type { ShippingOrderExtractionRun } from '../types/shipping.api.types';
|
||||
import type { ChatMessage } from '../types/chat.types';
|
||||
|
||||
const api = vi.hoisted(() => ({
|
||||
createRun: vi.fn(),
|
||||
getRun: vi.fn(),
|
||||
listRuns: vi.fn(),
|
||||
}));
|
||||
|
||||
vi.mock('../api/shipping.api', () => ({
|
||||
createWorkspaceShippingOrderExtractionRun: api.createRun,
|
||||
getWorkspaceShippingOrderExtractionRun: api.getRun,
|
||||
listWorkspaceShippingOrderExtractionRuns: api.listRuns,
|
||||
}));
|
||||
|
||||
const run = (patch: Partial<ShippingOrderExtractionRun>): ShippingOrderExtractionRun => ({
|
||||
run_no: 'SNER-1',
|
||||
agent_id: 1,
|
||||
conversation_id: 'conv-1',
|
||||
status: 'queued',
|
||||
phase: 'queued',
|
||||
intake_nos: ['SNI-1'],
|
||||
schema_version_id: 1,
|
||||
attempt_count: 0,
|
||||
...patch,
|
||||
});
|
||||
|
||||
const createHarness = () => {
|
||||
const messages = ref<ChatMessage[]>([]);
|
||||
const conversationId = ref<string | null>(null);
|
||||
let localId = 0;
|
||||
const options = {
|
||||
messages,
|
||||
conversationId,
|
||||
currentAgentId: computed(() => 1),
|
||||
newLocalMessageId: vi.fn((prefix: string) => `${prefix}-${++localId}`),
|
||||
saveLocalMessageToBackend: vi.fn(async () => true),
|
||||
refreshNoticeIntakeStatuses: vi.fn(async () => undefined),
|
||||
clearConsumedNoticeAttachments: vi.fn(),
|
||||
syncShippingConversationWorkspace: vi.fn(async () => true),
|
||||
refreshShippingActions: vi.fn(async () => undefined),
|
||||
loadHistory: vi.fn(async () => undefined),
|
||||
onConversationResolved: vi.fn(async () => undefined),
|
||||
t: (key: string) => key,
|
||||
};
|
||||
return { messages, conversationId, options, runs: useShippingOrderExtractionRuns(options) };
|
||||
};
|
||||
|
||||
/** 创建可手工完成的 Promise,用于验证切会话后的迟到响应。 */
|
||||
const deferred = <T>() => {
|
||||
let resolve!: (value: T) => void;
|
||||
const promise = new Promise<T>((done) => { resolve = done; });
|
||||
return { promise, resolve };
|
||||
};
|
||||
|
||||
describe('useShippingOrderExtractionRuns lifecycle', () => {
|
||||
beforeEach(() => {
|
||||
vi.useFakeTimers();
|
||||
vi.clearAllMocks();
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
vi.useRealTimers();
|
||||
});
|
||||
|
||||
it('persists stable user and assistant formIds and does not write unchanged polling state again', async () => {
|
||||
const queued = run({ run_no: 'SNER-START', conversation_id: 'conv-created' });
|
||||
api.createRun.mockResolvedValue({ run: queued, reused: false });
|
||||
api.getRun.mockResolvedValue(queued);
|
||||
const harness = createHarness();
|
||||
|
||||
await harness.runs.startRun('解析附件', ['SNI-1'], []);
|
||||
expect(harness.conversationId.value).toBe('conv-created');
|
||||
expect(harness.options.onConversationResolved).toHaveBeenCalledWith('conv-created');
|
||||
expect(harness.messages.value.map((item) => item.payload?.formId)).toEqual([
|
||||
'shipping-order-extraction-user:SNER-START',
|
||||
'shipping-order-extraction-run:SNER-START',
|
||||
]);
|
||||
expect(harness.options.saveLocalMessageToBackend).toHaveBeenCalledTimes(2);
|
||||
|
||||
await vi.advanceTimersByTimeAsync(1000);
|
||||
expect(api.getRun).toHaveBeenCalledWith('SNER-START', expect.any(AbortSignal));
|
||||
expect(harness.options.saveLocalMessageToBackend).toHaveBeenCalledTimes(2);
|
||||
harness.runs.stopPolling();
|
||||
});
|
||||
|
||||
it('absorbs restore failures and ignores an old conversation late response', async () => {
|
||||
const pending = deferred<ShippingOrderExtractionRun>();
|
||||
api.listRuns
|
||||
.mockResolvedValueOnce({ items: [run({ run_no: 'SNER-OLD', conversation_id: 'conv-old', status: 'running' })] })
|
||||
.mockRejectedValueOnce(new Error('offline'));
|
||||
api.getRun.mockReturnValueOnce(pending.promise);
|
||||
const harness = createHarness();
|
||||
harness.conversationId.value = 'conv-old';
|
||||
await harness.runs.restoreForConversation('conv-old');
|
||||
await vi.advanceTimersByTimeAsync(1000);
|
||||
|
||||
harness.conversationId.value = 'conv-new';
|
||||
await expect(harness.runs.restoreForConversation('conv-new')).resolves.toBeUndefined();
|
||||
pending.resolve(run({ run_no: 'SNER-OLD', conversation_id: 'conv-old', status: 'completed' }));
|
||||
await Promise.resolve();
|
||||
expect(harness.runs.getActiveRunNo()).toBe('');
|
||||
expect(harness.messages.value).toHaveLength(1);
|
||||
expect(harness.messages.value[0]?.shipping_order_extraction_state?.status).toBe('extracting');
|
||||
});
|
||||
|
||||
it('aborts a hanging Run query after ten seconds and keeps polling as a transport failure', async () => {
|
||||
api.createRun.mockResolvedValue({ run: run({ run_no: 'SNER-TIMEOUT', conversation_id: 'conv-timeout' }), reused: false });
|
||||
api.getRun.mockImplementation((_runNo: string, signal: AbortSignal) => new Promise((_resolve, reject) => {
|
||||
signal.addEventListener('abort', () => reject(new DOMException('aborted', 'AbortError')), { once: true });
|
||||
}));
|
||||
const harness = createHarness();
|
||||
await harness.runs.startRun('解析附件', ['SNI-1'], []);
|
||||
|
||||
await vi.advanceTimersByTimeAsync(11000);
|
||||
expect(api.getRun).toHaveBeenCalledWith('SNER-TIMEOUT', expect.any(AbortSignal));
|
||||
expect(harness.runs.getActiveRunNo()).toBe('SNER-TIMEOUT');
|
||||
expect(harness.messages.value[1]?.shipping_order_extraction_state?.status).toBe('extracting');
|
||||
harness.runs.stopPolling();
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
describe('mapOrderExtractionRunToMessageState', () => {
|
||||
it('maps queued/running to indeterminate extracting state', () => {
|
||||
expect(mapOrderExtractionRunToMessageState(run({ status: 'running', phase: 'calling_provider' }))).toMatchObject({
|
||||
status: 'extracting', terminal: false, phase: 'llm_extraction',
|
||||
});
|
||||
});
|
||||
|
||||
it('maps completed result counters without guessing from text', () => {
|
||||
expect(mapOrderExtractionRunToMessageState(run({
|
||||
status: 'completed',
|
||||
result: { batch_no: 'SB-1', created_count: 2, opened_existing_count: 1, pending_count: 0 },
|
||||
}))).toMatchObject({
|
||||
status: 'completed', terminal: true, batch_no: 'SB-1', created_count: 2, opened_existing_count: 1,
|
||||
});
|
||||
});
|
||||
|
||||
it('maps needs_review and failed to distinct terminal states', () => {
|
||||
expect(mapOrderExtractionRunToMessageState(run({
|
||||
status: 'needs_review', result: { pending_count: 3 },
|
||||
}))).toMatchObject({ status: 'partially_completed', pending_count: 3, terminal: true });
|
||||
expect(mapOrderExtractionRunToMessageState(run({
|
||||
status: 'failed', error: { code: 'X', message: 'provider failed' },
|
||||
}))).toMatchObject({ status: 'failed', message: 'provider failed', terminal: true });
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,245 @@
|
||||
/**
|
||||
* features/chat/shipping/useShippingOrderExtractionRuns.ts
|
||||
* 用途:把货代订单抽取作为独立 Run 启动、轮询并投影到聊天状态消息。
|
||||
* 依赖:shipping.api Run 接口、chat.types、Vue refs。
|
||||
* 逻辑:发送处理器调用 startRun;本模块持久化本地消息并轮询 Run,终态后刷新 Intake、批次工作台与动作。
|
||||
*/
|
||||
import { onBeforeUnmount, type ComputedRef, type Ref } from 'vue';
|
||||
import {
|
||||
createWorkspaceShippingOrderExtractionRun,
|
||||
getWorkspaceShippingOrderExtractionRun,
|
||||
listWorkspaceShippingOrderExtractionRuns,
|
||||
} from '../api/shipping.api';
|
||||
import type { ChatMessage, ChatMessageAttachment, ShippingOrderExtractionState } from '../types/chat.types';
|
||||
import type { ShippingOrderExtractionRun } from '../types/shipping.api.types';
|
||||
|
||||
interface UseShippingOrderExtractionRunsOptions {
|
||||
messages: Ref<ChatMessage[]>;
|
||||
conversationId: Ref<string | null>;
|
||||
currentAgentId: ComputedRef<number>;
|
||||
newLocalMessageId: (prefix: string) => string;
|
||||
saveLocalMessageToBackend: (message: ChatMessage, userQuery?: string) => Promise<boolean>;
|
||||
refreshNoticeIntakeStatuses: () => Promise<void>;
|
||||
clearConsumedNoticeAttachments: () => void;
|
||||
syncShippingConversationWorkspace: (options?: { preferLatest?: boolean }) => Promise<boolean>;
|
||||
refreshShippingActions: () => Promise<void>;
|
||||
loadHistory: () => Promise<void>;
|
||||
onConversationResolved: (conversationId: string) => Promise<void> | void;
|
||||
t: (key: string, params?: Record<string, unknown>) => string;
|
||||
}
|
||||
|
||||
const ACTIVE_RUN_STATUSES = new Set(['queued', 'running', 'result_persisted']);
|
||||
|
||||
/** 把领域 Run 转为聊天组件既有的订单抽取状态卡契约。 */
|
||||
export function mapOrderExtractionRunToMessageState(run: ShippingOrderExtractionRun): ShippingOrderExtractionState {
|
||||
const result = run.result || {};
|
||||
const failed = run.status === 'failed' || run.status === 'cancelled';
|
||||
const partial = run.status === 'needs_review';
|
||||
const completed = run.status === 'completed';
|
||||
return {
|
||||
status: failed ? 'failed' : partial ? 'partially_completed' : completed ? 'completed' : 'extracting',
|
||||
phase: failed ? 'failed' : run.status === 'result_persisted' ? 'result_persisted' : 'llm_extraction',
|
||||
message: failed ? String(run.error?.message || '') : '',
|
||||
created_count: Number(result.created_count || 0),
|
||||
opened_existing_count: Number(result.opened_existing_count || 0),
|
||||
pending_count: Number(result.pending_count || 0),
|
||||
non_shipping_count: Number(result.non_shipping_count || 0),
|
||||
created_with_missing_fields_count: Number(result.created_with_missing_fields_count || 0),
|
||||
batch_no: result.batch_no || null,
|
||||
terminal: failed || partial || completed,
|
||||
};
|
||||
}
|
||||
|
||||
export function useShippingOrderExtractionRuns(options: UseShippingOrderExtractionRunsOptions) {
|
||||
let pollTimer: ReturnType<typeof setTimeout> | null = null;
|
||||
let requestController: AbortController | null = null;
|
||||
let activeRunNo = '';
|
||||
let pollFailureCount = 0;
|
||||
let pollGeneration = 0;
|
||||
const persistedSignatures = new Map<string, string>();
|
||||
|
||||
/** 停止当前 Run 短轮询;终态、切会话和组件卸载都会调用。 */
|
||||
const stopPolling = () => {
|
||||
if (pollTimer) clearTimeout(pollTimer);
|
||||
requestController?.abort();
|
||||
requestController = null;
|
||||
pollTimer = null;
|
||||
activeRunNo = '';
|
||||
pollFailureCount = 0;
|
||||
pollGeneration += 1;
|
||||
};
|
||||
|
||||
/**
|
||||
* 查找或创建当前 Run 的助手状态消息,仅在业务状态真正变化时持久化。
|
||||
* @param run - 用户态 Run 摘要,不包含 Provider 快照或原始文档。
|
||||
* @returns 当前会话内原位更新后的助手状态消息。
|
||||
*/
|
||||
const upsertRunMessage = async (run: ShippingOrderExtractionRun): Promise<ChatMessage> => {
|
||||
const formId = `shipping-order-extraction-run:${run.run_no}`;
|
||||
const state = mapOrderExtractionRunToMessageState(run);
|
||||
let message = options.messages.value.find((item) => {
|
||||
const payload = item.payload && typeof item.payload === 'object' ? item.payload as Record<string, unknown> : {};
|
||||
return payload.formId === formId;
|
||||
});
|
||||
if (!message) {
|
||||
message = {
|
||||
role: 'assistant',
|
||||
type: 'text',
|
||||
content: '',
|
||||
local_id: options.newLocalMessageId('shipping-order-extraction'),
|
||||
local_only: true,
|
||||
};
|
||||
options.messages.value.push(message);
|
||||
}
|
||||
message.shipping_order_extraction_state = state;
|
||||
message.payload = {
|
||||
formId,
|
||||
order_extraction_run_no: run.run_no,
|
||||
shipping_order_extraction_state: state,
|
||||
};
|
||||
const signature = JSON.stringify({ status: run.status, phase: run.phase, result: run.result, error: run.error });
|
||||
if (persistedSignatures.get(run.run_no) !== signature) {
|
||||
const persisted = await options.saveLocalMessageToBackend(message);
|
||||
if (persisted) persistedSignatures.set(run.run_no, signature);
|
||||
}
|
||||
return message;
|
||||
};
|
||||
|
||||
/**
|
||||
* Run 终态后容错刷新领域事实;单个视图失败不得阻断其他事实和聊天历史恢复。
|
||||
* @returns 所有可独立执行的刷新均已尝试完成。
|
||||
*/
|
||||
const refreshTerminalFacts = async () => {
|
||||
await Promise.allSettled([
|
||||
options.refreshNoticeIntakeStatuses(),
|
||||
options.refreshShippingActions(),
|
||||
]);
|
||||
options.clearConsumedNoticeAttachments();
|
||||
try {
|
||||
if (!(await options.syncShippingConversationWorkspace({ preferLatest: true }))) {
|
||||
await new Promise((resolve) => setTimeout(resolve, 300));
|
||||
await options.syncShippingConversationWorkspace({ preferLatest: true });
|
||||
}
|
||||
} catch {
|
||||
// Run 状态卡已持久化;工作台可由页面下一次刷新继续恢复。
|
||||
}
|
||||
await Promise.allSettled([options.loadHistory()]);
|
||||
};
|
||||
|
||||
/** 创建带 10 秒上限的 Run GET 控制器;超时只中止本次查询,不改变后台业务状态。 */
|
||||
const createRequestController = (generation: number) => {
|
||||
requestController?.abort();
|
||||
const controller = new AbortController();
|
||||
requestController = controller;
|
||||
const timeout = setTimeout(() => controller.abort(), 10000);
|
||||
return {
|
||||
signal: controller.signal,
|
||||
release: () => { clearTimeout(timeout); if (generation === pollGeneration) requestController = null; },
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* 轮询指定 Run;generation 隔离切会话后的迟到响应,网络失败按上限退避。
|
||||
* @param runNo - 当前会话唯一活动 Run 编号。
|
||||
* @param generation - 启动本轮轮询时的生命周期版本。
|
||||
*/
|
||||
const pollRun = async (runNo: string, generation: number): Promise<void> => {
|
||||
if (generation !== pollGeneration || activeRunNo !== runNo) return;
|
||||
|
||||
try {
|
||||
const request = createRequestController(generation);
|
||||
const run = await getWorkspaceShippingOrderExtractionRun(runNo, request.signal).finally(request.release);
|
||||
if (generation !== pollGeneration || activeRunNo !== runNo) return;
|
||||
pollFailureCount = 0;
|
||||
await upsertRunMessage(run);
|
||||
if (generation !== pollGeneration || activeRunNo !== runNo) return;
|
||||
if (!ACTIVE_RUN_STATUSES.has(run.status)) {
|
||||
stopPolling();
|
||||
await refreshTerminalFacts();
|
||||
return;
|
||||
}
|
||||
pollTimer = setTimeout(() => void pollRun(run.run_no, generation), 2000);
|
||||
} catch {
|
||||
if (generation !== pollGeneration || activeRunNo !== runNo) return;
|
||||
pollFailureCount += 1;
|
||||
const delayMs = Math.min(15000, 2000 * (2 ** Math.min(pollFailureCount, 3)));
|
||||
pollTimer = setTimeout(() => void pollRun(runNo, generation), delayMs);
|
||||
}
|
||||
};
|
||||
|
||||
/** 为活动 Run 建立新的轮询生命周期,确保同一组件实例仅跟踪一个 Run。 */
|
||||
const beginPolling = (runNo: string, delayMs: number) => {
|
||||
stopPolling();
|
||||
activeRunNo = runNo;
|
||||
const generation = pollGeneration;
|
||||
pollTimer = setTimeout(() => void pollRun(runNo, generation), delayMs);
|
||||
};
|
||||
|
||||
/**
|
||||
* 启动订单抽取后台 Run,并把用户操作和状态卡持久化到本地会话。
|
||||
* @param query - 用户本次展示文本;不发送给 Dify Chatflow。
|
||||
* @param intakeNos - 本次冻结的 Intake 编号。
|
||||
* @param attachments - 用户消息中的安全附件快照。
|
||||
* @returns Run 已成功创建或幂等复用时为 true。
|
||||
*/
|
||||
const startRun = async (
|
||||
query: string,
|
||||
intakeNos: string[],
|
||||
attachments: ChatMessageAttachment[],
|
||||
): Promise<boolean> => {
|
||||
stopPolling();
|
||||
const response = await createWorkspaceShippingOrderExtractionRun({
|
||||
agent_id: options.currentAgentId.value,
|
||||
conversation_id: options.conversationId.value || undefined,
|
||||
intake_nos: intakeNos,
|
||||
});
|
||||
const run = response.run;
|
||||
if (!options.conversationId.value) options.conversationId.value = run.conversation_id;
|
||||
|
||||
const userMessage: ChatMessage = {
|
||||
role: 'user',
|
||||
type: 'text',
|
||||
content: query,
|
||||
attachments,
|
||||
local_id: options.newLocalMessageId('shipping-order-extraction-user'),
|
||||
local_only: true,
|
||||
payload: {
|
||||
formId: `shipping-order-extraction-user:${run.run_no}`,
|
||||
order_extraction_run_no: run.run_no,
|
||||
},
|
||||
};
|
||||
options.messages.value.push(userMessage);
|
||||
await options.saveLocalMessageToBackend(userMessage, query);
|
||||
await upsertRunMessage(run);
|
||||
await options.onConversationResolved(run.conversation_id);
|
||||
if (ACTIVE_RUN_STATUSES.has(run.status)) {
|
||||
beginPolling(run.run_no, 1000);
|
||||
} else {
|
||||
await refreshTerminalFacts();
|
||||
}
|
||||
return true;
|
||||
};
|
||||
|
||||
/** 刷新或进入既有会话时恢复最新 Run;活动 Run 继续轮询,终态只恢复状态卡。 */
|
||||
const restoreForConversation = async (conversationId: string): Promise<void> => {
|
||||
stopPolling();
|
||||
try {
|
||||
const generation = pollGeneration;
|
||||
const request = createRequestController(generation);
|
||||
const { items } = await listWorkspaceShippingOrderExtractionRuns(conversationId, 20, request.signal).finally(request.release);
|
||||
if (options.conversationId.value !== conversationId) return;
|
||||
const latest = items[0];
|
||||
if (!latest) return;
|
||||
await upsertRunMessage(latest);
|
||||
if (options.conversationId.value !== conversationId) return;
|
||||
if (ACTIVE_RUN_STATUSES.has(latest.status)) {
|
||||
beginPolling(latest.run_no, 1000);
|
||||
}
|
||||
} catch {
|
||||
// 会话历史仍可正常使用;下一次进入会话或手动刷新时重新恢复 Run。
|
||||
}
|
||||
};
|
||||
|
||||
onBeforeUnmount(stopPolling);
|
||||
return { startRun, restoreForConversation, stopPolling, getActiveRunNo: () => activeRunNo };
|
||||
}
|
||||
@@ -540,6 +540,46 @@ export interface ShippingNoticeIntakeResponse {
|
||||
candidate_count?: number;
|
||||
}
|
||||
|
||||
export type ShippingOrderExtractionRunStatus =
|
||||
| 'queued'
|
||||
| 'running'
|
||||
| 'result_persisted'
|
||||
| 'completed'
|
||||
| 'needs_review'
|
||||
| 'failed'
|
||||
| 'cancelled';
|
||||
|
||||
export interface ShippingOrderExtractionRun {
|
||||
run_no: string;
|
||||
agent_id: number;
|
||||
conversation_id: string;
|
||||
status: ShippingOrderExtractionRunStatus;
|
||||
phase: string;
|
||||
intake_nos: string[];
|
||||
schema_version_id: number;
|
||||
schema_version?: number | null;
|
||||
schema_checksum?: string | null;
|
||||
attempt_count: number;
|
||||
result?: {
|
||||
batch_no?: string | null;
|
||||
created_count?: number;
|
||||
opened_existing_count?: number;
|
||||
pending_count?: number;
|
||||
non_shipping_count?: number;
|
||||
created_with_missing_fields_count?: number;
|
||||
} | null;
|
||||
error?: { code?: string | null; message?: string | null } | null;
|
||||
created_at?: string | null;
|
||||
updated_at?: string | null;
|
||||
started_at?: string | null;
|
||||
finished_at?: string | null;
|
||||
}
|
||||
|
||||
export interface ShippingOrderExtractionRunCreateResponse {
|
||||
run: ShippingOrderExtractionRun;
|
||||
reused: boolean;
|
||||
}
|
||||
|
||||
export interface ShippingNoticeDocumentResponse {
|
||||
id: number;
|
||||
document_type: string;
|
||||
|
||||
@@ -34,6 +34,15 @@ const expectSameKeys = (trees: LocaleTree[]) => {
|
||||
};
|
||||
|
||||
describe('shipping notice i18n parity', () => {
|
||||
it('keeps admin order schema keys aligned', () => {
|
||||
expectSameKeys([
|
||||
adminZhCn.shippingOrderSchema as LocaleTree,
|
||||
adminZhTw.shippingOrderSchema as LocaleTree,
|
||||
adminEn.shippingOrderSchema as LocaleTree,
|
||||
adminTh.shippingOrderSchema as LocaleTree,
|
||||
]);
|
||||
});
|
||||
|
||||
it('keeps admin inventory configuration keys aligned', () => {
|
||||
expectSameKeys([
|
||||
adminZhCn.shippingInventory as LocaleTree,
|
||||
|
||||
@@ -76,12 +76,9 @@ export interface ShippingIdentityDefinitionOption {
|
||||
description?: string | null;
|
||||
evidence_label: string;
|
||||
target_type: 'customer' | 'site';
|
||||
source_adapter_key: 'email_metadata' | 'document_template' | 'order_field';
|
||||
source_selector: Record<string, unknown>;
|
||||
attribute_key: string;
|
||||
normalizer_key: string;
|
||||
context_field_id: string;
|
||||
max_automation: 'none' | 'conditional';
|
||||
order_field?: { field_id: string; field_code: string; display_name?: string } | null;
|
||||
context_field?: { field_id: string; field_code: string; display_name?: string } | null;
|
||||
}
|
||||
|
||||
export interface ShippingIdentityEvidence {
|
||||
|
||||
@@ -31,6 +31,8 @@
|
||||
"shippingConfig": "Shipping Configuration",
|
||||
"shippingInventory": "Inventory Configuration",
|
||||
"shippingIdentityRules": "Customer Identity Rules"
|
||||
,
|
||||
"platformApps": "Platform Apps"
|
||||
},
|
||||
"shippingOrderSchema": {
|
||||
"eyebrow": "Order field template",
|
||||
@@ -70,7 +72,14 @@
|
||||
"diffRemovedField": "This field existed in the baseline but was removed in the compared version",
|
||||
"diffOrderChanged": "Order only changed",
|
||||
"diffStatus": { "added": "Added", "removed": "Removed", "modified": "Modified", "unchanged": "Unchanged" },
|
||||
"diffField": { "field_code": "Field name (system identifier)", "scope": "Field placement", "value_type": "Data format", "enabled": "Included in current version", "display_name": "Current version display name", "description": "Description", "business_purpose": "Business purpose", "required": "Business required", "aliases": "Aliases", "normalizer_key": "Text processing", "validator_keys": "Content validation", "enum_options": "Enum options", "relation_role": "Cross-document relation", "comparator_key": "Comparison method", "extraction_instruction": "Extraction instruction", "sequence": "Field order", "evidence_policy.required": "Original evidence required", "evidence_policy.source_precedence": "Recognizable sources", "evidence_policy.conflict_policy": "On content conflict", "evidence_policy.allow_single_source": "Allow one trusted source" },
|
||||
"diffField": { "field_code": "Field name (system identifier)", "scope": "Field placement", "value_type": "Data format", "enabled": "Included in current version", "display_name": "Current version display name", "description": "Description", "business_purpose": "Business purpose", "required": "Business required", "aliases": "Aliases", "normalizer_key": "Text processing", "validator_keys": "Content validation", "enum_options": "Enum options", "relation_role": "Cross-document relation", "comparator_key": "Comparison method", "extraction_instruction": "Extraction instruction", "sequence": "Field order", "evidence_policy.required": "Original evidence required", "evidence_policy.source_precedence": "Recognizable sources", "evidence_policy.conflict_policy": "On content conflict", "evidence_policy.allow_single_source": "Allow one trusted source" ,
|
||||
"field_category": "Field category",
|
||||
"collection_mode": "Collection mode",
|
||||
"context_source": "Deterministic source",
|
||||
"sensitivity_level": "Sensitivity level",
|
||||
"dify_exposure_policy": "Dify exposure policy",
|
||||
"available_for_customer_identity": "Available for customer identity"
|
||||
},
|
||||
"auditTitle": "Configuration audit timeline",
|
||||
"auditEmpty": "No configuration audit events",
|
||||
"auditLoadMore": "Load more audit events",
|
||||
@@ -186,6 +195,19 @@
|
||||
"setupStepRules": "Set aliases, validation, and EML/PDF evidence rules for each field",
|
||||
"setupStepPublish": "Publish the field version for downstream configuration",
|
||||
"operationFailed": "Order template operation failed"
|
||||
,
|
||||
"fieldCategory": "Field category",
|
||||
"fieldCategoryOption": {"general_context":"General context fields","order_header":"Order information","order_line":"Item details"},
|
||||
"contextSource": "Deterministic source",
|
||||
"selectContextSource": "Select a source field",
|
||||
"contextSourceHint": "Only registered and active platform sources are available. No extraction prompt is required.",
|
||||
"contextOption": {"mail_header_from_email":"Sender email","mail_header_from_domain":"Sender organization domain"},
|
||||
"deterministicCollection": "Collected deterministically by HXOPS",
|
||||
"deterministicCollectionHint": "The LLM neither extracts nor adjudicates this field, and it is hidden from Dify by default. Sender identity always uses the original EML From header.",
|
||||
"difyExposurePolicy": "Dify read-only exposure",
|
||||
"difyExposurePolicyOption": {"never":"Never expose","redacted":"Redacted read-only","confirmed_readonly":"Frozen value read-only"},
|
||||
"difyExposurePolicyHint": {"never":"This field is omitted from Dify inputs.","redacted":"Only an irreversible placeholder is sent; the original email, domain, and recoverable patterns are excluded.","confirmed_readonly":"Sends the deterministic value frozen for this HXOPS run. This does not mean customer-confirmed, and Dify must not write it back."},
|
||||
"availableForCustomerIdentity": "Allow the published field for customer identity"
|
||||
},
|
||||
"shippingInventory": {
|
||||
"title": "Shipping Configuration",
|
||||
@@ -397,7 +419,9 @@
|
||||
"activationRequiredHint": "Complete the current item and the system will continue deciding whether the site can be enabled automatically.",
|
||||
"activationOptionalTitle": "Prepare later (does not block enablement)",
|
||||
"activationOptionalHint": "Complete when inventory exists or before an actual transfer.",
|
||||
"readinessState": { "passed": "Complete", "required": "Action required", "waiting": "Waiting for prerequisite", "optional": "Complete when inventory or a transfer requires it", "failed": "Check failed; resolve and retry", "stale": "Configuration changed; run the test again" },
|
||||
"readinessState": { "passed": "Complete", "required": "Action required", "waiting": "Waiting for prerequisite", "optional": "Complete when inventory or a transfer requires it", "failed": "Check failed; resolve and retry", "stale": "Configuration changed; run the test again" ,
|
||||
"empty": "Export succeeded but inventory is empty; validate rows with the first non-empty file"
|
||||
},
|
||||
"readinessAction": { "configure_connection": "Configure connection", "configure_parsing_profile": "Configure parsing", "configure_excel_template": "Configure template", "configure_warehouse_mapping": "Configure warehouse mapping" },
|
||||
"saveBeforeReadinessAction": "Save the current inventory-site changes before taking this action.",
|
||||
"activationReady": "The inventory site is enabled and can run in production.",
|
||||
@@ -698,8 +722,8 @@
|
||||
"scheduleTaskRequired": "Please select a linked schedule first"
|
||||
},
|
||||
"capabilities": {
|
||||
"title": "Runtime capabilities",
|
||||
"subtitle": "Control streaming, file upload, task progress, human confirmation, citations, guides, and more at runtime",
|
||||
"title": "Application interaction capabilities",
|
||||
"subtitle": "Control the interaction features and display options available in chat",
|
||||
"forcedByCatalog": "Fixed by the selected app type and cannot be turned off",
|
||||
"streaming": "Streaming",
|
||||
"streamingHint": "Stream chat responses via SSE; when off, wait for the full reply",
|
||||
@@ -806,6 +830,8 @@
|
||||
"memberCount": "{count} child apps",
|
||||
"normalListHint": "This app only"
|
||||
}
|
||||
,
|
||||
"runtimeBinding": {"title":"Background business capability binding","subtitle":"Explicitly select a background business provider; no name or environment fallback is used.","exposureMode":"Application visibility","exposureWorkspace":"Workspace entry","exposureInternal":"Internal business provider","exposureHint":"Internal applications are only available for background business bindings and are hidden from users.","enabled":"Enable order extraction service","provider":"Order extraction service provider","selectProvider":"Select an internal Dify Workflow","timeout":"Timeout (seconds)","maxAttempts":"Maximum attempts","noProvider":"No eligible internal Dify Workflow exists. Create and test the service provider application first.","providerRequired":"Select an order extraction service provider first."}
|
||||
},
|
||||
"question": {
|
||||
"title": "Common Questions",
|
||||
@@ -1065,6 +1091,8 @@
|
||||
"employeeIdSource": "Employee ID Source",
|
||||
"mobileNormalize": "Normalize mobile number",
|
||||
"publicBaseUrl": "Public HTTPS base (extranet)"
|
||||
,
|
||||
"userSelect": "Select user"
|
||||
},
|
||||
"bindModes": {
|
||||
"match_rules": "Match automatically",
|
||||
@@ -1755,6 +1783,8 @@
|
||||
"targets": { "customer": "Customer", "site": "Delivery site" },
|
||||
"automations": { "none": "Candidate/manual review only", "conditional": "Controlled auto-confirm" },
|
||||
"status": { "draft": "Draft", "published": "Current", "retired": "Retired" }
|
||||
,
|
||||
"selectFieldHint": "Only currently published order-header fields enabled for customer identity can be selected."
|
||||
},
|
||||
"shippingCustomers": {
|
||||
"title": "Shipping Customer Master Data", "subtitle": "Maintain stable customer identities, short codes, identifiers, and initial imports", "add": "Add Customer", "edit": "Edit Customer", "saving": "Saving...", "importButton": "Initial Import", "search": "Search", "searchPlaceholder": "Search by customer name or short code", "empty": "No customers", "deactivate": "Deactivate", "confirmDeactivate": "Deactivate customer \"{name}\"? Historical business references will be retained.", "yes": "Yes", "no": "No",
|
||||
|
||||
@@ -144,6 +144,12 @@
|
||||
"USER_UNIQUENESS_CONFLICT": "Data uniqueness conflict.",
|
||||
"SYSTEM_INTERNAL_ERROR": "Internal server error. Please try again later.",
|
||||
"AGENT_HANDLER_NOT_CONFIGURED": "Agent business handler is not configured. Please contact an administrator.",
|
||||
"AGENT_RUNTIME_CAPABILITY_NOT_DECLARED": "This application type does not declare the requested background business capability.",
|
||||
"AGENT_RUNTIME_BINDING_CONFIG_INVALID": "The background business capability timeout or retry configuration is invalid.",
|
||||
"AGENT_RUNTIME_PROVIDER_DISABLED": "The selected internal capability provider is disabled.",
|
||||
"AGENT_RUNTIME_PROVIDER_INVALID": "The selected application does not meet the provider requirements for this capability.",
|
||||
"AGENT_RUNTIME_PROVIDER_CONFIG_INCOMPLETE": "The internal provider is missing its Dify App ID, API base URL, or API key.",
|
||||
"AGENT_RUNTIME_PROVIDER_DELETE_BLOCKED": "This application is referenced by a runtime binding or historical run and cannot be deleted.",
|
||||
"SYSTEM_HTTP_ERROR": "Request failed.",
|
||||
"WECOM_RESET_NOT_CONFIGURED": "WeCom password reset is not configured. Enable WeCom under Admin → WeCom → System Settings and fill Corp ID, Agent ID, and Secret.",
|
||||
"WECOM_NOTIFY_DISABLED": "WeCom notifications are disabled. Enable them under Admin → WeCom → Notify Settings.",
|
||||
@@ -198,8 +204,24 @@
|
||||
"SHIPPING_NOTICE_DUPLICATE_ACTION_UNAVAILABLE": "This duplicate action is not allowed for the current state.",
|
||||
"SHIPPING_NOTICE_ORDER_EXTRACTION_CONTEXT_INVALID": "The order extraction context is invalid. Send the current email again.",
|
||||
"SHIPPING_NOTICE_ORDER_EXTRACTION_PENDING": "Email preprocessing is incomplete or order extraction is still in progress.",
|
||||
"SHIPPING_NOTICE_ORDER_EXTRACTION_ALREADY_COMPLETED": "The order extraction result has already been saved. Review the candidates or existing tasks.",
|
||||
"SHIPPING_NOTICE_ORDER_EXTRACTION_INVALID_RESULT": "The extracted order result does not match the contract. Parse it again.",
|
||||
"SHIPPING_NOTICE_ORDER_EXTRACTION_FAILED": "Order identification failed. Send the current email again.",
|
||||
"SHIPPING_NOTICE_ORDER_EXTRACTION_AGENT_NOT_FOUND": "The shipping agent was not found.",
|
||||
"SHIPPING_NOTICE_ORDER_EXTRACTION_AGENT_INVALID": "Select an active shipping notice agent.",
|
||||
"SHIPPING_NOTICE_ORDER_EXTRACTION_AGENT_FORBIDDEN": "You do not have permission to use this shipping agent.",
|
||||
"SHIPPING_NOTICE_ORDER_EXTRACTION_CONVERSATION_REQUIRED": "The order extraction conversation is required.",
|
||||
"SHIPPING_NOTICE_ORDER_EXTRACTION_CONVERSATION_NOT_FOUND": "The order extraction conversation was not found.",
|
||||
"SHIPPING_NOTICE_ORDER_EXTRACTION_CONVERSATION_MISMATCH": "The selected attachment does not belong to this conversation.",
|
||||
"SHIPPING_NOTICE_ORDER_EXTRACTION_INTAKES_INVALID": "Select between 1 and 50 valid shipping notice attachments.",
|
||||
"SHIPPING_NOTICE_ORDER_EXTRACTION_RUN_ACTIVE": "An order extraction run is already active for a selected attachment.",
|
||||
"SHIPPING_NOTICE_ORDER_EXTRACTION_RUN_NOT_FOUND": "The order extraction run was not found or is not accessible.",
|
||||
"SHIPPING_NOTICE_ORDER_EXTRACTION_RUN_TRANSITION_INVALID": "The order extraction run status changed. Refresh and try again.",
|
||||
"SHIPPING_NOTICE_ORDER_EXTRACTION_PROVIDER_NOT_CONFIGURED": "The freight application has no enabled order extraction Workflow binding. Ask an administrator to configure it.",
|
||||
"SHIPPING_NOTICE_ORDER_EXTRACTION_PROVIDER_INVALID_RESPONSE": "The order extraction Workflow returned data that does not match the structured contract.",
|
||||
"SHIPPING_NOTICE_ORDER_EXTRACTION_PROVIDER_FAILED": "The order extraction Workflow request failed. The system will retry according to policy.",
|
||||
"SHIPPING_NOTICE_ORDER_EXTRACTION_PROVIDER_CHANGED": "The order extraction Workflow application or address changed. Start a new run.",
|
||||
"SHIPPING_NOTICE_ORDER_EXTRACTION_TIMEOUT": "The order extraction Workflow timed out. The system will retry according to policy.",
|
||||
"SHIPPING_NOTICE_CANDIDATE_SOURCE_CHANGED": "The email or attachment content changed. Send it again to re-extract orders.",
|
||||
"SHIPPING_CUSTOMER_IMPORT_SOURCE_INVALID": "The source system code is invalid or too long.",
|
||||
"SHIPPING_CUSTOMER_IMPORT_TOO_MANY_ROWS": "The import exceeds the row limit.",
|
||||
|
||||
@@ -70,7 +70,14 @@
|
||||
"diffRemovedField": "ฟิลด์นี้มีในเวอร์ชันฐาน แต่ถูกลบในเวอร์ชันที่เปรียบเทียบ",
|
||||
"diffOrderChanged": "เปลี่ยนเฉพาะลำดับ",
|
||||
"diffStatus": { "added": "เพิ่ม", "removed": "ลบ", "modified": "แก้ไข", "unchanged": "ไม่เปลี่ยนแปลง" },
|
||||
"diffField": { "field_code": "ชื่อฟิลด์ (ตัวระบุระบบ)", "scope": "ตำแหน่งฟิลด์", "value_type": "รูปแบบข้อมูล", "enabled": "รวมในเวอร์ชันปัจจุบัน", "display_name": "ชื่อที่แสดงของเวอร์ชันปัจจุบัน", "description": "คำอธิบาย", "business_purpose": "วัตถุประสงค์ทางธุรกิจ", "required": "จำเป็นทางธุรกิจ", "aliases": "ชื่อแทน", "normalizer_key": "การประมวลผลข้อความ", "validator_keys": "การตรวจสอบเนื้อหา", "enum_options": "ตัวเลือก enum", "relation_role": "ความสัมพันธ์ข้ามเอกสาร", "comparator_key": "วิธีเปรียบเทียบ", "extraction_instruction": "คำสั่งสกัดข้อมูล", "sequence": "ลำดับฟิลด์", "evidence_policy.required": "ต้องมีหลักฐานต้นฉบับ", "evidence_policy.source_precedence": "แหล่งเนื้อหาที่จดจำได้", "evidence_policy.conflict_policy": "เมื่อเนื้อหาขัดแย้ง", "evidence_policy.allow_single_source": "อนุญาตแหล่งที่เชื่อถือได้แหล่งเดียว" },
|
||||
"diffField": { "field_code": "ชื่อฟิลด์ (ตัวระบุระบบ)", "scope": "ตำแหน่งฟิลด์", "value_type": "รูปแบบข้อมูล", "enabled": "รวมในเวอร์ชันปัจจุบัน", "display_name": "ชื่อที่แสดงของเวอร์ชันปัจจุบัน", "description": "คำอธิบาย", "business_purpose": "วัตถุประสงค์ทางธุรกิจ", "required": "จำเป็นทางธุรกิจ", "aliases": "ชื่อแทน", "normalizer_key": "การประมวลผลข้อความ", "validator_keys": "การตรวจสอบเนื้อหา", "enum_options": "ตัวเลือก enum", "relation_role": "ความสัมพันธ์ข้ามเอกสาร", "comparator_key": "วิธีเปรียบเทียบ", "extraction_instruction": "คำสั่งสกัดข้อมูล", "sequence": "ลำดับฟิลด์", "evidence_policy.required": "ต้องมีหลักฐานต้นฉบับ", "evidence_policy.source_precedence": "แหล่งเนื้อหาที่จดจำได้", "evidence_policy.conflict_policy": "เมื่อเนื้อหาขัดแย้ง", "evidence_policy.allow_single_source": "อนุญาตแหล่งที่เชื่อถือได้แหล่งเดียว" ,
|
||||
"field_category": "หมวดหมู่ฟิลด์",
|
||||
"collection_mode": "วิธีเก็บข้อมูล",
|
||||
"context_source": "แหล่งข้อมูลแบบกำหนดแน่นอน",
|
||||
"sensitivity_level": "ระดับความอ่อนไหว",
|
||||
"dify_exposure_policy": "นโยบายการเปิดเผยต่อ Dify",
|
||||
"available_for_customer_identity": "ใช้ระบุตัวตนลูกค้าได้"
|
||||
},
|
||||
"auditTitle": "ไทม์ไลน์การตรวจสอบการตั้งค่า",
|
||||
"auditEmpty": "ยังไม่มีเหตุการณ์ตรวจสอบการตั้งค่า",
|
||||
"auditLoadMore": "โหลดเหตุการณ์ตรวจสอบเพิ่มเติม",
|
||||
@@ -186,6 +193,19 @@
|
||||
"setupStepRules": "กำหนดชื่อเรียก การตรวจสอบ และกฎหลักฐาน EML/PDF ของแต่ละฟิลด์",
|
||||
"setupStepPublish": "เผยแพร่เวอร์ชันฟิลด์เพื่อให้การตั้งค่าถัดไปอ้างอิงได้อย่างปลอดภัย",
|
||||
"operationFailed": "ดำเนินการเทมเพลตคำสั่งซื้อไม่สำเร็จ"
|
||||
,
|
||||
"fieldCategory": "หมวดหมู่ฟิลด์",
|
||||
"fieldCategoryOption": {"general_context":"ฟิลด์บริบททั่วไป","order_header":"ข้อมูลคำสั่งซื้อ","order_line":"รายละเอียดสินค้า"},
|
||||
"contextSource": "แหล่งข้อมูลแบบกำหนดแน่นอน",
|
||||
"selectContextSource": "เลือกฟิลด์แหล่งข้อมูล",
|
||||
"contextSourceHint": "เลือกได้เฉพาะแหล่งข้อมูลของแพลตฟอร์มที่ลงทะเบียนและเปิดใช้งานแล้ว โดยไม่ต้องเขียนพรอมต์การแยกข้อมูล",
|
||||
"contextOption": {"mail_header_from_email":"อีเมลผู้ส่ง","mail_header_from_domain":"โดเมนองค์กรของผู้ส่ง"},
|
||||
"deterministicCollection": "HXOPS เก็บข้อมูลแบบกำหนดแน่นอน",
|
||||
"deterministicCollectionHint": "LLM จะไม่แยกหรือตัดสินฟิลด์นี้ และจะไม่ส่งให้ Dify โดยค่าเริ่มต้น ผู้ส่งจะอ้างอิงจากส่วนหัว From ของ EML ต้นฉบับเท่านั้น",
|
||||
"difyExposurePolicy": "นโยบายเปิดเผยแบบอ่านอย่างเดียวให้ Dify",
|
||||
"difyExposurePolicyOption": {"never":"ไม่เปิดเผย","redacted":"ปกปิดและอ่านอย่างเดียว","confirmed_readonly":"ค่าที่ตรึงและอ่านอย่างเดียว"},
|
||||
"difyExposurePolicyHint": {"never":"ฟิลด์นี้จะไม่อยู่ในอินพุตของ Dify","redacted":"ส่งเฉพาะค่าตัวแทนที่ย้อนคืนไม่ได้ โดยไม่ส่งอีเมล โดเมน หรือลักษณะที่กู้คืนได้","confirmed_readonly":"ส่งค่าที่ HXOPS เก็บแบบกำหนดแน่นอนและตรึงไว้สำหรับ Run นี้ ไม่ได้หมายความว่าลูกค้ายืนยันแล้ว และ Dify ห้ามเขียนค่ากลับ"},
|
||||
"availableForCustomerIdentity": "อนุญาตให้ใช้ฟิลด์ที่เผยแพร่แล้วเพื่อระบุตัวตนลูกค้า"
|
||||
},
|
||||
"shippingInventory": {
|
||||
"title": "การตั้งค่าการจัดส่ง",
|
||||
@@ -382,7 +402,9 @@
|
||||
"activationRequiredHint": "ทำรายการปัจจุบันให้เสร็จ แล้วระบบจะพิจารณาการเปิดใช้งานอัตโนมัติต่อไป",
|
||||
"activationOptionalTitle": "การเตรียมภายหลัง (ไม่ขัดขวางการเปิดใช้งาน)",
|
||||
"activationOptionalHint": "ดำเนินการเมื่อมีสต็อกหรือก่อนโอนย้ายจริง",
|
||||
"readinessState": { "passed": "เสร็จสมบูรณ์", "required": "ต้องดำเนินการ", "waiting": "รอขั้นตอนก่อนหน้า", "optional": "ดำเนินการเมื่อมีสต็อกหรือก่อนโอนย้าย", "failed": "การตรวจสอบไม่ผ่าน โปรดแก้ไขและลองใหม่", "stale": "การตั้งค่าเปลี่ยนแล้ว โปรดทดสอบอีกครั้ง" },
|
||||
"readinessState": { "passed": "เสร็จสมบูรณ์", "required": "ต้องดำเนินการ", "waiting": "รอขั้นตอนก่อนหน้า", "optional": "ดำเนินการเมื่อมีสต็อกหรือก่อนโอนย้าย", "failed": "การตรวจสอบไม่ผ่าน โปรดแก้ไขและลองใหม่", "stale": "การตั้งค่าเปลี่ยนแล้ว โปรดทดสอบอีกครั้ง" ,
|
||||
"empty": "ส่งออกสำเร็จแต่ยังไม่มีสต็อก โปรดตรวจสอบแถวข้อมูลด้วยไฟล์แรกที่มีข้อมูล"
|
||||
},
|
||||
"readinessAction": { "configure_connection": "ตั้งค่าการเชื่อมต่อ", "configure_parsing_profile": "ตั้งค่าการอ่านไฟล์", "configure_excel_template": "ตั้งค่าเทมเพลต", "configure_warehouse_mapping": "ตั้งค่าการแมปคลังสินค้า" },
|
||||
"saveBeforeReadinessAction": "โปรดบันทึกการเปลี่ยนแปลงไซต์สต็อกปัจจุบันก่อนดำเนินการนี้",
|
||||
"activationReady": "เปิดใช้งานไซต์สต็อกแล้วและพร้อมใช้งานจริง",
|
||||
@@ -683,8 +705,8 @@
|
||||
"scheduleTaskRequired": "โปรดเลือกตารางงานที่เชื่อมก่อน"
|
||||
},
|
||||
"capabilities": {
|
||||
"title": "ความสามารถในการทำงาน",
|
||||
"subtitle": "ควบคุมการสตรีม การอัปโหลดไฟล์ ความคืบหน้างาน การยืนยันจากผู้ใช้ การอ้างอิงแหล่งที่มา และคู่มือเริ่มต้นในแชท",
|
||||
"title": "ความสามารถด้านการโต้ตอบของแอป",
|
||||
"subtitle": "ควบคุมฟังก์ชันการโต้ตอบและรูปแบบการแสดงผลที่รองรับในหน้าแชท",
|
||||
"forcedByCatalog": "ถูกกำหนดโดยประเภทแอปปัจจุบันและปิดไม่ได้",
|
||||
"streaming": "สตรีมมิ่ง",
|
||||
"streamingHint": "ตอบแชทแบบ SSE แบบสตรีม ปิดแล้วจะรอคำตอบเต็ม",
|
||||
@@ -791,6 +813,8 @@
|
||||
"memberCount": "แอปลูก {count} รายการ",
|
||||
"normalListHint": "เฉพาะแอปนี้"
|
||||
}
|
||||
,
|
||||
"runtimeBinding": {"title":"การผูกความสามารถทางธุรกิจเบื้องหลัง","subtitle":"เลือกผู้ให้บริการธุรกิจเบื้องหลังอย่างชัดเจน โดยไม่ย้อนกลับไปใช้ชื่อหรือค่าจากสภาพแวดล้อม","exposureMode":"การมองเห็นแอป","exposureWorkspace":"ทางเข้าพื้นที่ทำงาน","exposureInternal":"ผู้ให้บริการธุรกิจภายใน","exposureHint":"แอปภายในใช้สำหรับการผูกธุรกิจเบื้องหลังเท่านั้นและไม่แสดงต่อผู้ใช้ทั่วไป","enabled":"เปิดใช้บริการแยกคำสั่งซื้อ","provider":"ผู้ให้บริการบริการแยกคำสั่งซื้อ","selectProvider":"เลือก Dify Workflow ภายใน","timeout":"หมดเวลา (วินาที)","maxAttempts":"จำนวนครั้งสูงสุด","noProvider":"ยังไม่มี Dify Workflow ภายในที่ใช้ได้ โปรดสร้างและทดสอบแอปผู้ให้บริการก่อน","providerRequired":"โปรดเลือกผู้ให้บริการบริการแยกคำสั่งซื้อก่อน"}
|
||||
},
|
||||
"question": {
|
||||
"title": "คำถามทั่วไป",
|
||||
@@ -1583,16 +1607,18 @@
|
||||
"shippingIdentityRules": {
|
||||
"eyebrow": "การกำกับลูกค้าขนส่ง",
|
||||
"title": "กฎการระบุตัวตนลูกค้า",
|
||||
"subtitle": "แพลตฟอร์มมีตัวปรับแหล่งข้อมูลที่ควบคุมได้ ผู้ดูแลกำหนด เผยแพร่ และตรวจสอบกฎอีเมล โดเมน เทมเพลต และฟิลด์คำสั่งซื้อเอง",
|
||||
"subtitle": "กฎระบุตัวตนลูกค้าอ้างอิงเฉพาะฟิลด์บริบทคำสั่งซื้อที่เผยแพร่แล้ว โดย Schema คำสั่งซื้อเป็นผู้กำหนดการเก็บ ตรวจสอบ และเวอร์ชัน",
|
||||
"loading": "กำลังโหลดกฎการระบุตัวตน...",
|
||||
"definitions": "นิยามการระบุตัวตน",
|
||||
"definitionHint": "นิยามการระบุตัวตนทั้งหมดเป็นการกำหนดค่าทางธุรกิจ เลือกตัวปรับแหล่งข้อมูลที่แพลตฟอร์มอนุญาต และใช้ได้เฉพาะฟิลด์ Header ที่เผยแพร่แล้วสำหรับคำสั่งซื้อ",
|
||||
"definitionHint": "เลือกฟิลด์ Header ที่เผยแพร่และเปิดใช้สำหรับการระบุตัวตนลูกค้า ระบบจะใช้เฉพาะค่าที่ตัดสินแล้วของฟิลด์นั้น",
|
||||
"code": "รหัสนิยาม", "target": "เป้าหมาย", "source": "แหล่งที่มา", "automation": "ระดับอัตโนมัติสูงสุด", "normalizer": "วิธีจัดการข้อความ",
|
||||
"displayName": "ชื่อกฎ", "displayNamePlaceholder": "เช่น อีเมลผู้ส่งของลูกค้าสหรัฐ", "evidenceLabel": "ชื่อหลักฐานในข้อมูลหลักลูกค้า", "evidenceLabelPlaceholder": "เช่น อีเมลธุรกิจของลูกค้า", "description": "คำอธิบายการใช้ (ไม่บังคับ)", "descriptionPlaceholder": "เช่น ใช้ระบุลูกค้าผู้ชำระเงินในภูมิภาคสหรัฐ", "formGuide": "ตั้งชื่อกฎตามความหมายทางธุรกิจและเลือกแหล่งข้อมูล ระบบจะใช้กฎทางเทคนิคที่จำเป็นให้อัตโนมัติ", "emailType": "ข้อมูลอีเมลที่ใช้", "identityAttribute": "ใช้ระบุอะไร", "templateValue": "ลักษณะรูปแบบของเอกสารปัจจุบัน", "selectionResult": "กฎนี้จะใช้",
|
||||
"selectField": "เลือกฟิลด์คำสั่งซื้อที่เผยแพร่แล้ว", "addDefinition": "เพิ่มนิยามธุรกิจ", "definitionSaved": "บันทึกนิยามการระบุตัวตนแล้ว", "workflowTitle": "ลำดับการตั้งค่า", "workflowHint": "1. เพิ่มนิยามการระบุตัวตน 2. สร้าง บันทึก และเผยแพร่ชุดกฎ 3. กลับไปที่ข้อมูลหลักลูกค้าเพื่อดูแลหลักฐานของลูกค้าหรือสถานที่จัดส่ง", "openCustomerMaster": "ไปที่ข้อมูลหลักลูกค้า",
|
||||
"displayName": "ชื่อกฎ", "displayNamePlaceholder": "เช่น อีเมลผู้ส่งของลูกค้าสหรัฐ", "evidenceLabel": "ชื่อหลักฐานในข้อมูลหลักลูกค้า", "evidenceLabelPlaceholder": "เช่น อีเมลธุรกิจของลูกค้า", "description": "คำอธิบายการใช้ (ไม่บังคับ)", "descriptionPlaceholder": "เช่น ใช้ระบุลูกค้าผู้ชำระเงินในภูมิภาคสหรัฐ", "formGuide": "ตั้งชื่อกฎและเลือกฟิลด์ระบุตัวตน วิธีเก็บ รูปแบบ และการตรวจสอบจะสืบทอดจาก Schema คำสั่งซื้อที่เผยแพร่แล้ว", "emailType": "ข้อมูลอีเมลที่ใช้", "identityAttribute": "ใช้ระบุอะไร", "templateValue": "ลักษณะรูปแบบของเอกสารปัจจุบัน", "selectionResult": "กฎนี้จะใช้",
|
||||
"selectField": "เลือกฟิลด์ระบุตัวตนที่เผยแพร่แล้ว", "addDefinition": "เพิ่มนิยามธุรกิจ", "definitionSaved": "บันทึกนิยามการระบุตัวตนแล้ว", "workflowTitle": "ลำดับการตั้งค่า", "workflowHint": "1. เพิ่มนิยามการระบุตัวตน 2. สร้าง บันทึก และเผยแพร่ชุดกฎ 3. กลับไปที่ข้อมูลหลักลูกค้าเพื่อดูแลหลักฐานของลูกค้าหรือสถานที่จัดส่ง", "openCustomerMaster": "ไปที่ข้อมูลหลักลูกค้า",
|
||||
"ruleSets": "เวอร์ชันชุดกฎ", "ruleSetHint": "สแนปช็อตที่เผยแพร่แล้วแก้ไขไม่ได้ ต้องแทนที่หรือเลิกใช้นิยามก่อนเลิกใช้ฟิลด์คำสั่งซื้อที่ถูกอ้างอิง",
|
||||
"createDraft": "สร้างร่างกฎ", "saveDraft": "บันทึกร่าง", "publish": "เผยแพร่ชุดกฎ", "ruleSetSaved": "บันทึกร่างกฎแล้ว", "ruleSetPublished": "เผยแพร่ชุดกฎการระบุตัวตนแล้ว", "operationFailed": "การดำเนินการกฎการระบุตัวตนลูกค้าล้มเหลว",
|
||||
"targets": { "customer": "ลูกค้า", "site": "สถานที่จัดส่ง" }, "automations": { "none": "เฉพาะผู้สมัคร/ตรวจสอบด้วยคน", "conditional": "ยืนยันอัตโนมัติแบบควบคุม" }, "status": { "draft": "ร่าง", "published": "ใช้งานอยู่", "retired": "เลิกใช้" }
|
||||
,
|
||||
"selectFieldHint": "แสดงเฉพาะฟิลด์ Header ที่เปิดใช้สำหรับการระบุตัวตนลูกค้าในเวอร์ชันปัจจุบัน"
|
||||
},
|
||||
"shippingCustomers": {
|
||||
"title": "ข้อมูลหลักลูกค้าขนส่ง", "subtitle": "จัดการตัวตนลูกค้า รหัสย่อ หลักฐานระบุตัวตน และการนำเข้าข้อมูลตั้งต้น", "add": "เพิ่มลูกค้า", "edit": "แก้ไขลูกค้า", "saving": "กำลังบันทึก...", "importButton": "นำเข้าข้อมูลตั้งต้น", "search": "ค้นหา", "searchPlaceholder": "ค้นหาชื่อลูกค้าหรือรหัสย่อ", "empty": "ไม่มีลูกค้า", "deactivate": "ปิดใช้งาน", "confirmDeactivate": "ยืนยันปิดใช้งานลูกค้า \"{name}\" หรือไม่? ประวัติธุรกิจจะยังคงอยู่", "yes": "ใช่", "no": "ไม่",
|
||||
|
||||
@@ -144,6 +144,12 @@
|
||||
"USER_UNIQUENESS_CONFLICT": "ข้อมูลซ้ำกัน",
|
||||
"SYSTEM_INTERNAL_ERROR": "เซิร์ฟเวอร์ขัดข้อง กรุณาลองใหม่ภายหลัง",
|
||||
"AGENT_HANDLER_NOT_CONFIGURED": "ยังไม่ได้กำหนด Agent handler กรุณาติดต่อผู้ดูแลระบบ",
|
||||
"AGENT_RUNTIME_CAPABILITY_NOT_DECLARED": "ประเภทแอปพลิเคชันนี้ไม่ได้ประกาศความสามารถทางธุรกิจเบื้องหลังที่ร้องขอ",
|
||||
"AGENT_RUNTIME_BINDING_CONFIG_INVALID": "การตั้งค่าเวลาหมดอายุหรือการลองใหม่ของความสามารถทางธุรกิจเบื้องหลังไม่ถูกต้อง",
|
||||
"AGENT_RUNTIME_PROVIDER_DISABLED": "Provider ความสามารถภายในที่เลือกถูกปิดใช้งาน",
|
||||
"AGENT_RUNTIME_PROVIDER_INVALID": "แอปพลิเคชันที่เลือกไม่ตรงตามข้อกำหนด Provider ของความสามารถนี้",
|
||||
"AGENT_RUNTIME_PROVIDER_CONFIG_INCOMPLETE": "Provider ภายในยังขาด Dify App ID, API base URL หรือ API key",
|
||||
"AGENT_RUNTIME_PROVIDER_DELETE_BLOCKED": "แอปพลิเคชันนี้ถูกอ้างอิงโดย runtime binding หรืองานในอดีต จึงไม่สามารถลบได้",
|
||||
"SYSTEM_HTTP_ERROR": "คำขอล้มเหลว",
|
||||
"WECOM_RESET_NOT_CONFIGURED": "ยังไม่ได้ตั้งค่าการรีเซ็ตรหัสผ่านผ่าน WeCom โปรดเปิดใช้งานและกรอก Corp ID, Agent ID, Secret ใน Admin → WeCom → System Settings",
|
||||
"WECOM_NOTIFY_DISABLED": "การแจ้งเตือน WeCom ถูกปิด โปรดเปิดใน Admin → WeCom → Notify Settings",
|
||||
@@ -198,8 +204,24 @@
|
||||
"SHIPPING_NOTICE_DUPLICATE_ACTION_UNAVAILABLE": "สถานะรายการซ้ำปัจจุบันไม่อนุญาตการดำเนินการนี้",
|
||||
"SHIPPING_NOTICE_ORDER_EXTRACTION_CONTEXT_INVALID": "บริบทการแยกคำสั่งซื้อไม่ถูกต้อง โปรดส่งอีเมลปัจจุบันอีกครั้ง",
|
||||
"SHIPPING_NOTICE_ORDER_EXTRACTION_PENDING": "การประมวลผลอีเมลเบื้องต้นยังไม่เสร็จ หรือกำลังแยกคำสั่งซื้ออยู่",
|
||||
"SHIPPING_NOTICE_ORDER_EXTRACTION_ALREADY_COMPLETED": "บันทึกผลการแยกคำสั่งซื้อของอีเมลนี้แล้ว โปรดตรวจสอบรายการคำสั่งซื้อที่เสนอหรืองานที่มีอยู่",
|
||||
"SHIPPING_NOTICE_ORDER_EXTRACTION_INVALID_RESULT": "ผลการแยกคำสั่งซื้อไม่ตรงตามสัญญาข้อมูล โปรดลองแยกข้อความใหม่",
|
||||
"SHIPPING_NOTICE_ORDER_EXTRACTION_FAILED": "การระบุคำสั่งซื้อล้มเหลว โปรดส่งอีเมลปัจจุบันอีกครั้ง",
|
||||
"SHIPPING_NOTICE_ORDER_EXTRACTION_AGENT_NOT_FOUND": "ไม่พบแอปตัวแทนขนส่ง",
|
||||
"SHIPPING_NOTICE_ORDER_EXTRACTION_AGENT_INVALID": "โปรดเลือกแอปใบแจ้งจัดส่งที่เปิดใช้งาน",
|
||||
"SHIPPING_NOTICE_ORDER_EXTRACTION_AGENT_FORBIDDEN": "คุณไม่มีสิทธิ์ใช้แอปตัวแทนขนส่งนี้",
|
||||
"SHIPPING_NOTICE_ORDER_EXTRACTION_CONVERSATION_REQUIRED": "ต้องระบุการสนทนาของงานแยกคำสั่งซื้อ",
|
||||
"SHIPPING_NOTICE_ORDER_EXTRACTION_CONVERSATION_NOT_FOUND": "ไม่พบการสนทนาของงานแยกคำสั่งซื้อ",
|
||||
"SHIPPING_NOTICE_ORDER_EXTRACTION_CONVERSATION_MISMATCH": "ไฟล์แนบที่เลือกไม่ได้อยู่ในการสนทนานี้",
|
||||
"SHIPPING_NOTICE_ORDER_EXTRACTION_INTAKES_INVALID": "เลือกไฟล์แนบใบแจ้งจัดส่งที่ถูกต้อง 1 ถึง 50 ไฟล์",
|
||||
"SHIPPING_NOTICE_ORDER_EXTRACTION_RUN_ACTIVE": "มีงานแยกคำสั่งซื้อที่กำลังทำงานสำหรับไฟล์แนบที่เลือกแล้ว",
|
||||
"SHIPPING_NOTICE_ORDER_EXTRACTION_RUN_NOT_FOUND": "ไม่พบงานแยกคำสั่งซื้อหรือคุณไม่มีสิทธิ์เข้าถึง",
|
||||
"SHIPPING_NOTICE_ORDER_EXTRACTION_RUN_TRANSITION_INVALID": "สถานะงานแยกคำสั่งซื้อเปลี่ยนแล้ว โปรดรีเฟรชและลองใหม่",
|
||||
"SHIPPING_NOTICE_ORDER_EXTRACTION_PROVIDER_NOT_CONFIGURED": "แอปขนส่งยังไม่ได้ผูก Workflow แยกคำสั่งซื้อที่เปิดใช้งาน โปรดติดต่อผู้ดูแลระบบ",
|
||||
"SHIPPING_NOTICE_ORDER_EXTRACTION_PROVIDER_INVALID_RESPONSE": "Workflow แยกคำสั่งซื้อส่งคืนข้อมูลที่ไม่ตรงตามสัญญาแบบมีโครงสร้าง",
|
||||
"SHIPPING_NOTICE_ORDER_EXTRACTION_PROVIDER_FAILED": "การเรียก Workflow แยกคำสั่งซื้อล้มเหลว ระบบจะลองใหม่ตามนโยบาย",
|
||||
"SHIPPING_NOTICE_ORDER_EXTRACTION_PROVIDER_CHANGED": "แอปหรือที่อยู่ของ Workflow แยกคำสั่งซื้อเปลี่ยนแล้ว โปรดเริ่มงานใหม่",
|
||||
"SHIPPING_NOTICE_ORDER_EXTRACTION_TIMEOUT": "Workflow แยกคำสั่งซื้อหมดเวลา ระบบจะลองใหม่ตามนโยบาย",
|
||||
"SHIPPING_NOTICE_CANDIDATE_SOURCE_CHANGED": "เนื้อหาอีเมลหรือไฟล์แนบเปลี่ยนแปลง โปรดส่งอีกครั้งเพื่อแยกคำสั่งซื้อใหม่",
|
||||
"SHIPPING_CUSTOMER_IMPORT_SOURCE_INVALID": "รหัสระบบต้นทางไม่ถูกต้องหรือยาวเกินไป",
|
||||
"SHIPPING_CUSTOMER_IMPORT_TOO_MANY_ROWS": "จำนวนแถวนำเข้าเกินขีดจำกัด",
|
||||
|
||||
@@ -71,7 +71,7 @@
|
||||
"diffRemovedField": "该字段在基线版本中存在,但比较版本已移除",
|
||||
"diffOrderChanged": "仅顺序变化",
|
||||
"diffStatus": { "added": "新增", "removed": "移除", "modified": "已修改", "unchanged": "未变化" },
|
||||
"diffField": { "field_code": "字段名称(系统标识)", "scope": "字段位置", "value_type": "数据格式", "enabled": "纳入当前版本", "display_name": "当前版本显示名称", "description": "说明", "business_purpose": "业务用途", "required": "业务必填", "aliases": "别名", "normalizer_key": "文本处理方式", "validator_keys": "内容校验", "enum_options": "枚举选项", "relation_role": "跨文档关联", "comparator_key": "核对方式", "extraction_instruction": "识别说明", "sequence": "字段顺序", "evidence_policy.required": "必须提供原文证据", "evidence_policy.source_precedence": "可识别的内容来源", "evidence_policy.conflict_policy": "内容不一致时", "evidence_policy.allow_single_source": "允许单一可信来源" },
|
||||
"diffField": { "field_code": "字段名称(系统标识)", "scope": "字段位置", "value_type": "数据格式", "field_category": "字段分类", "collection_mode": "采集方式", "enabled": "纳入当前版本", "display_name": "当前版本显示名称", "description": "说明", "business_purpose": "业务用途", "required": "业务必填", "aliases": "别名", "normalizer_key": "文本处理方式", "validator_keys": "内容校验", "enum_options": "枚举选项", "relation_role": "跨文档关联", "comparator_key": "核对方式", "extraction_instruction": "识别说明", "context_source": "确定性来源", "sensitivity_level": "敏感等级", "dify_exposure_policy": "Dify 暴露策略", "available_for_customer_identity": "可用于客户识别", "sequence": "字段顺序", "evidence_policy.required": "必须提供原文证据", "evidence_policy.source_precedence": "可识别的内容来源", "evidence_policy.conflict_policy": "内容不一致时", "evidence_policy.allow_single_source": "允许单一可信来源" },
|
||||
"auditTitle": "配置审计时间线",
|
||||
"auditEmpty": "暂无配置审计事件",
|
||||
"auditLoadMore": "加载更多审计事件",
|
||||
@@ -119,6 +119,18 @@
|
||||
"businessFieldNameHint": "请填写英文小写下划线标识,如 part_number、reservation_id、request_qty。",
|
||||
"fieldEditingHint": "显示名称和系统标识始终可编辑;是否纳入只影响当前版本发布。",
|
||||
"businessFieldPlacement": "字段位置",
|
||||
"fieldCategory": "字段分类",
|
||||
"fieldCategoryOption": { "general_context": "通用上下文字段", "order_header": "订单信息", "order_line": "货品明细" },
|
||||
"contextSource": "确定性来源",
|
||||
"selectContextSource": "请选择来源字段",
|
||||
"contextSourceHint": "仅可选择平台已登记并启用的来源,不需要填写解析提示词。",
|
||||
"contextOption": { "mail_header_from_email": "发件人邮箱", "mail_header_from_domain": "发件人企业域名" },
|
||||
"deterministicCollection": "由 HXOPS 确定性采集",
|
||||
"deterministicCollectionHint": "该字段不由 LLM 提取或裁决,默认不向 Dify 暴露。发件人固定取原始 EML 的 From 邮件头。",
|
||||
"difyExposurePolicy": "Dify 只读暴露策略",
|
||||
"difyExposurePolicyOption": { "never": "从不暴露", "redacted": "脱敏只读", "confirmed_readonly": "冻结值只读" },
|
||||
"difyExposurePolicyHint": { "never": "该字段不会进入 Dify 输入。", "redacted": "仅传入不可逆占位值,不包含原邮箱、域名或可恢复特征。", "confirmed_readonly": "传入当前 Run 已冻结的 HXOPS 确定性值;不代表客户已确认,Dify 不得回写。" },
|
||||
"availableForCustomerIdentity": "允许已发布版本用于客户识别",
|
||||
"businessFieldFormat": "数据格式",
|
||||
"placementHeader": "订单信息",
|
||||
"placementLine": "货品明细",
|
||||
@@ -751,8 +763,8 @@
|
||||
"scheduleTaskRequired": "请先选择关联的排程任务"
|
||||
},
|
||||
"capabilities": {
|
||||
"title": "运行能力",
|
||||
"subtitle": "控制聊天页是否支持流式输出、附件上传、任务进度、人工确认、引用来源与新手指南等运行时能力",
|
||||
"title": "应用交互能力",
|
||||
"subtitle": "控制聊天页支持的交互功能和展示方式",
|
||||
"forcedByCatalog": "由当前应用类型固定,不可关闭",
|
||||
"streaming": "流式输出",
|
||||
"streamingHint": "开启后对话以 SSE 流式返回,关闭则等待完整响应",
|
||||
@@ -787,7 +799,22 @@
|
||||
"erpKb": "ERP 固资知识库",
|
||||
"erpKbHint": "启用后聊天页默认展示企业知识库,并允许切换到 ERP 固资知识库"
|
||||
},
|
||||
"training": {
|
||||
"runtimeBinding": {
|
||||
"title": "后台业务能力绑定",
|
||||
"subtitle": "为当前入口应用显式选择后台业务 Provider,不按名称或环境变量回退。",
|
||||
"exposureMode": "应用可见性",
|
||||
"exposureWorkspace": "工作台入口",
|
||||
"exposureInternal": "内部业务 Provider",
|
||||
"exposureHint": "内部应用仅供后台业务绑定,不向普通用户展示。",
|
||||
"enabled": "启用订单抽取服务",
|
||||
"provider": "订单抽取服务 Provider",
|
||||
"selectProvider": "请选择内部 Dify Workflow",
|
||||
"timeout": "超时时间(秒)",
|
||||
"maxAttempts": "最大尝试次数",
|
||||
"noProvider": "暂无符合条件的内部 Dify Workflow,请先创建并测试服务 Provider 应用。",
|
||||
"providerRequired": "请先选择订单抽取服务 Provider。"
|
||||
},
|
||||
"training": {
|
||||
"title": "员工培训配置",
|
||||
"subtitle": "配置培训工作区的及格线、复盘要点和题库。保存后,员工培训页会优先读取这里的后台内容。",
|
||||
"enable": "启用员工培训工作区",
|
||||
@@ -1760,10 +1787,10 @@
|
||||
"shippingIdentityRules": {
|
||||
"eyebrow": "货代客户治理",
|
||||
"title": "客户识别规则",
|
||||
"subtitle": "平台提供受控来源适配器;邮箱、域名、模板与订单字段规则均由管理员配置、发布和审计。",
|
||||
"subtitle": "客户识别只引用已发布订单上下文字段;字段采集、校验与版本审计统一由订单 Schema 管理。",
|
||||
"loading": "正在加载识别规则...",
|
||||
"definitions": "识别定义",
|
||||
"definitionHint": "所有识别定义均为业务配置。请选择平台提供的来源适配器;订单字段仅可选择已发布 Header 字段。",
|
||||
"definitionHint": "请选择当前已发布 Schema 中允许客户识别的 Header 字段;运行时只使用该字段的已裁决值。",
|
||||
"code": "定义编码",
|
||||
"target": "识别对象",
|
||||
"source": "来源",
|
||||
@@ -1775,12 +1802,13 @@
|
||||
"evidenceLabelPlaceholder": "例如:客户业务邮箱",
|
||||
"description": "使用说明(可选)",
|
||||
"descriptionPlaceholder": "例如:用于识别美国区域的账款客户",
|
||||
"formGuide": "填写这条规则在业务中的名称,选择信息来源;系统会自动处理识别所需的技术规则。",
|
||||
"formGuide": "填写业务名称并选择识别字段;字段的采集方式、格式和校验规则全部继承已发布订单 Schema。",
|
||||
"emailType": "邮件识别内容",
|
||||
"identityAttribute": "用于识别什么",
|
||||
"templateValue": "当前单据的版式特征",
|
||||
"selectionResult": "本次规则将使用",
|
||||
"selectField": "请选择已发布订单字段",
|
||||
"selectField": "请选择已发布识别字段",
|
||||
"selectFieldHint": "只显示当前版本中已启用客户识别的 Header 字段",
|
||||
"addDefinition": "新增业务定义",
|
||||
"definitionSaved": "识别定义已保存",
|
||||
"workflowTitle": "配置顺序",
|
||||
|
||||
@@ -148,6 +148,12 @@
|
||||
"USER_UNIQUENESS_CONFLICT": "数据唯一性冲突。",
|
||||
"SYSTEM_INTERNAL_ERROR": "服务器内部错误,请稍后重试。",
|
||||
"AGENT_HANDLER_NOT_CONFIGURED": "应用业务 Handler 未配置,请联系管理员。",
|
||||
"AGENT_RUNTIME_CAPABILITY_NOT_DECLARED": "当前应用类型未声明该后台业务能力。",
|
||||
"AGENT_RUNTIME_BINDING_CONFIG_INVALID": "后台业务能力的超时或重试配置无效。",
|
||||
"AGENT_RUNTIME_PROVIDER_DISABLED": "所选内部能力 Provider 已停用。",
|
||||
"AGENT_RUNTIME_PROVIDER_INVALID": "所选应用不符合该后台业务能力的 Provider 类型要求。",
|
||||
"AGENT_RUNTIME_PROVIDER_CONFIG_INCOMPLETE": "内部能力 Provider 的 Dify App ID、API 地址或密钥配置不完整。",
|
||||
"AGENT_RUNTIME_PROVIDER_DELETE_BLOCKED": "该应用已被后台业务能力绑定或历史任务引用,不能删除。",
|
||||
"SYSTEM_HTTP_ERROR": "请求失败。",
|
||||
"WECOM_RESET_NOT_CONFIGURED": "企微找回密码未配置,请在管理端「企业微信 → 系统配置」开启企微并填写 Corp ID、Agent ID、Secret。",
|
||||
"WECOM_NOTIFY_DISABLED": "企微通知已关闭,请在管理端「企业微信 → 通知设置」开启。",
|
||||
@@ -202,8 +208,24 @@
|
||||
"SHIPPING_NOTICE_DUPLICATE_ACTION_UNAVAILABLE": "当前重复状态不允许该处理方式。",
|
||||
"SHIPPING_NOTICE_ORDER_EXTRACTION_CONTEXT_INVALID": "订单识别上下文无效,请重新发送当前邮件。",
|
||||
"SHIPPING_NOTICE_ORDER_EXTRACTION_PENDING": "邮件预处理尚未完成,或本次订单识别仍在处理中。",
|
||||
"SHIPPING_NOTICE_ORDER_EXTRACTION_ALREADY_COMPLETED": "该邮件的订单识别结果已保存,请查看订单候选或已有任务。",
|
||||
"SHIPPING_NOTICE_ORDER_EXTRACTION_INVALID_RESULT": "订单识别结果不符合协议,请重新解析。",
|
||||
"SHIPPING_NOTICE_ORDER_EXTRACTION_FAILED": "订单识别失败,请重新发送当前邮件。",
|
||||
"SHIPPING_NOTICE_ORDER_EXTRACTION_AGENT_NOT_FOUND": "货代应用不存在。",
|
||||
"SHIPPING_NOTICE_ORDER_EXTRACTION_AGENT_INVALID": "请选择已启用的货代发货应用。",
|
||||
"SHIPPING_NOTICE_ORDER_EXTRACTION_AGENT_FORBIDDEN": "您没有使用该货代应用的权限。",
|
||||
"SHIPPING_NOTICE_ORDER_EXTRACTION_CONVERSATION_REQUIRED": "缺少订单抽取所属会话。",
|
||||
"SHIPPING_NOTICE_ORDER_EXTRACTION_CONVERSATION_NOT_FOUND": "订单抽取所属会话不存在。",
|
||||
"SHIPPING_NOTICE_ORDER_EXTRACTION_CONVERSATION_MISMATCH": "所选附件不属于当前会话。",
|
||||
"SHIPPING_NOTICE_ORDER_EXTRACTION_INTAKES_INVALID": "请选择 1 至 50 个有效的发货通知附件。",
|
||||
"SHIPPING_NOTICE_ORDER_EXTRACTION_RUN_ACTIVE": "所选附件已有正在处理的订单抽取任务。",
|
||||
"SHIPPING_NOTICE_ORDER_EXTRACTION_RUN_NOT_FOUND": "订单抽取任务不存在或无权访问。",
|
||||
"SHIPPING_NOTICE_ORDER_EXTRACTION_RUN_TRANSITION_INVALID": "订单抽取任务状态已变化,请刷新后重试。",
|
||||
"SHIPPING_NOTICE_ORDER_EXTRACTION_PROVIDER_NOT_CONFIGURED": "货代应用尚未绑定启用的订单抽取 Workflow,请联系管理员配置。",
|
||||
"SHIPPING_NOTICE_ORDER_EXTRACTION_PROVIDER_INVALID_RESPONSE": "订单抽取 Workflow 返回的数据不符合结构化协议。",
|
||||
"SHIPPING_NOTICE_ORDER_EXTRACTION_PROVIDER_FAILED": "订单抽取 Workflow 调用失败,系统将按策略重试。",
|
||||
"SHIPPING_NOTICE_ORDER_EXTRACTION_PROVIDER_CHANGED": "订单抽取 Workflow 的应用或地址已变化,请重新发起任务。",
|
||||
"SHIPPING_NOTICE_ORDER_EXTRACTION_TIMEOUT": "订单抽取 Workflow 执行超时,系统将按策略重试。",
|
||||
"SHIPPING_NOTICE_CANDIDATE_SOURCE_CHANGED": "邮件或附件内容已变化,请重新发送并识别订单。",
|
||||
"SHIPPING_CUSTOMER_IMPORT_SOURCE_INVALID": "来源系统编码无效或过长。",
|
||||
"SHIPPING_CUSTOMER_IMPORT_TOO_MANY_ROWS": "导入数据行数超过限制。",
|
||||
|
||||
@@ -70,7 +70,14 @@
|
||||
"diffRemovedField": "該欄位在基線版本中存在,但比較版本已移除",
|
||||
"diffOrderChanged": "僅順序變化",
|
||||
"diffStatus": { "added": "新增", "removed": "移除", "modified": "已修改", "unchanged": "未變化" },
|
||||
"diffField": { "field_code": "欄位名稱(系統識別)", "scope": "欄位位置", "value_type": "資料格式", "enabled": "納入目前版本", "display_name": "目前版本顯示名稱", "description": "說明", "business_purpose": "業務用途", "required": "業務必填", "aliases": "別名", "normalizer_key": "文字處理方式", "validator_keys": "內容檢核", "enum_options": "列舉選項", "relation_role": "跨文件關聯", "comparator_key": "核對方式", "extraction_instruction": "識別說明", "sequence": "欄位順序", "evidence_policy.required": "必須提供原文證據", "evidence_policy.source_precedence": "可識別的內容來源", "evidence_policy.conflict_policy": "內容不一致時", "evidence_policy.allow_single_source": "允許單一可信來源" },
|
||||
"diffField": { "field_code": "欄位名稱(系統識別)", "scope": "欄位位置", "value_type": "資料格式", "enabled": "納入目前版本", "display_name": "目前版本顯示名稱", "description": "說明", "business_purpose": "業務用途", "required": "業務必填", "aliases": "別名", "normalizer_key": "文字處理方式", "validator_keys": "內容檢核", "enum_options": "列舉選項", "relation_role": "跨文件關聯", "comparator_key": "核對方式", "extraction_instruction": "識別說明", "sequence": "欄位順序", "evidence_policy.required": "必須提供原文證據", "evidence_policy.source_precedence": "可識別的內容來源", "evidence_policy.conflict_policy": "內容不一致時", "evidence_policy.allow_single_source": "允許單一可信來源" ,
|
||||
"field_category": "欄位分類",
|
||||
"collection_mode": "採集方式",
|
||||
"context_source": "確定性來源",
|
||||
"sensitivity_level": "敏感等級",
|
||||
"dify_exposure_policy": "Dify 暴露策略",
|
||||
"available_for_customer_identity": "可用於客戶識別"
|
||||
},
|
||||
"auditTitle": "設定審計時間線",
|
||||
"auditEmpty": "暫無設定審計事件",
|
||||
"auditLoadMore": "載入更多審計事件",
|
||||
@@ -186,6 +193,19 @@
|
||||
"setupStepRules": "為欄位設定別名、校驗與 EML/PDF 證據規則",
|
||||
"setupStepPublish": "發布欄位版本,供後續設定安全引用",
|
||||
"operationFailed": "訂單範本操作失敗"
|
||||
,
|
||||
"fieldCategory": "欄位分類",
|
||||
"fieldCategoryOption": {"general_context":"通用上下文欄位","order_header":"訂單資訊","order_line":"貨品明細"},
|
||||
"contextSource": "確定性來源",
|
||||
"selectContextSource": "請選擇來源欄位",
|
||||
"contextSourceHint": "只能選擇平台已登記並啟用的來源,不需要填寫解析提示詞。",
|
||||
"contextOption": {"mail_header_from_email":"寄件者電子郵件","mail_header_from_domain":"寄件者企業網域"},
|
||||
"deterministicCollection": "由 HXOPS 確定性採集",
|
||||
"deterministicCollectionHint": "此欄位不由 LLM 提取或裁決,預設不向 Dify 暴露。寄件者固定取原始 EML 的 From 郵件標頭。",
|
||||
"difyExposurePolicy": "Dify 唯讀暴露策略",
|
||||
"difyExposurePolicyOption": {"never":"永不暴露","redacted":"遮罩唯讀","confirmed_readonly":"凍結值唯讀"},
|
||||
"difyExposurePolicyHint": {"never":"此欄位不會進入 Dify 輸入。","redacted":"僅傳入不可逆佔位值,不含原始電子郵件、網域或可恢復特徵。","confirmed_readonly":"傳入目前 Run 已凍結的 HXOPS 確定性值;不代表客戶已確認,Dify 不得回寫。"},
|
||||
"availableForCustomerIdentity": "允許已發布版本用於客戶識別"
|
||||
},
|
||||
"shippingInventory": {
|
||||
"title": "貨代設定",
|
||||
@@ -406,7 +426,9 @@
|
||||
"activationRequiredHint": "完成目前項目後,系統會繼續判斷是否可自動啟用。",
|
||||
"activationOptionalTitle": "後續準備(不影響啟用)",
|
||||
"activationOptionalHint": "有庫存資料或實際調撥前再完成。",
|
||||
"readinessState": { "passed": "已完成", "required": "需要完成", "waiting": "等待前置步驟完成", "optional": "有庫存或調撥時再完成", "failed": "檢查未通過,請重新處理", "stale": "設定已變更,請重新測試" },
|
||||
"readinessState": { "passed": "已完成", "required": "需要完成", "waiting": "等待前置步驟完成", "optional": "有庫存或調撥時再完成", "failed": "檢查未通過,請重新處理", "stale": "設定已變更,請重新測試" ,
|
||||
"empty": "匯出成功但目前無庫存,資料列待首次非空檔案驗證"
|
||||
},
|
||||
"readinessAction": { "configure_connection": "設定連線", "configure_parsing_profile": "設定解析", "configure_excel_template": "設定範本", "configure_warehouse_mapping": "設定倉庫對應" },
|
||||
"saveBeforeReadinessAction": "請先儲存目前庫存站點的變更,再執行此操作。",
|
||||
"activationReady": "庫存站點已啟用,可進入正式庫存執行。",
|
||||
@@ -707,8 +729,8 @@
|
||||
"scheduleTaskRequired": "請先選擇關聯的排程任務"
|
||||
},
|
||||
"capabilities": {
|
||||
"title": "執行能力",
|
||||
"subtitle": "控制聊天頁是否支援串流輸出、附件上傳、任務進度、人工確認、引用來源與新手指南等執行時能力",
|
||||
"title": "應用互動能力",
|
||||
"subtitle": "控制聊天頁支援的互動功能與顯示方式",
|
||||
"forcedByCatalog": "由目前應用類型固定,不可關閉",
|
||||
"streaming": "串流輸出",
|
||||
"streamingHint": "開啟後對話以 SSE 串流返回,關閉則等待完整回應",
|
||||
@@ -815,6 +837,8 @@
|
||||
"memberCount": "子應用 {count} 個",
|
||||
"normalListHint": "僅目前應用"
|
||||
}
|
||||
,
|
||||
"runtimeBinding": {"title":"後台業務能力綁定","subtitle":"為目前入口應用明確選擇後台業務 Provider,不按名稱或環境變數回退。","exposureMode":"應用可見性","exposureWorkspace":"工作台入口","exposureInternal":"內部業務 Provider","exposureHint":"內部應用僅供後台業務綁定,不向一般使用者顯示。","enabled":"啟用訂單抽取服務","provider":"訂單抽取服務 Provider","selectProvider":"請選擇內部 Dify Workflow","timeout":"逾時時間(秒)","maxAttempts":"最大嘗試次數","noProvider":"暫無符合條件的內部 Dify Workflow,請先建立並測試服務 Provider 應用。","providerRequired":"請先選擇訂單抽取服務 Provider。"}
|
||||
},
|
||||
"question": {
|
||||
"title": "常用問題",
|
||||
@@ -1607,16 +1631,18 @@
|
||||
"shippingIdentityRules": {
|
||||
"eyebrow": "貨代客戶治理",
|
||||
"title": "客戶識別規則",
|
||||
"subtitle": "平台提供受控來源適配器;電子郵件、網域、範本與訂單欄位規則均由管理員設定、發布與稽核。",
|
||||
"subtitle": "客戶識別只引用已發布訂單上下文欄位;欄位採集、校驗與版本稽核統一由訂單 Schema 管理。",
|
||||
"loading": "正在載入識別規則...",
|
||||
"definitions": "識別定義",
|
||||
"definitionHint": "所有識別定義均為業務設定。請選擇平台提供的來源適配器;訂單欄位僅可選擇已發布 Header 欄位。",
|
||||
"definitionHint": "請選擇目前已發布 Schema 中允許客戶識別的 Header 欄位;執行時只使用該欄位的已裁決值。",
|
||||
"code": "定義編碼", "target": "識別對象", "source": "來源", "automation": "自動化上限", "normalizer": "文字處理方式",
|
||||
"displayName": "規則名稱", "displayNamePlaceholder": "例如:美國客戶寄件者電子郵件", "evidenceLabel": "客戶主資料中的證據名稱", "evidenceLabelPlaceholder": "例如:客戶業務電子郵件", "description": "使用說明(可選)", "descriptionPlaceholder": "例如:用於識別美國區域的帳款客戶", "formGuide": "填寫這條規則在業務中的名稱並選擇資訊來源;系統會自動處理識別所需的技術規則。", "emailType": "郵件識別內容", "identityAttribute": "用於識別什麼", "templateValue": "目前單據的版式特徵", "selectionResult": "本次規則將使用",
|
||||
"selectField": "請選擇已發布訂單欄位", "addDefinition": "新增業務定義", "definitionSaved": "識別定義已儲存", "workflowTitle": "設定順序", "workflowHint": "1. 新增識別定義;2. 建立、儲存並發布規則集;3. 返回客戶主資料維護客戶或送貨站點證據。", "openCustomerMaster": "前往客戶主資料維護證據",
|
||||
"displayName": "規則名稱", "displayNamePlaceholder": "例如:美國客戶寄件者電子郵件", "evidenceLabel": "客戶主資料中的證據名稱", "evidenceLabelPlaceholder": "例如:客戶業務電子郵件", "description": "使用說明(可選)", "descriptionPlaceholder": "例如:用於識別美國區域的帳款客戶", "formGuide": "填寫業務名稱並選擇識別欄位;採集方式、格式與校驗規則全部繼承已發布訂單 Schema。", "emailType": "郵件識別內容", "identityAttribute": "用於識別什麼", "templateValue": "目前單據的版式特徵", "selectionResult": "本次規則將使用",
|
||||
"selectField": "請選擇已發布識別欄位", "addDefinition": "新增業務定義", "definitionSaved": "識別定義已儲存", "workflowTitle": "設定順序", "workflowHint": "1. 新增識別定義;2. 建立、儲存並發布規則集;3. 返回客戶主資料維護客戶或送貨站點證據。", "openCustomerMaster": "前往客戶主資料維護證據",
|
||||
"ruleSets": "規則集版本", "ruleSetHint": "發布後快照不可修改;退役訂單欄位前必須先替換或退役其引用定義。",
|
||||
"createDraft": "建立規則草稿", "saveDraft": "儲存草稿", "publish": "發布規則集", "ruleSetSaved": "規則草稿已儲存", "ruleSetPublished": "識別規則集已發布", "operationFailed": "客戶識別規則操作失敗",
|
||||
"targets": { "customer": "客戶主體", "site": "送貨站點" }, "automations": { "none": "僅候選/人工確認", "conditional": "受控自動確認" }, "status": { "draft": "草稿", "published": "目前發布", "retired": "已退役" }
|
||||
,
|
||||
"selectFieldHint": "只顯示目前版本中已啟用客戶識別的 Header 欄位"
|
||||
},
|
||||
"shippingCustomers": {
|
||||
"title": "貨代客戶主資料", "subtitle": "維護穩定客戶身份、客戶簡碼、識別證據與期初匯入", "add": "新增客戶", "edit": "編輯客戶", "saving": "儲存中...", "importButton": "期初匯入", "search": "查詢", "searchPlaceholder": "搜尋客戶名稱或簡碼", "empty": "暫無客戶", "deactivate": "停用", "confirmDeactivate": "確認停用客戶「{name}」嗎?歷史業務引用會保留。", "yes": "是", "no": "否",
|
||||
|
||||
@@ -144,6 +144,12 @@
|
||||
"USER_UNIQUENESS_CONFLICT": "數據唯一性衝突。",
|
||||
"SYSTEM_INTERNAL_ERROR": "伺服器內部錯誤,請稍後重試。",
|
||||
"AGENT_HANDLER_NOT_CONFIGURED": "應用業務 Handler 未配置,請聯絡管理員。",
|
||||
"AGENT_RUNTIME_CAPABILITY_NOT_DECLARED": "目前應用類型未宣告此後台業務能力。",
|
||||
"AGENT_RUNTIME_BINDING_CONFIG_INVALID": "後台業務能力的逾時或重試設定無效。",
|
||||
"AGENT_RUNTIME_PROVIDER_DISABLED": "所選內部能力 Provider 已停用。",
|
||||
"AGENT_RUNTIME_PROVIDER_INVALID": "所選應用不符合此後台業務能力的 Provider 類型要求。",
|
||||
"AGENT_RUNTIME_PROVIDER_CONFIG_INCOMPLETE": "內部能力 Provider 的 Dify App ID、API 位址或金鑰設定不完整。",
|
||||
"AGENT_RUNTIME_PROVIDER_DELETE_BLOCKED": "此應用已被後台業務能力綁定或歷史任務引用,無法刪除。",
|
||||
"SYSTEM_HTTP_ERROR": "請求失敗。",
|
||||
"WECOM_RESET_NOT_CONFIGURED": "企微找回密碼未配置,請在管理端「企業微信 → 系統配置」開啟企微並填寫 Corp ID、Agent ID、Secret。",
|
||||
"WECOM_NOTIFY_DISABLED": "企微通知已關閉,請在管理端「企業微信 → 通知設定」開啟。",
|
||||
@@ -198,8 +204,24 @@
|
||||
"SHIPPING_NOTICE_DUPLICATE_ACTION_UNAVAILABLE": "目前重複狀態不允許此處理方式。",
|
||||
"SHIPPING_NOTICE_ORDER_EXTRACTION_CONTEXT_INVALID": "訂單識別上下文無效,請重新傳送目前郵件。",
|
||||
"SHIPPING_NOTICE_ORDER_EXTRACTION_PENDING": "郵件預處理尚未完成,或本次訂單識別仍在處理中。",
|
||||
"SHIPPING_NOTICE_ORDER_EXTRACTION_ALREADY_COMPLETED": "該郵件的訂單識別結果已儲存,請查看訂單候選或既有任務。",
|
||||
"SHIPPING_NOTICE_ORDER_EXTRACTION_INVALID_RESULT": "訂單識別結果不符合協議,請重新解析。",
|
||||
"SHIPPING_NOTICE_ORDER_EXTRACTION_FAILED": "訂單識別失敗,請重新傳送目前郵件。",
|
||||
"SHIPPING_NOTICE_ORDER_EXTRACTION_AGENT_NOT_FOUND": "貨代應用不存在。",
|
||||
"SHIPPING_NOTICE_ORDER_EXTRACTION_AGENT_INVALID": "請選擇已啟用的貨代發貨應用。",
|
||||
"SHIPPING_NOTICE_ORDER_EXTRACTION_AGENT_FORBIDDEN": "您沒有使用該貨代應用的權限。",
|
||||
"SHIPPING_NOTICE_ORDER_EXTRACTION_CONVERSATION_REQUIRED": "缺少訂單抽取所屬會話。",
|
||||
"SHIPPING_NOTICE_ORDER_EXTRACTION_CONVERSATION_NOT_FOUND": "訂單抽取所屬會話不存在。",
|
||||
"SHIPPING_NOTICE_ORDER_EXTRACTION_CONVERSATION_MISMATCH": "所選附件不屬於目前會話。",
|
||||
"SHIPPING_NOTICE_ORDER_EXTRACTION_INTAKES_INVALID": "請選擇 1 至 50 個有效的發貨通知附件。",
|
||||
"SHIPPING_NOTICE_ORDER_EXTRACTION_RUN_ACTIVE": "所選附件已有正在處理的訂單抽取任務。",
|
||||
"SHIPPING_NOTICE_ORDER_EXTRACTION_RUN_NOT_FOUND": "訂單抽取任務不存在或無權存取。",
|
||||
"SHIPPING_NOTICE_ORDER_EXTRACTION_RUN_TRANSITION_INVALID": "訂單抽取任務狀態已變更,請重新整理後再試。",
|
||||
"SHIPPING_NOTICE_ORDER_EXTRACTION_PROVIDER_NOT_CONFIGURED": "貨代應用尚未綁定已啟用的訂單抽取 Workflow,請聯絡管理員設定。",
|
||||
"SHIPPING_NOTICE_ORDER_EXTRACTION_PROVIDER_INVALID_RESPONSE": "訂單抽取 Workflow 回傳的資料不符合結構化協議。",
|
||||
"SHIPPING_NOTICE_ORDER_EXTRACTION_PROVIDER_FAILED": "訂單抽取 Workflow 呼叫失敗,系統將依策略重試。",
|
||||
"SHIPPING_NOTICE_ORDER_EXTRACTION_PROVIDER_CHANGED": "訂單抽取 Workflow 的應用或位址已變更,請重新發起任務。",
|
||||
"SHIPPING_NOTICE_ORDER_EXTRACTION_TIMEOUT": "訂單抽取 Workflow 執行逾時,系統將依策略重試。",
|
||||
"SHIPPING_NOTICE_CANDIDATE_SOURCE_CHANGED": "郵件或附件內容已變更,請重新傳送並識別訂單。",
|
||||
"SHIPPING_CUSTOMER_IMPORT_SOURCE_INVALID": "來源系統編碼無效或過長。",
|
||||
"SHIPPING_CUSTOMER_IMPORT_TOO_MANY_ROWS": "匯入資料行數超過限制。",
|
||||
|
||||
Reference in new issue
Block a user