app:
  description: ''
  icon: 🤖
  icon_background: '#FFEAD5'
  mode: workflow
  name: 抓股票最近30工作日成交数据
  use_icon_as_answer_icon: false
dependencies: []
kind: app
version: 0.1.5
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:
        audio_file_size_limit: 50
        batch_count_limit: 5
        file_size_limit: 15
        image_file_size_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
        sourceType: code
        targetType: end
      id: 1740228576808-source-1740228069847-target
      source: '1740228576808'
      sourceHandle: source
      target: '1740228069847'
      targetHandle: target
      type: custom
      zIndex: 0
    - data:
        isInIteration: false
        sourceType: start
        targetType: http-request
      id: 1740227344669-source-1740229404443-target
      source: '1740227344669'
      sourceHandle: source
      target: '1740229404443'
      targetHandle: target
      type: custom
      zIndex: 0
    - data:
        isInIteration: false
        sourceType: http-request
        targetType: code
      id: 1740229404443-source-1740228576808-target
      source: '1740229404443'
      sourceHandle: source
      target: '1740228576808'
      targetHandle: target
      type: custom
      zIndex: 0
    nodes:
    - data:
        desc: ''
        selected: false
        title: 开始
        type: start
        variables:
        - label: url
          max_length: 256
          options: []
          required: true
          type: text-input
          variable: url
        - label: time
          max_length: 256
          options: []
          required: true
          type: text-input
          variable: time
      height: 114
      id: '1740227344669'
      position:
        x: 61.00003308251661
        y: 217.61122322408403
      positionAbsolute:
        x: 61.00003308251661
        y: 217.61122322408403
      selected: false
      sourcePosition: right
      targetPosition: left
      type: custom
      width: 243
    - data:
        desc: ''
        outputs:
        - value_selector:
          - '1740228576808'
          - result
          variable: result
        selected: false
        title: 结束
        type: end
      height: 88
      id: '1740228069847'
      position:
        x: 1023.6666115291391
        y: 217.61122322408403
      positionAbsolute:
        x: 1023.6666115291391
        y: 217.61122322408403
      selected: false
      sourcePosition: right
      targetPosition: left
      type: custom
      width: 243
    - data:
        code: "import json\nfrom datetime import datetime\n\ndef main(arg1: str, arg2:\
          \ str) -> dict:\n    date_format = \"%Y-%m-%d\"\n    \n    try:\n      \
          \  # 数据预处理\n        data = json.loads(arg1)\n        if not isinstance(data,\
          \ list):\n            raise ValueError(\"Input must be a JSON array\")\n\
          \            \n        current_date = datetime.strptime(arg2, date_format).date()\n\
          \        \n        # 数据过滤和转换\n        valid_records = []\n        for item\
          \ in data:\n            if isinstance(item, dict) and \"d\" in item:\n \
          \               try:\n                    item_date = datetime.strptime(item[\"\
          d\"], date_format).date()\n                    if item_date <= current_date:\n\
          \                        # 保留原始数据并添加排序字段\n                        valid_records.append(\
          \ {\n                            \"_sort_key\": item_date,\n           \
          \                 \"data\": json.dumps(item)  # 提前转换为字符串\n             \
          \           } )\n                except (ValueError, TypeError):\n     \
          \               continue\n        \n        # 安全排序\n        valid_records.sort(key=lambda\
          \ x: x[\"_sort_key\"], reverse=True)\n        \n        # 构建最终结果\n     \
          \   return {\n            \"result\": json.dumps([\n                json.loads(entry[\"\
          data\"]) for entry in valid_records[:30]\n            ])  # 双重验证确保字符串类型\n\
          \        }\n    \n    except (json.JSONDecodeError, ValueError) as e:\n\
          \        return {\"result\": f\"Error: {str(e)}\"}"
        code_language: python3
        desc: ''
        outputs:
          result:
            children: null
            type: string
        selected: false
        title: 代码执行
        type: code
        variables:
        - value_selector:
          - '1740229404443'
          - body
          variable: arg1
        - value_selector:
          - '1740227344669'
          - time
          variable: arg2
      height: 52
      id: '1740228576808'
      position:
        x: 737.6110247289844
        y: 217.61122322408403
      positionAbsolute:
        x: 737.6110247289844
        y: 217.61122322408403
      selected: false
      sourcePosition: right
      targetPosition: left
      type: custom
      width: 243
    - data:
        authorization:
          config: null
          type: no-auth
        body:
          data: []
          type: none
        desc: ''
        headers: ''
        method: get
        params: ''
        retry_config:
          max_retries: 3
          retry_enabled: true
          retry_interval: 100
        selected: false
        timeout:
          max_connect_timeout: 0
          max_read_timeout: 0
          max_write_timeout: 0
        title: HTTP 请求
        type: http-request
        url: '{{#1740227344669.url#}}'
        variables: []
      height: 120
      id: '1740229404443'
      position:
        x: 410.7221321642604
        y: 217.61122322408403
      positionAbsolute:
        x: 410.7221321642604
        y: 217.61122322408403
      selected: false
      sourcePosition: right
      targetPosition: left
      type: custom
      width: 243
    - data:
        author: 超人阿亚
        desc: ''
        height: 161
        selected: false
        showAuthor: true
        text: '{"root":{"children":[{"children":[{"detail":0,"format":0,"mode":"normal","style":"","text":"开始节点，定义url和time变量","type":"text","version":1}],"direction":"ltr","format":"","indent":0,"type":"paragraph","version":1,"textFormat":0,"textStyle":""},{"children":[],"direction":"ltr","format":"","indent":0,"type":"paragraph","version":1,"textFormat":0,"textStyle":""},{"children":[{"detail":0,"format":0,"mode":"normal","style":"","text":"内容来自公众号
          dify实验室","type":"text","version":1}],"direction":"ltr","format":"","indent":0,"type":"paragraph","version":1,"textFormat":0,"textStyle":""},{"children":[{"detail":0,"format":0,"mode":"normal","style":"","text":"https://mp.weixin.qq.com/s/OOyvX2hiuFkFs45CEotvMw","type":"text","version":1}],"direction":"ltr","format":"","indent":0,"type":"paragraph","version":1,"textFormat":0,"textStyle":""}],"direction":"ltr","format":"","indent":0,"type":"root","version":1}}'
        theme: blue
        title: ''
        type: ''
        width: 255
      height: 161
      id: '1742429895880'
      position:
        x: 65.05536519931087
        y: 14.912329249991553
      positionAbsolute:
        x: 65.05536519931087
        y: 14.912329249991553
      selected: false
      sourcePosition: right
      targetPosition: left
      type: custom-note
      width: 255
    - data:
        author: 超人阿亚
        desc: ''
        height: 161
        selected: false
        showAuthor: true
        text: '{"root":{"children":[{"children":[{"detail":0,"format":0,"mode":"normal","style":"","text":"http请求节点","type":"text","version":1}],"direction":"ltr","format":"","indent":0,"type":"paragraph","version":1,"textFormat":0,"textStyle":""},{"children":[{"detail":0,"format":0,"mode":"normal","style":"","text":"请求抓取股票数据","type":"text","version":1}],"direction":"ltr","format":"","indent":0,"type":"paragraph","version":1,"textFormat":0,"textStyle":""},{"children":[{"detail":0,"format":0,"mode":"normal","style":"","text":"内容来自公众号
          dify实验室","type":"text","version":1}],"direction":"ltr","format":"","indent":0,"type":"paragraph","version":1,"textFormat":0,"textStyle":""},{"children":[{"detail":0,"format":0,"mode":"normal","style":"","text":"https://mp.weixin.qq.com/s/OOyvX2hiuFkFs45CEotvMw","type":"text","version":1}],"direction":"ltr","format":"","indent":0,"type":"paragraph","version":1,"textFormat":0,"textStyle":""}],"direction":"ltr","format":"","indent":0,"type":"root","version":1}}'
        theme: blue
        title: ' (1)'
        type: ''
        width: 255
      height: 161
      id: '17424299906920'
      position:
        x: 410.7221321642604
        y: 14.912329249991553
      positionAbsolute:
        x: 410.7221321642604
        y: 14.912329249991553
      selected: true
      sourcePosition: right
      targetPosition: left
      type: custom-note
      width: 255
    - data:
        author: 超人阿亚
        desc: ''
        height: 161
        selected: false
        showAuthor: true
        text: '{"root":{"children":[{"children":[{"detail":0,"format":0,"mode":"normal","style":"","text":"代码执行，取最近30个工作的数据返回。","type":"text","version":1}],"direction":"ltr","format":"","indent":0,"type":"paragraph","version":1,"textFormat":0,"textStyle":""},{"children":[],"direction":null,"format":"","indent":0,"type":"paragraph","version":1,"textFormat":0,"textStyle":""},{"children":[{"detail":0,"format":0,"mode":"normal","style":"","text":"内容来自公众号
          dify实验室","type":"text","version":1}],"direction":"ltr","format":"","indent":0,"type":"paragraph","version":1,"textFormat":0,"textStyle":""},{"children":[{"detail":0,"format":0,"mode":"normal","style":"","text":"https://mp.weixin.qq.com/s/OOyvX2hiuFkFs45CEotvMw","type":"text","version":1}],"direction":"ltr","format":"","indent":0,"type":"paragraph","version":1,"textFormat":0,"textStyle":""}],"direction":"ltr","format":"","indent":0,"type":"root","version":1}}'
        theme: blue
        title: ' (1)'
        type: ''
        width: 255
      height: 161
      id: '17424300217080'
      position:
        x: 721.0695725944263
        y: 14.912329249991553
      positionAbsolute:
        x: 721.0695725944263
        y: 14.912329249991553
      selected: false
      sourcePosition: right
      targetPosition: left
      type: custom-note
      width: 255
    viewport:
      x: 300.2937846002818
      y: 89.29509320899126
      zoom: 0.7179722553117178
