app:
  description: 客戶來信自動分類、生成回覆，並依類別走 Gmail 草稿（人工複核）或直接寄送。
  icon: 📨
  icon_background: '#E0F2FE'
  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
- current_identifier: null
  type: marketplace
  value:
    marketplace_plugin_unique_identifier: langgenius/dify-gmail:0.2.6@a532c62b7ba405169a464e251df742c3615aa417c3390edc64cdeeb1875f9fef
    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: question-classifier
      id: s-source-cls
      source: s
      sourceHandle: source
      target: cls
      targetHandle: target
      type: custom
      zIndex: 0
    - data:
        isInIteration: false
        isInLoop: false
        sourceType: question-classifier
        targetType: template-transform
      id: cls-c1-tpl
      source: cls
      sourceHandle: c1
      target: tpl
      targetHandle: target
      type: custom
      zIndex: 0
    - data:
        isInIteration: false
        isInLoop: false
        sourceType: question-classifier
        targetType: template-transform
      id: cls-c2-tpl
      source: cls
      sourceHandle: c2
      target: tpl
      targetHandle: target
      type: custom
      zIndex: 0
    - data:
        isInIteration: false
        isInLoop: false
        sourceType: question-classifier
        targetType: template-transform
      id: cls-c3-tpl
      source: cls
      sourceHandle: c3
      target: tpl
      targetHandle: target
      type: custom
      zIndex: 0
    - data:
        isInIteration: false
        isInLoop: false
        sourceType: question-classifier
        targetType: template-transform
      id: cls-c4-tpl
      source: cls
      sourceHandle: c4
      target: tpl
      targetHandle: target
      type: custom
      zIndex: 0
    - data:
        isInIteration: false
        isInLoop: false
        sourceType: template-transform
        targetType: llm
      id: tpl-source-llm
      source: tpl
      sourceHandle: source
      target: llm
      targetHandle: target
      type: custom
      zIndex: 0
    - data:
        isInIteration: false
        isInLoop: false
        sourceType: llm
        targetType: if-else
      id: llm-source-ife
      source: llm
      sourceHandle: source
      target: ife
      targetHandle: target
      type: custom
      zIndex: 0
    - data:
        isInIteration: false
        isInLoop: false
        sourceType: if-else
        targetType: tool
      id: ife-true-gd
      source: ife
      sourceHandle: 'true'
      target: gd
      targetHandle: target
      type: custom
      zIndex: 0
    - data:
        isInIteration: false
        isInLoop: false
        sourceType: if-else
        targetType: tool
      id: ife-false-gs
      source: ife
      sourceHandle: 'false'
      target: gs
      targetHandle: target
      type: custom
      zIndex: 0
    - data:
        isInIteration: false
        isInLoop: false
        sourceType: tool
        targetType: variable-aggregator
      id: gd-source-agg
      source: gd
      sourceHandle: source
      target: agg
      targetHandle: target
      type: custom
      zIndex: 0
    - data:
        isInIteration: false
        isInLoop: false
        sourceType: tool
        targetType: variable-aggregator
      id: gs-source-agg
      source: gs
      sourceHandle: source
      target: agg
      targetHandle: target
      type: custom
      zIndex: 0
    - data:
        isInIteration: false
        isInLoop: false
        sourceType: variable-aggregator
        targetType: end
      id: agg-source-e
      source: agg
      sourceHandle: source
      target: e
      targetHandle: target
      type: custom
      zIndex: 0
    nodes:
    - data:
        selected: false
        title: 開始
        type: start
        variables:
        - default: ''
          label: 客戶來信內容
          options: []
          required: true
          type: paragraph
          variable: inquiry
        - default: ''
          label: 客戶信箱
          max_length: 120
          options: []
          required: true
          type: text-input
          variable: customer_email
        - default: ''
          label: 客戶稱呼
          max_length: 60
          options: []
          required: true
          type: text-input
          variable: customer_name
      height: 161
      id: s
      position:
        x: 0
        y: 23.66666666666668
      positionAbsolute:
        x: 0
        y: 23.66666666666668
      selected: false
      sourcePosition: right
      targetPosition: left
      type: custom
      width: 242
    - data:
        classes:
        - id: c1
          name: 退款退貨
        - id: c2
          name: 物流到貨
        - id: c3
          name: 產品技術
        - id: c4
          name: 一般諮詢
        instructions: 依客戶來信主旨判斷所屬類別。
        model:
          completion_params:
            temperature: 0
          mode: chat
          name: claude-sonnet-5
          provider: langgenius/anthropic/anthropic
        query_variable_selector:
        - s
        - inquiry
        selected: false
        title: 問題分類器
        type: question-classifier
        vision:
          enabled: false
      height: 262
      id: cls
      position:
        x: 342
        y: 0
      positionAbsolute:
        x: 342
        y: 0
      selected: false
      sourcePosition: right
      targetPosition: left
      type: custom
      width: 242
    - data:
        selected: false
        template: 【星光客服】關於您的{{ cls }}來信
        title: 產生主旨
        type: template-transform
        variables:
        - value_selector:
          - cls
          - class_name
          variable: cls
      height: 52
      id: tpl
      position:
        x: 704
        y: 103.95555555555555
      positionAbsolute:
        x: 704
        y: 103.95555555555555
      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: sy
          role: system
          text: '你是『星光生活館』的資深客服。依【分類】與【客戶來信】，用繁體中文寫一封得體、可直接寄出的回覆信內文（不要寫主旨行）。

            分類：{{#cls.class_name#}}

            客戶稱呼：{{#s.customer_name#}}

            來信：

            {{#s.inquiry#}}


            規則：開頭以「{{#s.customer_name#}} 您好」稱呼；同理客戶情緒、具體回應問題、給明確下一步或時程；退款退貨與產品技術類請說明會有專員跟進；語氣專業友善、不冗長；結尾署名「星光生活館
            客服團隊」。只輸出信件內文。'
        - id: us
          role: user
          text: 請撰寫回覆信內文。
        selected: false
        title: 回覆生成
        type: llm
        vision:
          enabled: false
      height: 88
      id: llm
      position:
        x: 1046
        y: 94.6222222222222
      positionAbsolute:
        x: 1046
        y: 94.6222222222222
      selected: false
      sourcePosition: right
      targetPosition: left
      type: custom
      width: 242
    - data:
        cases:
        - case_id: 'true'
          conditions:
          - comparison_operator: contains
            id: cd1
            value: 退款
            variable_selector:
            - cls
            - class_name
          - comparison_operator: contains
            id: cd2
            value: 技術
            variable_selector:
            - cls
            - class_name
          id: 'true'
          logical_operator: or
        selected: false
        title: 是否需人工複核
        type: if-else
      height: 198
      id: ife
      position:
        x: 1388
        y: 54.28888888888889
      positionAbsolute:
        x: 1388
        y: 54.28888888888889
      selected: false
      sourcePosition: right
      targetPosition: left
      type: custom
      width: 242
    - data:
        provider_id: langgenius/dify-gmail/dify-gmail
        provider_name: langgenius/dify-gmail/dify-gmail
        provider_type: builtin
        selected: false
        title: Gmail 建立草稿
        tool_configurations: {}
        tool_label: Create Gmail Draft
        tool_name: draft_message
        tool_node_version: '2'
        tool_parameters:
          body:
            type: mixed
            value: '{{#llm.text#}}'
          subject:
            type: mixed
            value: '{{#tpl.output#}}'
          to:
            type: mixed
            value: '{{#s.customer_email#}}'
        type: tool
      height: 52
      id: gd
      position:
        x: 1750
        y: 100.88888888888891
      positionAbsolute:
        x: 1750
        y: 100.88888888888891
      selected: false
      sourcePosition: right
      targetPosition: left
      type: custom
      width: 242
    - data:
        provider_id: langgenius/dify-gmail/dify-gmail
        provider_name: langgenius/dify-gmail/dify-gmail
        provider_type: builtin
        selected: false
        title: Gmail 直接寄送
        tool_configurations: {}
        tool_label: Send Gmail Message
        tool_name: send_message
        tool_node_version: '2'
        tool_parameters:
          body:
            type: mixed
            value: '{{#llm.text#}}'
          subject:
            type: mixed
            value: '{{#tpl.output#}}'
          to:
            type: mixed
            value: '{{#s.customer_email#}}'
        type: tool
      height: 52
      id: gs
      position:
        x: 1750
        y: 232.8888888888889
      positionAbsolute:
        x: 1750
        y: 232.8888888888889
      selected: false
      sourcePosition: right
      targetPosition: left
      type: custom
      width: 242
    - data:
        output_type: string
        selected: true
        title: 彙整結果
        type: variable-aggregator
        variables:
        - - gd
          - text
        - - gs
          - text
      height: 134
      id: agg
      position:
        x: 2112
        y: 134.55555555555557
      positionAbsolute:
        x: 2112
        y: 134.55555555555557
      selected: true
      sourcePosition: right
      targetPosition: left
      type: custom
      width: 242
    - data:
        outputs:
        - value_selector:
          - llm
          - text
          value_type: string
          variable: reply_body
        - value_selector:
          - agg
          - output
          value_type: string
          variable: action_result
        - value_selector:
          - cls
          - class_name
          value_type: string
          variable: category
        selected: false
        title: 輸出
        type: end
      height: 140
      id: e
      position:
        x: 2454
        y: 153.8888888888889
      positionAbsolute:
        x: 2454
        y: 153.8888888888889
      selected: false
      sourcePosition: right
      targetPosition: left
      type: custom
      width: 242
    viewport:
      x: -639.0013487995682
      y: 360.0095914635974
      zoom: 0.4019422713784731
  rag_pipeline_variables: []
