app:
  description: 建設現場の日報を統合し、未解決課題・安全懸念・優先度を抽出するワークフロー
  icon: 🏗️
  icon_background: '#FFEAD5'
  mode: workflow
  name: 現場日報 課題抽出
  use_icon_as_answer_icon: false
kind: app
version: 0.6.0
workflow:
  conversation_variables: []
  environment_variables: []
  features:
    file_upload:
      image:
        enabled: false
    opening_statement: ''
    suggested_questions: []
    suggested_questions_after_answer:
      enabled: false
    text_to_speech:
      enabled: false
  graph:
    edges:
    - data:
        sourceType: start
        targetType: code
      id: start-to-code1
      source: start
      target: code1
    - data:
        sourceType: code
        targetType: parameter-extractor
      id: code1-to-extractor1
      source: code1
      target: extractor1
    - data:
        sourceType: parameter-extractor
        targetType: code
      id: extractor1-to-code2
      source: extractor1
      target: code2
    - data:
        sourceType: code
        targetType: end
      id: code2-to-end
      source: code2
      target: end
    nodes:
    - data:
        title: 開始
        type: start
        variables:
        - label: query
          max_length: 2048
          options: []
          required: true
          type: paragraph
          variable: query
      height: 90
      id: start
      position:
        x: 80
        y: 282
      type: custom
      width: 244
    - data:
        title: 日報統合（前処理）
        type: code
        code_language: python3
        code: "def _safe_str(v):\n    \"\"\"Convert any value to string safely.\"\"\
          \"\n    if v is None:\n        return \"\"\n    if isinstance(v, list):\n\
          \        return \"\\n\".join(str(i) for i in v)\n    return str(v)\n\ndef\
          \ _safe_list(v):\n    \"\"\"Ensure value is a list.\"\"\"\n    if v is None:\n\
          \        return []\n    if isinstance(v, str):\n        return [v]\n   \
          \ if isinstance(v, list):\n        return v\n    return [v]\n\ndef main(**kwargs)\
          \ -> dict:\n    inputs = kwargs\n    # inputs[\"text\"] に複数作業員の日報（プレーンテキスト）を受け取る想定\n\
          \    raw = str(inputs.get(\"text\", \"\"))\n    # 想定される区切り文字として \"----\"\
          \ や連続改行を考慮して分割・正規化\n    parts = []\n    for part in raw.split(\"----\"):\n\
          \        p = part.strip()\n        if p:\n            parts.append(p)\n\
          \    if not parts:\n        # 改行2つ以上を区切りとして試す\n        chunks = [c.strip()\
          \ for c in raw.split(\"\\n\\n\") if c.strip()]\n        if chunks:\n   \
          \         merged = \"\\n\\n\".join(chunks)\n        else:\n            merged\
          \ = raw\n    else:\n        merged = \"\\n\\n\".join(parts)\n    # 出力は merged\
          \ に格納\n    return dict(merged=merged)\n"
        variables:
        - value_selector:
          - start
          - query
          variable: text
        outputs:
          merged:
            type: string
            children: null
      height: 90
      id: code1
      position:
        x: 380
        y: 282
      type: custom
      width: 244
    - data:
        title: 情報抽出
        type: parameter-extractor
        model:
          provider: openai
          name: gpt-5-mini
          mode: chat
          completion_params:
            temperature: 0.2
        query:
        - code1
        - merged
        parameters:
        - name: unresolved_issues
          type: string
          description: 未解決の課題（カンマ区切りで列挙）
          required: true
        - name: safety_concerns
          type: string
          description: 安全懸念（カンマ区切りで列挙）
          required: false
        - name: priority_summary
          type: string
          description: '優先度の要約（例: 高, 中, 低 のいずれか、または優先度ごとの簡潔な説明）'
          required: true
        reasoning_mode: prompt
        instruction: '以下の統合された日報テキストから、次の項目を抽出してください。

          1) 未解決の課題: 解決が必要な具体的な課題をカンマ区切りで列挙してください。

          2) 安全懸念: 現場で報告された安全に関する懸念をカンマ区切りで列挙してください。該当がなければ空にしてください。

          3) 優先度の要約: 全体としての優先度を「高」「中」「低」のいずれかで示し、必要なら簡潔な理由を付けてください。

          出力形式は各項目を対応するパラメータに正確に割り当てられるようにしてください。リストはカンマ区切りの文字列で返してください。

          '
      height: 120
      id: extractor1
      position:
        x: 680
        y: 282
      type: custom
      width: 244
    - data:
        title: レポート整形
        type: code
        code_language: python3
        code: "def _safe_str(v):\n    \"\"\"Convert any value to string safely.\"\"\
          \"\n    if v is None:\n        return \"\"\n    if isinstance(v, list):\n\
          \        return \"\\n\".join(str(i) for i in v)\n    return str(v)\n\ndef\
          \ _safe_list(v):\n    \"\"\"Ensure value is a list.\"\"\"\n    if v is None:\n\
          \        return []\n    if isinstance(v, str):\n        return [v]\n   \
          \ if isinstance(v, list):\n        return v\n    return [v]\n\ndef main(**kwargs)\
          \ -> dict:\n    inputs = kwargs\n    unresolved = str(inputs.get(\"unresolved\"\
          , \"\")).strip()\n    safety = str(inputs.get(\"safety\", \"\")).strip()\n\
          \    priority = str(inputs.get(\"priority\", \"\")).strip()\n    # 見やすいレポートを作成\n\
          \    report_lines = []\n    report_lines.append(\"【未解決課題】\")\n    if unresolved:\n\
          \        # カンマ区切りを改行に変換して箇条書き風に整形\n        items = [i.strip() for i in unresolved.split(\"\
          ,\") if i.strip()]\n        for it in items:\n            report_lines.append(\"\
          - \" + it)\n    else:\n        report_lines.append(\"- なし\")\n    report_lines.append(\"\
          \")\n    report_lines.append(\"【安全懸念】\")\n    if safety:\n        s_items\
          \ = [s.strip() for s in safety.split(\",\") if s.strip()]\n        for si\
          \ in s_items:\n            report_lines.append(\"- \" + si)\n    else:\n\
          \        report_lines.append(\"- なし\")\n    report_lines.append(\"\")\n\
          \    report_lines.append(\"【優先度】\")\n    if priority:\n        report_lines.append(priority)\n\
          \    else:\n        report_lines.append(\"未設定\")\n    report_text = \"\\\
          n\".join(report_lines)\n    return dict(report=report_text)\n"
        variables:
        - value_selector:
          - extractor1
          - unresolved_issues
          variable: unresolved
        - value_selector:
          - extractor1
          - safety_concerns
          variable: safety
        - value_selector:
          - extractor1
          - priority_summary
          variable: priority
        outputs:
          report:
            type: string
            children: null
      height: 90
      id: code2
      position:
        x: 980
        y: 282
      type: custom
      width: 244
    - data:
        title: 終了
        type: end
        outputs:
        - value_selector:
          - code2
          - report
          variable: result
      height: 90
      id: end
      position:
        x: 1280
        y: 282
      type: custom
      width: 244
  hash: null
