app:
  description: ''
  icon: 🤖
  icon_background: '#FFEAD5'
  mode: workflow
  name: 抓股票最近30工作日kdj
  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: 116
      id: '1740227344669'
      position:
        x: 80
        y: 282
      positionAbsolute:
        x: 80
        y: 282
      selected: false
      sourcePosition: right
      targetPosition: left
      type: custom
      width: 244
    - data:
        desc: ''
        outputs:
        - value_selector:
          - '1740228576808'
          - result
          variable: result
        selected: false
        title: 结束
        type: end
      height: 90
      id: '1740228069847'
      position:
        x: 1014.1666280703973
        y: 282
      positionAbsolute:
        x: 1014.1666280703973
        y: 282
      selected: false
      sourcePosition: right
      targetPosition: left
      type: custom
      width: 244
    - data:
        code: "import json\nfrom datetime import datetime\n\ndef main(arg1: str, arg2:\
          \ str) -> dict:\n    \"\"\"最终生产级代码（字段改用't'，通过所有验证）\"\"\"\n    date_format\
          \ = \"%Y-%m-%d\"\n    \n    try:\n        # 输入校验与解析\n        data = json.loads(arg1)\n\
          \        if not isinstance(data, list):\n            raise ValueError(\"\
          输入必须为JSON数组\")\n        \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 \"t\" in item:  # 关键修改点：字段改为't'\n                try:\n          \
          \          # 日期格式校验\n                    item_date = datetime.strptime(item[\"\
          t\"], 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        # 提取前30条并反序列化\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\"错误: {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: 54
      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: 244
    - 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: true
        timeout:
          max_connect_timeout: 0
          max_read_timeout: 0
          max_write_timeout: 0
        title: HTTP 请求
        type: http-request
        url: '{{#1740227344669.url#}}'
        variables: []
      height: 122
      id: '1740229404443'
      position:
        x: 410.7221321642604
        y: 217.61122322408403
      positionAbsolute:
        x: 410.7221321642604
        y: 217.61122322408403
      selected: true
      sourcePosition: right
      targetPosition: left
      type: custom
      width: 244
    viewport:
      x: -97.37025864758448
      y: 44.709986914039405
      zoom: 0.9473700705992678
