fix(shipping-notice): 优化发货通知Agent相关逻辑并修复问题

This commit is contained in:
hugo committed 2026-06-08 20:13:27 +08:00
1 parent ee90b66ff7
commit c974566c34
5 files changed
+11 -6

No files matched your search

-4
View File
@@ -1103,7 +1103,6 @@ def chat_completions():
raise ValidationError('This route does not support attachments')
generator = Text2SQLService.stream_chat(query, user_proxy.id, agent_proxy, external_conversation_id, session_id=session.session_id)
else:
<<<<<<< HEAD
from app.services.hr_leave_sqlserver import HRLeaveSQLServerService
if HRLeaveSQLServerService.supports(query):
if normalized_files:
@@ -1124,9 +1123,6 @@ def chat_completions():
files=normalized_files,
inputs=dify_inputs,
)
=======
generator = DifyService.stream_chat(query, user_proxy.id, agent_proxy, external_conversation_id, request_id=request_id, session_id=session.session_id, files=normalized_files)
>>>>>>> dev
def relay_stream():
created_event = {
@@ -78,6 +78,7 @@ def build_dify_openapi_spec(base_url: str) -> dict[str, Any]:
"create_task",
"创建发货任务 task",
{
"task_id": _str_prop("已存在的发货任务编号(可选)。传入时将直接复用该任务,禁止重复创建。"),
"user_id": _int_prop("Hxops 用户 ID(可选)"),
"conversation_id": _str_prop("Dify 会话 ID,便于工作台关联"),
"source_type": _str_prop("来源:manual|email|wecom|pdf", enum=["manual", "email", "wecom", "pdf"]),
+1 -1
View File
@@ -2823,7 +2823,7 @@ const messages = {
thinking: '正在生成回答...',
disclaimer: 'AI 可能会犯错,请核实重要信息。',
createNewChat: '创建新对话',
shippingNoticeContinue: '请继续处理发货任务 {taskId},请先调用 get_task_status 查询当前状态并告知我下一步。',
shippingNoticeContinue: '请继续处理发货任务 {taskId}。该任务已存在,禁止调用 create_task。请先调用 get_task_status(task_id={taskId})查询当前状态并告知我下一步。',
shippingNoticeActionsHint: '请选择操作:',
shippingNoticeMissingTaskId: '未找到任务编号,请先完成发货通知解析。',
shippingNoticeUploadDone: '库存文件已上传:{fileName}。',
+8
View File
@@ -2403,11 +2403,14 @@ const findHistorySessionForShippingTask = (taskId: string) => {
return history.value.find((item) => String(item.title || '').toUpperCase().includes(needle)) || null;
};
const autoResumedShippingTasks = ref<Record<string, boolean>>({});
const resumeShippingTaskFromQuery = async () => {
const taskId = shippingTaskIdFromQuery.value;
if (!taskId || !isShippingNoticeAgent.value) return;
if (route.query.conversation_id) return;
if (presetQuestion.value) return;
if (autoResumedShippingTasks.value[taskId]) return;
const existing = findHistorySessionForShippingTask(taskId);
if (existing) {
@@ -2415,6 +2418,7 @@ const resumeShippingTaskFromQuery = async () => {
return;
}
autoResumedShippingTasks.value[taskId] = true;
input.value = t('chat.shippingNoticeContinue', { taskId });
await handleSend();
};
@@ -3925,6 +3929,10 @@ const loadConversation = async (id: string, options?: { force?: boolean }) => {
loadConversationState(id, Array.isArray(loaded) ? loaded : []);
if (!loaded?.length) {
msg.warning(t('chat.historyEmpty'));
if (isShippingNoticeAgent.value && shippingTaskIdFromQuery.value && !isThinking.value) {
await router.replace({ path: route.path, query: { task_id: shippingTaskIdFromQuery.value } });
return;
}
}
void refreshShippingActions();
} catch (e) {
+1 -1
View File
@@ -93,7 +93,7 @@ const openInChat = (taskNo: string, conversationId?: string | null) => {
if (!chatAgentId.value) return;
const query: Record<string, string> = { task_id: taskNo };
const cid = String(conversationId || '').trim();
if (cid) query.conversation_id = cid;
if (/^[0-9a-f]{32}$/i.test(cid)) query.conversation_id = cid;
router.push({ path: `/chat/${chatAgentId.value}`, query });
};