app:
  description: 從詢價 email 擷取需求、Code 試算報價、依金額分流核准，自動產出回信草稿。
  icon: 📧
  icon_background: '#E4F2F5'
  icon_type: emoji
  mode: workflow
  name: 國貿詢價自動報價與回信
  use_icon_as_answer_icon: false
dependencies:
- current_identifier: null
  type: marketplace
  value:
    marketplace_plugin_unique_identifier: langgenius/anthropic:0.3.24@c5e50da8c13c7ac75348df5ac75b9418c79736eb506064669dd7ca06cbd83537
    version: null
kind: app
version: 0.6.0
workflow:
  conversation_variables: []
  environment_variables: []
  features:
    file_upload:
      allowed_file_extensions:
      - .JPG
      allowed_file_types:
      - image
      allowed_file_upload_methods:
      - local_file
      enabled: false
      fileUploadConfig:
        attachment_image_file_size_limit: 2
        audio_file_size_limit: 50
        batch_count_limit: 5
        file_size_limit: 15
        file_upload_limit: 20
        image_file_batch_limit: 10
        image_file_size_limit: 10
        single_chunk_attachment_limit: 10
        video_file_size_limit: 100
        workflow_file_upload_limit: 10
      image:
        enabled: false
        number_limits: 3
        transfer_methods:
        - local_file
      number_limits: 3
    opening_statement: ''
    retriever_resource:
      enabled: true
    sensitive_word_avoidance:
      enabled: false
    speech_to_text:
      enabled: false
    suggested_questions: []
    suggested_questions_after_answer:
      enabled: false
    text_to_speech:
      enabled: false
      language: ''
      voice: ''
  graph:
    edges:
    - data:
        isInIteration: false
        isInLoop: false
        sourceType: start
        targetType: llm
      id: 29s-source-29ex
      source: 29s
      sourceHandle: source
      target: 29ex
      targetHandle: target
      type: custom
      zIndex: 0
    - data:
        isInIteration: false
        isInLoop: false
        sourceType: llm
        targetType: tool
      id: 29ex-source-29code
      source: 29ex
      sourceHandle: source
      target: 29code
      targetHandle: target
      type: custom
      zIndex: 0
    - data:
        isInIteration: false
        isInLoop: false
        sourceType: tool
        targetType: if-else
      id: 29code-source-29if
      source: 29code
      sourceHandle: source
      target: 29if
      targetHandle: target
      type: custom
      zIndex: 0
    - data:
        isInIteration: false
        isInLoop: false
        sourceType: if-else
        targetType: llm
      id: 29if-true-29lap
      source: 29if
      sourceHandle: 'true'
      target: 29lap
      targetHandle: target
      type: custom
      zIndex: 0
    - data:
        isInIteration: false
        isInLoop: false
        sourceType: if-else
        targetType: llm
      id: 29if-false-29ldir
      source: 29if
      sourceHandle: 'false'
      target: 29ldir
      targetHandle: target
      type: custom
      zIndex: 0
    - data:
        isInIteration: false
        isInLoop: false
        sourceType: llm
        targetType: variable-aggregator
      id: 29lap-source-29agg
      source: 29lap
      sourceHandle: source
      target: 29agg
      targetHandle: target
      type: custom
      zIndex: 0
    - data:
        isInIteration: false
        isInLoop: false
        sourceType: llm
        targetType: variable-aggregator
      id: 29ldir-source-29agg
      source: 29ldir
      sourceHandle: source
      target: 29agg
      targetHandle: target
      type: custom
      zIndex: 0
    - data:
        isInIteration: false
        isInLoop: false
        sourceType: variable-aggregator
        targetType: template-transform
      id: 29agg-source-29tpl
      source: 29agg
      sourceHandle: source
      target: 29tpl
      targetHandle: target
      type: custom
      zIndex: 0
    - data:
        isInIteration: false
        isInLoop: false
        sourceType: template-transform
        targetType: llm
      id: 29tpl-source-29lsum
      source: 29tpl
      sourceHandle: source
      target: 29lsum
      targetHandle: target
      type: custom
      zIndex: 0
    - data:
        isInIteration: false
        isInLoop: false
        sourceType: llm
        targetType: end
      id: 29lsum-source-29e
      source: 29lsum
      sourceHandle: source
      target: 29e
      targetHandle: target
      type: custom
      zIndex: 0
    nodes:
    - data:
        selected: false
        title: 開始
        type: start
        variables:
        - default: ''
          hint: ''
          label: 客戶詢價原文
          options: []
          placeholder: 貼上客戶的詢價 email 全文
          required: true
          type: paragraph
          variable: email
        - default: ''
          hint: ''
          label: 客戶名稱
          max_length: 60
          options: []
          placeholder: 例：ABC Trading
          required: false
          type: text-input
          variable: customer
      height: 135
      id: 29s
      position:
        x: 0
        y: 0
      positionAbsolute:
        x: 0
        y: 0
      selected: false
      sourcePosition: right
      targetPosition: left
      type: custom
      width: 242
    - data:
        context:
          enabled: false
          variable_selector: []
        model:
          completion_params:
            temperature: 0.1
          mode: chat
          name: claude-sonnet-5
          provider: langgenius/anthropic/anthropic
        prompt_template:
        - id: s擷取需求
          role: system
          text: '你是國貿業務助理。從客戶詢價 email 抽出關鍵需求，並【只輸出一行】，格式嚴格如下（不要多餘文字、不要引號、不要換行）：

            PRODUCT=<下列其一：A4影印紙/原子筆/資料夾/便利貼/其他>|QTY=<整數，無法判斷填0>|DEST=<目的地城市或國家，無則填
            未提供>


            客戶 email：

            {{#29s.email#}}'
        - id: u擷取需求
          role: user
          text: 請開始。
        selected: false
        title: 擷取需求
        type: llm
        vision:
          enabled: false
      height: 88
      id: 29ex
      position:
        x: 342
        y: 46
      positionAbsolute:
        x: 342
        y: 46
      selected: false
      sourcePosition: right
      targetPosition: left
      type: custom
      width: 242
    - data:
        provider_id: code
        provider_name: code
        provider_type: builtin
        selected: false
        title: Code 報價試算
        tool_configurations: {}
        tool_label: Code Interpreter
        tool_name: simple_code
        tool_node_version: '2'
        tool_parameters:
          code:
            type: mixed
            value: "import re\nraw = \"\"\"{{#29ex.text#}}\"\"\"\ndef g(k,d=''):\n\
              \    m=re.search(k+r'\\s*=\\s*([^|\\n]+)', raw)\n    return m.group(1).strip()\
              \ if m else d\nproduct=g('PRODUCT','其他')\ntry:\n    qty=int(re.sub(r'[^0-9]','',\
              \ g('QTY','0')) or 0)\nexcept:\n    qty=0\ndest=g('DEST','未提供')\nprices={'A4影印紙':85,'原子筆':12,'資料夾':35,'便利貼':40}\n\
              unit=prices.get(product,0)\nsub=unit*qty\nfreight=0 if sub>=30000 else\
              \ 800\ntotal=sub+freight\nflag='APPROVAL' if total>=50000 else 'OK'\n\
              print(f'品項：{product}')\nprint(f'數量：{qty}　目的地：{dest}')\nprint(f'單價：NT${unit}　小計：NT${sub:,}')\n\
              print(f'運費：NT${freight}（滿 3 萬免運）')\nprint(f'報價合計：NT${total:,}')\nprint(f'FLAG={flag}')\n"
          language:
            type: constant
            value: python3
        type: tool
      height: 52
      id: 29code
      position:
        x: 684
        y: 78.66666666666667
      positionAbsolute:
        x: 684
        y: 78.66666666666667
      selected: false
      sourcePosition: right
      targetPosition: left
      type: custom
      width: 242
    - data:
        cases:
        - case_id: 'true'
          conditions:
          - comparison_operator: contains
            id: c1
            value: APPROVAL
            variable_selector:
            - 29code
            - text
          logical_operator: and
        selected: false
        title: 是否需核准
        type: if-else
      height: 148
      id: 29if
      position:
        x: 1026
        y: 39.33333333333334
      positionAbsolute:
        x: 1026
        y: 39.33333333333334
      selected: false
      sourcePosition: right
      targetPosition: left
      type: custom
      width: 242
    - data:
        context:
          enabled: false
          variable_selector: []
        model:
          completion_params:
            temperature: 0.3
          mode: chat
          name: claude-sonnet-5
          provider: langgenius/anthropic/anthropic
        prompt_template:
        - id: s核准版回信
          role: system
          text: '你是國貿業務。以下報價金額較高、需主管核准後才能正式報價。請草擬一封給客戶「{{#29s.customer#}}」的英文回信（客戶多為海外），語氣專業：先感謝詢價、附上初步報價明細，說明因訂單金額較大，正式報價需
            1-2 個工作天內經主管確認後提供，並請對方確認交期與付款需求。


            報價明細：

            {{#29code.text#}}'
        - id: u核准版回信
          role: user
          text: 請開始。
        selected: false
        title: 核准版回信
        type: llm
        vision:
          enabled: false
      height: 88
      id: 29lap
      position:
        x: 1388
        y: 14.933333333333351
      positionAbsolute:
        x: 1388
        y: 14.933333333333351
      selected: false
      sourcePosition: right
      targetPosition: left
      type: custom
      width: 242
    - data:
        context:
          enabled: false
          variable_selector: []
        model:
          completion_params:
            temperature: 0.3
          mode: chat
          name: claude-sonnet-5
          provider: langgenius/anthropic/anthropic
        prompt_template:
        - id: s直接報價回信
          role: system
          text: '你是國貿業務。請草擬一封給客戶「{{#29s.customer#}}」的英文報價回信：感謝詢價、附上清楚的報價明細（含運費說明）、報價有效期
            14 天、詢問付款與交期需求、邀請進一步洽談。語氣專業友善。


            報價明細：

            {{#29code.text#}}'
        - id: u直接報價回信
          role: user
          text: 請開始。
        selected: false
        title: 直接報價回信
        type: llm
        vision:
          enabled: false
      height: 88
      id: 29ldir
      position:
        x: 1388
        y: 182.93333333333337
      positionAbsolute:
        x: 1388
        y: 182.93333333333337
      selected: false
      sourcePosition: right
      targetPosition: left
      type: custom
      width: 242
    - data:
        output_type: string
        selected: false
        title: 彙整回信
        type: variable-aggregator
        variables:
        - - 29lap
          - text
        - - 29ldir
          - text
      height: 134
      id: 29agg
      position:
        x: 1750
        y: 90.60000000000002
      positionAbsolute:
        x: 1750
        y: 90.60000000000002
      selected: false
      sourcePosition: right
      targetPosition: left
      type: custom
      width: 242
    - data:
        selected: false
        template: '---

          【自動產生回信草稿・請業務確認後寄出】

          收件人：{{ customer }}

          ---


          {{ body }}


          ---

          Best regards,

          Sales Team

          晴光國際貿易

          '
        title: 套用信件格式
        type: template-transform
        variables:
        - value_selector:
          - 29s
          - customer
          variable: customer
        - value_selector:
          - 29agg
          - output
          variable: body
      height: 52
      id: 29tpl
      position:
        x: 2092
        y: 153.93333333333337
      positionAbsolute:
        x: 2092
        y: 153.93333333333337
      selected: false
      sourcePosition: right
      targetPosition: left
      type: custom
      width: 242
    - data:
        context:
          enabled: false
          variable_selector: []
        model:
          completion_params:
            temperature: 0.2
          mode: chat
          name: claude-sonnet-5
          provider: langgenius/anthropic/anthropic
        prompt_template:
        - id: sCRM 內部摘要
          role: system
          text: '用一行繁體中文摘要這筆詢價供 CRM 記錄：客戶、品項數量、報價金額、是否需核准、下一步。


            報價：

            {{#29code.text#}}'
        - id: uCRM 內部摘要
          role: user
          text: 請開始。
        selected: false
        title: CRM 內部摘要
        type: llm
        vision:
          enabled: false
      height: 88
      id: 29lsum
      position:
        x: 2434
        y: 144.60000000000002
      positionAbsolute:
        x: 2434
        y: 144.60000000000002
      selected: false
      sourcePosition: right
      targetPosition: left
      type: custom
      width: 242
    - data:
        outputs:
        - value_selector:
          - 29tpl
          - output
          value_type: string
          variable: email_draft
        - value_selector:
          - 29lsum
          - text
          value_type: string
          variable: crm_note
        - value_selector:
          - 29code
          - text
          value_type: string
          variable: quote
        selected: false
        title: 輸出
        type: end
      height: 140
      id: 29e
      position:
        x: 2776
        y: 133.2666666666667
      positionAbsolute:
        x: 2776
        y: 133.2666666666667
      selected: false
      sourcePosition: right
      targetPosition: left
      type: custom
      width: 242
    viewport:
      x: -644.190372914031
      y: 377.0155230234753
      zoom: 0.3590577745647328
  rag_pipeline_variables: []
