app:
  description: 'あつまれどうぶつの森のamiiboの画像から番号、キャラ名、住民の可否、性格、口癖、URL、値段を取得・ネット検索し、Notionに登録するワークフローです。Notionで上記の列名のテーブルを作成し、NotionのConnectionsを接続の上、データベースidとConnectionsのアクセストークンを環境変数に設定してご利用ください。（OpenAIとTavily
    SearchのAPI登録も必要です。）

    ※精度はいまいちです。完全にフローが止まるのは10％未満ですが、情報収集がうまくいきません。検索語の情報抽出は4o-miniを使っていますが、4oにすると精度が上がるかもしれません。'
  icon: 🤖
  icon_background: '#FFEAD5'
  mode: workflow
  name: Atsumori Amiibo To Notion
  use_icon_as_answer_icon: false
kind: app
version: 0.1.5
workflow:
  conversation_variables: []
  environment_variables:
  - description: ''
    id: 672197d7-646f-49ed-891d-4fc14843aee3
    name: database_id
    selector:
    - env
    - database_id
    value: your_database_id
    value_type: secret
  - description: ''
    id: 0664e086-164b-44c7-99a0-53737cd8ccce
    name: NOTION_API_KEY
    selector:
    - env
    - NOTION_API_KEY
    value: your_notion_api_key
    value_type: secret
  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: false
    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: start
        targetType: llm
      id: 1733224980318-source-1733225047174-target
      selected: false
      source: '1733224980318'
      sourceHandle: source
      target: '1733225047174'
      targetHandle: target
      type: custom
      zIndex: 0
    - data:
        isInIteration: false
        sourceType: llm
        targetType: tool
      id: 1733225047174-source-1733297682340-target
      source: '1733225047174'
      sourceHandle: source
      target: '1733297682340'
      targetHandle: target
      type: custom
      zIndex: 0
    - data:
        isInIteration: false
        sourceType: llm
        targetType: tool
      id: 1733225047174-source-17332979680750-target
      source: '1733225047174'
      sourceHandle: source
      target: '17332979680750'
      targetHandle: target
      type: custom
      zIndex: 0
    - data:
        isInIteration: false
        sourceType: tool
        targetType: llm
      id: 1733297682340-source-1733298019322-target
      source: '1733297682340'
      sourceHandle: source
      target: '1733298019322'
      targetHandle: target
      type: custom
      zIndex: 0
    - data:
        isInIteration: false
        sourceType: tool
        targetType: llm
      id: 17332979680750-source-1733298019322-target
      source: '17332979680750'
      sourceHandle: source
      target: '1733298019322'
      targetHandle: target
      type: custom
      zIndex: 0
    - data:
        isInIteration: false
        sourceType: llm
        targetType: code
      id: 1733298019322-source-1733307178804-target
      source: '1733298019322'
      sourceHandle: source
      target: '1733307178804'
      targetHandle: target
      type: custom
      zIndex: 0
    - data:
        isInIteration: false
        sourceType: code
        targetType: http-request
      id: 1733307178804-source-1733306849920-target
      source: '1733307178804'
      sourceHandle: source
      target: '1733306849920'
      targetHandle: target
      type: custom
      zIndex: 0
    - data:
        isInIteration: false
        sourceType: code
        targetType: end
      id: 1733307178804-source-1733253004409-target
      source: '1733307178804'
      sourceHandle: source
      target: '1733253004409'
      targetHandle: target
      type: custom
      zIndex: 0
    - data:
        isInIteration: false
        sourceType: llm
        targetType: tool
      id: 1733225047174-source-17350019813120-target
      source: '1733225047174'
      sourceHandle: source
      target: '17350019813120'
      targetHandle: target
      type: custom
      zIndex: 0
    - data:
        isInIteration: false
        sourceType: tool
        targetType: llm
      id: 17350019813120-source-1733298019322-target
      source: '17350019813120'
      sourceHandle: source
      target: '1733298019322'
      targetHandle: target
      type: custom
      zIndex: 0
    nodes:
    - data:
        desc: ''
        selected: false
        title: 開始
        type: start
        variables:
        - allowed_file_extensions: []
          allowed_file_types:
          - image
          allowed_file_upload_methods:
          - local_file
          - remote_url
          label: amiboカードの画像をアップロード
          max_length: 48
          options: []
          required: true
          type: file
          variable: amiibo
      height: 89
      id: '1733224980318'
      position:
        x: 80
        y: 282
      positionAbsolute:
        x: 80
        y: 282
      selected: false
      sourcePosition: right
      targetPosition: left
      type: custom
      width: 243
    - data:
        context:
          enabled: false
          variable_selector: []
        desc: ''
        model:
          completion_params:
            temperature: 0.7
          mode: chat
          name: gpt-4o-mini
          provider: openai
        prompt_template:
        - id: 22ea94ec-d8ac-4634-ab3b-50723d30e79a
          role: system
          text: '{{#1733224980318.amiibo.name#}}から番号とキャラ名を読み取って。

            出力

            番号：

            キャラ名：'
        selected: false
        title: LLM_検索クエリ生成
        type: llm
        variables: []
        vision:
          configs:
            detail: high
            variable_selector:
            - '1733224980318'
            - amiibo
          enabled: true
      height: 97
      id: '1733225047174'
      position:
        x: 382
        y: 282
      positionAbsolute:
        x: 382
        y: 282
      selected: false
      sourcePosition: right
      targetPosition: left
      type: custom
      width: 243
    - data:
        desc: ''
        outputs:
        - value_selector:
          - '1733298019322'
          - text
          variable: text
        selected: false
        title: 終了
        type: end
      height: 89
      id: '1733253004409'
      position:
        x: 1679.1982421871098
        y: 420.54833063115393
      positionAbsolute:
        x: 1679.1982421871098
        y: 420.54833063115393
      selected: false
      sourcePosition: right
      targetPosition: left
      type: custom
      width: 243
    - data:
        desc: ''
        provider_id: tavily
        provider_name: tavily
        provider_type: builtin
        selected: true
        title: TavilySearch_住民
        tool_configurations:
          days: 3
          exclude_domains: null
          include_answer: 0
          include_domains: null
          include_image_descriptions: 0
          include_images: 0
          include_raw_content: 0
          max_results: 3
          search_depth: advanced
          topic: general
        tool_label: Tavily Search
        tool_name: tavily_search
        tool_parameters:
          query:
            type: mixed
            value: あつまれどうぶつの森の{{#1733225047174.text#}}は、住民になれる？
        type: tool
      height: 323
      id: '1733297682340'
      position:
        x: 686
        y: 282
      positionAbsolute:
        x: 686
        y: 282
      selected: true
      sourcePosition: right
      targetPosition: left
      type: custom
      width: 243
    - data:
        desc: ''
        provider_id: tavily
        provider_name: tavily
        provider_type: builtin
        selected: false
        title: TavilySearch_性格と口癖
        tool_configurations:
          days: 3
          exclude_domains: null
          include_answer: 0
          include_domains: null
          include_image_descriptions: 0
          include_images: 0
          include_raw_content: 0
          max_results: 3
          search_depth: advanced
          topic: general
        tool_label: Tavily Search
        tool_name: tavily_search
        tool_parameters:
          query:
            type: mixed
            value: あつまれどうぶつの森の{{#1733225047174.text#}}の性格と口癖は？
        type: tool
      height: 323
      id: '17332979680750'
      position:
        x: 686
        y: 630.6465734331522
      positionAbsolute:
        x: 686
        y: 630.6465734331522
      selected: false
      sourcePosition: right
      targetPosition: left
      type: custom
      width: 243
    - data:
        context:
          enabled: false
          variable_selector: []
        desc: ''
        model:
          completion_params:
            temperature: 0.7
          mode: chat
          name: gpt-4o-mini
          provider: openai
        prompt_template:
        - id: d3229cc6-e534-4f22-a211-ff6caa4d6c32
          role: system
          text: "{{#1733225047174.text#}}について、\n{{#1733297682340.text#}}と{{#17332979680750.text#}}と{{#17350019813120.text#}}の情報から、以下の項目を抜き出してXML形式で出力してください。\n\
            \n### 抜き出す情報:\n1. **住民の可否**: 「可」または「否」として回答。\n2. **性格（何系か）**: 住民が「可」の場合のみ回答。住民不可の場合は空欄とする。\n\
            3. **口ぐせ**: 住民が「可」の場合のみ回答。住民不可の場合は空欄とする。\n4. **情報源のURL**: 上記の情報源。確実に記載。\n\
            5. **amiiboの値段**: \n\n### 出力形式\n以下の形式に厳密に従って出力してください。出力形式の表示など、余計な情報や説明を含めないでください。\n\
            \n<characterData>\n    <no>番号</no>\n    <character>キャラ名</character>\n\
            \    <resident>住民の可否</resident>\n    <personality>性格（住民不可の場合は空欄）</personality>\n\
            \    <saying>口ぐせ（住民不可の場合は空欄）</saying>\n    <url>情報源のURL</url>\n    <price>amiibo値段</price>\n\
            </characterData>\n"
        selected: false
        title: LLM_検索結果整理
        type: llm
        variables: []
        vision:
          enabled: false
      height: 97
      id: '1733298019322'
      position:
        x: 1076.1982421871098
        y: 282
      positionAbsolute:
        x: 1076.1982421871098
        y: 282
      selected: false
      sourcePosition: right
      targetPosition: left
      type: custom
      width: 243
    - data:
        authorization:
          config:
            api_key: '{{#env.NOTION_API_KEY#}}'
            type: bearer
          type: api-key
        body:
          data:
          - id: key-value-431
            key: ''
            type: text
            value: "{\n  \"parent\": { \"database_id\": \"{{#env.database_id#}}\"\
              \ },\n  \"properties\": {\n    \"番号\": {\n      \"title\": [\n     \
              \   {\n          \"text\": {\n            \"content\": \"{{#1733307178804.no#}}\"\
              \n          }\n        }\n      ]\n    },\n    \"キャラ名\": {\n      \"\
              rich_text\": [\n        {\n          \"text\": {\n            \"content\"\
              : \"{{#1733307178804.character#}}\"\n          }\n        }\n      ]\n\
              \    },\n    \"住民の可否\": {\n      \"rich_text\": [\n        {\n     \
              \     \"text\": {\n            \"content\": \"{{#1733307178804.resident#}}\"\
              \n          }\n        }\n      ]\n    },\n    \"性格\": {\n      \"rich_text\"\
              : [\n        {\n          \"text\": {\n            \"content\": \"{{#1733307178804.personality#}}\"\
              \n          }\n        }\n      ]\n    },\n    \"口癖\": {\n      \"rich_text\"\
              : [\n        {\n          \"text\": {\n            \"content\": \"{{#1733307178804.saying#}}\"\
              \n          }\n        }\n      ]\n    },\n    \"URL\": {\n      \"\
              url\": \"{{#1733307178804.url#}}\"\n    },\n    \"値段\": {\n      \"\
              rich_text\": [\n        {\n          \"text\": {\n            \"content\"\
              : \"{{#1733307178804.price#}}\"\n          }\n        }\n      ]\n \
              \   }\n  }\n}\n"
          type: json
        desc: ''
        headers: 'Content-Type:application/json

          Notion-Version:2022-06-28'
        method: post
        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: https://api.notion.com/v1/pages
        variables: []
      height: 134
      id: '1733306849920'
      position:
        x: 1679.1982421871098
        y: 282
      positionAbsolute:
        x: 1679.1982421871098
        y: 282
      selected: false
      sourcePosition: right
      targetPosition: left
      type: custom
      width: 243
    - data:
        code: "import xml.etree.ElementTree as ET\n\ndef main(xml_input):\n    try:\n\
          \        # XMLデータをパース\n        root = ET.fromstring(xml_input.strip())\n\
          \n        # 各要素を抽出\n        data = {\n            \"no\": root.find(\"no\"\
          ).text if root.find(\"no\") is not None else \"\",\n            \"character\"\
          : root.find(\"character\").text if root.find(\"character\") is not None\
          \ else \"\",\n            \"resident\": root.find(\"resident\").text if\
          \ root.find(\"resident\") is not None else \"\",\n            \"personality\"\
          : root.find(\"personality\").text if root.find(\"personality\") is not None\
          \ else \"\",\n            \"saying\": root.find(\"saying\").text if root.find(\"\
          saying\") is not None else \"\",\n            \"url\": root.find(\"url\"\
          ).text if root.find(\"url\") is not None else \"\",\n            \"price\"\
          : root.find(\"price\").text if root.find(\"price\") is not None else \"\"\
          \n        }\n\n        # 変数として返す\n        return {\n            \"no\":\
          \ data[\"no\"],\n            \"character\": data[\"character\"],\n     \
          \       \"resident\": data[\"resident\"],\n            \"personality\":\
          \ data[\"personality\"],\n            \"saying\": data[\"saying\"],\n  \
          \          \"url\": data[\"url\"],\n            \"price\": data[\"price\"\
          ]\n        }\n\n    except ET.ParseError as e:\n        # エラー処理\n      \
          \  return {\"error\": f\"XMLパースエラー: {str(e)}\"}\n"
        code_language: python3
        desc: ''
        outputs:
          character:
            children: null
            type: string
          'no':
            children: null
            type: string
          personality:
            children: null
            type: string
          price:
            children: null
            type: string
          resident:
            children: null
            type: string
          saying:
            children: null
            type: string
          url:
            children: null
            type: string
        selected: false
        title: コード
        type: code
        variables:
        - value_selector:
          - '1733298019322'
          - text
          variable: xml_input
      height: 53
      id: '1733307178804'
      position:
        x: 1379.1982421871098
        y: 282
      positionAbsolute:
        x: 1379.1982421871098
        y: 282
      selected: false
      sourcePosition: right
      targetPosition: left
      type: custom
      width: 243
    - data:
        desc: ''
        provider_id: tavily
        provider_name: tavily
        provider_type: builtin
        selected: false
        title: TavilySearch_値段
        tool_configurations:
          days: 3
          exclude_domains: null
          include_answer: 0
          include_domains: null
          include_image_descriptions: 0
          include_images: 0
          include_raw_content: 0
          max_results: 3
          search_depth: advanced
          topic: general
        tool_label: Tavily Search
        tool_name: tavily_search
        tool_parameters:
          query:
            type: mixed
            value: あつまれどうぶつの森 amiibo {{#1733225047174.text#}} 値段
        type: tool
      height: 323
      id: '17350019813120'
      position:
        x: 686
        y: 978.5910096442506
      positionAbsolute:
        x: 686
        y: 978.5910096442506
      selected: false
      sourcePosition: right
      targetPosition: left
      type: custom
      width: 243
    viewport:
      x: -64.05300762620755
      y: -1.3196586244506534
      zoom: 0.7578582832552002
