{
  "openapi": "3.1.0",
  "info": {
    "title": "Enterprise AI DataQuery API",
    "description": "\n        ## 企业AI问数 API\n\n        支持数据源管理、SQL查询、自然语言查询、Schema可视化等功能的完整API接口。\n\n        ### 🚀 快速开始\n\n        1. **测试连接**: `GET /api/v1/data-sources` - 列出所有数据源\n        2. **创建数据源**: `POST /api/v1/data-sources` - 添加CSV/MySQL/PostgreSQL/SQLite/SQL Server/Oracle/DuckDB/ClickHouse/TiDB/CockroachDB/GaussDB/OceanBase/Snowflake/API数据源\n        3. **执行查询**: `POST /api/v1/nl-query-stream` - 自然语言转SQL，SSE流式返回结果\n\n        ### 主要功能\n\n        - **数据源管理**: 创建、列出、获取、删除数据源（支持CSV、MySQL、PostgreSQL、SQLite、SQL Server、Oracle、DuckDB、ClickHouse、TiDB、CockroachDB、GaussDB、OceanBase、Snowflake、HTTP API）\n        - **查询执行**: 支持SQL查询和自然语言查询\n        - **Schema可视化**: 获取数据源结构和ER图数据\n        - **流式查询**: SSE流式返回查询结果\n        - **权限控制**: 字段级权限和RBAC支持\n\n        ### 🌐 跨域支持\n\n        本API完全支持跨域访问（CORS），所有端点返回 `Access-Control-Allow-Origin: *`\n\n        ### 📦 数据源类型\n\n        - **CSV**: 本地或远程CSV文件\n        - **MySQL**: MySQL/MariaDB数据库\n        - **PostgreSQL**: PostgreSQL数据库\n        - **SQLite**: SQLite数据库文件或内存数据库\n        - **SQL Server**: Microsoft SQL Server / Azure SQL 数据库\n        - **Oracle**: Oracle 数据库\n        - **DuckDB**: 本地 DuckDB 文件或内存数据库\n        - **ClickHouse**: ClickHouse OLAP 数据库\n        - **TiDB**: 兼容 MySQL 协议的分布式数据库\n        - **CockroachDB**: 兼容 PostgreSQL 协议的分布式数据库\n        - **GaussDB**: 华为 GaussDB 数据库（兼容 PostgreSQL 协议）\n        - **OceanBase**: OceanBase 数据库（兼容 MySQL / Oracle 协议）\n        - **Snowflake**: Snowflake 数据仓库\n        - **HTTP API**: 通过HTTP API访问的远程数据库\n\n        ### 🔧 认证方式\n\n        所有API请求需要认证。Web控制台使用Cookie认证（cow_auth_token），外部调用可先通过 /auth/login 获取token。\n        ",
    "contact": {
      "name": "EnterpriseAI",
      "url": "https://github.com/zhayujie/chatgpt-on-wechat"
    },
    "license": {
      "name": "MIT License"
    },
    "version": "1.0.0"
  },
  "servers": [
    {
      "url": "http://localhost:9899",
      "description": "Enterprise AI DataQuery API 服务器"
    }
  ],
  "paths": {
    "/api/v1/packs": {
      "get": {
        "tags": [
          "dataquery",
          "packs"
        ],
        "summary": "List Packs",
        "description": "列出所有可用 Config Pack",
        "operationId": "list_packs_api_v1_packs_get",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object",
                  "title": "Response List Packs Api V1 Packs Get"
                }
              }
            }
          },
          "404": {
            "description": "Pack not found"
          },
          "500": {
            "description": "Internal server error"
          }
        }
      }
    },
    "/api/v1/packs/{pack_id}": {
      "get": {
        "tags": [
          "dataquery",
          "packs"
        ],
        "summary": "Get Pack",
        "description": "获取指定 Pack 的元数据",
        "operationId": "get_pack_api_v1_packs__pack_id__get",
        "parameters": [
          {
            "name": "pack_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Pack Id"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true,
                  "title": "Response Get Pack Api V1 Packs  Pack Id  Get"
                }
              }
            }
          },
          "404": {
            "description": "Pack not found"
          },
          "500": {
            "description": "Internal server error"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/packs/{pack_id}/apply/{source_id}": {
      "post": {
        "tags": [
          "dataquery",
          "packs"
        ],
        "summary": "Apply Pack",
        "description": "将指定 Pack 应用到数据源（Ontology + 术语库）",
        "operationId": "apply_pack_api_v1_packs__pack_id__apply__source_id__post",
        "parameters": [
          {
            "name": "pack_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Pack Id"
            }
          },
          {
            "name": "source_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Source Id"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true,
                  "title": "Response Apply Pack Api V1 Packs  Pack Id  Apply  Source Id  Post"
                }
              }
            }
          },
          "404": {
            "description": "Pack not found"
          },
          "500": {
            "description": "Internal server error"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/packs/reload": {
      "post": {
        "tags": [
          "dataquery",
          "packs"
        ],
        "summary": "Reload Packs",
        "description": "重新扫描 packs 目录并热重载",
        "operationId": "reload_packs_api_v1_packs_reload_post",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object",
                  "title": "Response Reload Packs Api V1 Packs Reload Post"
                }
              }
            }
          },
          "404": {
            "description": "Pack not found"
          },
          "500": {
            "description": "Internal server error"
          }
        }
      }
    },
    "/api/v1/packs/{pack_id}/bind/{tenant_id}": {
      "post": {
        "tags": [
          "dataquery",
          "packs"
        ],
        "summary": "Bind Pack To Tenant",
        "description": "将 Pack 绑定到租户（影响该租户可见的 profile）",
        "operationId": "bind_pack_to_tenant_api_v1_packs__pack_id__bind__tenant_id__post",
        "parameters": [
          {
            "name": "pack_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Pack Id"
            }
          },
          {
            "name": "tenant_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Tenant Id"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true,
                  "title": "Response Bind Pack To Tenant Api V1 Packs  Pack Id  Bind  Tenant Id  Post"
                }
              }
            }
          },
          "404": {
            "description": "Pack not found"
          },
          "500": {
            "description": "Internal server error"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "dataquery",
          "packs"
        ],
        "summary": "Unbind Pack From Tenant",
        "description": "解除 Pack 与租户的绑定",
        "operationId": "unbind_pack_from_tenant_api_v1_packs__pack_id__bind__tenant_id__delete",
        "parameters": [
          {
            "name": "pack_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Pack Id"
            }
          },
          {
            "name": "tenant_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Tenant Id"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true,
                  "title": "Response Unbind Pack From Tenant Api V1 Packs  Pack Id  Bind  Tenant Id  Delete"
                }
              }
            }
          },
          "404": {
            "description": "Pack not found"
          },
          "500": {
            "description": "Internal server error"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/packs/{tenant_id}/dashboards": {
      "get": {
        "tags": [
          "dataquery",
          "packs"
        ],
        "summary": "List Dashboard Profiles",
        "description": "列出租户可用的驾驶舱 profile",
        "operationId": "list_dashboard_profiles_api_v1_packs__tenant_id__dashboards_get",
        "parameters": [
          {
            "name": "tenant_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Tenant Id"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true,
                  "title": "Response List Dashboard Profiles Api V1 Packs  Tenant Id  Dashboards Get"
                }
              }
            }
          },
          "404": {
            "description": "Pack not found"
          },
          "500": {
            "description": "Internal server error"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/packs/{tenant_id}/dashboards/{profile_id}": {
      "get": {
        "tags": [
          "dataquery",
          "packs"
        ],
        "summary": "Get Dashboard Profile",
        "description": "获取租户驾驶舱 profile 详情",
        "operationId": "get_dashboard_profile_api_v1_packs__tenant_id__dashboards__profile_id__get",
        "parameters": [
          {
            "name": "tenant_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Tenant Id"
            }
          },
          {
            "name": "profile_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Profile Id"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true,
                  "title": "Response Get Dashboard Profile Api V1 Packs  Tenant Id  Dashboards  Profile Id  Get"
                }
              }
            }
          },
          "404": {
            "description": "Pack not found"
          },
          "500": {
            "description": "Internal server error"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/packs/{tenant_id}/governance": {
      "get": {
        "tags": [
          "dataquery",
          "packs"
        ],
        "summary": "List Governance Profiles",
        "description": "列出租户可用的治理 profile",
        "operationId": "list_governance_profiles_api_v1_packs__tenant_id__governance_get",
        "parameters": [
          {
            "name": "tenant_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Tenant Id"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true,
                  "title": "Response List Governance Profiles Api V1 Packs  Tenant Id  Governance Get"
                }
              }
            }
          },
          "404": {
            "description": "Pack not found"
          },
          "500": {
            "description": "Internal server error"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/packs/{tenant_id}/governance/{profile_id}/run": {
      "post": {
        "tags": [
          "dataquery",
          "packs"
        ],
        "summary": "Run Governance Profile",
        "description": "执行治理 profile",
        "operationId": "run_governance_profile_api_v1_packs__tenant_id__governance__profile_id__run_post",
        "parameters": [
          {
            "name": "tenant_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Tenant Id"
            }
          },
          {
            "name": "profile_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Profile Id"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": true,
                "default": {},
                "title": "Body"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true,
                  "title": "Response Run Governance Profile Api V1 Packs  Tenant Id  Governance  Profile Id  Run Post"
                }
              }
            }
          },
          "404": {
            "description": "Pack not found"
          },
          "500": {
            "description": "Internal server error"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/packs/{tenant_id}/governance/{profile_id}/runs": {
      "get": {
        "tags": [
          "dataquery",
          "packs"
        ],
        "summary": "List Governance Runs",
        "description": "列出治理 profile 的运行记录",
        "operationId": "list_governance_runs_api_v1_packs__tenant_id__governance__profile_id__runs_get",
        "parameters": [
          {
            "name": "tenant_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Tenant Id"
            }
          },
          {
            "name": "profile_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Profile Id"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true,
                  "title": "Response List Governance Runs Api V1 Packs  Tenant Id  Governance  Profile Id  Runs Get"
                }
              }
            }
          },
          "404": {
            "description": "Pack not found"
          },
          "500": {
            "description": "Internal server error"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/packs/{tenant_id}/governance/{profile_id}/runs/{run_id}": {
      "get": {
        "tags": [
          "dataquery",
          "packs"
        ],
        "summary": "Get Governance Run",
        "description": "获取治理运行详情",
        "operationId": "get_governance_run_api_v1_packs__tenant_id__governance__profile_id__runs__run_id__get",
        "parameters": [
          {
            "name": "tenant_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Tenant Id"
            }
          },
          {
            "name": "profile_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Profile Id"
            }
          },
          {
            "name": "run_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Run Id"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true,
                  "title": "Response Get Governance Run Api V1 Packs  Tenant Id  Governance  Profile Id  Runs  Run Id  Get"
                }
              }
            }
          },
          "404": {
            "description": "Pack not found"
          },
          "500": {
            "description": "Internal server error"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/packs/{tenant_id}/governance/{profile_id}": {
      "get": {
        "tags": [
          "dataquery",
          "packs"
        ],
        "summary": "Get Governance Profile",
        "description": "获取租户治理 profile 详情",
        "operationId": "get_governance_profile_api_v1_packs__tenant_id__governance__profile_id__get",
        "parameters": [
          {
            "name": "tenant_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Tenant Id"
            }
          },
          {
            "name": "profile_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Profile Id"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true,
                  "title": "Response Get Governance Profile Api V1 Packs  Tenant Id  Governance  Profile Id  Get"
                }
              }
            }
          },
          "404": {
            "description": "Pack not found"
          },
          "500": {
            "description": "Internal server error"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/packs/{tenant_id}/scenarios": {
      "get": {
        "tags": [
          "dataquery",
          "packs"
        ],
        "summary": "List Scenario Suites",
        "description": "列出租户可用的验收套件",
        "operationId": "list_scenario_suites_api_v1_packs__tenant_id__scenarios_get",
        "parameters": [
          {
            "name": "tenant_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Tenant Id"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true,
                  "title": "Response List Scenario Suites Api V1 Packs  Tenant Id  Scenarios Get"
                }
              }
            }
          },
          "404": {
            "description": "Pack not found"
          },
          "500": {
            "description": "Internal server error"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/packs/{tenant_id}/scenarios/{suite_id}": {
      "get": {
        "tags": [
          "dataquery",
          "packs"
        ],
        "summary": "Get Scenario Suite",
        "description": "获取租户验收套件详情",
        "operationId": "get_scenario_suite_api_v1_packs__tenant_id__scenarios__suite_id__get",
        "parameters": [
          {
            "name": "tenant_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Tenant Id"
            }
          },
          {
            "name": "suite_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Suite Id"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true,
                  "title": "Response Get Scenario Suite Api V1 Packs  Tenant Id  Scenarios  Suite Id  Get"
                }
              }
            }
          },
          "404": {
            "description": "Pack not found"
          },
          "500": {
            "description": "Internal server error"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/dashboard/profiles": {
      "get": {
        "tags": [
          "dataquery",
          "dashboard"
        ],
        "summary": "列出租户可用 Dashboard profile",
        "description": "列出租户可用的驾驶舱 profile。",
        "operationId": "list_dashboard_profiles_api_v1_dashboard_profiles_get",
        "parameters": [
          {
            "name": "pack_id",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "按 pack_id 过滤",
              "title": "Pack Id"
            },
            "description": "按 pack_id 过滤"
          },
          {
            "name": "X-Tenant-ID",
            "in": "header",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Tenant-Id"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true,
                  "title": "Response List Dashboard Profiles Api V1 Dashboard Profiles Get"
                }
              }
            }
          },
          "404": {
            "description": "Dashboard profile or widget not found"
          },
          "500": {
            "description": "Internal server error"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/dashboard/profile": {
      "get": {
        "tags": [
          "dataquery",
          "dashboard"
        ],
        "summary": "获取 Dashboard profile 详情",
        "description": "获取租户指定 dashboard profile 详情。",
        "operationId": "get_dashboard_profile_api_v1_dashboard_profile_get",
        "parameters": [
          {
            "name": "pack_id",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "description": "Pack ID",
              "title": "Pack Id"
            },
            "description": "Pack ID"
          },
          {
            "name": "profile_id",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "description": "Profile ID",
              "title": "Profile Id"
            },
            "description": "Profile ID"
          },
          {
            "name": "X-Tenant-ID",
            "in": "header",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Tenant-Id"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true,
                  "title": "Response Get Dashboard Profile Api V1 Dashboard Profile Get"
                }
              }
            }
          },
          "404": {
            "description": "Dashboard profile or widget not found"
          },
          "500": {
            "description": "Internal server error"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/dashboard/widget/{widget_id}/data": {
      "post": {
        "tags": [
          "dataquery",
          "dashboard"
        ],
        "summary": "执行 Widget 数据查询",
        "description": "执行单个 widget 的数据查询。",
        "operationId": "execute_widget_data_api_v1_dashboard_widget__widget_id__data_post",
        "parameters": [
          {
            "name": "widget_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "Widget ID",
              "title": "Widget Id"
            },
            "description": "Widget ID"
          },
          {
            "name": "X-Tenant-ID",
            "in": "header",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Tenant-Id"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DashboardWidgetDataRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true,
                  "title": "Response Execute Widget Data Api V1 Dashboard Widget  Widget Id  Data Post"
                }
              }
            }
          },
          "404": {
            "description": "Dashboard profile or widget not found"
          },
          "500": {
            "description": "Internal server error"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/data-sources": {
      "post": {
        "tags": [
          "dataquery"
        ],
        "summary": "创建数据源",
        "description": "创建新的数据源连接，支持 CSV、MySQL、PostgreSQL 等类型",
        "operationId": "create_datasource_api_v1_data_sources_post",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DataSourceCreateRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIResponse"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found"
          },
          "500": {
            "description": "Internal server error"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      },
      "get": {
        "tags": [
          "dataquery"
        ],
        "summary": "列出数据源",
        "description": "获取所有数据源列表，支持过滤",
        "operationId": "list_datasources_api_v1_data_sources_get",
        "parameters": [
          {
            "name": "persistent_only",
            "in": "query",
            "required": false,
            "schema": {
              "type": "boolean",
              "description": "仅返回持久化数据源",
              "default": false,
              "title": "Persistent Only"
            },
            "description": "仅返回持久化数据源"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIResponse"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found"
          },
          "500": {
            "description": "Internal server error"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/data-sources/{source_id}": {
      "get": {
        "tags": [
          "dataquery"
        ],
        "summary": "获取数据源详情",
        "description": "获取指定数据源的详细信息",
        "operationId": "get_datasource_api_v1_data_sources__source_id__get",
        "parameters": [
          {
            "name": "source_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "数据源ID",
              "title": "Source Id"
            },
            "description": "数据源ID"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIResponse"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found"
          },
          "500": {
            "description": "Internal server error"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "dataquery"
        ],
        "summary": "删除数据源",
        "description": "删除指定的数据源",
        "operationId": "delete_datasource_api_v1_data_sources__source_id__delete",
        "parameters": [
          {
            "name": "source_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "数据源ID",
              "title": "Source Id"
            },
            "description": "数据源ID"
          },
          {
            "name": "delete_persistent",
            "in": "query",
            "required": false,
            "schema": {
              "type": "boolean",
              "description": "是否删除持久化数据",
              "default": false,
              "title": "Delete Persistent"
            },
            "description": "是否删除持久化数据"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIResponse"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found"
          },
          "500": {
            "description": "Internal server error"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/query": {
      "post": {
        "tags": [
          "dataquery"
        ],
        "summary": "执行 SQL 查询",
        "description": "在指定数据源上执行 SQL 查询语句",
        "operationId": "execute_query_api_v1_query_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/QueryExecuteRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIResponse"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found"
          },
          "500": {
            "description": "Internal server error"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/nl-query": {
      "post": {
        "tags": [
          "dataquery"
        ],
        "summary": "执行自然语言查询",
        "description": "将自然语言转换为 SQL 并执行查询",
        "operationId": "execute_nl_query_api_v1_nl_query_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/NLQueryRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIResponse"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found"
          },
          "500": {
            "description": "Internal server error"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/nl-query-stream": {
      "post": {
        "tags": [
          "dataquery"
        ],
        "summary": "执行自然语言查询（流式）",
        "description": "将自然语言转换为 SQL 并执行查询，使用 SSE 流式返回结果",
        "operationId": "execute_nl_query_stream_api_v1_nl_query_stream_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/NLQueryRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "404": {
            "description": "Resource not found"
          },
          "500": {
            "description": "Internal server error"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/cross-source-query": {
      "post": {
        "tags": [
          "dataquery"
        ],
        "summary": "执行跨数据源查询",
        "description": "在多个数据源上执行联邦查询",
        "operationId": "execute_cross_source_query_api_v1_cross_source_query_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CrossSourceQueryRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIResponse"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found"
          },
          "500": {
            "description": "Internal server error"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/ontology/unified/query": {
      "get": {
        "tags": [
          "dataquery"
        ],
        "summary": "统一实体查询",
        "description": "根据虚拟本体查询跨源统一实体记录",
        "operationId": "ontology_unified_query_api_v1_ontology_unified_query_get",
        "parameters": [
          {
            "name": "virtual_ontology_id",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "description": "虚拟本体ID",
              "title": "Virtual Ontology Id"
            },
            "description": "虚拟本体ID"
          },
          {
            "name": "entity_type",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "description": "实体类型，如 Customer",
              "title": "Entity Type"
            },
            "description": "实体类型，如 Customer"
          },
          {
            "name": "entity_value",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "description": "实体值，如 华创网络技术有限公司",
              "title": "Entity Value"
            },
            "description": "实体值，如 华创网络技术有限公司"
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "description": "单源最大返回行数",
              "default": 100,
              "title": "Limit"
            },
            "description": "单源最大返回行数"
          },
          {
            "name": "timeout",
            "in": "query",
            "required": false,
            "schema": {
              "type": "number",
              "description": "并行查询超时秒数",
              "default": 30,
              "title": "Timeout"
            },
            "description": "并行查询超时秒数"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIResponse"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found"
          },
          "500": {
            "description": "Internal server error"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/ontology/orchestrate/intent": {
      "post": {
        "tags": [
          "dataquery"
        ],
        "summary": "编排意图识别与回复",
        "description": "识别用户消息中的编排意图并返回统一查询结果或映射建议",
        "operationId": "ontology_orchestrate_intent_api_v1_ontology_orchestrate_intent_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/OrchestrateIntentRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIResponse"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found"
          },
          "500": {
            "description": "Internal server error"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/ontology/virtual/llm-align": {
      "post": {
        "tags": [
          "dataquery"
        ],
        "summary": "LLM 语义对齐",
        "description": "使用 LLM 推导跨源语义映射建议",
        "operationId": "ontology_virtual_llm_align_api_v1_ontology_virtual_llm_align_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/VirtualOntologyLLMAlignRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIResponse"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found"
          },
          "500": {
            "description": "Internal server error"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/ontology/virtual/{virtual_id}/derived-properties": {
      "get": {
        "tags": [
          "dataquery"
        ],
        "summary": "列出虚拟本体派生属性",
        "description": "列出指定虚拟本体的派生属性",
        "operationId": "list_virtual_derived_properties_api_v1_ontology_virtual__virtual_id__derived_properties_get",
        "parameters": [
          {
            "name": "virtual_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "虚拟本体ID",
              "title": "Virtual Id"
            },
            "description": "虚拟本体ID"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIResponse"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found"
          },
          "500": {
            "description": "Internal server error"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "dataquery"
        ],
        "summary": "创建/生成派生属性",
        "description": "创建派生属性或传入 business_description 让 LLM 生成建议",
        "operationId": "create_virtual_derived_property_api_v1_ontology_virtual__virtual_id__derived_properties_post",
        "parameters": [
          {
            "name": "virtual_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "虚拟本体ID",
              "title": "Virtual Id"
            },
            "description": "虚拟本体ID"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/VirtualOntologyDerivedPropertyRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIResponse"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found"
          },
          "500": {
            "description": "Internal server error"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/ontology/virtual/{virtual_id}/derived-properties/{dp_id}/evaluate": {
      "post": {
        "tags": [
          "dataquery"
        ],
        "summary": "求值派生属性",
        "description": "对指定实体键值求值派生属性",
        "operationId": "evaluate_virtual_derived_property_api_v1_ontology_virtual__virtual_id__derived_properties__dp_id__evaluate_post",
        "parameters": [
          {
            "name": "virtual_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "虚拟本体ID",
              "title": "Virtual Id"
            },
            "description": "虚拟本体ID"
          },
          {
            "name": "dp_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "派生属性ID",
              "title": "Dp Id"
            },
            "description": "派生属性ID"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/VirtualOntologyDerivedPropertyEvaluateRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIResponse"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found"
          },
          "500": {
            "description": "Internal server error"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/ontology/gaps": {
      "get": {
        "tags": [
          "dataquery"
        ],
        "summary": "列出 Gaps",
        "description": "列出已知 gaps / 反模式",
        "operationId": "list_gaps_api_v1_ontology_gaps_get",
        "parameters": [
          {
            "name": "category",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "分类过滤",
              "title": "Category"
            },
            "description": "分类过滤"
          },
          {
            "name": "status",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "状态过滤",
              "title": "Status"
            },
            "description": "状态过滤"
          },
          {
            "name": "affected_source",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "受影响数据源过滤",
              "title": "Affected Source"
            },
            "description": "受影响数据源过滤"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIResponse"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found"
          },
          "500": {
            "description": "Internal server error"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "dataquery"
        ],
        "summary": "创建 Gap",
        "description": "创建已知 gap / 反模式",
        "operationId": "create_gap_api_v1_ontology_gaps_post",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/GapCreateRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIResponse"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found"
          },
          "500": {
            "description": "Internal server error"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/ontology/gaps/{gap_id}": {
      "put": {
        "tags": [
          "dataquery"
        ],
        "summary": "更新 Gap",
        "description": "更新或解决 gap",
        "operationId": "update_gap_api_v1_ontology_gaps__gap_id__put",
        "parameters": [
          {
            "name": "gap_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "Gap ID",
              "title": "Gap Id"
            },
            "description": "Gap ID"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/GapUpdateRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIResponse"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found"
          },
          "500": {
            "description": "Internal server error"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/ontology/{source_id}/clarification": {
      "post": {
        "tags": [
          "dataquery"
        ],
        "summary": "开启苏格拉底式澄清访谈",
        "description": "基于数据源本体成熟度开启一轮澄清访谈",
        "operationId": "start_clarification_session_api_v1_ontology__source_id__clarification_post",
        "parameters": [
          {
            "name": "source_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "数据源ID",
              "title": "Source Id"
            },
            "description": "数据源ID"
          },
          {
            "name": "X-Ontology-Actor",
            "in": "header",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Ontology-Actor"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIResponse"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found"
          },
          "500": {
            "description": "Internal server error"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/ontology/{source_id}/clarification/{session_id}": {
      "get": {
        "tags": [
          "dataquery"
        ],
        "summary": "获取澄清访谈状态",
        "description": "获取当前澄清访谈会话的状态和当前问题",
        "operationId": "get_clarification_session_api_v1_ontology__source_id__clarification__session_id__get",
        "parameters": [
          {
            "name": "source_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "数据源ID",
              "title": "Source Id"
            },
            "description": "数据源ID"
          },
          {
            "name": "session_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "会话ID",
              "title": "Session Id"
            },
            "description": "会话ID"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIResponse"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found"
          },
          "500": {
            "description": "Internal server error"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "dataquery"
        ],
        "summary": "放弃澄清访谈会话",
        "description": "放弃当前澄清访谈会话",
        "operationId": "abandon_clarification_session_api_v1_ontology__source_id__clarification__session_id__delete",
        "parameters": [
          {
            "name": "source_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "数据源ID",
              "title": "Source Id"
            },
            "description": "数据源ID"
          },
          {
            "name": "session_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "会话ID",
              "title": "Session Id"
            },
            "description": "会话ID"
          },
          {
            "name": "X-Ontology-Actor",
            "in": "header",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Ontology-Actor"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIResponse"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found"
          },
          "500": {
            "description": "Internal server error"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/ontology/{source_id}/clarification/{session_id}/answer": {
      "post": {
        "tags": [
          "dataquery"
        ],
        "summary": "提交澄清访谈回答",
        "description": "提交用户对当前问题的回答，返回下一个问题或进入预览",
        "operationId": "answer_clarification_question_api_v1_ontology__source_id__clarification__session_id__answer_post",
        "parameters": [
          {
            "name": "source_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "数据源ID",
              "title": "Source Id"
            },
            "description": "数据源ID"
          },
          {
            "name": "session_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "会话ID",
              "title": "Session Id"
            },
            "description": "会话ID"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ClarificationAnswerRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIResponse"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found"
          },
          "500": {
            "description": "Internal server error"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/ontology/{source_id}/clarification/{session_id}/preview": {
      "post": {
        "tags": [
          "dataquery"
        ],
        "summary": "预览澄清访谈更新",
        "description": "对当前累积的候选更新进行 dry-run 预览",
        "operationId": "preview_clarification_updates_api_v1_ontology__source_id__clarification__session_id__preview_post",
        "parameters": [
          {
            "name": "source_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "数据源ID",
              "title": "Source Id"
            },
            "description": "数据源ID"
          },
          {
            "name": "session_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "会话ID",
              "title": "Session Id"
            },
            "description": "会话ID"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIResponse"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found"
          },
          "500": {
            "description": "Internal server error"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/ontology/{source_id}/clarification/{session_id}/apply": {
      "post": {
        "tags": [
          "dataquery"
        ],
        "summary": "应用澄清访谈更新",
        "description": "确认并应用候选更新到本体，自动生成版本快照",
        "operationId": "apply_clarification_updates_api_v1_ontology__source_id__clarification__session_id__apply_post",
        "parameters": [
          {
            "name": "source_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "数据源ID",
              "title": "Source Id"
            },
            "description": "数据源ID"
          },
          {
            "name": "session_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "会话ID",
              "title": "Session Id"
            },
            "description": "会话ID"
          },
          {
            "name": "X-Ontology-Actor",
            "in": "header",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Ontology-Actor"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIResponse"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found"
          },
          "500": {
            "description": "Internal server error"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/ontology/{source_id}/clarification/{session_id}/skip": {
      "post": {
        "tags": [
          "dataquery"
        ],
        "summary": "跳过当前澄清访谈问题",
        "description": "跳过当前问题并进入下一个",
        "operationId": "skip_clarification_question_api_v1_ontology__source_id__clarification__session_id__skip_post",
        "parameters": [
          {
            "name": "source_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "数据源ID",
              "title": "Source Id"
            },
            "description": "数据源ID"
          },
          {
            "name": "session_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "会话ID",
              "title": "Session Id"
            },
            "description": "会话ID"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIResponse"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found"
          },
          "500": {
            "description": "Internal server error"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/ontology/{source_id}/actions/history": {
      "get": {
        "tags": [
          "dataquery"
        ],
        "summary": "获取 Action 执行历史",
        "description": "获取指定数据源的 Action 执行历史日志",
        "operationId": "get_action_history_api_v1_ontology__source_id__actions_history_get",
        "parameters": [
          {
            "name": "source_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "数据源ID",
              "title": "Source Id"
            },
            "description": "数据源ID"
          },
          {
            "name": "action_type_id",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Action Type Id"
            }
          },
          {
            "name": "actor",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Actor"
            }
          },
          {
            "name": "success",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "boolean"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Success"
            }
          },
          {
            "name": "dry_run",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "boolean"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Dry Run"
            }
          },
          {
            "name": "start_time",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Start Time"
            }
          },
          {
            "name": "end_time",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "End Time"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "maximum": 1000,
              "minimum": 1,
              "default": 50,
              "title": "Limit"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIResponse"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found"
          },
          "500": {
            "description": "Internal server error"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "dataquery"
        ],
        "summary": "清空 Action 执行历史",
        "description": "清空指定数据源的 Action 执行历史日志",
        "operationId": "clear_action_history_api_v1_ontology__source_id__actions_history_delete",
        "parameters": [
          {
            "name": "source_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "数据源ID",
              "title": "Source Id"
            },
            "description": "数据源ID"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIResponse"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found"
          },
          "500": {
            "description": "Internal server error"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/ontology/{source_id}/actions/history/stats": {
      "get": {
        "tags": [
          "dataquery"
        ],
        "summary": "获取 Action 执行历史统计",
        "description": "获取指定数据源的 Action 执行历史统计信息",
        "operationId": "get_action_history_stats_api_v1_ontology__source_id__actions_history_stats_get",
        "parameters": [
          {
            "name": "source_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "数据源ID",
              "title": "Source Id"
            },
            "description": "数据源ID"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIResponse"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found"
          },
          "500": {
            "description": "Internal server error"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/ontology/{source_id}/actions/propose": {
      "post": {
        "tags": [
          "dataquery"
        ],
        "summary": "从自然语言生成 Action 提案",
        "description": "根据自然语言指令生成 Action 提案，每个提案都经过 dry-run 校验",
        "operationId": "propose_actions_api_v1_ontology__source_id__actions_propose_post",
        "parameters": [
          {
            "name": "source_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "数据源ID或虚拟本体ID",
              "title": "Source Id"
            },
            "description": "数据源ID或虚拟本体ID"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ActionProposeRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIResponse"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found"
          },
          "500": {
            "description": "Internal server error"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/ontology/{source_id}/functions": {
      "get": {
        "tags": [
          "dataquery"
        ],
        "summary": "获取 Function 列表",
        "description": "获取指定数据源本体的 Function 列表（含内置模板和自定义函数）",
        "operationId": "list_functions_api_v1_ontology__source_id__functions_get",
        "parameters": [
          {
            "name": "source_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "数据源ID",
              "title": "Source Id"
            },
            "description": "数据源ID"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIResponse"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found"
          },
          "500": {
            "description": "Internal server error"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/ontology/{source_id}/functions/{function_id}": {
      "get": {
        "tags": [
          "dataquery"
        ],
        "summary": "获取 Function 定义",
        "description": "获取指定 Function 的详细定义",
        "operationId": "get_function_api_v1_ontology__source_id__functions__function_id__get",
        "parameters": [
          {
            "name": "source_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "数据源ID",
              "title": "Source Id"
            },
            "description": "数据源ID"
          },
          {
            "name": "function_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "Function ID",
              "title": "Function Id"
            },
            "description": "Function ID"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIResponse"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found"
          },
          "500": {
            "description": "Internal server error"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/ontology/{source_id}/functions/invoke": {
      "post": {
        "tags": [
          "dataquery"
        ],
        "summary": "调用 Function（请求体指定 function_id）",
        "description": "通过请求体中的 function_id 调用指定 Function",
        "operationId": "invoke_function_api_v1_ontology__source_id__functions_invoke_post",
        "parameters": [
          {
            "name": "source_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "数据源ID",
              "title": "Source Id"
            },
            "description": "数据源ID"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/FunctionInvokeRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIResponse"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found"
          },
          "500": {
            "description": "Internal server error"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/ontology/{source_id}/functions/{function_id}/invoke": {
      "post": {
        "tags": [
          "dataquery"
        ],
        "summary": "调用指定 Function",
        "description": "通过 URL 中的 function_id 调用指定 Function",
        "operationId": "invoke_function_detail_api_v1_ontology__source_id__functions__function_id__invoke_post",
        "parameters": [
          {
            "name": "source_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "数据源ID",
              "title": "Source Id"
            },
            "description": "数据源ID"
          },
          {
            "name": "function_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "Function ID",
              "title": "Function Id"
            },
            "description": "Function ID"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/FunctionInvokeRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIResponse"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found"
          },
          "500": {
            "description": "Internal server error"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/ontology/virtual": {
      "get": {
        "tags": [
          "dataquery"
        ],
        "summary": "列出虚拟本体",
        "description": "列出所有虚拟本体，可按数据源过滤",
        "operationId": "list_virtual_ontologies_api_v1_ontology_virtual_get",
        "parameters": [
          {
            "name": "source_id",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "数据源ID过滤",
              "title": "Source Id"
            },
            "description": "数据源ID过滤"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIResponse"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found"
          },
          "500": {
            "description": "Internal server error"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "dataquery"
        ],
        "summary": "创建虚拟本体",
        "description": "创建持久化虚拟本体",
        "operationId": "create_virtual_ontology_api_v1_ontology_virtual_post",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/VirtualOntologyCreateRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIResponse"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found"
          },
          "500": {
            "description": "Internal server error"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/ontology/virtual/{virtual_id}": {
      "get": {
        "tags": [
          "dataquery"
        ],
        "summary": "获取虚拟本体",
        "description": "获取单个虚拟本体详情",
        "operationId": "get_virtual_ontology_api_v1_ontology_virtual__virtual_id__get",
        "parameters": [
          {
            "name": "virtual_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "虚拟本体ID",
              "title": "Virtual Id"
            },
            "description": "虚拟本体ID"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIResponse"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found"
          },
          "500": {
            "description": "Internal server error"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      },
      "put": {
        "tags": [
          "dataquery"
        ],
        "summary": "更新虚拟本体",
        "description": "更新虚拟本体定义",
        "operationId": "update_virtual_ontology_api_v1_ontology_virtual__virtual_id__put",
        "parameters": [
          {
            "name": "virtual_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "虚拟本体ID",
              "title": "Virtual Id"
            },
            "description": "虚拟本体ID"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/VirtualOntologyUpdateRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIResponse"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found"
          },
          "500": {
            "description": "Internal server error"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "dataquery"
        ],
        "summary": "删除虚拟本体",
        "description": "删除指定虚拟本体，可级联清理版本快照和 orphan mappings",
        "operationId": "delete_virtual_ontology_api_v1_ontology_virtual__virtual_id__delete",
        "parameters": [
          {
            "name": "virtual_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "虚拟本体ID",
              "title": "Virtual Id"
            },
            "description": "虚拟本体ID"
          },
          {
            "name": "cleanup",
            "in": "query",
            "required": false,
            "schema": {
              "type": "boolean",
              "description": "是否清理版本快照和仅被该虚拟本体引用的 mapping",
              "default": true,
              "title": "Cleanup"
            },
            "description": "是否清理版本快照和仅被该虚拟本体引用的 mapping"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIResponse"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found"
          },
          "500": {
            "description": "Internal server error"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/ontology/virtual/{virtual_id}/versions/rollback": {
      "post": {
        "tags": [
          "dataquery"
        ],
        "summary": "回滚虚拟本体",
        "description": "将虚拟本体回滚到指定版本",
        "operationId": "rollback_virtual_ontology_version_api_v1_ontology_virtual__virtual_id__versions_rollback_post",
        "parameters": [
          {
            "name": "virtual_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "虚拟本体ID",
              "title": "Virtual Id"
            },
            "description": "虚拟本体ID"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/VirtualOntologyRollbackRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIResponse"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found"
          },
          "500": {
            "description": "Internal server error"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/ontology/virtual/{virtual_id}/versions/diff": {
      "get": {
        "tags": [
          "dataquery"
        ],
        "summary": "比较虚拟本体版本",
        "description": "比较虚拟本体两个版本之间的差异",
        "operationId": "diff_virtual_ontology_versions_api_v1_ontology_virtual__virtual_id__versions_diff_get",
        "parameters": [
          {
            "name": "virtual_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "虚拟本体ID",
              "title": "Virtual Id"
            },
            "description": "虚拟本体ID"
          },
          {
            "name": "from_version",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "起始版本号，默认 v1",
              "title": "From Version"
            },
            "description": "起始版本号，默认 v1"
          },
          {
            "name": "to_version",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "目标版本号，默认最新",
              "title": "To Version"
            },
            "description": "目标版本号，默认最新"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIResponse"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found"
          },
          "500": {
            "description": "Internal server error"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/ontology/virtual/{virtual_id}/versions": {
      "get": {
        "tags": [
          "dataquery"
        ],
        "summary": "列出虚拟本体版本",
        "description": "列出虚拟本体的历史版本快照",
        "operationId": "list_virtual_ontology_versions_api_v1_ontology_virtual__virtual_id__versions_get",
        "parameters": [
          {
            "name": "virtual_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "虚拟本体ID",
              "title": "Virtual Id"
            },
            "description": "虚拟本体ID"
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "maximum": 200,
              "minimum": 1,
              "description": "返回的最大版本数",
              "default": 50,
              "title": "Limit"
            },
            "description": "返回的最大版本数"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIResponse"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found"
          },
          "500": {
            "description": "Internal server error"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/ontology/virtual/{virtual_id}/versions/{version_id}": {
      "get": {
        "tags": [
          "dataquery"
        ],
        "summary": "获取虚拟本体版本快照",
        "description": "获取虚拟本体指定版本的完整快照",
        "operationId": "get_virtual_ontology_version_api_v1_ontology_virtual__virtual_id__versions__version_id__get",
        "parameters": [
          {
            "name": "virtual_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "虚拟本体ID",
              "title": "Virtual Id"
            },
            "description": "虚拟本体ID"
          },
          {
            "name": "version_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "版本号，例如 v1",
              "title": "Version Id"
            },
            "description": "版本号，例如 v1"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIResponse"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found"
          },
          "500": {
            "description": "Internal server error"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/ontology/virtual/mappings/{mapping_id}/validate": {
      "post": {
        "tags": [
          "dataquery"
        ],
        "summary": "验证跨源映射",
        "description": "基于数据值 overlap 验证跨源映射质量",
        "operationId": "validate_cross_source_mapping_api_v1_ontology_virtual_mappings__mapping_id__validate_post",
        "parameters": [
          {
            "name": "mapping_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "映射ID",
              "title": "Mapping Id"
            },
            "description": "映射ID"
          },
          {
            "name": "sample_limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "maximum": 10000,
              "minimum": 1,
              "description": "采样行数",
              "default": 1000,
              "title": "Sample Limit"
            },
            "description": "采样行数"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIResponse"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found"
          },
          "500": {
            "description": "Internal server error"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/ontology/virtual/{virtual_id}/graph": {
      "get": {
        "tags": [
          "dataquery"
        ],
        "summary": "获取虚拟本体图谱数据",
        "description": "获取虚拟本体的可视化图谱数据与业务规则",
        "operationId": "get_virtual_ontology_graph_api_v1_ontology_virtual__virtual_id__graph_get",
        "parameters": [
          {
            "name": "virtual_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "虚拟本体ID",
              "title": "Virtual Id"
            },
            "description": "虚拟本体ID"
          },
          {
            "name": "include_disabled",
            "in": "query",
            "required": false,
            "schema": {
              "type": "boolean",
              "description": "是否包含 disabled 的映射/属性/规则",
              "default": false,
              "title": "Include Disabled"
            },
            "description": "是否包含 disabled 的映射/属性/规则"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIResponse"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found"
          },
          "500": {
            "description": "Internal server error"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/ontology/virtual/conversations": {
      "post": {
        "tags": [
          "dataquery"
        ],
        "summary": "开启对话式虚拟本体创建",
        "description": "开启自然语言对话，逐步编排跨源本体",
        "operationId": "start_virtual_ontology_conversation_api_v1_ontology_virtual_conversations_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/VirtualOntologyConversationStartRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIResponse"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found"
          },
          "500": {
            "description": "Internal server error"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/ontology/virtual/conversations/{session_id}/messages": {
      "post": {
        "tags": [
          "dataquery"
        ],
        "summary": "发送对话消息",
        "description": "继续对话式虚拟本体编排",
        "operationId": "continue_virtual_ontology_conversation_api_v1_ontology_virtual_conversations__session_id__messages_post",
        "parameters": [
          {
            "name": "session_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "会话ID",
              "title": "Session Id"
            },
            "description": "会话ID"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/VirtualOntologyConversationMessageRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIResponse"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found"
          },
          "500": {
            "description": "Internal server error"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/ontology/virtual/conversations/{session_id}/summary": {
      "get": {
        "tags": [
          "dataquery"
        ],
        "summary": "获取对话摘要",
        "description": "获取对话式编排的结构化摘要草稿",
        "operationId": "summarize_virtual_ontology_conversation_api_v1_ontology_virtual_conversations__session_id__summary_get",
        "parameters": [
          {
            "name": "session_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "会话ID",
              "title": "Session Id"
            },
            "description": "会话ID"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIResponse"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found"
          },
          "500": {
            "description": "Internal server error"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/ontology/virtual/conversations/{session_id}/confirm": {
      "post": {
        "tags": [
          "dataquery"
        ],
        "summary": "确认并持久化对话草稿",
        "description": "用户确认后持久化虚拟本体、映射、派生属性、gaps",
        "operationId": "confirm_virtual_ontology_conversation_api_v1_ontology_virtual_conversations__session_id__confirm_post",
        "parameters": [
          {
            "name": "session_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "会话ID",
              "title": "Session Id"
            },
            "description": "会话ID"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/VirtualOntologyConversationConfirmRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIResponse"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found"
          },
          "500": {
            "description": "Internal server error"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/schema/{source_id}": {
      "get": {
        "tags": [
          "dataquery"
        ],
        "summary": "获取数据源 Schema",
        "description": "获取指定数据源的表结构信息",
        "operationId": "get_schema_api_v1_schema__source_id__get",
        "parameters": [
          {
            "name": "source_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "数据源ID",
              "title": "Source Id"
            },
            "description": "数据源ID"
          },
          {
            "name": "use_cache",
            "in": "query",
            "required": false,
            "schema": {
              "type": "boolean",
              "description": "是否使用缓存",
              "default": true,
              "title": "Use Cache"
            },
            "description": "是否使用缓存"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIResponse"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found"
          },
          "500": {
            "description": "Internal server error"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/schema/{source_id}/tables": {
      "get": {
        "tags": [
          "dataquery"
        ],
        "summary": "获取数据源表列表",
        "description": "获取数据源的所有表名和基本信息（轻量级，用于延迟加载场景）",
        "operationId": "get_table_list_api_v1_schema__source_id__tables_get",
        "parameters": [
          {
            "name": "source_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "数据源ID",
              "title": "Source Id"
            },
            "description": "数据源ID"
          },
          {
            "name": "use_cache",
            "in": "query",
            "required": false,
            "schema": {
              "type": "boolean",
              "description": "是否使用缓存",
              "default": true,
              "title": "Use Cache"
            },
            "description": "是否使用缓存"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIResponse"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found"
          },
          "500": {
            "description": "Internal server error"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/schema/{source_id}/tables/{table_name}": {
      "get": {
        "tags": [
          "dataquery"
        ],
        "summary": "获取单表详细结构",
        "description": "获取指定表的字段详情（用于延迟加载场景）",
        "operationId": "get_table_detail_api_v1_schema__source_id__tables__table_name__get",
        "parameters": [
          {
            "name": "source_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "数据源ID",
              "title": "Source Id"
            },
            "description": "数据源ID"
          },
          {
            "name": "table_name",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "表名",
              "title": "Table Name"
            },
            "description": "表名"
          },
          {
            "name": "use_cache",
            "in": "query",
            "required": false,
            "schema": {
              "type": "boolean",
              "description": "是否使用缓存",
              "default": true,
              "title": "Use Cache"
            },
            "description": "是否使用缓存"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIResponse"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found"
          },
          "500": {
            "description": "Internal server error"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/schema/{source_id}/paginated": {
      "get": {
        "tags": [
          "dataquery"
        ],
        "summary": "分页获取 Schema",
        "description": "适用于表数量较大的数据源，分页返回表结构和字段信息",
        "operationId": "get_schema_paginated_api_v1_schema__source_id__paginated_get",
        "parameters": [
          {
            "name": "source_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "数据源ID",
              "title": "Source Id"
            },
            "description": "数据源ID"
          },
          {
            "name": "page",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "description": "页码（从1开始）",
              "default": 1,
              "title": "Page"
            },
            "description": "页码（从1开始）"
          },
          {
            "name": "page_size",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "maximum": 100,
              "minimum": 10,
              "description": "每页表数量",
              "default": 50,
              "title": "Page Size"
            },
            "description": "每页表数量"
          },
          {
            "name": "include_statistics",
            "in": "query",
            "required": false,
            "schema": {
              "type": "boolean",
              "description": "是否包含列统计信息",
              "default": false,
              "title": "Include Statistics"
            },
            "description": "是否包含列统计信息"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIResponse"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found"
          },
          "500": {
            "description": "Internal server error"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/schema/{source_id}/visualize": {
      "post": {
        "tags": [
          "dataquery"
        ],
        "summary": "可视化 Schema",
        "description": "获取 Schema 的可视化数据",
        "operationId": "visualize_schema_api_v1_schema__source_id__visualize_post",
        "parameters": [
          {
            "name": "source_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "数据源ID",
              "title": "Source Id"
            },
            "description": "数据源ID"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SchemaVisualizationRequest",
                "default": {
                  "view_type": "table"
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIResponse"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found"
          },
          "500": {
            "description": "Internal server error"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/schema/{source_id}/discover": {
      "get": {
        "tags": [
          "dataquery"
        ],
        "summary": "发现 Schema 关系",
        "description": "基于数据采样推断数据源表之间的潜在关系",
        "operationId": "discover_schema_relationships_get_api_v1_schema__source_id__discover_get",
        "parameters": [
          {
            "name": "source_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "数据源ID",
              "title": "Source Id"
            },
            "description": "数据源ID"
          },
          {
            "name": "sample_size",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "maximum": 100000,
              "minimum": 1,
              "description": "每表采样行数",
              "default": 1000,
              "title": "Sample Size"
            },
            "description": "每表采样行数"
          },
          {
            "name": "threshold",
            "in": "query",
            "required": false,
            "schema": {
              "type": "number",
              "maximum": 1.0,
              "minimum": 0.0,
              "description": "置信度阈值",
              "default": 0.75,
              "title": "Threshold"
            },
            "description": "置信度阈值"
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "maximum": 500,
              "minimum": 1,
              "description": "返回最大关系数",
              "default": 50,
              "title": "Limit"
            },
            "description": "返回最大关系数"
          },
          {
            "name": "table",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "仅返回涉及该表的关系",
              "title": "Table"
            },
            "description": "仅返回涉及该表的关系"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIResponse"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found"
          },
          "500": {
            "description": "Internal server error"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "dataquery"
        ],
        "summary": "发现 Schema 关系",
        "description": "基于数据采样推断数据源表之间的潜在关系",
        "operationId": "discover_schema_relationships_post_api_v1_schema__source_id__discover_post",
        "parameters": [
          {
            "name": "source_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "数据源ID",
              "title": "Source Id"
            },
            "description": "数据源ID"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SchemaDiscoverRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIResponse"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found"
          },
          "500": {
            "description": "Internal server error"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/schema/{source_id}/suggest_fk_targets": {
      "get": {
        "tags": [
          "dataquery"
        ],
        "summary": "FK 目标推荐",
        "description": "为指定列推荐可能指向的目标表与主键",
        "operationId": "suggest_fk_targets_api_v1_schema__source_id__suggest_fk_targets_get",
        "parameters": [
          {
            "name": "source_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "数据源ID",
              "title": "Source Id"
            },
            "description": "数据源ID"
          },
          {
            "name": "column",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "description": "待匹配的列名",
              "title": "Column"
            },
            "description": "待匹配的列名"
          },
          {
            "name": "top_k",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "maximum": 50,
              "minimum": 1,
              "description": "返回最大建议数",
              "default": 5,
              "title": "Top K"
            },
            "description": "返回最大建议数"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIResponse"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found"
          },
          "500": {
            "description": "Internal server error"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/ontology/{source_id}/relations": {
      "get": {
        "tags": [
          "dataquery"
        ],
        "summary": "获取推荐关系",
        "description": "获取指定数据源的关系推荐列表",
        "operationId": "get_relationship_recommendations_api_v1_ontology__source_id__relations_get",
        "parameters": [
          {
            "name": "source_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "数据源ID",
              "title": "Source Id"
            },
            "description": "数据源ID"
          },
          {
            "name": "threshold",
            "in": "query",
            "required": false,
            "schema": {
              "type": "number",
              "maximum": 1.0,
              "minimum": 0.0,
              "description": "置信度阈值",
              "default": 0.75,
              "title": "Threshold"
            },
            "description": "置信度阈值"
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "maximum": 500,
              "minimum": 1,
              "description": "返回最大关系数",
              "default": 50,
              "title": "Limit"
            },
            "description": "返回最大关系数"
          },
          {
            "name": "table",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "仅返回涉及该表的关系",
              "title": "Table"
            },
            "description": "仅返回涉及该表的关系"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIResponse"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found"
          },
          "500": {
            "description": "Internal server error"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "dataquery"
        ],
        "summary": "应用推荐关系",
        "description": "将选中的推荐关系应用为 ontology 对象属性",
        "operationId": "apply_relationship_recommendations_api_v1_ontology__source_id__relations_post",
        "parameters": [
          {
            "name": "source_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "数据源ID",
              "title": "Source Id"
            },
            "description": "数据源ID"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RelationApplyRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIResponse"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found"
          },
          "500": {
            "description": "Internal server error"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/ontology/{source_id}/relations/discover": {
      "post": {
        "tags": [
          "dataquery"
        ],
        "summary": "发现并应用关系",
        "description": "自动发现关系并在非 dry-run 模式下应用全部推荐关系",
        "operationId": "discover_and_apply_relationships_api_v1_ontology__source_id__relations_discover_post",
        "parameters": [
          {
            "name": "source_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "数据源ID",
              "title": "Source Id"
            },
            "description": "数据源ID"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RelationDiscoverRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIResponse"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found"
          },
          "500": {
            "description": "Internal server error"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/ontology/{source_id}/sync": {
      "get": {
        "tags": [
          "dataquery"
        ],
        "summary": "预览本体同步",
        "description": "以 dry-run 模式预览本体与 Schema 的同步结果",
        "operationId": "preview_sync_ontology_api_v1_ontology__source_id__sync_get",
        "parameters": [
          {
            "name": "source_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "数据源ID",
              "title": "Source Id"
            },
            "description": "数据源ID"
          },
          {
            "name": "refresh_schema",
            "in": "query",
            "required": false,
            "schema": {
              "type": "boolean",
              "description": "是否刷新 Schema",
              "default": true,
              "title": "Refresh Schema"
            },
            "description": "是否刷新 Schema"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIResponse"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found"
          },
          "500": {
            "description": "Internal server error"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "dataquery"
        ],
        "summary": "执行本体同步",
        "description": "同步本体与 Schema，可配置 dry-run、刷新 Schema 等选项",
        "operationId": "sync_ontology_endpoint_api_v1_ontology__source_id__sync_post",
        "parameters": [
          {
            "name": "source_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "数据源ID",
              "title": "Source Id"
            },
            "description": "数据源ID"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": true,
                "title": "Data"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIResponse"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found"
          },
          "500": {
            "description": "Internal server error"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/ontology/{source_id}/visualizations/batch": {
      "post": {
        "tags": [
          "dataquery"
        ],
        "summary": "批量生成可视化",
        "description": "基于查询结果批量生成多个图表并导出",
        "operationId": "batch_visualize_api_v1_ontology__source_id__visualizations_batch_post",
        "parameters": [
          {
            "name": "source_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "数据源ID",
              "title": "Source Id"
            },
            "description": "数据源ID"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/BatchVisualizeRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIResponse"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found"
          },
          "500": {
            "description": "Internal server error"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/maps/{map_name}": {
      "get": {
        "tags": [
          "dataquery"
        ],
        "summary": "获取地图 GeoJSON",
        "description": "返回内置地图 GeoJSON 数据，供前端 ECharts 注册使用",
        "operationId": "get_map_geojson_api_v1_maps__map_name__get",
        "parameters": [
          {
            "name": "map_name",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "地图名称，如 china/world",
              "title": "Map Name"
            },
            "description": "地图名称，如 china/world"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIResponse"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found"
          },
          "500": {
            "description": "Internal server error"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/ontology/{source_id}/visualizations/batch/{job_id}": {
      "get": {
        "tags": [
          "dataquery"
        ],
        "summary": "获取批量可视化任务状态",
        "description": "获取批量可视化任务结果与状态",
        "operationId": "get_batch_visualization_status_api_v1_ontology__source_id__visualizations_batch__job_id__get",
        "parameters": [
          {
            "name": "source_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "数据源ID",
              "title": "Source Id"
            },
            "description": "数据源ID"
          },
          {
            "name": "job_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "任务ID",
              "title": "Job Id"
            },
            "description": "任务ID"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIResponse"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found"
          },
          "500": {
            "description": "Internal server error"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/ontology/{source_id}/visualizations/batch/{job_id}/export": {
      "post": {
        "tags": [
          "dataquery"
        ],
        "summary": "导出批量可视化结果",
        "description": "根据任务 ID 与格式返回可下载文件 URL",
        "operationId": "export_batch_visualization_api_v1_ontology__source_id__visualizations_batch__job_id__export_post",
        "parameters": [
          {
            "name": "source_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "数据源ID",
              "title": "Source Id"
            },
            "description": "数据源ID"
          },
          {
            "name": "job_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "任务ID",
              "title": "Job Id"
            },
            "description": "任务ID"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/BatchExportRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIResponse"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found"
          },
          "500": {
            "description": "Internal server error"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/terminology": {
      "post": {
        "tags": [
          "dataquery"
        ],
        "summary": "管理业务术语",
        "description": "添加、更新或删除业务术语",
        "operationId": "manage_terminology_api_v1_terminology_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TerminologyBatchRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIResponse"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found"
          },
          "500": {
            "description": "Internal server error"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/terminology/search": {
      "post": {
        "tags": [
          "dataquery"
        ],
        "summary": "搜索业务术语",
        "description": "根据关键词搜索业务术语",
        "operationId": "search_terminology_api_v1_terminology_search_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TerminologySearchRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIResponse"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found"
          },
          "500": {
            "description": "Internal server error"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/terminology/stats": {
      "get": {
        "tags": [
          "dataquery"
        ],
        "summary": "获取术语库统计",
        "description": "获取术语库的统计信息",
        "operationId": "get_terminology_stats_api_v1_terminology_stats_get",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIResponse"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found"
          },
          "500": {
            "description": "Internal server error"
          }
        }
      }
    },
    "/api/v1/permissions/grant": {
      "post": {
        "tags": [
          "dataquery"
        ],
        "summary": "授予权限",
        "description": "为用户授予指定资源的访问权限",
        "operationId": "grant_permission_api_v1_permissions_grant_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PermissionGrantRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIResponse"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found"
          },
          "500": {
            "description": "Internal server error"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/permissions/revoke": {
      "post": {
        "tags": [
          "dataquery"
        ],
        "summary": "撤销权限",
        "description": "撤销用户的指定权限",
        "operationId": "revoke_permission_api_v1_permissions_revoke_post",
        "parameters": [
          {
            "name": "user_id",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "description": "用户ID",
              "title": "User Id"
            },
            "description": "用户ID"
          },
          {
            "name": "role",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "角色名称",
              "title": "Role"
            },
            "description": "角色名称"
          },
          {
            "name": "permission_type",
            "in": "query",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/PermissionTypeEnum",
              "description": "权限类型"
            },
            "description": "权限类型"
          },
          {
            "name": "resource_type",
            "in": "query",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/ResourceTypeEnum",
              "description": "资源类型"
            },
            "description": "资源类型"
          },
          {
            "name": "resource_id",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "资源ID",
              "title": "Resource Id"
            },
            "description": "资源ID"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIResponse"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found"
          },
          "500": {
            "description": "Internal server error"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/permissions/field": {
      "post": {
        "tags": [
          "dataquery"
        ],
        "summary": "设置字段权限",
        "description": "设置对特定字段的访问权限和脱敏规则",
        "operationId": "set_field_permission_api_v1_permissions_field_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/FieldPermissionRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIResponse"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found"
          },
          "500": {
            "description": "Internal server error"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/permissions/roles": {
      "post": {
        "tags": [
          "dataquery"
        ],
        "summary": "创建角色",
        "description": "创建新的角色并分配权限",
        "operationId": "create_role_api_v1_permissions_roles_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RoleCreateRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIResponse"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found"
          },
          "500": {
            "description": "Internal server error"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/permissions/roles/assign": {
      "post": {
        "tags": [
          "dataquery"
        ],
        "summary": "分配角色",
        "description": "为用户分配角色",
        "operationId": "assign_role_api_v1_permissions_roles_assign_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RoleAssignRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIResponse"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found"
          },
          "500": {
            "description": "Internal server error"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/permissions/check": {
      "get": {
        "tags": [
          "dataquery"
        ],
        "summary": "检查权限",
        "description": "检查用户是否具有指定权限",
        "operationId": "check_permission_api_v1_permissions_check_get",
        "parameters": [
          {
            "name": "user_id",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "description": "用户ID",
              "title": "User Id"
            },
            "description": "用户ID"
          },
          {
            "name": "permission_type",
            "in": "query",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/PermissionTypeEnum",
              "description": "权限类型"
            },
            "description": "权限类型"
          },
          {
            "name": "resource_type",
            "in": "query",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/ResourceTypeEnum",
              "description": "资源类型"
            },
            "description": "资源类型"
          },
          {
            "name": "resource_id",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "资源ID",
              "title": "Resource Id"
            },
            "description": "资源ID"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIResponse"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found"
          },
          "500": {
            "description": "Internal server error"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/insights/questions": {
      "post": {
        "tags": [
          "dataquery"
        ],
        "summary": "生成洞察问题",
        "description": "基于查询上下文生成相关问题",
        "operationId": "create_insight_question_api_v1_insights_questions_post",
        "parameters": [
          {
            "name": "session_id",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "description": "会话ID",
              "title": "Session Id"
            },
            "description": "会话ID"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/InsightQuestionRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIResponse"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found"
          },
          "500": {
            "description": "Internal server error"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      },
      "get": {
        "tags": [
          "dataquery"
        ],
        "summary": "获取洞察问题列表",
        "description": "获取待回答的洞察问题",
        "operationId": "get_insight_questions_api_v1_insights_questions_get",
        "parameters": [
          {
            "name": "session_id",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "description": "会话ID",
              "title": "Session Id"
            },
            "description": "会话ID"
          },
          {
            "name": "question_type",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "$ref": "#/components/schemas/QuestionTypeEnum"
                },
                {
                  "type": "null"
                }
              ],
              "description": "问题类型过滤",
              "title": "Question Type"
            },
            "description": "问题类型过滤"
          },
          {
            "name": "answered",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "boolean"
                },
                {
                  "type": "null"
                }
              ],
              "description": "是否已回答过滤",
              "title": "Answered"
            },
            "description": "是否已回答过滤"
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "maximum": 100,
              "minimum": 1,
              "description": "返回数量限制",
              "default": 50,
              "title": "Limit"
            },
            "description": "返回数量限制"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIResponse"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found"
          },
          "500": {
            "description": "Internal server error"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/insights/questions/{question_id}/answer": {
      "post": {
        "tags": [
          "dataquery"
        ],
        "summary": "回答洞察问题",
        "description": "提交对洞察问题的回答",
        "operationId": "answer_insight_question_api_v1_insights_questions__question_id__answer_post",
        "parameters": [
          {
            "name": "question_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "description": "问题ID",
              "title": "Question Id"
            },
            "description": "问题ID"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/InsightQuestionAnswerRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIResponse"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found"
          },
          "500": {
            "description": "Internal server error"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/insights/questions/{question_id}": {
      "delete": {
        "tags": [
          "dataquery"
        ],
        "summary": "删除洞察问题",
        "description": "删除指定的洞察问题",
        "operationId": "delete_insight_question_api_v1_insights_questions__question_id__delete",
        "parameters": [
          {
            "name": "question_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "description": "问题ID",
              "title": "Question Id"
            },
            "description": "问题ID"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIResponse"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found"
          },
          "500": {
            "description": "Internal server error"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/insights": {
      "post": {
        "tags": [
          "dataquery"
        ],
        "summary": "创建洞察",
        "description": "创建业务洞察卡片",
        "operationId": "create_insight_api_v1_insights_post",
        "parameters": [
          {
            "name": "session_id",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "description": "会话ID",
              "title": "Session Id"
            },
            "description": "会话ID"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/InsightRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIResponse"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found"
          },
          "500": {
            "description": "Internal server error"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      },
      "get": {
        "tags": [
          "dataquery"
        ],
        "summary": "获取洞察列表",
        "description": "获取洞察卡片列表",
        "operationId": "get_insights_api_v1_insights_get",
        "parameters": [
          {
            "name": "session_id",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "会话ID",
              "title": "Session Id"
            },
            "description": "会话ID"
          },
          {
            "name": "insight_type",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "$ref": "#/components/schemas/InsightTypeEnum"
                },
                {
                  "type": "null"
                }
              ],
              "description": "洞察类型过滤",
              "title": "Insight Type"
            },
            "description": "洞察类型过滤"
          },
          {
            "name": "verified",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "boolean"
                },
                {
                  "type": "null"
                }
              ],
              "description": "是否已验证过滤",
              "title": "Verified"
            },
            "description": "是否已验证过滤"
          },
          {
            "name": "min_confidence",
            "in": "query",
            "required": false,
            "schema": {
              "type": "number",
              "maximum": 1.0,
              "minimum": 0.0,
              "description": "最小置信度",
              "default": 0.0,
              "title": "Min Confidence"
            },
            "description": "最小置信度"
          },
          {
            "name": "is_favorite",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "boolean"
                },
                {
                  "type": "null"
                }
              ],
              "description": "是否收藏过滤",
              "title": "Is Favorite"
            },
            "description": "是否收藏过滤"
          },
          {
            "name": "tag",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "标签过滤",
              "title": "Tag"
            },
            "description": "标签过滤"
          },
          {
            "name": "category_id",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "integer"
                },
                {
                  "type": "null"
                }
              ],
              "description": "分类ID过滤",
              "title": "Category Id"
            },
            "description": "分类ID过滤"
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "maximum": 100,
              "minimum": 1,
              "description": "返回数量限制",
              "default": 50,
              "title": "Limit"
            },
            "description": "返回数量限制"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIResponse"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found"
          },
          "500": {
            "description": "Internal server error"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/insights/{insight_id}/verify": {
      "post": {
        "tags": [
          "dataquery"
        ],
        "summary": "验证洞察",
        "description": "验证洞察的准确性",
        "operationId": "verify_insight_api_v1_insights__insight_id__verify_post",
        "parameters": [
          {
            "name": "insight_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "description": "洞察ID",
              "title": "Insight Id"
            },
            "description": "洞察ID"
          },
          {
            "name": "verified_by",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "description": "验证人ID",
              "title": "Verified By"
            },
            "description": "验证人ID"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/InsightVerifyRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIResponse"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found"
          },
          "500": {
            "description": "Internal server error"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/insights/{insight_id}": {
      "delete": {
        "tags": [
          "dataquery"
        ],
        "summary": "删除洞察",
        "description": "删除指定的洞察",
        "operationId": "delete_insight_api_v1_insights__insight_id__delete",
        "parameters": [
          {
            "name": "insight_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "description": "洞察ID",
              "title": "Insight Id"
            },
            "description": "洞察ID"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIResponse"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found"
          },
          "500": {
            "description": "Internal server error"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/insights/{insight_id}/favorite": {
      "post": {
        "tags": [
          "dataquery"
        ],
        "summary": "切换洞察收藏",
        "description": "设置或取消洞察收藏状态",
        "operationId": "toggle_insight_favorite_api_v1_insights__insight_id__favorite_post",
        "parameters": [
          {
            "name": "insight_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "description": "洞察ID",
              "title": "Insight Id"
            },
            "description": "洞察ID"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/FavoriteToggleRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIResponse"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found"
          },
          "500": {
            "description": "Internal server error"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/insights/{insight_id}/tags": {
      "post": {
        "tags": [
          "dataquery"
        ],
        "summary": "更新洞察标签",
        "description": "更新洞察标签",
        "operationId": "update_insight_tags_route_api_v1_insights__insight_id__tags_post",
        "parameters": [
          {
            "name": "insight_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "description": "洞察ID",
              "title": "Insight Id"
            },
            "description": "洞察ID"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateTagsRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIResponse"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found"
          },
          "500": {
            "description": "Internal server error"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/insights/{insight_id}/category": {
      "post": {
        "tags": [
          "dataquery"
        ],
        "summary": "更新洞察分类",
        "description": "更新洞察分类",
        "operationId": "update_insight_category_route_api_v1_insights__insight_id__category_post",
        "parameters": [
          {
            "name": "insight_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "description": "洞察ID",
              "title": "Insight Id"
            },
            "description": "洞察ID"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateCategoryRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIResponse"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found"
          },
          "500": {
            "description": "Internal server error"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/insights/reviews/generate": {
      "post": {
        "tags": [
          "dataquery"
        ],
        "summary": "生成复盘报告",
        "description": "基于查询历史生成复盘报告",
        "operationId": "generate_review_report_api_v1_insights_reviews_generate_post",
        "parameters": [
          {
            "name": "session_id",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "description": "会话ID",
              "title": "Session Id"
            },
            "description": "会话ID"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ReviewReportRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIResponse"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found"
          },
          "500": {
            "description": "Internal server error"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/insights/reviews": {
      "get": {
        "tags": [
          "dataquery"
        ],
        "summary": "获取复盘报告列表",
        "description": "获取复盘报告列表",
        "operationId": "get_review_reports_api_v1_insights_reviews_get",
        "parameters": [
          {
            "name": "session_id",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "description": "会话ID",
              "title": "Session Id"
            },
            "description": "会话ID"
          },
          {
            "name": "report_type",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "$ref": "#/components/schemas/ReviewReportTypeEnum"
                },
                {
                  "type": "null"
                }
              ],
              "description": "报告类型过滤",
              "title": "Report Type"
            },
            "description": "报告类型过滤"
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "maximum": 50,
              "minimum": 1,
              "description": "返回数量限制",
              "default": 20,
              "title": "Limit"
            },
            "description": "返回数量限制"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIResponse"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found"
          },
          "500": {
            "description": "Internal server error"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/insights/reviews/{report_id}": {
      "get": {
        "tags": [
          "dataquery"
        ],
        "summary": "获取复盘报告详情",
        "description": "获取指定复盘报告的完整内容",
        "operationId": "get_review_report_detail_api_v1_insights_reviews__report_id__get",
        "parameters": [
          {
            "name": "report_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "description": "报告ID",
              "title": "Report Id"
            },
            "description": "报告ID"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIResponse"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found"
          },
          "500": {
            "description": "Internal server error"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/insights/decisions": {
      "get": {
        "tags": [
          "dataquery"
        ],
        "summary": "决策复盘列表",
        "description": "列出所有被标记为关键决策的 AIP TALK 消息，支持多维筛选与共享可见性",
        "operationId": "list_decision_reviews_api_v1_insights_decisions_get",
        "parameters": [
          {
            "name": "user_id",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "当前用户ID",
              "title": "User Id"
            },
            "description": "当前用户ID"
          },
          {
            "name": "tenant_id",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "当前租户ID",
              "title": "Tenant Id"
            },
            "description": "当前租户ID"
          },
          {
            "name": "session_id",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "会话ID",
              "title": "Session Id"
            },
            "description": "会话ID"
          },
          {
            "name": "status",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "决策状态：marked/open/reviewed/closed",
              "title": "Status"
            },
            "description": "决策状态：marked/open/reviewed/closed"
          },
          {
            "name": "category_id",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "integer"
                },
                {
                  "type": "null"
                }
              ],
              "description": "分类ID",
              "title": "Category Id"
            },
            "description": "分类ID"
          },
          {
            "name": "tags",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                },
                {
                  "type": "null"
                }
              ],
              "description": "标签列表",
              "title": "Tags"
            },
            "description": "标签列表"
          },
          {
            "name": "is_favorite",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "boolean"
                },
                {
                  "type": "null"
                }
              ],
              "description": "是否收藏",
              "title": "Is Favorite"
            },
            "description": "是否收藏"
          },
          {
            "name": "datasource",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "数据源",
              "title": "Datasource"
            },
            "description": "数据源"
          },
          {
            "name": "keyword",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "关键词",
              "title": "Keyword"
            },
            "description": "关键词"
          },
          {
            "name": "period_start",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "周期开始时间 ISO",
              "title": "Period Start"
            },
            "description": "周期开始时间 ISO"
          },
          {
            "name": "period_end",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "周期结束时间 ISO",
              "title": "Period End"
            },
            "description": "周期结束时间 ISO"
          },
          {
            "name": "visibility",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "可见性：private/tenant/shared",
              "title": "Visibility"
            },
            "description": "可见性：private/tenant/shared"
          },
          {
            "name": "include_shared",
            "in": "query",
            "required": false,
            "schema": {
              "type": "boolean",
              "description": "是否包含共享给我的决策",
              "default": false,
              "title": "Include Shared"
            },
            "description": "是否包含共享给我的决策"
          },
          {
            "name": "page",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "description": "页码",
              "default": 1,
              "title": "Page"
            },
            "description": "页码"
          },
          {
            "name": "page_size",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "maximum": 100,
              "minimum": 1,
              "description": "每页数量",
              "default": 20,
              "title": "Page Size"
            },
            "description": "每页数量"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIResponse"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found"
          },
          "500": {
            "description": "Internal server error"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/insights/decisions/{session_id}/{seq}": {
      "get": {
        "tags": [
          "dataquery"
        ],
        "summary": "决策复盘详情",
        "description": "获取单条关键决策的完整详情，包括消息上下文与关联查询记录",
        "operationId": "get_decision_review_api_v1_insights_decisions__session_id___seq__get",
        "parameters": [
          {
            "name": "session_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "会话ID",
              "title": "Session Id"
            },
            "description": "会话ID"
          },
          {
            "name": "seq",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "description": "消息seq",
              "title": "Seq"
            },
            "description": "消息seq"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIResponse"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found"
          },
          "500": {
            "description": "Internal server error"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/insights/decisions/{session_id}/{seq}/review": {
      "post": {
        "tags": [
          "dataquery"
        ],
        "summary": "更新决策复盘信息",
        "description": "补充实际结果、复盘笔记并更新决策状态",
        "operationId": "update_decision_review_api_v1_insights_decisions__session_id___seq__review_post",
        "parameters": [
          {
            "name": "session_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "会话ID",
              "title": "Session Id"
            },
            "description": "会话ID"
          },
          {
            "name": "seq",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "description": "消息seq",
              "title": "Seq"
            },
            "description": "消息seq"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AipTalkMessageDecisionReviewRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIResponse"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found"
          },
          "500": {
            "description": "Internal server error"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/insights/decisions/{decision_id}/share": {
      "post": {
        "tags": [
          "dataquery"
        ],
        "summary": "共享决策",
        "description": "将决策共享给指定用户并设置可见性",
        "operationId": "share_decision_review_api_v1_insights_decisions__decision_id__share_post",
        "parameters": [
          {
            "name": "decision_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "description": "决策ID",
              "title": "Decision Id"
            },
            "description": "决策ID"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DecisionShareRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIResponse"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found"
          },
          "500": {
            "description": "Internal server error"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/insights/decisions/{decision_id}/approve": {
      "post": {
        "tags": [
          "dataquery"
        ],
        "summary": "审批决策",
        "description": "更新决策的审批状态",
        "operationId": "approve_decision_review_api_v1_insights_decisions__decision_id__approve_post",
        "parameters": [
          {
            "name": "decision_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "description": "决策ID",
              "title": "Decision Id"
            },
            "description": "决策ID"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DecisionApproveRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIResponse"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found"
          },
          "500": {
            "description": "Internal server error"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/insights/decisions/diff-summary": {
      "post": {
        "tags": [
          "dataquery"
        ],
        "summary": "生成预期 vs 实际差异摘要",
        "description": "基于预期结果与实际结果，使用 LLM 生成差异分析和建议",
        "operationId": "generate_decision_diff_summary_api_v1_insights_decisions_diff_summary_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ExpectedActualDiffSummaryRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIResponse"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found"
          },
          "500": {
            "description": "Internal server error"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/insights/decisions/{decision_id}": {
      "delete": {
        "tags": [
          "dataquery"
        ],
        "summary": "删除决策",
        "description": "删除指定的关键决策记录",
        "operationId": "delete_decision_review_api_v1_insights_decisions__decision_id__delete",
        "parameters": [
          {
            "name": "decision_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "description": "决策ID",
              "title": "Decision Id"
            },
            "description": "决策ID"
          },
          {
            "name": "user_id",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "当前用户ID",
              "title": "User Id"
            },
            "description": "当前用户ID"
          },
          {
            "name": "tenant_id",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "当前租户ID",
              "title": "Tenant Id"
            },
            "description": "当前租户ID"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIResponse"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found"
          },
          "500": {
            "description": "Internal server error"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/insights/ontology-suggestions": {
      "get": {
        "tags": [
          "dataquery"
        ],
        "summary": "获取Ontology更新建议",
        "description": "获取待处理的Ontology更新建议列表",
        "operationId": "get_ontology_suggestions_api_v1_insights_ontology_suggestions_get",
        "parameters": [
          {
            "name": "status",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "description": "状态过滤（pending, approved, rejected）",
              "default": "pending",
              "title": "Status"
            },
            "description": "状态过滤（pending, approved, rejected）"
          },
          {
            "name": "suggestion_type",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "$ref": "#/components/schemas/OntologySuggestionTypeEnum"
                },
                {
                  "type": "null"
                }
              ],
              "description": "建议类型过滤",
              "title": "Suggestion Type"
            },
            "description": "建议类型过滤"
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "maximum": 100,
              "minimum": 1,
              "description": "返回数量限制",
              "default": 50,
              "title": "Limit"
            },
            "description": "返回数量限制"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIResponse"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found"
          },
          "500": {
            "description": "Internal server error"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/insights/ontology-suggestions/{suggestion_id}/approve": {
      "post": {
        "tags": [
          "dataquery"
        ],
        "summary": "批准或拒绝Ontology建议",
        "description": "批准或拒绝Ontology更新建议",
        "operationId": "approve_ontology_suggestion_api_v1_insights_ontology_suggestions__suggestion_id__approve_post",
        "parameters": [
          {
            "name": "suggestion_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "description": "建议ID",
              "title": "Suggestion Id"
            },
            "description": "建议ID"
          },
          {
            "name": "reviewed_by",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "description": "审核人ID",
              "title": "Reviewed By"
            },
            "description": "审核人ID"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/OntologySuggestionApproveRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIResponse"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found"
          },
          "500": {
            "description": "Internal server error"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/insights/settings": {
      "get": {
        "tags": [
          "dataquery"
        ],
        "summary": "获取洞察设置",
        "description": "获取当前会话的洞察功能设置",
        "operationId": "get_insight_settings_api_v1_insights_settings_get",
        "parameters": [
          {
            "name": "session_id",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "description": "会话ID",
              "title": "Session Id"
            },
            "description": "会话ID"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIResponse"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found"
          },
          "500": {
            "description": "Internal server error"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      },
      "put": {
        "tags": [
          "dataquery"
        ],
        "summary": "更新洞察设置",
        "description": "更新当前会话的洞察功能设置",
        "operationId": "update_insight_settings_api_v1_insights_settings_put",
        "parameters": [
          {
            "name": "session_id",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "description": "会话ID",
              "title": "Session Id"
            },
            "description": "会话ID"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/InsightSettingsRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIResponse"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found"
          },
          "500": {
            "description": "Internal server error"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/insights/settings/reset": {
      "post": {
        "tags": [
          "dataquery"
        ],
        "summary": "恢复默认设置",
        "description": "将洞察设置恢复为默认值",
        "operationId": "reset_insight_settings_api_v1_insights_settings_reset_post",
        "parameters": [
          {
            "name": "session_id",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "description": "会话ID",
              "title": "Session Id"
            },
            "description": "会话ID"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIResponse"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found"
          },
          "500": {
            "description": "Internal server error"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/insights/settings/export": {
      "get": {
        "tags": [
          "dataquery"
        ],
        "summary": "导出设置",
        "description": "导出当前设置为JSON格式",
        "operationId": "export_insight_settings_api_v1_insights_settings_export_get",
        "parameters": [
          {
            "name": "session_id",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "description": "会话ID",
              "title": "Session Id"
            },
            "description": "会话ID"
          },
          {
            "name": "include_sensitive",
            "in": "query",
            "required": false,
            "schema": {
              "type": "boolean",
              "description": "是否包含敏感信息",
              "default": false,
              "title": "Include Sensitive"
            },
            "description": "是否包含敏感信息"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIResponse"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found"
          },
          "500": {
            "description": "Internal server error"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/insights/settings/import": {
      "post": {
        "tags": [
          "dataquery"
        ],
        "summary": "导入设置",
        "description": "从JSON导入设置",
        "operationId": "import_insight_settings_api_v1_insights_settings_import_post",
        "parameters": [
          {
            "name": "session_id",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "description": "会话ID",
              "title": "Session Id"
            },
            "description": "会话ID"
          },
          {
            "name": "merge_strategy",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "description": "合并策略：merge, replace",
              "default": "merge",
              "title": "Merge Strategy"
            },
            "description": "合并策略：merge, replace"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": true,
                "title": "Request"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIResponse"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found"
          },
          "500": {
            "description": "Internal server error"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/insights/stats": {
      "get": {
        "tags": [
          "dataquery"
        ],
        "summary": "获取洞察统计",
        "description": "获取洞察功能的统计信息",
        "operationId": "get_insight_stats_api_v1_insights_stats_get",
        "parameters": [
          {
            "name": "session_id",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "会话ID（可选）",
              "title": "Session Id"
            },
            "description": "会话ID（可选）"
          },
          {
            "name": "days",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "maximum": 90,
              "minimum": 1,
              "description": "统计最近N天",
              "default": 7,
              "title": "Days"
            },
            "description": "统计最近N天"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIResponse"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found"
          },
          "500": {
            "description": "Internal server error"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/insights/review-questions/generate": {
      "post": {
        "tags": [
          "dataquery"
        ],
        "summary": "生成复盘问题",
        "description": "基于查询历史生成复盘问题（每周/每月）",
        "operationId": "generate_review_questions_api_v1_insights_review_questions_generate_post",
        "parameters": [
          {
            "name": "question_type",
            "in": "query",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/QuestionTypeEnum",
              "description": "问题类型（weekly/monthly）"
            },
            "description": "问题类型（weekly/monthly）"
          },
          {
            "name": "period_start",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "description": "周期开始时间（ISO格式）",
              "title": "Period Start"
            },
            "description": "周期开始时间（ISO格式）"
          },
          {
            "name": "period_end",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "description": "周期结束时间（ISO格式）",
              "title": "Period End"
            },
            "description": "周期结束时间（ISO格式）"
          },
          {
            "name": "max_questions",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "maximum": 20,
              "minimum": 1,
              "description": "最大问题数",
              "default": 5,
              "title": "Max Questions"
            },
            "description": "最大问题数"
          },
          {
            "name": "session_id",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "description": "会话ID",
              "title": "Session Id"
            },
            "description": "会话ID"
          }
        ],
        "responses": {
          "201": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIResponse"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found"
          },
          "500": {
            "description": "Internal server error"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/insights/review-questions": {
      "get": {
        "tags": [
          "dataquery"
        ],
        "summary": "获取复盘问题列表",
        "description": "获取待回答的复盘问题",
        "operationId": "get_review_questions_api_v1_insights_review_questions_get",
        "parameters": [
          {
            "name": "session_id",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "description": "会话ID",
              "title": "Session Id"
            },
            "description": "会话ID"
          },
          {
            "name": "question_type",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "$ref": "#/components/schemas/QuestionTypeEnum"
                },
                {
                  "type": "null"
                }
              ],
              "description": "问题类型过滤",
              "title": "Question Type"
            },
            "description": "问题类型过滤"
          },
          {
            "name": "answered",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "boolean"
                },
                {
                  "type": "null"
                }
              ],
              "description": "是否已回答过滤",
              "title": "Answered"
            },
            "description": "是否已回答过滤"
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "maximum": 100,
              "minimum": 1,
              "description": "返回数量限制",
              "default": 20,
              "title": "Limit"
            },
            "description": "返回数量限制"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIResponse"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found"
          },
          "500": {
            "description": "Internal server error"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/insights/review-questions/{question_id}/answer": {
      "post": {
        "tags": [
          "dataquery"
        ],
        "summary": "答复盘问题",
        "description": "提交对复盘问题的回答",
        "operationId": "answer_review_question_api_v1_insights_review_questions__question_id__answer_post",
        "parameters": [
          {
            "name": "question_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "description": "问题ID",
              "title": "Question Id"
            },
            "description": "问题ID"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/InsightQuestionAnswerRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIResponse"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found"
          },
          "500": {
            "description": "Internal server error"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/insights/review-questions/{question_id}/feedback": {
      "post": {
        "tags": [
          "dataquery"
        ],
        "summary": "复盘问题反馈",
        "description": "提交对复盘问题的反馈（有用/无用）",
        "operationId": "submit_review_question_feedback_api_v1_insights_review_questions__question_id__feedback_post",
        "parameters": [
          {
            "name": "question_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "description": "问题ID",
              "title": "Question Id"
            },
            "description": "问题ID"
          },
          {
            "name": "useful",
            "in": "query",
            "required": true,
            "schema": {
              "type": "boolean",
              "description": "问题是否有用",
              "title": "Useful"
            },
            "description": "问题是否有用"
          },
          {
            "name": "feedback_text",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "反馈文本",
              "title": "Feedback Text"
            },
            "description": "反馈文本"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIResponse"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found"
          },
          "500": {
            "description": "Internal server error"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/insights/conversation-questions/generate": {
      "post": {
        "tags": [
          "dataquery"
        ],
        "summary": "从对话历史生成洞察问题",
        "description": "从 conversations.db 读取对话历史并生成洞察问题",
        "operationId": "generate_conversation_insight_questions_api_v1_insights_conversation_questions_generate_post",
        "parameters": [
          {
            "name": "session_id",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "description": "会话ID",
              "title": "Session Id"
            },
            "description": "会话ID"
          },
          {
            "name": "recent_days",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "maximum": 90,
              "minimum": 1,
              "description": "获取最近N天的对话",
              "default": 7,
              "title": "Recent Days"
            },
            "description": "获取最近N天的对话"
          },
          {
            "name": "max_questions",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "maximum": 20,
              "minimum": 1,
              "description": "最大生成问题数",
              "default": 5,
              "title": "Max Questions"
            },
            "description": "最大生成问题数"
          },
          {
            "name": "save_to_store",
            "in": "query",
            "required": false,
            "schema": {
              "type": "boolean",
              "description": "是否保存到洞察存储",
              "default": true,
              "title": "Save To Store"
            },
            "description": "是否保存到洞察存储"
          }
        ],
        "responses": {
          "201": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIResponse"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found"
          },
          "500": {
            "description": "Internal server error"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/insights/conversation-questions": {
      "get": {
        "tags": [
          "dataquery"
        ],
        "summary": "获取对话历史洞察问题列表",
        "description": "获取从对话历史生成的洞察问题",
        "operationId": "get_conversation_insight_questions_api_v1_insights_conversation_questions_get",
        "parameters": [
          {
            "name": "session_id",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "description": "会话ID",
              "title": "Session Id"
            },
            "description": "会话ID"
          },
          {
            "name": "answered",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "boolean"
                },
                {
                  "type": "null"
                }
              ],
              "description": "是否已回答过滤",
              "title": "Answered"
            },
            "description": "是否已回答过滤"
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "maximum": 100,
              "minimum": 1,
              "description": "返回数量限制",
              "default": 20,
              "title": "Limit"
            },
            "description": "返回数量限制"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIResponse"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found"
          },
          "500": {
            "description": "Internal server error"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/insights/questions/{question_id}/thread": {
      "get": {
        "tags": [
          "dataquery"
        ],
        "summary": "获取问题的线程",
        "description": "获取指定问题的对话线程，如果不存在则返回空",
        "operationId": "get_question_thread_api_v1_insights_questions__question_id__thread_get",
        "parameters": [
          {
            "name": "question_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "description": "问题ID",
              "title": "Question Id"
            },
            "description": "问题ID"
          },
          {
            "name": "session_id",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "description": "会话ID",
              "title": "Session Id"
            },
            "description": "会话ID"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIResponse"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found"
          },
          "500": {
            "description": "Internal server error"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "dataquery"
        ],
        "summary": "创建问题的线程",
        "description": "为指定问题创建新的对话线程",
        "operationId": "create_question_thread_api_v1_insights_questions__question_id__thread_post",
        "parameters": [
          {
            "name": "question_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "description": "问题ID",
              "title": "Question Id"
            },
            "description": "问题ID"
          },
          {
            "name": "session_id",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "description": "会话ID",
              "title": "Session Id"
            },
            "description": "会话ID"
          }
        ],
        "responses": {
          "201": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIResponse"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found"
          },
          "500": {
            "description": "Internal server error"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/insights/threads/{thread_id}/messages": {
      "post": {
        "tags": [
          "dataquery"
        ],
        "summary": "添加线程消息",
        "description": "向指定线程添加新消息",
        "operationId": "add_thread_message_api_v1_insights_threads__thread_id__messages_post",
        "parameters": [
          {
            "name": "thread_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "description": "线程ID",
              "title": "Thread Id"
            },
            "description": "线程ID"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": true,
                "default": {},
                "title": "Request"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIResponse"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found"
          },
          "500": {
            "description": "Internal server error"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      },
      "get": {
        "tags": [
          "dataquery"
        ],
        "summary": "获取线程消息",
        "description": "获取指定线程的所有消息",
        "operationId": "get_thread_messages_api_v1_insights_threads__thread_id__messages_get",
        "parameters": [
          {
            "name": "thread_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "description": "线程ID",
              "title": "Thread Id"
            },
            "description": "线程ID"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIResponse"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found"
          },
          "500": {
            "description": "Internal server error"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/history": {
      "get": {
        "tags": [
          "dataquery"
        ],
        "summary": "查询历史列表",
        "description": "分页查询历史记录，支持关键词、数据源、状态、收藏、标签、分类过滤",
        "operationId": "list_history_api_v1_history_get",
        "parameters": [
          {
            "name": "keyword",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "description": "SQL关键词",
              "default": "",
              "title": "Keyword"
            },
            "description": "SQL关键词"
          },
          {
            "name": "datasource",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "description": "数据源",
              "default": "",
              "title": "Datasource"
            },
            "description": "数据源"
          },
          {
            "name": "status",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "description": "状态",
              "default": "",
              "title": "Status"
            },
            "description": "状态"
          },
          {
            "name": "is_favorite",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "boolean"
                },
                {
                  "type": "null"
                }
              ],
              "description": "是否收藏",
              "title": "Is Favorite"
            },
            "description": "是否收藏"
          },
          {
            "name": "category_id",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "integer"
                },
                {
                  "type": "null"
                }
              ],
              "description": "分类ID",
              "title": "Category Id"
            },
            "description": "分类ID"
          },
          {
            "name": "tags",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                },
                {
                  "type": "null"
                }
              ],
              "description": "标签列表",
              "title": "Tags"
            },
            "description": "标签列表"
          },
          {
            "name": "page",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "description": "页码",
              "default": 1,
              "title": "Page"
            },
            "description": "页码"
          },
          {
            "name": "page_size",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "maximum": 1000,
              "minimum": 1,
              "description": "每页数量",
              "default": 20,
              "title": "Page Size"
            },
            "description": "每页数量"
          },
          {
            "name": "order_by",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "description": "排序方式",
              "default": "created_at DESC",
              "title": "Order By"
            },
            "description": "排序方式"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIResponse"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found"
          },
          "500": {
            "description": "Internal server error"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/history/{record_id}": {
      "get": {
        "tags": [
          "dataquery"
        ],
        "summary": "历史记录详情",
        "description": "根据ID获取单条历史记录",
        "operationId": "get_history_record_api_v1_history__record_id__get",
        "parameters": [
          {
            "name": "record_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "description": "记录ID",
              "title": "Record Id"
            },
            "description": "记录ID"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIResponse"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found"
          },
          "500": {
            "description": "Internal server error"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "dataquery"
        ],
        "summary": "删除历史记录",
        "description": "删除指定历史记录",
        "operationId": "delete_history_record_api_v1_history__record_id__delete",
        "parameters": [
          {
            "name": "record_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "description": "记录ID",
              "title": "Record Id"
            },
            "description": "记录ID"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIResponse"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found"
          },
          "500": {
            "description": "Internal server error"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/history/{record_id}/favorite": {
      "post": {
        "tags": [
          "dataquery"
        ],
        "summary": "切换历史记录收藏",
        "description": "设置或取消历史记录收藏状态",
        "operationId": "toggle_history_favorite_api_v1_history__record_id__favorite_post",
        "parameters": [
          {
            "name": "record_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "description": "记录ID",
              "title": "Record Id"
            },
            "description": "记录ID"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/FavoriteToggleRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIResponse"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found"
          },
          "500": {
            "description": "Internal server error"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/history/{record_id}/tags": {
      "post": {
        "tags": [
          "dataquery"
        ],
        "summary": "更新历史记录标签",
        "description": "更新历史记录标签",
        "operationId": "update_history_tags_api_v1_history__record_id__tags_post",
        "parameters": [
          {
            "name": "record_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "description": "记录ID",
              "title": "Record Id"
            },
            "description": "记录ID"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateTagsRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIResponse"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found"
          },
          "500": {
            "description": "Internal server error"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/history/{record_id}/category": {
      "post": {
        "tags": [
          "dataquery"
        ],
        "summary": "更新历史记录分类",
        "description": "更新历史记录分类",
        "operationId": "update_history_category_api_v1_history__record_id__category_post",
        "parameters": [
          {
            "name": "record_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "description": "记录ID",
              "title": "Record Id"
            },
            "description": "记录ID"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateCategoryRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIResponse"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found"
          },
          "500": {
            "description": "Internal server error"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/favorites": {
      "get": {
        "tags": [
          "dataquery"
        ],
        "summary": "收藏列表",
        "description": "获取所有收藏的查询记录",
        "operationId": "list_favorites_api_v1_favorites_get",
        "parameters": [
          {
            "name": "datasource",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "description": "数据源",
              "default": "",
              "title": "Datasource"
            },
            "description": "数据源"
          },
          {
            "name": "category_id",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "integer"
                },
                {
                  "type": "null"
                }
              ],
              "description": "分类ID",
              "title": "Category Id"
            },
            "description": "分类ID"
          },
          {
            "name": "tags",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                },
                {
                  "type": "null"
                }
              ],
              "description": "标签列表",
              "title": "Tags"
            },
            "description": "标签列表"
          },
          {
            "name": "page",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "description": "页码",
              "default": 1,
              "title": "Page"
            },
            "description": "页码"
          },
          {
            "name": "page_size",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "maximum": 1000,
              "minimum": 1,
              "description": "每页数量",
              "default": 20,
              "title": "Page Size"
            },
            "description": "每页数量"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIResponse"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found"
          },
          "500": {
            "description": "Internal server error"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/history-tags": {
      "get": {
        "tags": [
          "dataquery"
        ],
        "summary": "所有标签",
        "description": "获取所有使用过的标签",
        "operationId": "list_all_tags_api_v1_history_tags_get",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIResponse"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found"
          },
          "500": {
            "description": "Internal server error"
          }
        }
      }
    },
    "/api/v1/history-categories": {
      "get": {
        "tags": [
          "dataquery"
        ],
        "summary": "分类树",
        "description": "获取分类树（仅支持一级+二级）",
        "operationId": "list_categories_api_v1_history_categories_get",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIResponse"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found"
          },
          "500": {
            "description": "Internal server error"
          }
        }
      },
      "post": {
        "tags": [
          "dataquery"
        ],
        "summary": "创建分类",
        "description": "创建新分类",
        "operationId": "create_category_api_v1_history_categories_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CategoryCreateRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIResponse"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found"
          },
          "500": {
            "description": "Internal server error"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/history-categories/{category_id}": {
      "get": {
        "tags": [
          "dataquery"
        ],
        "summary": "分类详情",
        "description": "根据ID获取分类详情",
        "operationId": "get_category_api_v1_history_categories__category_id__get",
        "parameters": [
          {
            "name": "category_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "description": "分类ID",
              "title": "Category Id"
            },
            "description": "分类ID"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIResponse"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found"
          },
          "500": {
            "description": "Internal server error"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      },
      "put": {
        "tags": [
          "dataquery"
        ],
        "summary": "更新分类",
        "description": "更新分类信息",
        "operationId": "update_category_route_api_v1_history_categories__category_id__put",
        "parameters": [
          {
            "name": "category_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "description": "分类ID",
              "title": "Category Id"
            },
            "description": "分类ID"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CategoryUpdateRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIResponse"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found"
          },
          "500": {
            "description": "Internal server error"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "dataquery"
        ],
        "summary": "删除分类",
        "description": "删除分类",
        "operationId": "delete_category_route_api_v1_history_categories__category_id__delete",
        "parameters": [
          {
            "name": "category_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "description": "分类ID",
              "title": "Category Id"
            },
            "description": "分类ID"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIResponse"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found"
          },
          "500": {
            "description": "Internal server error"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/aip-talk/messages/{session_id}/{seq}/favorite": {
      "post": {
        "tags": [
          "dataquery"
        ],
        "summary": "切换 AIP TALK 消息收藏",
        "description": "对 AIP TALK 某条助手消息切换收藏状态",
        "operationId": "toggle_aip_talk_message_favorite_api_v1_aip_talk_messages__session_id___seq__favorite_post",
        "parameters": [
          {
            "name": "session_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "会话ID",
              "title": "Session Id"
            },
            "description": "会话ID"
          },
          {
            "name": "seq",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "description": "消息seq",
              "title": "Seq"
            },
            "description": "消息seq"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AipTalkMessageFavoriteRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIResponse"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found"
          },
          "500": {
            "description": "Internal server error"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/aip-talk/messages/{session_id}/{seq}/tags": {
      "post": {
        "tags": [
          "dataquery"
        ],
        "summary": "更新 AIP TALK 消息标签",
        "description": "对 AIP TALK 某条助手消息更新标签",
        "operationId": "update_aip_talk_message_tags_api_v1_aip_talk_messages__session_id___seq__tags_post",
        "parameters": [
          {
            "name": "session_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "会话ID",
              "title": "Session Id"
            },
            "description": "会话ID"
          },
          {
            "name": "seq",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "description": "消息seq",
              "title": "Seq"
            },
            "description": "消息seq"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AipTalkMessageTagsRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIResponse"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found"
          },
          "500": {
            "description": "Internal server error"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/aip-talk/messages/{session_id}/{seq}/category": {
      "post": {
        "tags": [
          "dataquery"
        ],
        "summary": "更新 AIP TALK 消息分类",
        "description": "对 AIP TALK 某条助手消息设置分类",
        "operationId": "update_aip_talk_message_category_api_v1_aip_talk_messages__session_id___seq__category_post",
        "parameters": [
          {
            "name": "session_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "会话ID",
              "title": "Session Id"
            },
            "description": "会话ID"
          },
          {
            "name": "seq",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "description": "消息seq",
              "title": "Seq"
            },
            "description": "消息seq"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AipTalkMessageCategoryRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIResponse"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found"
          },
          "500": {
            "description": "Internal server error"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/aip-talk/messages/{session_id}/{seq}/decision": {
      "post": {
        "tags": [
          "dataquery"
        ],
        "summary": "标记 AIP TALK 关键决策",
        "description": "对 AIP TALK 某条助手消息标记/取消关键决策",
        "operationId": "mark_aip_talk_message_decision_api_v1_aip_talk_messages__session_id___seq__decision_post",
        "parameters": [
          {
            "name": "session_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "会话ID",
              "title": "Session Id"
            },
            "description": "会话ID"
          },
          {
            "name": "seq",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "description": "消息seq",
              "title": "Seq"
            },
            "description": "消息seq"
          },
          {
            "name": "user_id",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "当前用户ID",
              "title": "User Id"
            },
            "description": "当前用户ID"
          },
          {
            "name": "tenant_id",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "当前租户ID",
              "title": "Tenant Id"
            },
            "description": "当前租户ID"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AipTalkMessageDecisionRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIResponse"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found"
          },
          "500": {
            "description": "Internal server error"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/aip-talk/messages/{session_id}/{seq}/decision/review": {
      "post": {
        "tags": [
          "dataquery"
        ],
        "summary": "更新 AIP TALK 决策复盘信息",
        "description": "对 AIP TALK 某条关键决策补充实际结果、复盘笔记与复盘状态",
        "operationId": "update_aip_talk_message_decision_review_api_v1_aip_talk_messages__session_id___seq__decision_review_post",
        "parameters": [
          {
            "name": "session_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "会话ID",
              "title": "Session Id"
            },
            "description": "会话ID"
          },
          {
            "name": "seq",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "description": "消息seq",
              "title": "Seq"
            },
            "description": "消息seq"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AipTalkMessageDecisionReviewRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIResponse"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found"
          },
          "500": {
            "description": "Internal server error"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/aip-talk/history": {
      "get": {
        "tags": [
          "dataquery"
        ],
        "summary": "AIP TALK 历史消息",
        "description": "获取指定会话中带有查询记录的助手消息",
        "operationId": "list_aip_talk_history_api_v1_aip_talk_history_get",
        "parameters": [
          {
            "name": "session_id",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "description": "会话ID",
              "title": "Session Id"
            },
            "description": "会话ID"
          },
          {
            "name": "page",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "description": "页码",
              "default": 1,
              "title": "Page"
            },
            "description": "页码"
          },
          {
            "name": "page_size",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "maximum": 200,
              "minimum": 1,
              "description": "每页数量",
              "default": 20,
              "title": "Page Size"
            },
            "description": "每页数量"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIResponse"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found"
          },
          "500": {
            "description": "Internal server error"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/aip-talk/favorites": {
      "get": {
        "tags": [
          "dataquery"
        ],
        "summary": "AIP TALK 收藏",
        "description": "获取收藏的查询记录（跨会话）",
        "operationId": "list_aip_talk_favorites_api_v1_aip_talk_favorites_get",
        "parameters": [
          {
            "name": "category_id",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "integer"
                },
                {
                  "type": "null"
                }
              ],
              "description": "分类ID",
              "title": "Category Id"
            },
            "description": "分类ID"
          },
          {
            "name": "tags",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                },
                {
                  "type": "null"
                }
              ],
              "description": "标签列表",
              "title": "Tags"
            },
            "description": "标签列表"
          },
          {
            "name": "page",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "description": "页码",
              "default": 1,
              "title": "Page"
            },
            "description": "页码"
          },
          {
            "name": "page_size",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "maximum": 1000,
              "minimum": 1,
              "description": "每页数量",
              "default": 20,
              "title": "Page Size"
            },
            "description": "每页数量"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIResponse"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found"
          },
          "500": {
            "description": "Internal server error"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/health": {
      "get": {
        "tags": [
          "dataquery"
        ],
        "summary": "健康检查",
        "description": "检查 API 服务健康状态",
        "operationId": "health_check_api_v1_health_get",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIResponse"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found"
          },
          "500": {
            "description": "Internal server error"
          }
        }
      }
    },
    "/api/v1/health/datasource": {
      "get": {
        "tags": [
          "dataquery"
        ],
        "summary": "数据源健康检查",
        "description": "检查所有已注册数据源的连接健康状态",
        "operationId": "health_check_all_datasources_api_v1_health_datasource_get",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIResponse"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found"
          },
          "500": {
            "description": "Internal server error"
          }
        }
      }
    },
    "/api/v1/health/datasource/{source_id}": {
      "get": {
        "tags": [
          "dataquery"
        ],
        "summary": "单个数据源健康检查",
        "description": "检查指定数据源的健康与诊断信息",
        "operationId": "health_check_datasource_api_v1_health_datasource__source_id__get",
        "parameters": [
          {
            "name": "source_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "数据源ID",
              "title": "Source Id"
            },
            "description": "数据源ID"
          },
          {
            "name": "include_diagnosis",
            "in": "query",
            "required": false,
            "schema": {
              "type": "boolean",
              "description": "是否包含诊断详情",
              "default": false,
              "title": "Include Diagnosis"
            },
            "description": "是否包含诊断详情"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIResponse"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found"
          },
          "500": {
            "description": "Internal server error"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/health/datasource/{source_id}/history": {
      "get": {
        "tags": [
          "dataquery"
        ],
        "summary": "数据源健康检查历史",
        "description": "获取指定数据源的最近健康检查历史记录",
        "operationId": "health_check_datasource_history_api_v1_health_datasource__source_id__history_get",
        "parameters": [
          {
            "name": "source_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "数据源ID",
              "title": "Source Id"
            },
            "description": "数据源ID"
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "maximum": 100,
              "minimum": 1,
              "description": "返回记录数",
              "default": 20,
              "title": "Limit"
            },
            "description": "返回记录数"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIResponse"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found"
          },
          "500": {
            "description": "Internal server error"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/health/datasource/{source_id}/reset": {
      "post": {
        "tags": [
          "dataquery"
        ],
        "summary": "重置数据源熔断器",
        "description": "手动重置指定数据源的熔断器状态",
        "operationId": "reset_datasource_circuit_breaker_api_v1_health_datasource__source_id__reset_post",
        "parameters": [
          {
            "name": "source_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "数据源ID",
              "title": "Source Id"
            },
            "description": "数据源ID"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIResponse"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found"
          },
          "500": {
            "description": "Internal server error"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "APIResponse": {
        "properties": {
          "success": {
            "type": "boolean",
            "title": "Success",
            "description": "请求是否成功"
          },
          "message": {
            "type": "string",
            "title": "Message",
            "description": "响应消息",
            "default": ""
          },
          "data": {
            "anyOf": [
              {},
              {
                "type": "null"
              }
            ],
            "title": "Data",
            "description": "响应数据"
          },
          "errors": {
            "anyOf": [
              {
                "items": {
                  "type": "string"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Errors",
            "description": "错误信息列表"
          }
        },
        "type": "object",
        "required": [
          "success"
        ],
        "title": "APIResponse",
        "description": "统一 API 响应格式",
        "example": {
          "data": {},
          "message": "操作成功",
          "success": true
        }
      },
      "ActionProposeRequest": {
        "properties": {
          "instruction": {
            "type": "string",
            "title": "Instruction",
            "description": "自然语言指令"
          },
          "options": {
            "anyOf": [
              {
                "additionalProperties": true,
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "title": "Options",
            "description": "可选配置"
          }
        },
        "type": "object",
        "required": [
          "instruction"
        ],
        "title": "ActionProposeRequest",
        "description": "Action 提案请求"
      },
      "AipTalkMessageCategoryRequest": {
        "properties": {
          "category_id": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Category Id",
            "description": "分类ID"
          }
        },
        "type": "object",
        "title": "AipTalkMessageCategoryRequest",
        "description": "AIP TALK 消息分类请求"
      },
      "AipTalkMessageDecisionRequest": {
        "properties": {
          "is_decision": {
            "type": "boolean",
            "title": "Is Decision",
            "description": "是否标记为关键决策"
          },
          "title": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Title",
            "description": "决策标题"
          },
          "note": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Note",
            "description": "决策说明"
          },
          "expected_outcome": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Expected Outcome",
            "description": "预期结果"
          },
          "decision_status": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/DecisionStatusEnum"
              },
              {
                "type": "null"
              }
            ],
            "description": "决策状态（默认 marked）"
          },
          "decision_source": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Decision Source",
            "description": "决策来源（默认 aip-talk）"
          }
        },
        "type": "object",
        "required": [
          "is_decision"
        ],
        "title": "AipTalkMessageDecisionRequest",
        "description": "AIP TALK 消息关键决策标记请求"
      },
      "AipTalkMessageDecisionReviewRequest": {
        "properties": {
          "decision_status": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/DecisionStatusEnum"
              },
              {
                "type": "null"
              }
            ],
            "description": "决策状态"
          },
          "actual_outcome": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Actual Outcome",
            "description": "实际结果"
          },
          "review_notes": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Review Notes",
            "description": "复盘笔记"
          },
          "reviewed_at": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Reviewed At",
            "description": "复盘时间 ISO 格式"
          },
          "reviewed_by": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Reviewed By",
            "description": "复盘人"
          }
        },
        "type": "object",
        "title": "AipTalkMessageDecisionReviewRequest",
        "description": "AIP TALK 决策复盘信息更新请求"
      },
      "AipTalkMessageFavoriteRequest": {
        "properties": {
          "is_favorite": {
            "type": "boolean",
            "title": "Is Favorite",
            "description": "是否收藏"
          }
        },
        "type": "object",
        "required": [
          "is_favorite"
        ],
        "title": "AipTalkMessageFavoriteRequest",
        "description": "AIP TALK 消息收藏请求"
      },
      "AipTalkMessageTagsRequest": {
        "properties": {
          "tags": {
            "items": {
              "type": "string"
            },
            "type": "array",
            "title": "Tags",
            "description": "标签列表"
          }
        },
        "type": "object",
        "title": "AipTalkMessageTagsRequest",
        "description": "AIP TALK 消息标签请求"
      },
      "BatchExportRequest": {
        "properties": {
          "format": {
            "type": "string",
            "title": "Format",
            "description": "导出格式：pdf 或 zip"
          }
        },
        "type": "object",
        "required": [
          "format"
        ],
        "title": "BatchExportRequest",
        "description": "批量可视化导出请求"
      },
      "BatchVisualizeRequest": {
        "properties": {
          "query_result": {
            "additionalProperties": true,
            "type": "object",
            "title": "Query Result",
            "description": "查询结果，需包含 columns/rows"
          },
          "intent": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Intent",
            "description": "可视化意图"
          },
          "min_charts": {
            "type": "integer",
            "maximum": 20.0,
            "minimum": 1.0,
            "title": "Min Charts",
            "description": "最少生成图表数",
            "default": 3
          },
          "max_charts": {
            "type": "integer",
            "maximum": 20.0,
            "minimum": 1.0,
            "title": "Max Charts",
            "description": "最多生成图表数",
            "default": 5
          },
          "export_formats": {
            "items": {
              "type": "string"
            },
            "type": "array",
            "title": "Export Formats",
            "description": "导出格式"
          },
          "report_title": {
            "type": "string",
            "title": "Report Title",
            "description": "报告标题",
            "default": "数据分析报告"
          },
          "language": {
            "type": "string",
            "title": "Language",
            "description": "输出语言：zh/en，空字符串自动检测",
            "default": ""
          },
          "output_format": {
            "type": "string",
            "title": "Output Format",
            "description": "输出模态：image/echarts/spec/report",
            "default": "image"
          }
        },
        "type": "object",
        "required": [
          "query_result"
        ],
        "title": "BatchVisualizeRequest",
        "description": "批量可视化请求"
      },
      "CategoryCreateRequest": {
        "properties": {
          "name": {
            "type": "string",
            "maxLength": 100,
            "minLength": 1,
            "title": "Name",
            "description": "分类名称"
          },
          "description": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Description",
            "description": "分类描述",
            "default": ""
          },
          "parent_id": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Parent Id",
            "description": "父分类ID"
          },
          "color": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Color",
            "description": "颜色",
            "default": "#35A85B"
          },
          "icon": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Icon",
            "description": "图标",
            "default": ""
          }
        },
        "type": "object",
        "required": [
          "name"
        ],
        "title": "CategoryCreateRequest",
        "description": "创建分类请求"
      },
      "CategoryUpdateRequest": {
        "properties": {
          "name": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 100,
                "minLength": 1
              },
              {
                "type": "null"
              }
            ],
            "title": "Name",
            "description": "分类名称"
          },
          "description": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Description",
            "description": "分类描述"
          },
          "parent_id": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Parent Id",
            "description": "父分类ID"
          },
          "color": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Color",
            "description": "颜色"
          },
          "icon": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Icon",
            "description": "图标"
          }
        },
        "type": "object",
        "title": "CategoryUpdateRequest",
        "description": "更新分类请求"
      },
      "ClarificationAnswerRequest": {
        "properties": {
          "answer": {
            "type": "string",
            "title": "Answer",
            "description": "用户回答",
            "default": ""
          },
          "answer_type": {
            "type": "string",
            "title": "Answer Type",
            "description": "回答类型",
            "default": "free_text"
          }
        },
        "type": "object",
        "title": "ClarificationAnswerRequest"
      },
      "CrossSourceQueryRequest": {
        "properties": {
          "source_ids": {
            "anyOf": [
              {
                "items": {
                  "type": "string"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Source Ids",
            "description": "数据源ID列表；使用虚拟本体时可不传"
          },
          "query": {
            "type": "string",
            "minLength": 1,
            "title": "Query",
            "description": "SQL查询或自然语言查询"
          },
          "is_nl_query": {
            "type": "boolean",
            "title": "Is Nl Query",
            "description": "是否为自然语言查询",
            "default": false
          },
          "virtual_ontology_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Virtual Ontology Id",
            "description": "虚拟本体ID（M21）"
          },
          "limit": {
            "anyOf": [
              {
                "type": "integer",
                "maximum": 10000.0,
                "minimum": 1.0
              },
              {
                "type": "null"
              }
            ],
            "title": "Limit",
            "description": "返回行数限制",
            "default": 1000
          },
          "offset": {
            "anyOf": [
              {
                "type": "integer",
                "minimum": 0.0
              },
              {
                "type": "null"
              }
            ],
            "title": "Offset",
            "description": "起始偏移",
            "default": 0
          },
          "timeout": {
            "anyOf": [
              {
                "type": "integer",
                "maximum": 300.0,
                "minimum": 1.0
              },
              {
                "type": "null"
              }
            ],
            "title": "Timeout",
            "description": "查询超时时间(秒)",
            "default": 60
          }
        },
        "type": "object",
        "required": [
          "query"
        ],
        "title": "CrossSourceQueryRequest",
        "description": "跨数据源查询请求"
      },
      "DashboardWidgetDataRequest": {
        "properties": {
          "source_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Source Id",
            "description": "数据源 ID；未指定时从 widget 配置解析"
          },
          "params": {
            "additionalProperties": true,
            "type": "object",
            "title": "Params",
            "description": "运行态参数"
          },
          "profile_id": {
            "type": "string",
            "title": "Profile Id",
            "description": "所属 dashboard profile ID"
          }
        },
        "type": "object",
        "required": [
          "profile_id"
        ],
        "title": "DashboardWidgetDataRequest",
        "description": "Widget 数据请求"
      },
      "DataSourceCreateRequest": {
        "properties": {
          "source_type": {
            "$ref": "#/components/schemas/DataSourceTypeEnum",
            "description": "数据源类型"
          },
          "name": {
            "type": "string",
            "maxLength": 100,
            "minLength": 1,
            "title": "Name",
            "description": "数据源名称"
          },
          "connection_params": {
            "additionalProperties": true,
            "type": "object",
            "title": "Connection Params",
            "description": "连接参数"
          },
          "is_persistent": {
            "type": "boolean",
            "title": "Is Persistent",
            "description": "是否持久化",
            "default": true
          },
          "metadata": {
            "anyOf": [
              {
                "additionalProperties": true,
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "title": "Metadata",
            "description": "元数据"
          }
        },
        "type": "object",
        "required": [
          "source_type",
          "name",
          "connection_params"
        ],
        "title": "DataSourceCreateRequest",
        "description": "创建数据源请求",
        "example": {
          "connection_params": {
            "encoding": "utf-8",
            "file_path": "/path/to/sales.csv"
          },
          "is_persistent": true,
          "metadata": {
            "description": "2024年销售数据",
            "owner": "数据团队"
          },
          "name": "销售数据",
          "source_type": "csv",
          "http_api": {
            "source_type": "api",
            "name": "川航航班数据",
            "connection_params": {
              "endpoint": "http://43.139.27.12/6d6b4e50087c/api/query",
              "method": "GET",
              "sql_param": "sql",
              "auth_type": "none",
              "timeout": 30,
              "verify_ssl": true
            },
            "is_persistent": true,
            "metadata": {
              "description": "川航航班SQLite数据库，通过HTTP API远程访问"
            }
          }
        }
      },
      "DataSourceTypeEnum": {
        "type": "string",
        "enum": [
          "csv",
          "mysql",
          "postgresql",
          "sqlite",
          "mssql",
          "oracle",
          "snowflake",
          "bigquery",
          "clickhouse",
          "duckdb",
          "tidb",
          "oceanbase",
          "gaussdb",
          "cockroachdb",
          "dameng",
          "api",
          "warehouse"
        ],
        "title": "DataSourceTypeEnum",
        "description": "数据源类型枚举"
      },
      "DecisionApproveRequest": {
        "properties": {
          "approval_status": {
            "type": "string",
            "title": "Approval Status",
            "description": "审批状态：none / pending / approved / rejected"
          },
          "approved_by": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Approved By",
            "description": "审批人"
          }
        },
        "type": "object",
        "required": [
          "approval_status"
        ],
        "title": "DecisionApproveRequest",
        "description": "决策审批请求",
        "example": {
          "approval_status": "approved",
          "approved_by": "manager_001"
        }
      },
      "DecisionShareRequest": {
        "properties": {
          "user_ids": {
            "items": {
              "type": "string"
            },
            "type": "array",
            "title": "User Ids",
            "description": "共享给用户 ID 列表"
          },
          "visibility": {
            "type": "string",
            "title": "Visibility",
            "description": "可见性：private / tenant / shared",
            "default": "shared"
          }
        },
        "type": "object",
        "title": "DecisionShareRequest",
        "description": "决策共享请求",
        "example": {
          "user_ids": [
            "user_001",
            "user_002"
          ],
          "visibility": "shared"
        }
      },
      "DecisionStatusEnum": {
        "type": "string",
        "enum": [
          "marked",
          "open",
          "reviewed",
          "closed"
        ],
        "title": "DecisionStatusEnum",
        "description": "决策复盘状态枚举"
      },
      "ExpectedActualDiffSummaryRequest": {
        "properties": {
          "decision_id": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Decision Id",
            "description": "决策 ID（可选，提供时自动读取决策字段）"
          },
          "title": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Title",
            "description": "决策标题"
          },
          "note": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Note",
            "description": "决策说明"
          },
          "expected_outcome": {
            "type": "string",
            "title": "Expected Outcome",
            "description": "预期结果",
            "default": ""
          },
          "actual_outcome": {
            "type": "string",
            "title": "Actual Outcome",
            "description": "实际结果",
            "default": ""
          },
          "query_record_ids": {
            "anyOf": [
              {
                "items": {
                  "type": "integer"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Query Record Ids",
            "description": "关联查询记录 ID 列表"
          }
        },
        "type": "object",
        "title": "ExpectedActualDiffSummaryRequest",
        "description": "\n        生成预期 vs 实际差异摘要请求\n\n        两种使用方式：\n        1. 传入 `decision_id`，系统会自动读取决策的标题、说明、预期/实际结果及关联查询记录\n        2. 手动填写 `title`, `note`, `expected_outcome`, `actual_outcome`, `query_record_ids`\n\n        若提供 `decision_id`，生成的摘要会自动保存到该决策记录中。\n        ",
        "example": {
          "decision_id": 42
        }
      },
      "FavoriteToggleRequest": {
        "properties": {
          "is_favorite": {
            "type": "boolean",
            "title": "Is Favorite",
            "description": "是否收藏"
          },
          "favorite_id": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Favorite Id",
            "description": "收藏ID"
          }
        },
        "type": "object",
        "required": [
          "is_favorite"
        ],
        "title": "FavoriteToggleRequest",
        "description": "收藏切换请求"
      },
      "FieldPermissionRequest": {
        "properties": {
          "user_id": {
            "type": "string",
            "title": "User Id",
            "description": "用户ID"
          },
          "table_name": {
            "type": "string",
            "title": "Table Name",
            "description": "表名"
          },
          "field_name": {
            "type": "string",
            "title": "Field Name",
            "description": "字段名"
          },
          "access_level": {
            "type": "string",
            "title": "Access Level",
            "description": "访问级别: full, masked, hidden"
          },
          "mask_type": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Mask Type",
            "description": "脱敏类型"
          }
        },
        "type": "object",
        "required": [
          "user_id",
          "table_name",
          "field_name",
          "access_level"
        ],
        "title": "FieldPermissionRequest",
        "description": "字段权限请求"
      },
      "FunctionInvokeRequest": {
        "properties": {
          "function_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Function Id",
            "description": "Function ID（在通用 invoke 端点必填，在 detail 端点可省略）"
          },
          "params": {
            "additionalProperties": true,
            "type": "object",
            "title": "Params",
            "description": "Function 参数"
          },
          "timeout_ms": {
            "type": "integer",
            "maximum": 60000.0,
            "minimum": 100.0,
            "title": "Timeout Ms",
            "description": "超时毫秒",
            "default": 10000
          },
          "max_results": {
            "type": "integer",
            "maximum": 10000.0,
            "minimum": 1.0,
            "title": "Max Results",
            "description": "最大返回结果数",
            "default": 1000
          }
        },
        "type": "object",
        "title": "FunctionInvokeRequest",
        "description": "Function 调用请求"
      },
      "GapCreateRequest": {
        "properties": {
          "category": {
            "type": "string",
            "title": "Category",
            "description": "missing_mapping | missing_property | anti_pattern | data_quality",
            "default": "missing_mapping"
          },
          "description": {
            "type": "string",
            "title": "Description",
            "description": "描述"
          },
          "affected_sources": {
            "anyOf": [
              {
                "items": {
                  "type": "string"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Affected Sources",
            "description": "受影响数据源"
          },
          "anti_pattern": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Anti Pattern",
            "description": "反模式示例"
          },
          "remediation": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Remediation",
            "description": "修复建议"
          }
        },
        "type": "object",
        "required": [
          "description"
        ],
        "title": "GapCreateRequest",
        "description": "Gap 创建请求"
      },
      "GapUpdateRequest": {
        "properties": {
          "status": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Status",
            "description": "open | resolved | ignored"
          },
          "description": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Description",
            "description": "描述"
          },
          "remediation": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Remediation",
            "description": "修复建议"
          }
        },
        "type": "object",
        "title": "GapUpdateRequest",
        "description": "Gap 更新请求"
      },
      "HTTPValidationError": {
        "properties": {
          "detail": {
            "items": {
              "$ref": "#/components/schemas/ValidationError"
            },
            "type": "array",
            "title": "Detail"
          }
        },
        "type": "object",
        "title": "HTTPValidationError"
      },
      "InsightQuestionAnswerRequest": {
        "properties": {
          "response_text": {
            "type": "string",
            "maxLength": 2000,
            "minLength": 1,
            "title": "Response Text",
            "description": "回答内容"
          }
        },
        "type": "object",
        "required": [
          "response_text"
        ],
        "title": "InsightQuestionAnswerRequest",
        "description": "回答洞察问题请求",
        "example": {
          "response_text": "这个趋势表明我们需要调整Q4的销售策略..."
        }
      },
      "InsightQuestionRequest": {
        "properties": {
          "question_text": {
            "type": "string",
            "maxLength": 500,
            "minLength": 1,
            "title": "Question Text",
            "description": "问题文本"
          },
          "question_type": {
            "$ref": "#/components/schemas/QuestionTypeEnum",
            "description": "问题类型"
          },
          "question_level": {
            "$ref": "#/components/schemas/QuestionLevelEnum",
            "description": "问题层次"
          },
          "context_query_id": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Context Query Id",
            "description": "关联的查询ID"
          },
          "session_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Session Id",
            "description": "会话ID"
          }
        },
        "type": "object",
        "required": [
          "question_text",
          "question_type",
          "question_level"
        ],
        "title": "InsightQuestionRequest",
        "description": "洞察问题请求",
        "example": {
          "context_query_id": 123,
          "question_level": "insight",
          "question_text": "这个趋势对Q4目标意味着什么？",
          "question_type": "immediate"
        }
      },
      "InsightRequest": {
        "properties": {
          "insight_type": {
            "$ref": "#/components/schemas/InsightTypeEnum",
            "description": "洞察类型"
          },
          "title": {
            "type": "string",
            "maxLength": 200,
            "minLength": 1,
            "title": "Title",
            "description": "洞察标题"
          },
          "description": {
            "type": "string",
            "maxLength": 2000,
            "minLength": 1,
            "title": "Description",
            "description": "洞察描述"
          },
          "confidence_score": {
            "type": "number",
            "maximum": 1.0,
            "minimum": 0.0,
            "title": "Confidence Score",
            "description": "置信度分数"
          },
          "source_queries": {
            "items": {
              "type": "integer"
            },
            "type": "array",
            "title": "Source Queries",
            "description": "来源查询ID列表"
          },
          "session_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Session Id",
            "description": "会话ID"
          },
          "is_favorite": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "title": "Is Favorite",
            "description": "是否收藏",
            "default": false
          },
          "tags": {
            "anyOf": [
              {
                "items": {
                  "type": "string"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Tags",
            "description": "标签列表"
          },
          "category_id": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Category Id",
            "description": "分类ID"
          }
        },
        "type": "object",
        "required": [
          "insight_type",
          "title",
          "description",
          "confidence_score"
        ],
        "title": "InsightRequest",
        "description": "洞察创建请求",
        "example": {
          "confidence_score": 0.85,
          "description": "华东区域销售额环比下降12%，主要集中在上海和浙江省份...",
          "insight_type": "trend",
          "source_queries": [
            123,
            124
          ],
          "tags": [
            "销售"
          ],
          "title": "华东区域销售额下降12%"
        }
      },
      "InsightSettingsRequest": {
        "properties": {
          "enabled": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "title": "Enabled",
            "description": "是否启用洞察功能"
          },
          "immediate_questions": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "title": "Immediate Questions",
            "description": "是否启用即时反问"
          },
          "scheduled_review": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "title": "Scheduled Review",
            "description": "是否启用定期复盘"
          },
          "idle_trigger": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "title": "Idle Trigger",
            "description": "是否启用空闲触发"
          },
          "auto_extract_insights": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "title": "Auto Extract Insights",
            "description": "是否自动提取洞察"
          },
          "max_questions_per_query": {
            "anyOf": [
              {
                "type": "integer",
                "maximum": 5.0,
                "minimum": 1.0
              },
              {
                "type": "null"
              }
            ],
            "title": "Max Questions Per Query",
            "description": "每次查询最多生成问题数"
          },
          "question_depth": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Question Depth",
            "description": "问题深度倾向：basic, balanced, deep"
          },
          "idle_trigger_minutes": {
            "anyOf": [
              {
                "type": "integer",
                "maximum": 120.0,
                "minimum": 5.0
              },
              {
                "type": "null"
              }
            ],
            "title": "Idle Trigger Minutes",
            "description": "空闲触发分钟数"
          },
          "review_schedule": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Review Schedule",
            "description": "复盘周期：daily, weekly, monthly"
          },
          "notification_max_per_day": {
            "anyOf": [
              {
                "type": "integer",
                "maximum": 10.0,
                "minimum": 1.0
              },
              {
                "type": "null"
              }
            ],
            "title": "Notification Max Per Day",
            "description": "每日最多通知次数"
          },
          "auto_pause_after_ignore": {
            "anyOf": [
              {
                "type": "integer",
                "maximum": 10.0,
                "minimum": 1.0
              },
              {
                "type": "null"
              }
            ],
            "title": "Auto Pause After Ignore",
            "description": "连续忽略后自动暂停次数"
          },
          "insight_confidence_threshold": {
            "anyOf": [
              {
                "type": "number",
                "maximum": 1.0,
                "minimum": 0.0
              },
              {
                "type": "null"
              }
            ],
            "title": "Insight Confidence Threshold",
            "description": "洞察置信度阈值"
          },
          "retention_days": {
            "anyOf": [
              {
                "type": "integer",
                "maximum": 365.0,
                "minimum": 7.0
              },
              {
                "type": "null"
              }
            ],
            "title": "Retention Days",
            "description": "数据保留天数"
          },
          "conversation_history_days": {
            "anyOf": [
              {
                "type": "integer",
                "maximum": 365.0,
                "minimum": 0.0
              },
              {
                "type": "null"
              }
            ],
            "title": "Conversation History Days",
            "description": "对话历史默认时间范围（天），0 表示全部历史"
          }
        },
        "type": "object",
        "title": "InsightSettingsRequest",
        "description": "洞察设置请求",
        "example": {
          "auto_pause_after_ignore": 3,
          "conversation_history_days": 7,
          "enabled": true,
          "idle_trigger": true,
          "idle_trigger_minutes": 30,
          "immediate_questions": false,
          "insight_confidence_threshold": 0.7,
          "max_questions_per_query": 2,
          "notification_max_per_day": 3,
          "question_depth": "balanced",
          "retention_days": 30,
          "review_schedule": "weekly",
          "scheduled_review": true
        }
      },
      "InsightTypeEnum": {
        "type": "string",
        "enum": [
          "trend",
          "anomaly",
          "correlation",
          "suggestion"
        ],
        "title": "InsightTypeEnum",
        "description": "洞察类型枚举"
      },
      "InsightVerifyRequest": {
        "properties": {
          "verified": {
            "type": "boolean",
            "title": "Verified",
            "description": "是否验证通过"
          },
          "feedback": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Feedback",
            "description": "验证反馈"
          }
        },
        "type": "object",
        "required": [
          "verified"
        ],
        "title": "InsightVerifyRequest",
        "description": "验证洞察请求"
      },
      "NLQueryRequest": {
        "properties": {
          "source_id": {
            "type": "string",
            "title": "Source Id",
            "description": "数据源ID"
          },
          "nl_query": {
            "type": "string",
            "maxLength": 1000,
            "minLength": 1,
            "title": "Nl Query",
            "description": "自然语言查询"
          },
          "use_cache": {
            "type": "boolean",
            "title": "Use Cache",
            "description": "是否使用缓存的Schema",
            "default": true
          },
          "include_explanation": {
            "type": "boolean",
            "title": "Include Explanation",
            "description": "是否包含SQL解释",
            "default": true
          },
          "timeout": {
            "anyOf": [
              {
                "type": "integer",
                "maximum": 300.0,
                "minimum": 1.0
              },
              {
                "type": "null"
              }
            ],
            "title": "Timeout",
            "description": "查询超时时间(秒)",
            "default": 30
          }
        },
        "type": "object",
        "required": [
          "source_id",
          "nl_query"
        ],
        "title": "NLQueryRequest",
        "description": "自然语言查询请求",
        "example": {
          "include_explanation": true,
          "nl_query": "查询年龄大于18岁的用户数量",
          "source_id": "uuid-string",
          "use_cache": true
        }
      },
      "OntologySuggestionApproveRequest": {
        "properties": {
          "approve": {
            "type": "boolean",
            "title": "Approve",
            "description": "是否批准"
          },
          "feedback": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Feedback",
            "description": "反馈意见"
          }
        },
        "type": "object",
        "required": [
          "approve"
        ],
        "title": "OntologySuggestionApproveRequest",
        "description": "批准Ontology建议请求"
      },
      "OntologySuggestionTypeEnum": {
        "type": "string",
        "enum": [
          "new_term",
          "new_synonym",
          "new_relation"
        ],
        "title": "OntologySuggestionTypeEnum",
        "description": "Ontology建议类型枚举"
      },
      "OrchestrateIntentRequest": {
        "properties": {
          "user_message": {
            "type": "string",
            "title": "User Message",
            "description": "用户消息"
          },
          "virtual_ontology_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Virtual Ontology Id",
            "description": "可选指定虚拟本体ID"
          },
          "entity_type": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Entity Type",
            "description": "可选实体类型"
          },
          "entity_value": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Entity Value",
            "description": "可选实体值"
          },
          "suggested_source_ids": {
            "anyOf": [
              {
                "items": {
                  "type": "string"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Suggested Source Ids",
            "description": "建议的数据源ID"
          }
        },
        "type": "object",
        "required": [
          "user_message"
        ],
        "title": "OrchestrateIntentRequest",
        "description": "编排意图识别与回复请求"
      },
      "PermissionGrantRequest": {
        "properties": {
          "user_id": {
            "type": "string",
            "title": "User Id",
            "description": "用户ID"
          },
          "role": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Role",
            "description": "角色名称"
          },
          "permission_type": {
            "$ref": "#/components/schemas/PermissionTypeEnum",
            "description": "权限类型"
          },
          "resource_type": {
            "$ref": "#/components/schemas/ResourceTypeEnum",
            "description": "资源类型"
          },
          "resource_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Resource Id",
            "description": "资源ID"
          },
          "conditions": {
            "anyOf": [
              {
                "additionalProperties": true,
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "title": "Conditions",
            "description": "条件限制"
          }
        },
        "type": "object",
        "required": [
          "user_id",
          "permission_type",
          "resource_type"
        ],
        "title": "PermissionGrantRequest",
        "description": "授权请求",
        "example": {
          "conditions": {
            "row_filter": "region = 'north'"
          },
          "permission_type": "query",
          "resource_id": "datasource-uuid",
          "resource_type": "datasource",
          "role": "analyst",
          "user_id": "user-123"
        }
      },
      "PermissionTypeEnum": {
        "type": "string",
        "enum": [
          "query",
          "update",
          "delete",
          "admin"
        ],
        "title": "PermissionTypeEnum",
        "description": "权限类型枚举"
      },
      "QueryExecuteRequest": {
        "properties": {
          "source_id": {
            "type": "string",
            "title": "Source Id",
            "description": "数据源ID"
          },
          "query": {
            "type": "string",
            "minLength": 1,
            "title": "Query",
            "description": "SQL查询语句"
          },
          "limit": {
            "anyOf": [
              {
                "type": "integer",
                "maximum": 10000.0,
                "minimum": 1.0
              },
              {
                "type": "null"
              }
            ],
            "title": "Limit",
            "description": "返回行数限制",
            "default": 1000
          },
          "offset": {
            "anyOf": [
              {
                "type": "integer",
                "minimum": 0.0
              },
              {
                "type": "null"
              }
            ],
            "title": "Offset",
            "description": "起始偏移",
            "default": 0
          },
          "timeout": {
            "anyOf": [
              {
                "type": "integer",
                "maximum": 300.0,
                "minimum": 1.0
              },
              {
                "type": "null"
              }
            ],
            "title": "Timeout",
            "description": "查询超时时间(秒)",
            "default": 30
          },
          "params": {
            "anyOf": [
              {
                "items": {},
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Params",
            "description": "可选位置参数，用于参数化查询"
          }
        },
        "type": "object",
        "required": [
          "source_id",
          "query"
        ],
        "title": "QueryExecuteRequest",
        "description": "执行查询请求",
        "example": {
          "limit": 1000,
          "query": "SELECT * FROM users WHERE age > ? LIMIT 100",
          "source_id": "uuid-string",
          "timeout": 30
        }
      },
      "QuestionLevelEnum": {
        "type": "string",
        "enum": [
          "basic",
          "analysis",
          "insight"
        ],
        "title": "QuestionLevelEnum",
        "description": "问题层次枚举"
      },
      "QuestionTypeEnum": {
        "type": "string",
        "enum": [
          "immediate",
          "weekly",
          "monthly",
          "idle",
          "aip_talk"
        ],
        "title": "QuestionTypeEnum",
        "description": "问题类型枚举"
      },
      "RelationApplyRequest": {
        "properties": {
          "relation_ids": {
            "items": {
              "type": "string"
            },
            "type": "array",
            "title": "Relation Ids",
            "description": "要接受的关系 ID 列表"
          },
          "dry_run": {
            "type": "boolean",
            "title": "Dry Run",
            "description": "仅预览，不持久化",
            "default": false
          }
        },
        "type": "object",
        "required": [
          "relation_ids"
        ],
        "title": "RelationApplyRequest",
        "description": "应用推荐关系请求"
      },
      "RelationDiscoverRequest": {
        "properties": {
          "dry_run": {
            "type": "boolean",
            "title": "Dry Run",
            "description": "是否仅 dry-run 预览",
            "default": true
          },
          "threshold": {
            "type": "number",
            "maximum": 1.0,
            "minimum": 0.0,
            "title": "Threshold",
            "description": "置信度阈值",
            "default": 0.75
          },
          "sample_size": {
            "type": "integer",
            "maximum": 100000.0,
            "minimum": 1.0,
            "title": "Sample Size",
            "description": "每表采样行数",
            "default": 1000
          }
        },
        "type": "object",
        "title": "RelationDiscoverRequest",
        "description": "发现并应用关系请求"
      },
      "ResourceTypeEnum": {
        "type": "string",
        "enum": [
          "datasource",
          "table",
          "field"
        ],
        "title": "ResourceTypeEnum",
        "description": "资源类型枚举"
      },
      "ReviewReportRequest": {
        "properties": {
          "report_type": {
            "$ref": "#/components/schemas/ReviewReportTypeEnum",
            "description": "报告类型"
          },
          "period_start": {
            "type": "string",
            "format": "date-time",
            "title": "Period Start",
            "description": "周期开始时间"
          },
          "period_end": {
            "type": "string",
            "format": "date-time",
            "title": "Period End",
            "description": "周期结束时间"
          },
          "session_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Session Id",
            "description": "会话ID"
          },
          "category_ids": {
            "anyOf": [
              {
                "items": {
                  "type": "integer"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Category Ids",
            "description": "分类ID列表"
          },
          "tags": {
            "anyOf": [
              {
                "items": {
                  "type": "string"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Tags",
            "description": "标签列表"
          },
          "only_favorites": {
            "type": "boolean",
            "title": "Only Favorites",
            "description": "仅包含收藏",
            "default": false
          },
          "only_decisions": {
            "type": "boolean",
            "title": "Only Decisions",
            "description": "仅包含关键决策",
            "default": false
          }
        },
        "type": "object",
        "required": [
          "report_type",
          "period_start",
          "period_end"
        ],
        "title": "ReviewReportRequest",
        "description": "复盘报告生成请求",
        "example": {
          "category_ids": [],
          "only_decisions": false,
          "only_favorites": false,
          "period_end": "2026-07-07T23:59:59",
          "period_start": "2026-07-01T00:00:00",
          "report_type": "weekly",
          "tags": []
        }
      },
      "ReviewReportTypeEnum": {
        "type": "string",
        "enum": [
          "daily",
          "weekly",
          "monthly",
          "custom"
        ],
        "title": "ReviewReportTypeEnum",
        "description": "复盘报告类型枚举"
      },
      "RoleAssignRequest": {
        "properties": {
          "user_id": {
            "type": "string",
            "title": "User Id",
            "description": "用户ID"
          },
          "role_name": {
            "type": "string",
            "title": "Role Name",
            "description": "角色名称"
          }
        },
        "type": "object",
        "required": [
          "user_id",
          "role_name"
        ],
        "title": "RoleAssignRequest",
        "description": "分配角色请求"
      },
      "RoleCreateRequest": {
        "properties": {
          "role_name": {
            "type": "string",
            "maxLength": 50,
            "minLength": 1,
            "title": "Role Name",
            "description": "角色名称"
          },
          "description": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Description",
            "description": "角色描述"
          },
          "permissions": {
            "items": {
              "additionalProperties": true,
              "type": "object"
            },
            "type": "array",
            "title": "Permissions",
            "description": "权限列表"
          }
        },
        "type": "object",
        "required": [
          "role_name"
        ],
        "title": "RoleCreateRequest",
        "description": "创建角色请求"
      },
      "SchemaDiscoverRequest": {
        "properties": {
          "sample_size": {
            "type": "integer",
            "maximum": 100000.0,
            "minimum": 1.0,
            "title": "Sample Size",
            "description": "每表采样行数",
            "default": 1000
          },
          "threshold": {
            "type": "number",
            "maximum": 1.0,
            "minimum": 0.0,
            "title": "Threshold",
            "description": "置信度阈值",
            "default": 0.75
          },
          "limit": {
            "type": "integer",
            "maximum": 500.0,
            "minimum": 1.0,
            "title": "Limit",
            "description": "返回最大关系数",
            "default": 50
          },
          "table": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Table",
            "description": "仅返回涉及该表的关系"
          }
        },
        "type": "object",
        "title": "SchemaDiscoverRequest",
        "description": "Schema关系发现请求"
      },
      "SchemaVisualizationRequest": {
        "properties": {
          "view_type": {
            "type": "string",
            "title": "View Type",
            "description": "视图类型: table, er_graph, card",
            "default": "table"
          }
        },
        "type": "object",
        "title": "SchemaVisualizationRequest",
        "description": "Schema可视化请求"
      },
      "TerminologyBatchRequest": {
        "properties": {
          "action": {
            "type": "string",
            "title": "Action",
            "description": "操作类型: add, delete, update"
          },
          "entries": {
            "items": {
              "$ref": "#/components/schemas/TerminologyEntryRequest"
            },
            "type": "array",
            "title": "Entries",
            "description": "术语条目列表"
          }
        },
        "type": "object",
        "required": [
          "action",
          "entries"
        ],
        "title": "TerminologyBatchRequest",
        "description": "批量术语操作请求"
      },
      "TerminologyEntryRequest": {
        "properties": {
          "term": {
            "type": "string",
            "maxLength": 100,
            "minLength": 1,
            "title": "Term",
            "description": "业务术语"
          },
          "table_name": {
            "type": "string",
            "minLength": 1,
            "title": "Table Name",
            "description": "表名"
          },
          "column_name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Column Name",
            "description": "字段名"
          },
          "description": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Description",
            "description": "描述"
          },
          "category": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Category",
            "description": "分类"
          },
          "metadata": {
            "anyOf": [
              {
                "additionalProperties": true,
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "title": "Metadata",
            "description": "元数据"
          }
        },
        "type": "object",
        "required": [
          "term",
          "table_name"
        ],
        "title": "TerminologyEntryRequest",
        "description": "术语条目请求",
        "example": {
          "category": "财务指标",
          "column_name": "total_amount",
          "description": "订单总金额",
          "table_name": "orders",
          "term": "销售额"
        }
      },
      "TerminologySearchRequest": {
        "properties": {
          "query": {
            "type": "string",
            "minLength": 1,
            "title": "Query",
            "description": "搜索关键词"
          },
          "limit": {
            "type": "integer",
            "maximum": 100.0,
            "minimum": 1.0,
            "title": "Limit",
            "description": "返回数量限制",
            "default": 10
          }
        },
        "type": "object",
        "required": [
          "query"
        ],
        "title": "TerminologySearchRequest",
        "description": "术语搜索请求"
      },
      "UpdateCategoryRequest": {
        "properties": {
          "category_id": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Category Id",
            "description": "分类ID"
          }
        },
        "type": "object",
        "title": "UpdateCategoryRequest",
        "description": "更新分类请求"
      },
      "UpdateTagsRequest": {
        "properties": {
          "tags": {
            "items": {
              "type": "string"
            },
            "type": "array",
            "title": "Tags",
            "description": "标签列表"
          }
        },
        "type": "object",
        "title": "UpdateTagsRequest",
        "description": "更新标签请求"
      },
      "ValidationError": {
        "properties": {
          "loc": {
            "items": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "integer"
                }
              ]
            },
            "type": "array",
            "title": "Location"
          },
          "msg": {
            "type": "string",
            "title": "Message"
          },
          "type": {
            "type": "string",
            "title": "Error Type"
          },
          "input": {
            "title": "Input"
          },
          "ctx": {
            "type": "object",
            "title": "Context"
          }
        },
        "type": "object",
        "required": [
          "loc",
          "msg",
          "type"
        ],
        "title": "ValidationError"
      },
      "VirtualOntologyConversationConfirmRequest": {
        "properties": {
          "selected_items": {
            "anyOf": [
              {
                "additionalProperties": {
                  "items": {
                    "type": "string"
                  },
                  "type": "array"
                },
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "title": "Selected Items",
            "description": "用户选择保留的项ID，如 {mappings: [id1], derived_properties: [id2]}"
          }
        },
        "type": "object",
        "title": "VirtualOntologyConversationConfirmRequest",
        "description": "对话确认持久化请求"
      },
      "VirtualOntologyConversationMessageRequest": {
        "properties": {
          "message": {
            "type": "string",
            "minLength": 1,
            "title": "Message",
            "description": "用户消息"
          }
        },
        "type": "object",
        "required": [
          "message"
        ],
        "title": "VirtualOntologyConversationMessageRequest",
        "description": "对话消息请求"
      },
      "VirtualOntologyConversationStartRequest": {
        "properties": {
          "source_ids": {
            "items": {
              "type": "string"
            },
            "type": "array",
            "minItems": 2,
            "title": "Source Ids",
            "description": "参与的数据源ID列表"
          },
          "sample_rows": {
            "anyOf": [
              {
                "additionalProperties": {
                  "additionalProperties": {
                    "items": {
                      "additionalProperties": true,
                      "type": "object"
                    },
                    "type": "array"
                  },
                  "type": "object"
                },
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "title": "Sample Rows",
            "description": "可选样本值"
          }
        },
        "type": "object",
        "required": [
          "source_ids"
        ],
        "title": "VirtualOntologyConversationStartRequest",
        "description": "对话式虚拟本体创建开始请求"
      },
      "VirtualOntologyCreateRequest": {
        "properties": {
          "name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Name",
            "description": "虚拟本体名称"
          },
          "description": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Description",
            "description": "描述"
          },
          "source_ids": {
            "items": {
              "type": "string"
            },
            "type": "array",
            "minItems": 2,
            "title": "Source Ids",
            "description": "参与的数据源ID列表"
          },
          "mapping_ids": {
            "anyOf": [
              {
                "items": {
                  "type": "string"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Mapping Ids",
            "description": "跨源映射ID列表"
          },
          "source_aliases": {
            "anyOf": [
              {
                "additionalProperties": {
                  "type": "string"
                },
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "title": "Source Aliases",
            "description": "自定义数据源别名 {source_id: alias}"
          },
          "derived_properties": {
            "anyOf": [
              {
                "items": {
                  "additionalProperties": true,
                  "type": "object"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Derived Properties",
            "description": "派生属性"
          },
          "gaps": {
            "anyOf": [
              {
                "items": {
                  "additionalProperties": true,
                  "type": "object"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Gaps",
            "description": "Gap 列表"
          },
          "orchestration_rules": {
            "anyOf": [
              {
                "items": {
                  "additionalProperties": true,
                  "type": "object"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Orchestration Rules",
            "description": "编排规则"
          },
          "metadata": {
            "anyOf": [
              {
                "additionalProperties": true,
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "title": "Metadata",
            "description": "元数据"
          }
        },
        "type": "object",
        "required": [
          "source_ids"
        ],
        "title": "VirtualOntologyCreateRequest",
        "description": "创建虚拟本体请求"
      },
      "VirtualOntologyDerivedPropertyEvaluateRequest": {
        "properties": {
          "entity_key": {
            "type": "string",
            "title": "Entity Key",
            "description": "实体键值，如公司名称"
          },
          "entity_type": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Entity Type",
            "description": "实体类型",
            "default": "Customer"
          }
        },
        "type": "object",
        "required": [
          "entity_key"
        ],
        "title": "VirtualOntologyDerivedPropertyEvaluateRequest",
        "description": "派生属性求值请求"
      },
      "VirtualOntologyDerivedPropertyRequest": {
        "properties": {
          "business_description": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Business Description",
            "description": "业务目标描述（用于LLM生成建议）"
          },
          "id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Id",
            "description": "派生属性ID"
          },
          "name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Name",
            "description": "派生属性名"
          },
          "business_term": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Business Term",
            "description": "业务术语"
          },
          "description": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Description",
            "description": "描述"
          },
          "formula": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Formula",
            "description": "公式"
          },
          "formula_type": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Formula Type",
            "description": "sql_expression | python_expression",
            "default": "sql_expression"
          },
          "result_type": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Result Type",
            "description": "结果类型",
            "default": "string"
          },
          "unit": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Unit",
            "description": "单位"
          },
          "source_bindings": {
            "anyOf": [
              {
                "additionalProperties": {
                  "additionalProperties": true,
                  "type": "object"
                },
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "title": "Source Bindings",
            "description": "来源绑定"
          }
        },
        "type": "object",
        "title": "VirtualOntologyDerivedPropertyRequest",
        "description": "派生属性创建/生成请求"
      },
      "VirtualOntologyLLMAlignRequest": {
        "properties": {
          "source_ids": {
            "items": {
              "type": "string"
            },
            "type": "array",
            "minItems": 2,
            "title": "Source Ids",
            "description": "参与对齐的数据源ID列表"
          },
          "sample_rows": {
            "anyOf": [
              {
                "additionalProperties": {
                  "additionalProperties": {
                    "items": {
                      "additionalProperties": true,
                      "type": "object"
                    },
                    "type": "array"
                  },
                  "type": "object"
                },
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "title": "Sample Rows",
            "description": "可选样本值 {source_id: {table: [rows]}}"
          }
        },
        "type": "object",
        "required": [
          "source_ids"
        ],
        "title": "VirtualOntologyLLMAlignRequest",
        "description": "LLM 语义对齐请求"
      },
      "VirtualOntologyRollbackRequest": {
        "properties": {
          "version_id": {
            "type": "string",
            "title": "Version Id",
            "description": "目标版本号，例如 v1"
          },
          "message": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Message",
            "description": "回滚说明",
            "default": ""
          },
          "actor": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Actor",
            "description": "操作者",
            "default": "api"
          }
        },
        "type": "object",
        "required": [
          "version_id"
        ],
        "title": "VirtualOntologyRollbackRequest",
        "description": "虚拟本体回滚请求"
      },
      "VirtualOntologyUpdateRequest": {
        "properties": {
          "name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Name",
            "description": "虚拟本体名称"
          },
          "description": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Description",
            "description": "描述"
          },
          "source_ids": {
            "anyOf": [
              {
                "items": {
                  "type": "string"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Source Ids",
            "description": "参与的数据源ID列表"
          },
          "mapping_ids": {
            "anyOf": [
              {
                "items": {
                  "type": "string"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Mapping Ids",
            "description": "跨源映射ID列表"
          },
          "source_aliases": {
            "anyOf": [
              {
                "additionalProperties": {
                  "type": "string"
                },
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "title": "Source Aliases",
            "description": "自定义数据源别名 {source_id: alias}"
          },
          "derived_properties": {
            "anyOf": [
              {
                "items": {
                  "additionalProperties": true,
                  "type": "object"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Derived Properties",
            "description": "派生属性"
          },
          "gaps": {
            "anyOf": [
              {
                "items": {
                  "additionalProperties": true,
                  "type": "object"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Gaps",
            "description": "Gap 列表"
          },
          "orchestration_rules": {
            "anyOf": [
              {
                "items": {
                  "additionalProperties": true,
                  "type": "object"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Orchestration Rules",
            "description": "编排规则"
          },
          "metadata": {
            "anyOf": [
              {
                "additionalProperties": true,
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "title": "Metadata",
            "description": "元数据"
          }
        },
        "type": "object",
        "title": "VirtualOntologyUpdateRequest",
        "description": "更新虚拟本体请求"
      }
    }
  }
}