{
  "name": "Router - P1 - V3",
  "nodes": [
    {
      "parameters": {
        "rule": {
          "interval": [
            {
              "field": "seconds",
              "secondsInterval": 10
            }
          ]
        }
      },
      "type": "n8n-nodes-base.scheduleTrigger",
      "typeVersion": 1.3,
      "position": [
        4528,
        784
      ],
      "id": "300924cb-3b56-4f06-b9bb-5ffac564ea2d",
      "name": "Schedule Trigger"
    },
    {
      "parameters": {
        "url": "=https://api.telegram.org/bot{{ $env.TELEGRAM_BOT_TOKEN }}/getUpdates",
        "sendQuery": true,
        "queryParameters": {
          "parameters": [
            {
              "name": "offset",
              "value": "={{ $json.offset }}"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.4,
      "position": [
        4928,
        784
      ],
      "id": "1d0b393d-bcca-4464-830b-77b1dc1f476f",
      "name": "HTTP Request"
    },
    {
      "parameters": {
        "jsCode": "// ========== Router V2:\u591a\u7c7b\u578b\u6392\u961f(\u7167\u7247/PDF/\u6587\u5b57) + \u8bc4\u5206\u5206\u6d41 ==========\n// \u8ddf\u65e7\u7248\u6bd4,\u8fd9\u6b21\u7684\u5dee\u5f02:\n// 1. \u65b0\u589e\u652f\u63f4PDF,\u4e0d\u53ea\u662f\u7167\u7247\n// 2. \u4e0d\u518d\u81ea\u5df1\u7ec4Gemini request\u2014\u2014\u53ea\u8d1f\u8d23\u6536\u96c6file_id/text,\u6253\u5305\u6210JSON\u4e22\u7ed9Worker,\n//    \u771f\u6b63\u7684\u8fa8\u8bc6/\u5224\u65ad\u903b\u8f91\u73b0\u5728\u4ea4\u7ed9AI Agent\u5904\u7406\n// 3. \u6bcf\u4e2a\u8f93\u51faitem\u90fd\u5e26\u4e00\u4e2aroute\u6b04\u4f4d(\"dispatch\"\u6216\"rating\"),\u8ba9\u753b\u5e03\u4e0a\u7684\n//    Switch/IF\u77e5\u9053\u8be5\u5f80\u54ea\u9001\u2014\u2014Data Table\u76f8\u5173\u7684\u64cd\u4f5c,Code node\u672c\u8eab\u505a\u4e0d\u5230,\n//    \u6240\u4ee5\u90a3\u90e8\u5206\u6539\u6210\u5728\u753b\u5e03\u4e0a\u7528\u771f\u6b63\u7684Data Table node\u5904\u7406\n// 4. \u62ff\u6389\u4e86\u65e7\u7248\"awaitingFeedback\u6587\u5b57\u53cd\u9988\"\u90a3\u6bb5\u2014\u2014\u73b0\u5728\u8bc4\u5206\u6539\u7528\u6309\u94ae+\n//    Data Table\u771f\u7684\u5b58\u8d77\u6765,\u4e0d\u518d\u662f\"\u6536\u5230\u5c31\u4e22\"\u7684\u5047\u53cd\u9988\n\nconst updates = $input.first().json.result;\nconst staticData = $getWorkflowStaticData('global');\n\nif (!updates || updates.length === 0) return [];\n\nconst TOKEN = $env.TELEGRAM_BOT_TOKEN;\nconst API = `https://api.telegram.org/bot${TOKEN}`;\n\nasync function sendMsg(chatId, text, withButton = false) {\n  const body = { chat_id: String(chatId), text };\n  if (withButton) {\n    body.reply_markup = {\n      inline_keyboard: [[\n        { text: '\u5f00\u59cb\u5904\u7406 / Start \u2705', callback_data: 'start' },\n        { text: '\ud83d\udd04 \u91cd\u65b0\u5f00\u59cb', callback_data: 'cancel' }\n      ]]\n    };\n  }\n  await this.helpers.httpRequest({\n    method: 'POST', url: `${API}/sendMessage`,\n    headers: { 'Content-Type': 'application/json' },\n    body, json: true\n  });\n}\n\nconst outputItems = [];\nlet maxProcessedUpdateId = staticData.lastUpdateId || 0;\n\nfor (const update of updates) {\n  try {\n    // \u2500\u2500 \u7528\u6237\u70b9\u4e86\u6309\u94ae \u2500\u2500\n    if (update.callback_query) {\n      const cb = update.callback_query;\n      const chatId = cb.message.chat.id;\n\n      try {\n        await this.helpers.httpRequest({\n          method: 'POST', url: `${API}/answerCallbackQuery`,\n          headers: { 'Content-Type': 'application/json' },\n          body: { callback_query_id: cb.id, text: '\u23f3 \u6536\u5230' },\n          json: true\n        });\n      } catch (e) { /* callback\u8fc7\u671f,\u5ffd\u7565 */ }\n\n      // \u8bc4\u5206\u6309\u94ae:\u4e0d\u8fdb\u6392\u961f\u673a\u5236,\u76f4\u63a5\u6807\u8bb0route='rating',\n      // \u4ea4\u7ed9\u753b\u5e03\u4e0a\u7684Data Table Upsert\u5904\u7406\n      if (cb.data && cb.data.startsWith('rate_')) {\n        const stars = cb.data.replace('rate_', '');\n        outputItems.push({\n          json: { route: 'rating', chat_id: String(chatId), stars: Number(stars) }\n        });\n        maxProcessedUpdateId = Math.max(maxProcessedUpdateId, update.update_id);\n        continue;\n      }\n\n      if (cb.data === 'cancel') {\n        delete staticData[`queue_${chatId}`];\n        delete staticData[`caption_${chatId}`];\n        await sendMsg.call(this, chatId, '\ud83d\udd04 \u5df2\u6e05\u7a7a\u5f53\u524d\u961f\u5217,\u8bf7\u91cd\u65b0\u53d1\u9001\u83dc\u5355\u56fe\u7247\u3001PDF\u6216\u6587\u5b57\u3002');\n        maxProcessedUpdateId = Math.max(maxProcessedUpdateId, update.update_id);\n        continue;\n      }\n\n      if (cb.data === 'end_modify') {\n        outputItems.push({\n          json: { route: 'end_modify', chat_id: String(chatId), bot_id: 'worker1' }\n        });\n        maxProcessedUpdateId = Math.max(maxProcessedUpdateId, update.update_id);\n        continue;\n      }\n\n      if (cb.data === 'modify') {\n        await sendMsg.call(this, chatId, '\u8bf7\u76f4\u63a5\u6253\u5b57\u544a\u8bc9\u6211\u60a8\u60f3\u600e\u4e48\u4fee\u6539\u8fd9\u4efd\u83dc\u5355 \ud83d\udcdd');\n        maxProcessedUpdateId = Math.max(maxProcessedUpdateId, update.update_id);\n        continue;\n      }\n\n      if (cb.data === 'start') {\n        const queue = staticData[`queue_${chatId}`] || [];\n        if (queue.length === 0) {\n          await sendMsg.call(this, chatId, '\u274c \u6ca1\u6709\u5f85\u5904\u7406\u7684\u83dc\u5355,\u8bf7\u5148\u53d1\u9001\u83dc\u5355\u56fe\u7247\u3001PDF\u6216\u6587\u5b57\u3002');\n        } else {\n          const caption = staticData[`caption_${chatId}`] || '';\n          await sendMsg.call(this, chatId, `\u23f3 \u6b63\u5728\u5904\u7406 ${queue.length} \u4e2a\u6587\u4ef6,\u8bf7\u7a0d\u7b49...`);\n          outputItems.push({\n            json: {\n              route: 'dispatch',\n              chat_id: String(chatId),\n              caption: caption,\n              items: JSON.stringify(queue)\n            }\n          });\n          delete staticData[`queue_${chatId}`];\n          delete staticData[`caption_${chatId}`];\n        }\n      }\n      maxProcessedUpdateId = Math.max(maxProcessedUpdateId, update.update_id);\n      continue;\n    }\n\n    const msg = update.message;\n    if (!msg) {\n      maxProcessedUpdateId = Math.max(maxProcessedUpdateId, update.update_id);\n      continue;\n    }\n    const chatId = msg.chat.id;\n\n    // \u2500\u2500 \u7167\u7247 \u2500\u2500\n    if (msg.photo) {\n      const photo = msg.photo[msg.photo.length - 1];\n      if (!staticData[`queue_${chatId}`]) staticData[`queue_${chatId}`] = [];\n      staticData[`queue_${chatId}`].push({\n        type: 'photo',\n        file_id: photo.file_id,\n        mime_type: 'image/jpeg'\n      });\n      const count = staticData[`queue_${chatId}`].length;\n      await sendMsg.call(this, chatId,\n        `\ud83d\udce5 \u5df2\u6536\u5230\u83dc\u5355\u56fe\u7247(\u961f\u5217\u5171 ${count} \u4e2a)\\n\\n\u6709\u9700\u8981\u7279\u522b\u6ce8\u610f\u7684\u5417?(\u5206\u7c7b\u3001\u89c4\u683c\u3001\u5916\u5e26\u52a0\u4ef7\u7b49)\\n\u76f4\u63a5\u56de\u590d\u6211,\u6216\u8005\u6ca1\u6709\u7684\u8bdd\u6309\u4e0b\u9762\u6309\u94ae\u76f4\u63a5\u5f00\u59cb\u3002`,\n        true\n      );\n      maxProcessedUpdateId = Math.max(maxProcessedUpdateId, update.update_id);\n      continue;\n    }\n\n    // \u2500\u2500 PDF \u2500\u2500\n    if (msg.document && msg.document.mime_type === 'application/pdf') {\n      if (msg.document.file_size > 20971520) {\n        const sizeMB = (msg.document.file_size / 1024 / 1024).toFixed(1);\n        await sendMsg.call(this, chatId,\n          `\u26a0\ufe0f PDF\u6587\u4ef6(${sizeMB}MB)\u8d85\u8fc720MB\u9650\u5236\u3002\\n\\n\u8bf7\u5148\u538b\u7f29\u540e\u91cd\u65b0\u53d1\u7ed9\u6211\u3002`\n        );\n        maxProcessedUpdateId = Math.max(maxProcessedUpdateId, update.update_id);\n        continue;\n      }\n      if (!staticData[`queue_${chatId}`]) staticData[`queue_${chatId}`] = [];\n      staticData[`queue_${chatId}`].push({\n        type: 'pdf',\n        file_id: msg.document.file_id,\n        mime_type: 'application/pdf'\n      });\n      const count = staticData[`queue_${chatId}`].length;\n      await sendMsg.call(this, chatId,\n        `\ud83d\udce5 \u5df2\u6536\u5230PDF\u83dc\u5355(\u961f\u5217\u5171 ${count} \u4e2a)\\n\\n\u6709\u9700\u8981\u7279\u522b\u6ce8\u610f\u7684\u5417?\\n\u76f4\u63a5\u56de\u590d\u6211,\u6216\u8005\u6ca1\u6709\u7684\u8bdd\u6309\u4e0b\u9762\u6309\u94ae\u76f4\u63a5\u5f00\u59cb\u3002`,\n        true\n      );\n      maxProcessedUpdateId = Math.max(maxProcessedUpdateId, update.update_id);\n      continue;\n    }\n\n    // \u2500\u2500 Excel(\u91cd\u65b0\u4e0a\u4f20\u5df2\u586b\u597d\u7684\u5b98\u65b9\u6a21\u677f) \u2500\u2500\n    if (msg.document && msg.document.mime_type === 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet') {\n      if (!staticData[`queue_${chatId}`]) staticData[`queue_${chatId}`] = [];\n      staticData[`queue_${chatId}`].push({\n        type: 'excel',\n        file_id: msg.document.file_id,\n        mime_type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'\n      });\n      const count = staticData[`queue_${chatId}`].length;\n      await sendMsg.call(this, chatId,\n        `\ud83d\udce5 \u5df2\u6536\u5230Excel\u83dc\u5355\u6a21\u677f(\u961f\u5217\u5171 ${count} \u4e2a)\\n\\n\u76f4\u63a5\u6309\u4e0b\u9762\u6309\u94ae\u5f00\u59cb\u5904\u7406\u3002`,\n        true\n      );\n      maxProcessedUpdateId = Math.max(maxProcessedUpdateId, update.update_id);\n      continue;\n    }\n\n    // \u2500\u2500 \u6587\u5b57 \u2500\u2500\n    if (msg.text) {\n      const text = msg.text.trim();\n      const lower = text.toLowerCase();\n\n      if (lower === '\u5f00\u59cb' || lower === 'start' || lower === '/go') {\n        const queue = staticData[`queue_${chatId}`] || [];\n        if (queue.length === 0) {\n          await sendMsg.call(this, chatId, '\u274c \u6ca1\u6709\u5f85\u5904\u7406\u7684\u83dc\u5355,\u8bf7\u5148\u53d1\u9001\u83dc\u5355\u56fe\u7247\u3001PDF\u6216\u6587\u5b57\u3002');\n        } else {\n          const caption = staticData[`caption_${chatId}`] || '';\n          await sendMsg.call(this, chatId, `\u23f3 \u6b63\u5728\u5904\u7406 ${queue.length} \u4e2a\u6587\u4ef6,\u8bf7\u7a0d\u7b49...`);\n          outputItems.push({\n            json: {\n              route: 'dispatch',\n              chat_id: String(chatId),\n              caption: caption,\n              items: JSON.stringify(queue)\n            }\n          });\n          delete staticData[`queue_${chatId}`];\n          delete staticData[`caption_${chatId}`];\n        }\n        maxProcessedUpdateId = Math.max(maxProcessedUpdateId, update.update_id);\n        continue;\n      }\n\n      // \u961f\u5217\u975e\u7a7a \u2192 \u5f53\u5907\u6ce8\n      if (staticData[`queue_${chatId}`] && staticData[`queue_${chatId}`].length > 0) {\n        staticData[`caption_${chatId}`] = text;\n        await sendMsg.call(this, chatId,\n          `\u270f\ufe0f \u5907\u6ce8\u5df2\u8bb0\u5f55:\u300c${text}\u300d\\n\\n\u51c6\u5907\u597d\u4e86\u5c31\u6309\u5f00\u59cb\u5904\u7406\u3002`,\n          true\n        );\n        maxProcessedUpdateId = Math.max(maxProcessedUpdateId, update.update_id);\n        continue;\n      }\n\n      // \u961f\u5217\u7a7a\u3001\u53c8\u4e0d\u662f\u5f00\u59cb\u6307\u4ee4 \u2192 \u4e0d\u786e\u5b9a\u662f\"\u65b0\u83dc\u5355\u6587\u5b57\"\u8fd8\u662f\"\u9488\u5bf9\u4e0a\u6b21\u751f\u6210\u7684\u4fee\u6539\u610f\u89c1\",\n      // \u4ea4\u7ed9\u753b\u5e03\u4e0a\u7684Data Table Get\u67e5last_generation\u624d\u80fd\u5224\u65ad,\u8fd9\u91cc\u5148\u4e0d\u4e0b\u7ed3\u8bba\u3001\u4e0d\u56de\u8986\n      outputItems.push({\n        json: { route: 'text_check', chat_id: String(chatId), bot_id: 'worker1', text: text }\n      });\n      maxProcessedUpdateId = Math.max(maxProcessedUpdateId, update.update_id);\n      continue;\n    }\n\n    maxProcessedUpdateId = Math.max(maxProcessedUpdateId, update.update_id);\n\n  } catch (err) {\n    maxProcessedUpdateId = Math.max(maxProcessedUpdateId, update.update_id);\n    try {\n      const failedChatId = update.callback_query?.message?.chat?.id || update.message?.chat?.id;\n      if (failedChatId) {\n        await sendMsg.call(this, failedChatId, `\u26a0\ufe0f \u5904\u7406\u6d88\u606f\u65f6\u51fa\u9519:${err.message}\\n\u8bf7\u91cd\u8bd5\u4e00\u6b21\u3002`);\n      }\n    } catch (e) { /* ignore */ }\n  }\n}\n\nstaticData.lastUpdateId = maxProcessedUpdateId;\n\nreturn outputItems;"
      },
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        5120,
        784
      ],
      "id": "d3d625a4-33f8-4d14-a890-2d0bfad8948a",
      "name": "Code - Main Router"
    },
    {
      "parameters": {
        "jsCode": "const staticData = $getWorkflowStaticData('global');\nconst offset = staticData.lastUpdateId ? staticData.lastUpdateId + 1 : 0;\nreturn [{ json: { offset: offset } }];"
      },
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        4720,
        784
      ],
      "id": "f1e59844-62ed-461d-b8f2-b10ed5e769a0",
      "name": "Code - Read Offset"
    },
    {
      "parameters": {
        "rules": {
          "values": [
            {
              "conditions": {
                "options": {
                  "caseSensitive": true,
                  "leftValue": "",
                  "typeValidation": "strict",
                  "version": 3
                },
                "conditions": [
                  {
                    "leftValue": "={{ $json.route }}",
                    "rightValue": "dispatch",
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    },
                    "id": "14ee2edc-b412-4a1a-a7c5-39794cfdabe3"
                  }
                ],
                "combinator": "and"
              },
              "renameOutput": true,
              "outputKey": "dispatch"
            },
            {
              "conditions": {
                "options": {
                  "caseSensitive": true,
                  "leftValue": "",
                  "typeValidation": "strict",
                  "version": 3
                },
                "conditions": [
                  {
                    "id": "5decd669-7db2-4b84-a23c-8ec40a5d7161",
                    "leftValue": "={{ $json.route }}",
                    "rightValue": "rating",
                    "operator": {
                      "type": "string",
                      "operation": "equals",
                      "name": "filter.operator.equals"
                    }
                  }
                ],
                "combinator": "and"
              },
              "renameOutput": true,
              "outputKey": "rating"
            },
            {
              "conditions": {
                "options": {
                  "caseSensitive": true,
                  "leftValue": "",
                  "typeValidation": "strict",
                  "version": 3
                },
                "conditions": [
                  {
                    "id": "f0deecc3-c4db-45ed-be76-73bd9cefeab9",
                    "leftValue": "={{ $json.route }}",
                    "rightValue": "text_check",
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    }
                  }
                ],
                "combinator": "and"
              },
              "renameOutput": true,
              "outputKey": "text_check"
            },
            {
              "conditions": {
                "options": {
                  "caseSensitive": true,
                  "leftValue": "",
                  "typeValidation": "strict",
                  "version": 3
                },
                "conditions": [
                  {
                    "id": "264ca15e-b621-4da5-92f1-4e4bc70ca41b",
                    "leftValue": "={{ $json.route }}",
                    "rightValue": "end_modify",
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    }
                  }
                ],
                "combinator": "and"
              },
              "renameOutput": true,
              "outputKey": "end_modify"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.switch",
      "typeVersion": 3.4,
      "position": [
        5312,
        768
      ],
      "id": "23d2ea4e-d91d-4ae0-92f0-db3889df7197",
      "name": "Switch"
    },
    {
      "parameters": {
        "operation": "upsert",
        "dataTableId": {
          "__rl": true,
          "value": "hzaSbVDXvHGFBfh7",
          "mode": "list",
          "cachedResultName": "merchant_feedback",
          "cachedResultUrl": "/projects/W1Bzh2H8JZecMoTf/datatables/hzaSbVDXvHGFBfh7"
        },
        "filters": {
          "conditions": [
            {
              "keyName": "chat_id",
              "keyValue": "={{ $json.chat_id }}"
            }
          ]
        },
        "columns": {
          "mappingMode": "defineBelow",
          "value": {
            "chat_id": "={{ $json.chat_id }}",
            "stars": "={{ $json.stars }}"
          },
          "matchingColumns": [],
          "schema": [
            {
              "id": "chat_id",
              "displayName": "chat_id",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "readOnly": false,
              "removed": false
            },
            {
              "id": "stars",
              "displayName": "stars",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "number",
              "readOnly": false,
              "removed": false
            }
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {}
      },
      "type": "n8n-nodes-base.dataTable",
      "typeVersion": 1.1,
      "position": [
        5552,
        928
      ],
      "id": "db8e8a9d-8cf9-41b1-830f-e900f0f2d850",
      "name": "Upsert row(s)"
    },
    {
      "parameters": {
        "workflowId": {
          "__rl": true,
          "value": "oyJXEnSwAiux2k4C",
          "mode": "list",
          "cachedResultUrl": "/workflow/oyJXEnSwAiux2k4C",
          "cachedResultName": "DEEPP AUTO P1 V3 - Worker"
        },
        "workflowInputs": {
          "mappingMode": "defineBelow",
          "value": {
            "chat_id": "={{ $json.chat_id }}",
            "caption": "={{ $json.caption }}",
            "items": "={{ $json.items }}"
          },
          "matchingColumns": [],
          "schema": [
            {
              "id": "chat_id",
              "displayName": "chat_id",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "canBeUsedToMatch": true,
              "type": "string",
              "removed": false
            },
            {
              "id": "caption",
              "displayName": "caption",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "canBeUsedToMatch": true,
              "type": "string",
              "removed": false
            },
            {
              "id": "items",
              "displayName": "items",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "canBeUsedToMatch": true,
              "type": "string",
              "removed": false
            }
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": true
        },
        "options": {
          "waitForSubWorkflow": false
        }
      },
      "type": "n8n-nodes-base.executeWorkflow",
      "typeVersion": 1.3,
      "position": [
        5552,
        752
      ],
      "id": "e5d016a2-3061-47cf-b91e-9b5c50b398f1",
      "name": "Call 'DEEPP AUTO P1 V3 - Worker'"
    },
    {
      "parameters": {
        "operation": "get",
        "dataTableId": {
          "__rl": true,
          "value": "F8XZDNOad3tXgoQJ",
          "mode": "list",
          "cachedResultName": "last_generation",
          "cachedResultUrl": "/projects/W1Bzh2H8JZecMoTf/datatables/F8XZDNOad3tXgoQJ"
        },
        "filters": {
          "conditions": [
            {
              "keyName": "chat_id",
              "keyValue": "={{ $('\u5224\u65ad\u662f\u5426\u4e3a\u53cd\u95ee\u56de\u8986').item.json.chat_id }}"
            },
            {
              "keyName": "bot_id",
              "keyValue": "={{ $('\u5224\u65ad\u662f\u5426\u4e3a\u53cd\u95ee\u56de\u8986').item.json.bot_id }}"
            }
          ]
        }
      },
      "type": "n8n-nodes-base.dataTable",
      "typeVersion": 1.1,
      "position": [
        6400,
        1120
      ],
      "id": "3b5b9138-d061-41aa-8e7c-ed5e844108b9",
      "name": "\u67e5last_generation\u72b6\u6001",
      "alwaysOutputData": true
    },
    {
      "parameters": {
        "jsCode": "const getResult = $input.all(); // \u67e5last_generation\u7684\u7ed3\u679c,\u53ef\u80fd0\u7b14\u62161\u7b14\nconst original = $('Code - Main Router').item.json; // \u8fd9\u4e00\u7b14\u6587\u5b57\u6d88\u606f\u7684\u539f\u59cb\u8d44\u6599: chat_id, bot_id, text\n\nconst STALE_THRESHOLD_MS = 2 * 60 * 60 * 1000; // \u8ddf\u53cd\u95ee\u90a3\u8fb9\u7528\u540c\u4e00\u4e2a\u65f6\u9650\n\nlet isModification = false;\nlet isStaleSession = false;\n\nif (getResult.length > 0 && getResult[0].json.awaiting_modification === true) {\n  // \u7528flagged_at(\u8fd9\u6b21\u6807\u8bb0\u771f\u6b63\u88ab\u8bbe\u7f6e\u7684\u65f6\u95f4)\u5224\u65ad,\u4e0d\u8981\u7528createdAt\u2014\u2014\n  // createdAt\u53ea\u5728\u8fd9\u884c\u8d44\u6599\u7b2c\u4e00\u6b21\u5efa\u7acb\u65f6\u5199\u5165,\u8001\u7528\u6237\u53cd\u590d\u5bf9\u8bdd\u65f6\u5b83\u4e0d\u4f1a\u66f4\u65b0,\n  // \u4f1a\u5bfc\u81f4\u6bcf\u6b21\u6807\u8bb0\u90fd\u88ab\u8bef\u5224\u6210\"\u5f88\u4e45\u4ee5\u524d\u8bbe\u7f6e\u7684\"\u800c\u9519\u8bef\u5224\u5b9a\u8fc7\u671f\n  const flaggedAt = getResult[0].json.flagged_at ? new Date(getResult[0].json.flagged_at).getTime() : 0;\n  const ageMs = Date.now() - flaggedAt;\n\n  if (ageMs > STALE_THRESHOLD_MS) {\n    isStaleSession = true; // \u5361\u6b7b\u8d85\u8fc7\u65f6\u9650,\u5224\u5b9a\u4e3a\u65e7session,\u8ba9\u8fd9\u6761\u6d88\u606f\u91cd\u65b0\u5f53\u6210\u65b0\u7684\u5904\u7406\n  } else {\n    isModification = true;\n  }\n}\n\nreturn [{\n  json: {\n    is_modification: isModification,\n    is_stale_session: isStaleSession,\n    chat_id: original.chat_id,\n    bot_id: original.bot_id,\n    text: original.text,\n    old_items: isModification ? getResult[0].json.items : null,\n    image_paths: isModification ? getResult[0].json.image_paths : null\n  }\n}];"
      },
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        6608,
        1120
      ],
      "id": "fbc30d7c-cf22-48b8-aa8c-292a14977a81",
      "name": "\u5224\u65ad\u662f\u5426\u4e3a\u4fee\u6539\u8bf7\u6c42"
    },
    {
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "strict",
            "version": 3
          },
          "conditions": [
            {
              "id": "6470e814-dd2a-4d01-baec-2a8b97c36826",
              "leftValue": "={{ $json.is_modification }}",
              "rightValue": true,
              "operator": {
                "type": "boolean",
                "operation": "true",
                "singleValue": true
              }
            }
          ],
          "combinator": "and"
        },
        "options": {}
      },
      "type": "n8n-nodes-base.if",
      "typeVersion": 2.3,
      "position": [
        6816,
        1120
      ],
      "id": "a6c7f828-86fe-4045-9e2e-c6ba1835526c",
      "name": "\u662f\u5426\u4e3a\u4fee\u6539\u8bf7\u6c42"
    },
    {
      "parameters": {
        "jsCode": "const TOKEN = $env.TELEGRAM_BOT_TOKEN;\nconst API = `https://api.telegram.org/bot${TOKEN}`;\n\nawait this.helpers.httpRequest({\n  method: 'POST', url: `${API}/sendMessage`,\n  headers: { 'Content-Type': 'application/json' },\n  body: { chat_id: String($json.chat_id), text: '\u23f3 \u6536\u5230\u60a8\u7684\u4fee\u6539\u9700\u6c42,\u6b63\u5728\u91cd\u65b0\u5904\u7406\u4e2d...' },\n  json: true\n});\n\nreturn [{ json: $json }];"
      },
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        7024,
        1008
      ],
      "id": "b19c6a2d-9f76-4214-bf57-3426faa89891",
      "name": "\u786e\u8ba4\u6536\u5230\u4fee\u6539\u9700\u6c42"
    },
    {
      "parameters": {
        "jsCode": "// \u5224\u65ad\u4e3a\"\u4e0d\u662f\u4fee\u6539\u8bf7\u6c42\" \u2192 \u7167\u539f\u672c\u903b\u8f91\u5f53\u65b0\u83dc\u5355\u6587\u5b57\u5904\u7406\nconst TOKEN = $env.TELEGRAM_BOT_TOKEN;\nconst API = `https://api.telegram.org/bot${TOKEN}`;\nconst staticData = $getWorkflowStaticData('global');\n\nconst chatId = $('\u5224\u65ad\u662f\u5426\u4e3a\u4fee\u6539\u8bf7\u6c42').item.json.chat_id;\nconst text = $('\u5224\u65ad\u662f\u5426\u4e3a\u4fee\u6539\u8bf7\u6c42').item.json.text;\n\nif (!staticData[`queue_${chatId}`]) staticData[`queue_${chatId}`] = [];\nstaticData[`queue_${chatId}`].push({ type: 'text', text_content: text });\nconst count = staticData[`queue_${chatId}`].length;\n\nawait this.helpers.httpRequest({\n  method: 'POST', url: `${API}/sendMessage`,\n  headers: { 'Content-Type': 'application/json' },\n  body: {\n    chat_id: String(chatId),\n    text: `\ud83d\udce5 \u5df2\u6536\u5230\u83dc\u5355\u6587\u5b57\u5185\u5bb9(\u961f\u5217\u5171 ${count} \u4e2a)\\n\\n\u6709\u9700\u8981\u7279\u522b\u6ce8\u610f\u7684\u5417?\\n\u6ca1\u6709\u7684\u8bdd\u6309\u4e0b\u9762\u6309\u94ae\u76f4\u63a5\u5f00\u59cb\u3002`,\n    reply_markup: {\n      inline_keyboard: [[\n        { text: '\u5f00\u59cb\u5904\u7406 / Start \u2705', callback_data: 'start' },\n        { text: '\ud83d\udd04 \u91cd\u65b0\u5f00\u59cb', callback_data: 'cancel' }\n      ]]\n    }\n  },\n  json: true\n});\n\nreturn [];"
      },
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        7024,
        1216
      ],
      "id": "cf95f8b4-4352-42df-94b9-9136f13a6b98",
      "name": "\u6309\u539f\u903b\u8f91\u5904\u7406\u65b0\u83dc\u5355\u6587\u5b57"
    },
    {
      "parameters": {
        "chatId": "={{ $json.chat_id }}",
        "text": "=\u8c22\u8c22\u4f60\u7684\u8bc4\u4ef7\uff01\u6709\u4ec0\u4e48\u60f3\u8ba9\u6211\u6539\u8fdb\u7684\uff0c\u76f4\u63a5\u6253\u5b57\u544a\u8bc9\u6211\u5c31\u884c\u3002",
        "additionalFields": {
          "appendAttribution": false
        }
      },
      "type": "n8n-nodes-base.telegram",
      "typeVersion": 1.2,
      "position": [
        5760,
        928
      ],
      "id": "623da56c-5791-450a-a0b2-35532af6b2a2",
      "name": "Send a text message",
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "operation": "get",
        "dataTableId": {
          "__rl": true,
          "value": "CZYbTzwR1b6Hn3fr",
          "mode": "id"
        },
        "filters": {
          "conditions": [
            {
              "keyName": "session_key",
              "keyValue": "={{ $json.bot_id }}_{{ $json.chat_id }}"
            }
          ]
        }
      },
      "type": "n8n-nodes-base.dataTable",
      "typeVersion": 1.1,
      "position": [
        5552,
        1104
      ],
      "id": "cec57194-dc14-4fa8-98fc-3faedd64cceb",
      "name": "\u67e5agent_sessions\u72b6\u6001",
      "alwaysOutputData": true
    },
    {
      "parameters": {
        "jsCode": "const getResult = $input.all();\nconst original = $('Code - Main Router').item.json; // chat_id, bot_id, text\n\nconst STALE_THRESHOLD_MS = 2 * 60 * 60 * 1000; // 2\u5c0f\u65f6,\u8d85\u8fc7\u8fd8\u5361\u5728awaiting_clarification,\u89c6\u4e3a\u5361\u6b7b\u7684\u65e7session,\u4e0d\u5f53\u53cd\u95ee\u56de\u8986\u5904\u7406\n\nlet isClarificationReply = false;\nlet isStaleSession = false;\nlet oldItems = null;\nlet imagePaths = null;\nlet sessionKey = null;\n\nif (getResult.length > 0 && getResult[0].json.awaiting_clarification === true) {\n  sessionKey = getResult[0].json.session_key;\n  const history = JSON.parse(getResult[0].json.conversation_history);\n\n  // \u7528flagged_at(\u8fd9\u6b21\u53cd\u95ee\u771f\u6b63\u88ab\u95ee\u51fa\u6765\u7684\u65f6\u95f4)\u5224\u65ad,\u4e0d\u8981\u7528createdAt\u2014\u2014\n  // createdAt\u53ea\u5728\u8fd9\u884c\u8d44\u6599\u7b2c\u4e00\u6b21\u5efa\u7acb\u65f6\u5199\u5165,\u8001\u7528\u6237\u53cd\u590d\u5bf9\u8bdd\u65f6\u5b83\u4e0d\u4f1a\u66f4\u65b0,\n  // \u4f1a\u5bfc\u81f4\u6bcf\u6b21\u53cd\u95ee\u90fd\u88ab\u8bef\u5224\u6210\"\u5f88\u4e45\u4ee5\u524d\u95ee\u7684\"\u800c\u9519\u8bef\u5224\u5b9a\u8fc7\u671f\n  const flaggedAt = history.flagged_at ? new Date(history.flagged_at).getTime() : 0;\n  const ageMs = Date.now() - flaggedAt;\n\n  if (ageMs > STALE_THRESHOLD_MS) {\n    isStaleSession = true; // \u5361\u6b7b\u8d85\u8fc7\u65f6\u9650,\u5224\u5b9a\u4e3a\u65e7session,\u8ba9\u8fd9\u6761\u6d88\u606f\u91cd\u65b0\u5f53\u6210\u65b0\u7684\u5904\u7406\n  } else {\n    isClarificationReply = true;\n    oldItems = history.context; // \u8fd9\u672c\u8eab\u5df2\u7ecf\u662fJSON\u5b57\u7b26\u4e32(items\u9635\u5217),\u4e0d\u7528\u518d\u5305\u4e00\u5c42\n    imagePaths = getResult[0].json.image_paths;\n  }\n}\n\nreturn [{\n  json: {\n    is_clarification_reply: isClarificationReply,\n    is_stale_session: isStaleSession,\n    session_key: sessionKey,\n    chat_id: original.chat_id,\n    bot_id: original.bot_id,\n    text: original.text,\n    old_items: oldItems,\n    image_paths: imagePaths\n  }\n}];"
      },
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        5760,
        1104
      ],
      "id": "6390231e-a6f0-44df-afb5-ddf04032851c",
      "name": "\u5224\u65ad\u662f\u5426\u4e3a\u53cd\u95ee\u56de\u8986"
    },
    {
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "strict",
            "version": 3
          },
          "conditions": [
            {
              "id": "8f15bfc7-8a4c-4e03-93c2-070c6744ac76",
              "leftValue": "={{ $json.is_clarification_reply }}",
              "rightValue": true,
              "operator": {
                "type": "boolean",
                "operation": "true",
                "singleValue": true
              }
            }
          ],
          "combinator": "and"
        },
        "options": {}
      },
      "type": "n8n-nodes-base.if",
      "typeVersion": 2.3,
      "position": [
        5968,
        1104
      ],
      "id": "8712d959-e71f-46cc-b70f-1bab844fd6f0",
      "name": "\u662f\u5426\u4e3a\u53cd\u95ee\u56de\u8986"
    },
    {
      "parameters": {
        "jsCode": "const TOKEN = $env.TELEGRAM_BOT_TOKEN;\nconst API = `https://api.telegram.org/bot${TOKEN}`;\n\nawait this.helpers.httpRequest({\n  method: 'POST', url: `${API}/sendMessage`,\n  headers: { 'Content-Type': 'application/json' },\n  body: { chat_id: String($json.chat_id), text: '\u23f3 \u6536\u5230\u60a8\u7684\u56de\u8986,\u6b63\u5728\u91cd\u65b0\u5904\u7406\u4e2d...' },\n  json: true\n});\n\nreturn [{ json: $json }];"
      },
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        6400,
        928
      ],
      "id": "f84b8f8c-35e6-49b3-9d3c-d5cd09ab0ea2",
      "name": "\u786e\u8ba4\u6536\u5230\u53cd\u95ee\u56de\u8986"
    },
    {
      "parameters": {
        "workflowId": {
          "__rl": true,
          "value": "D8ZieXbOG7PGZDE2",
          "mode": "list",
          "cachedResultName": "DEEPP AUTO P1 V3 - Worker (Back)"
        },
        "workflowInputs": {
          "mappingMode": "defineBelow",
          "value": {
            "chat_id": "={{ $json.chat_id }}",
            "bot_id": "={{ $json.bot_id }}",
            "image_paths": "={{ $json.image_paths }}",
            "old_items": "={{ $json.old_items }}",
            "user_message": "={{ $json.text }}"
          },
          "matchingColumns": [],
          "schema": [],
          "attemptToConvertTypes": false,
          "convertFieldsToString": true
        },
        "options": {
          "waitForSubWorkflow": false
        }
      },
      "type": "n8n-nodes-base.executeWorkflow",
      "typeVersion": 1.3,
      "position": [
        6576,
        928
      ],
      "id": "f3c20cc4-acad-438b-99d2-ff9e6d7a7def",
      "name": "Call 'Worker (Back)'(\u53cd\u95ee\u7eed\u7b54)"
    },
    {
      "parameters": {
        "workflowId": {
          "__rl": true,
          "value": "D8ZieXbOG7PGZDE2",
          "mode": "list",
          "cachedResultName": "DEEPP AUTO P1 V3 - Worker (Back)"
        },
        "workflowInputs": {
          "mappingMode": "defineBelow",
          "value": {
            "chat_id": "={{ $json.chat_id }}",
            "bot_id": "={{ $json.bot_id }}",
            "image_paths": "={{ $json.image_paths }}",
            "old_items": "={{ $json.old_items }}",
            "user_message": "={{ $json.text }}"
          },
          "matchingColumns": [],
          "schema": [],
          "attemptToConvertTypes": false,
          "convertFieldsToString": true
        },
        "options": {
          "waitForSubWorkflow": false
        }
      },
      "type": "n8n-nodes-base.executeWorkflow",
      "typeVersion": 1.3,
      "position": [
        7184,
        1008
      ],
      "id": "d800033f-3f54-4ee6-b77e-196994627aa1",
      "name": "Call 'Worker (Back)'(\u4fee\u6539\u7eed\u7b54)"
    },
    {
      "parameters": {
        "operation": "upsert",
        "dataTableId": {
          "__rl": true,
          "value": "F8XZDNOad3tXgoQJ",
          "mode": "list",
          "cachedResultName": "last_generation"
        },
        "filters": {
          "conditions": [
            {
              "keyName": "chat_id",
              "keyValue": "={{ $json.chat_id }}"
            },
            {
              "keyName": "bot_id",
              "keyValue": "={{ $json.bot_id }}"
            }
          ]
        },
        "columns": {
          "mappingMode": "defineBelow",
          "value": {
            "awaiting_modification": false
          },
          "matchingColumns": [],
          "schema": [],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {}
      },
      "type": "n8n-nodes-base.dataTable",
      "typeVersion": 1.1,
      "position": [
        5552,
        1312
      ],
      "id": "73fd605f-5e11-429c-984f-c4a28fd83454",
      "name": "\u6e05\u9664\u4fee\u6539\u6807\u8bb0(\u624b\u52a8\u7ed3\u675f)"
    },
    {
      "parameters": {
        "jsCode": "const TOKEN = $env.TELEGRAM_BOT_TOKEN;\nconst API = `https://api.telegram.org/bot${TOKEN}`;\n\nawait this.helpers.httpRequest({\n  method: 'POST', url: `${API}/sendMessage`,\n  headers: { 'Content-Type': 'application/json' },\n  body: { chat_id: String($json.chat_id), text: '\u597d\u7684,\u8fd9\u6b21\u5148\u5230\u8fd9\u91cc \ud83d\ude0a \u6709\u65b0\u7684\u83dc\u5355\u8981\u5904\u7406,\u968f\u65f6\u53d1\u7ed9\u6211!' },\n  json: true\n});\n\nreturn [];"
      },
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        5760,
        1312
      ],
      "id": "3469f905-6301-4ae1-a0e7-cf64449e1d22",
      "name": "\u53d1\u9001\u7ed3\u675f\u8baf\u606f"
    },
    {
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "strict",
            "version": 3
          },
          "conditions": [
            {
              "id": "d3bc8cac-7de7-4d74-8b68-90275baca803",
              "leftValue": "={{ $json.is_stale_session }}",
              "rightValue": true,
              "operator": {
                "type": "boolean",
                "operation": "equals"
              }
            }
          ],
          "combinator": "and"
        },
        "options": {}
      },
      "type": "n8n-nodes-base.if",
      "typeVersion": 2.3,
      "position": [
        5760,
        1280
      ],
      "id": "fa7c967c-4df4-4468-81a2-95341ed29fc6",
      "name": "\u662f\u5426\u4e3a\u8fc7\u671f\u53cd\u95eesession"
    },
    {
      "parameters": {
        "operation": "upsert",
        "dataTableId": {
          "__rl": true,
          "value": "CZYbTzwR1b6Hn3fr",
          "mode": "id"
        },
        "filters": {
          "conditions": [
            {
              "keyName": "=session_key",
              "keyValue": "={{ $json.session_key }}"
            }
          ]
        },
        "columns": {
          "mappingMode": "defineBelow",
          "value": {
            "awaiting_clarification": false
          },
          "matchingColumns": [],
          "schema": [],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {}
      },
      "type": "n8n-nodes-base.dataTable",
      "typeVersion": 1.1,
      "position": [
        5968,
        1280
      ],
      "id": "fe2ba353-3d46-4b55-9ae5-c2e9a4da2558",
      "name": "\u6e05\u9664\u8fc7\u671f\u53cd\u95ee\u6807\u8bb0"
    },
    {
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "strict",
            "version": 3
          },
          "conditions": [
            {
              "id": "9cc6fccc-9872-4766-9246-232eba7e1cc9",
              "leftValue": "={{ $json.is_stale_session }}",
              "rightValue": true,
              "operator": {
                "type": "boolean",
                "operation": "equals"
              }
            }
          ],
          "combinator": "and"
        },
        "options": {}
      },
      "type": "n8n-nodes-base.if",
      "typeVersion": 2.3,
      "position": [
        6608,
        1296
      ],
      "id": "74771e9c-f3d4-4555-9678-ea477641fcec",
      "name": "\u662f\u5426\u4e3a\u8fc7\u671f\u4fee\u6539session"
    },
    {
      "parameters": {
        "operation": "upsert",
        "dataTableId": {
          "__rl": true,
          "value": "F8XZDNOad3tXgoQJ",
          "mode": "list",
          "cachedResultName": "last_generation"
        },
        "filters": {
          "conditions": [
            {
              "keyName": "chat_id",
              "keyValue": "={{ $json.chat_id }}"
            },
            {
              "keyName": "bot_id",
              "keyValue": "={{ $json.bot_id }}"
            }
          ]
        },
        "columns": {
          "mappingMode": "defineBelow",
          "value": {
            "awaiting_modification": false
          },
          "matchingColumns": [],
          "schema": [],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {}
      },
      "type": "n8n-nodes-base.dataTable",
      "typeVersion": 1.1,
      "position": [
        6816,
        1296
      ],
      "id": "157875be-8182-4032-9c7b-0ba986f1d371",
      "name": "\u6e05\u9664\u8fc7\u671f\u4fee\u6539\u6807\u8bb0"
    }
  ],
  "connections": {
    "Schedule Trigger": {
      "main": [
        [
          {
            "node": "Code - Read Offset",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "HTTP Request": {
      "main": [
        [
          {
            "node": "Code - Main Router",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Code - Main Router": {
      "main": [
        [
          {
            "node": "Switch",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Code - Read Offset": {
      "main": [
        [
          {
            "node": "HTTP Request",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Switch": {
      "main": [
        [
          {
            "node": "Call 'DEEPP AUTO P1 V3 - Worker'",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Upsert row(s)",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "\u67e5agent_sessions\u72b6\u6001",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "\u6e05\u9664\u4fee\u6539\u6807\u8bb0(\u624b\u52a8\u7ed3\u675f)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Upsert row(s)": {
      "main": [
        [
          {
            "node": "Send a text message",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "\u67e5last_generation\u72b6\u6001": {
      "main": [
        [
          {
            "node": "\u5224\u65ad\u662f\u5426\u4e3a\u4fee\u6539\u8bf7\u6c42",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "\u5224\u65ad\u662f\u5426\u4e3a\u4fee\u6539\u8bf7\u6c42": {
      "main": [
        [
          {
            "node": "\u662f\u5426\u4e3a\u8fc7\u671f\u4fee\u6539session",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "\u662f\u5426\u4e3a\u4fee\u6539\u8bf7\u6c42": {
      "main": [
        [
          {
            "node": "\u786e\u8ba4\u6536\u5230\u4fee\u6539\u9700\u6c42",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "\u6309\u539f\u903b\u8f91\u5904\u7406\u65b0\u83dc\u5355\u6587\u5b57",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "\u67e5agent_sessions\u72b6\u6001": {
      "main": [
        [
          {
            "node": "\u5224\u65ad\u662f\u5426\u4e3a\u53cd\u95ee\u56de\u8986",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "\u5224\u65ad\u662f\u5426\u4e3a\u53cd\u95ee\u56de\u8986": {
      "main": [
        [
          {
            "node": "\u662f\u5426\u4e3a\u8fc7\u671f\u53cd\u95eesession",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "\u662f\u5426\u4e3a\u53cd\u95ee\u56de\u8986": {
      "main": [
        [
          {
            "node": "\u786e\u8ba4\u6536\u5230\u53cd\u95ee\u56de\u8986",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "\u67e5last_generation\u72b6\u6001",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "\u786e\u8ba4\u6536\u5230\u53cd\u95ee\u56de\u8986": {
      "main": [
        [
          {
            "node": "Call 'Worker (Back)'(\u53cd\u95ee\u7eed\u7b54)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "\u786e\u8ba4\u6536\u5230\u4fee\u6539\u9700\u6c42": {
      "main": [
        [
          {
            "node": "Call 'Worker (Back)'(\u4fee\u6539\u7eed\u7b54)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "\u6e05\u9664\u4fee\u6539\u6807\u8bb0(\u624b\u52a8\u7ed3\u675f)": {
      "main": [
        [
          {
            "node": "\u53d1\u9001\u7ed3\u675f\u8baf\u606f",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "\u662f\u5426\u4e3a\u8fc7\u671f\u53cd\u95eesession": {
      "main": [
        [
          {
            "node": "\u6e05\u9664\u8fc7\u671f\u53cd\u95ee\u6807\u8bb0",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "\u662f\u5426\u4e3a\u53cd\u95ee\u56de\u8986",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "\u6e05\u9664\u8fc7\u671f\u53cd\u95ee\u6807\u8bb0": {
      "main": [
        [
          {
            "node": "\u67e5last_generation\u72b6\u6001",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "\u662f\u5426\u4e3a\u8fc7\u671f\u4fee\u6539session": {
      "main": [
        [
          {
            "node": "\u6e05\u9664\u8fc7\u671f\u4fee\u6539\u6807\u8bb0",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "\u662f\u5426\u4e3a\u4fee\u6539\u8bf7\u6c42",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "\u6e05\u9664\u8fc7\u671f\u4fee\u6539\u6807\u8bb0": {
      "main": [
        [
          {
            "node": "\u6309\u539f\u903b\u8f91\u5904\u7406\u65b0\u83dc\u5355\u6587\u5b57",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": true,
  "settings": {
    "executionOrder": "v1",
    "binaryMode": "separate",
    "availableInMCP": false
  },
  "versionId": "07bdbe2a-f320-465c-bd01-4218a33761d2",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "nodeGroups": [],
  "id": "8rbTFRRHSuviSxPR",
  "tags": [
    {
      "updatedAt": "2026-07-27T07:50:01.682Z",
      "createdAt": "2026-07-27T07:50:01.682Z",
      "id": "oulTjbe8ViVdh1V7",
      "name": "AUTO-P1-V3"
    },
    {
      "updatedAt": "2026-07-20T07:40:54.445Z",
      "createdAt": "2026-07-20T07:40:54.445Z",
      "id": "sBao71AvdSJ3hx2O",
      "name": "3FS"
    }
  ]
}