app:
  description: 通过openclaw定时提醒
  icon: 🤖
  icon_background: '#FFEAD5'
  mode: advanced-chat
  name: 库存分析-dws-外发版
  use_icon_as_answer_icon: false
dependencies:
- current_identifier: null
  type: marketplace
  value:
    marketplace_plugin_unique_identifier: hjlarry/database:0.0.6@534bc26cf5bc4ff6b5557457452287ccc71f00eef9378784c4f43ca49954ca2f
    version: null
- current_identifier: null
  type: marketplace
  value:
    marketplace_plugin_unique_identifier: langgenius/openai_api_compatible:0.0.42@cf508badd3f6c086c137a6034697e0c48a60038783b3c3ed0af2fe55000842e8
    version: null
kind: app
version: 0.5.0
workflow:
  conversation_variables: []
  environment_variables: []
  features:
    file_upload:
      allowed_file_extensions:
      - .JPG
      - .JPEG
      - .PNG
      - .GIF
      - .WEBP
      - .SVG
      allowed_file_types:
      - image
      allowed_file_upload_methods:
      - local_file
      - remote_url
      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
        - remote_url
      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: 1774681266588-source-1774682812414-target
      selected: false
      source: '1774681266588'
      sourceHandle: source
      target: '1774682812414'
      targetHandle: target
      type: custom
      zIndex: 0
    - data:
        isInIteration: false
        isInLoop: false
        sourceType: llm
        targetType: if-else
      id: 1774682812414-source-1774682835187-target
      selected: false
      source: '1774682812414'
      sourceHandle: source
      target: '1774682835187'
      targetHandle: target
      type: custom
      zIndex: 0
    - data:
        isInLoop: false
        sourceType: if-else
        targetType: answer
      id: 1774682835187-true-answer-target
      selected: false
      source: '1774682835187'
      sourceHandle: 'true'
      target: answer
      targetHandle: target
      type: custom
      zIndex: 0
    - data:
        isInIteration: false
        isInLoop: false
        sourceType: if-else
        targetType: answer
      id: 1774682835187-dfc58f21-b69c-4c7d-8f7d-110f77743086-1774682882997-target
      selected: false
      source: '1774682835187'
      sourceHandle: dfc58f21-b69c-4c7d-8f7d-110f77743086
      target: '1774682882997'
      targetHandle: target
      type: custom
      zIndex: 0
    - data:
        isInIteration: false
        isInLoop: false
        sourceType: llm
        targetType: answer
      id: 1774683052598-source-1774683046096-target
      selected: false
      source: '1774683052598'
      sourceHandle: source
      target: '1774683046096'
      targetHandle: target
      type: custom
      zIndex: 0
    - data:
        isInLoop: false
        sourceType: if-else
        targetType: tool
      id: 1774682835187-false-1774682986204-target
      selected: false
      source: '1774682835187'
      sourceHandle: 'false'
      target: '1774682986204'
      targetHandle: target
      type: custom
      zIndex: 0
    - data:
        isInIteration: false
        isInLoop: false
        sourceType: tool
        targetType: code
      id: 1774682986204-source-1774684690622-target
      selected: false
      source: '1774682986204'
      sourceHandle: source
      target: '1774684690622'
      targetHandle: target
      type: custom
      zIndex: 0
    - data:
        isInIteration: false
        isInLoop: false
        sourceType: code
        targetType: llm
      id: 1774684690622-source-1774683052598-target
      selected: false
      source: '1774684690622'
      sourceHandle: source
      target: '1774683052598'
      targetHandle: target
      type: custom
      zIndex: 0
    nodes:
    - data:
        desc: ''
        selected: false
        title: 开始
        type: start
        variables: []
      height: 73
      id: '1774681266588'
      position:
        x: 80
        y: 282
      positionAbsolute:
        x: 80
        y: 282
      selected: false
      sourcePosition: right
      targetPosition: left
      type: custom
      width: 242
    - data:
        answer: 抱歉，你想了解的内容超出我的认知范围
        desc: ''
        selected: false
        title: 直接回复
        type: answer
        variables: []
      height: 116
      id: answer
      position:
        x: 1045
        y: 118
      positionAbsolute:
        x: 1045
        y: 118
      selected: false
      sourcePosition: right
      targetPosition: left
      type: custom
      width: 242
    - data:
        context:
          enabled: true
          variable_selector:
          - sys
          - query
        desc: ''
        model:
          completion_params:
            temperature: 0.7
          mode: chat
          name: DeepSeek-V3
          provider: langgenius/openai_api_compatible/openai_api_compatible
        prompt_template:
        - id: 29ca12a9-6969-43e7-8447-b43e6f405cc2
          role: system
          text: '# 任务描述

            你是一个零售数据分析助手。请需要先根据用户输入，判断用户意图，结合数据库的元数据，生成符合语法可执行的sql。


            ## 数据库元数据

            数据库：华为云数仓DWS（PostgesSQL）

            表名：product

            字段：ID、product_name、inventory

            其中，ID--主键；product_name--产品名称；inventory--库存数


            ## 输出要求

            - 如果用户意图和已有的元数据吻合，则只输出可执行的SQL，不输出任何其他内容

            - 如果用户意图与零售数据系统无关，则输出1，不输出任何其他内容

            - 仅可输出查询SELECT相关的SQL，不可有增删改等其他SQL，如果用户意图需要增删改数据，则输出2，，不输出任何其他内容


            ## 示例

            输入：目前库里有多少件商品？

            输出：SELECT COUNT(*) FROM product;


            输入：今天天气如何？

            输出：1


            输入：帮我新加一条数据，产品名称是苹果手机，库存1

            输出：2'
        - id: 7b814251-25c2-4a6c-be6f-9a813a06b929
          role: user
          text: '{{#context#}}'
        selected: true
        title: 生成SQL
        type: llm
        variables: []
        vision:
          enabled: false
      height: 88
      id: '1774682812414'
      position:
        x: 380
        y: 282
      positionAbsolute:
        x: 380
        y: 282
      selected: true
      sourcePosition: right
      targetPosition: left
      type: custom
      width: 242
    - data:
        cases:
        - case_id: 'true'
          conditions:
          - comparison_operator: is
            id: 1190ee9c-5482-4ceb-88ba-dfc84fdae962
            value: '1'
            varType: string
            variable_selector:
            - '1774682812414'
            - text
          id: 'true'
          logical_operator: and
        - case_id: dfc58f21-b69c-4c7d-8f7d-110f77743086
          conditions:
          - comparison_operator: is
            id: dda92dc7-8d15-43be-bf4f-55f781947d35
            value: '2'
            varType: string
            variable_selector:
            - '1774682812414'
            - text
          id: dfc58f21-b69c-4c7d-8f7d-110f77743086
          logical_operator: and
        desc: ''
        selected: false
        title: 条件分支
        type: if-else
      height: 172
      id: '1774682835187'
      position:
        x: 684
        y: 282
      positionAbsolute:
        x: 684
        y: 282
      selected: false
      sourcePosition: right
      targetPosition: left
      type: custom
      width: 242
    - data:
        answer: 抱歉，我无权限操作！
        desc: ''
        selected: false
        title: 直接回复 2
        type: answer
        variables: []
      height: 100
      id: '1774682882997'
      position:
        x: 1045
        y: 275
      positionAbsolute:
        x: 1045
        y: 275
      selected: false
      sourcePosition: right
      targetPosition: left
      type: custom
      width: 242
    - data:
        desc: ''
        is_team_authorization: true
        output_schema: null
        paramSchemas:
        - auto_generate: null
          default: null
          form: llm
          human_description:
            en_US: The SQL query string.
            ja_JP: The SQL query string.
            pt_BR: The SQL query string.
            zh_Hans: SQL 查询语句。
          label:
            en_US: SQL Query
            ja_JP: SQL Query
            pt_BR: SQL Query
            zh_Hans: SQL 查询语句
          llm_description: The SQL query string.
          max: null
          min: null
          name: query
          options: []
          placeholder: null
          precision: null
          required: true
          scope: null
          template: null
          type: string
        - auto_generate: null
          default: null
          form: llm
          human_description:
            en_US: Optional, Filling in this field will overwrite the database connection
              entered during authorization.
            ja_JP: Optional, Filling in this field will overwrite the database connection
              entered during authorization.
            pt_BR: Optional, Filling in this field will overwrite the database connection
              entered during authorization.
            zh_Hans: 选填，填写后将覆盖授权时填写的数据库连接。
          label:
            en_US: DB URI
            ja_JP: DB URI
            pt_BR: DB URI
            zh_Hans: DB URI
          llm_description: ''
          max: null
          min: null
          name: db_uri
          options: []
          placeholder: null
          precision: null
          required: false
          scope: null
          template: null
          type: string
        - auto_generate: null
          default: json
          form: form
          human_description:
            en_US: Choose the output format.
            ja_JP: Choose the output format.
            pt_BR: Choose the output format.
            zh_Hans: 选择输出格式。
          label:
            en_US: Output format
            ja_JP: Output format
            pt_BR: Output format
            zh_Hans: 输出格式
          llm_description: ''
          max: null
          min: null
          name: format
          options:
          - icon: ''
            label:
              en_US: JSON
              ja_JP: JSON
              pt_BR: JSON
              zh_Hans: JSON
            value: json
          - icon: ''
            label:
              en_US: CSV
              ja_JP: CSV
              pt_BR: CSV
              zh_Hans: CSV
            value: csv
          - icon: ''
            label:
              en_US: YAML
              ja_JP: YAML
              pt_BR: YAML
              zh_Hans: YAML
            value: yaml
          - icon: ''
            label:
              en_US: Markdown
              ja_JP: Markdown
              pt_BR: Markdown
              zh_Hans: Markdown
            value: md
          - icon: ''
            label:
              en_US: Excel
              ja_JP: Excel
              pt_BR: Excel
              zh_Hans: Excel
            value: xlsx
          - icon: ''
            label:
              en_US: HTML
              ja_JP: HTML
              pt_BR: HTML
              zh_Hans: HTML
            value: html
          placeholder: null
          precision: null
          required: false
          scope: null
          template: null
          type: select
        - auto_generate: null
          default: null
          form: form
          human_description:
            en_US: 'Optional. For example {"connect_args": {"ssl": {"ca": "/path/to/ca.pem"}}}

              More connection options can be found at https://docs.sqlalchemy.org/en/20/core/engines.html#sqlalchemy.create_engine

              '
            ja_JP: 'Optional. For example {"connect_args": {"ssl": {"ca": "/path/to/ca.pem"}}}

              More connection options can be found at https://docs.sqlalchemy.org/en/20/core/engines.html#sqlalchemy.create_engine

              '
            pt_BR: 'Optional. For example {"connect_args": {"ssl": {"ca": "/path/to/ca.pem"}}}

              More connection options can be found at https://docs.sqlalchemy.org/en/20/core/engines.html#sqlalchemy.create_engine

              '
            zh_Hans: '选填项。例如 {"connect_args": {"ssl": {"ca": "/path/to/ca.pem"}}}

              更多连接选项可参考 https://docs.sqlalchemy.org/en/20/core/engines.html#sqlalchemy.create_engine

              '
          label:
            en_US: DB Config Options
            ja_JP: DB Config Options
            pt_BR: DB Config Options
            zh_Hans: 数据库连接配置选项
          llm_description: ''
          max: null
          min: null
          name: config_options
          options: []
          placeholder: null
          precision: null
          required: false
          scope: null
          template: null
          type: string
        params:
          config_options: ''
          db_uri: ''
          format: ''
          query: ''
        provider_id: hjlarry/database/database
        provider_name: hjlarry/database/database
        provider_type: builtin
        selected: false
        title: SQL Execute
        tool_configurations:
          config_options:
            type: mixed
            value: "{\n  \"connect_args\": {\n    \"client_encoding\": \"utf8\"\n\
              \  }\n}"
          format:
            type: constant
            value: json
        tool_description: 此工具用于在已存在的数据库中执行 SQL 查询。
        tool_label: SQL Execute
        tool_name: sql_execute
        tool_node_version: '2'
        tool_parameters:
          db_uri:
            type: mixed
            value: null
          query:
            type: mixed
            value: '{{#1774682812414.text#}}'
        type: tool
      height: 114
      id: '1774682986204'
      position:
        x: 1045
        y: 407
      positionAbsolute:
        x: 1045
        y: 407
      selected: false
      sourcePosition: right
      targetPosition: left
      type: custom
      width: 242
    - data:
        answer: '{{#1774683052598.text#}}'
        desc: ''
        selected: false
        title: 直接回复 3
        type: answer
        variables: []
      height: 103
      id: '1774683046096'
      position:
        x: 2253
        y: 416
      positionAbsolute:
        x: 2253
        y: 416
      selected: false
      sourcePosition: right
      targetPosition: left
      type: custom
      width: 242
    - data:
        context:
          enabled: true
          variable_selector:
          - '1774684690622'
          - result
        desc: ''
        model:
          completion_params:
            temperature: 0.7
          mode: chat
          name: DeepSeek-V3
          provider: langgenius/openai_api_compatible/openai_api_compatible
        prompt_template:
        - id: be4770a8-fb65-43d3-a541-51d9cca388b1
          role: system
          text: '# 任务描述

            你是一个零售数据分析助手。请需要先根据用户输入，判断用户意图，结合从数据库里查询的信息，整合成最后的答案。



            ## 输出要求

            - 如果用户意图和已有的数据吻合，则整合成最后的答案

            - 如果用户意图与零售数据系统无关，则输出：抱歉，你想了解的内容超出我的认知范围

            - 如果用户意图需要增删改数据，则输出：抱歉，我无权限操作！

            - 如果上一个节点没有准确数据信息，请不要编造任何答案，可输出：抱歉，未到具体信息！


            '
        - id: 2224bc53-b8a8-474f-9bf0-c9e6ef0a984f
          role: user
          text: '用户问题：{{#sys.query#}}

            生成sql：{{#1774682812414.text#}}

            {{#context#}}'
        selected: false
        title: 生成答案
        type: llm
        variables: []
        vision:
          enabled: false
      height: 88
      id: '1774683052598'
      position:
        x: 1858
        y: 407
      positionAbsolute:
        x: 1858
        y: 407
      selected: false
      sourcePosition: right
      targetPosition: left
      type: custom
      width: 242
    - data:
        code: "\ndef main(query_result: dict) -> dict:\n    flag = 0\n    if not query_result:\n\
          \        return {\n        \"flag\": flag,\n        \"result\": \"[]\"\n\
          \    }\n    result = query_result[0].get(\"result\", [])\n    len_result\
          \ = len(result)\n    if len_result ==1:\n        flag = 1\n    elif 1<len_result<50:\n\
          \        flag = 2\n    elif len_result>=50:\n        flag = 3\n    return\
          \ {\n        \"flag\": flag,\n        \"result\": str(result)\n    }\n"
        code_language: python3
        desc: ''
        outputs:
          flag:
            children: null
            type: number
          result:
            children: null
            type: string
        selected: false
        title: 代码执行
        type: code
        variables:
        - value_selector:
          - '1774682986204'
          - json
          value_type: array[object]
          variable: query_result
      height: 52
      id: '1774684690622'
      position:
        x: 1447
        y: 407
      positionAbsolute:
        x: 1447
        y: 407
      selected: false
      sourcePosition: right
      targetPosition: left
      type: custom
      width: 242
    viewport:
      x: 130.59899224875699
      y: 167.04370284752463
      zoom: 0.6597539553864473
  rag_pipeline_variables: []
