feat(shipping-notice): 新增临时库存管理功能,支持创建会话、获取分析结果及字段映射建议
This commit is contained in:
1 parent
46eb63f5bb
commit
e9bdd81f1a
320 files changed
+28361
-10487
No files matched your search
@@ -16,11 +16,9 @@ export interface ShippingDecisionContext {
|
||||
history: Ref<ChatSessionItem[]>;
|
||||
isShippingNoticeAgent: ComputedRef<boolean>;
|
||||
currentAgentId: ComputedRef<number>;
|
||||
shippingInventorySchemaPreviewCache: Ref<Record<string, unknown>>;
|
||||
getActiveShippingTaskId: () => string;
|
||||
getActiveShippingBatchNo: () => string;
|
||||
loadHistory: () => Promise<void>;
|
||||
openShippingInventoryMappingFormForTask: (taskId: string) => Promise<boolean>;
|
||||
refreshShippingActions: () => Promise<void>;
|
||||
startChatTurn: (options: StartChatTurnOptions) => Promise<boolean>;
|
||||
msg: { warning: (text: string) => void; success: (text: string) => void };
|
||||
@@ -54,23 +52,9 @@ export function createShippingDecisionHandlers(ctx: ShippingDecisionContext) {
|
||||
}
|
||||
};
|
||||
|
||||
const afterDecisionTurn = async (decision: string, taskId: string, assistantMsg?: ChatMessage) => {
|
||||
if (decision === 'correct_inventory_mapping' && assistantMsg?.payload && typeof assistantMsg.payload === 'object') {
|
||||
const toolResult = (assistantMsg.payload as { tool_result?: { data?: { schema_preview?: unknown } } }).tool_result;
|
||||
const preview = toolResult?.data?.schema_preview;
|
||||
const key = String(taskId || '').trim().toUpperCase();
|
||||
if (key && preview && typeof preview === 'object') {
|
||||
ctx.shippingInventorySchemaPreviewCache.value = {
|
||||
...ctx.shippingInventorySchemaPreviewCache.value,
|
||||
[key]: preview,
|
||||
};
|
||||
}
|
||||
}
|
||||
const afterDecisionTurn = async () => {
|
||||
await syncHistoryIfNeeded();
|
||||
void ctx.refreshShippingActions();
|
||||
if (decision === 'correct_inventory_mapping') {
|
||||
await ctx.openShippingInventoryMappingFormForTask(taskId);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -105,7 +89,8 @@ export function createShippingDecisionHandlers(ctx: ShippingDecisionContext) {
|
||||
silent: options?.silent,
|
||||
hooks: {
|
||||
onAssistantMessageFinished: async (assistantMsg) => {
|
||||
await afterDecisionTurn(decision, taskId, assistantMsg);
|
||||
void assistantMsg;
|
||||
await afterDecisionTurn();
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
Reference in new issue
Block a user