{ "openapi": "3.1.0", "info": { "title": "AI Town Backend", "description": "二次元 AI 小镇陪伴智能体 - World Engine + LLM", "version": "0.1.0" }, "paths": { "/api/v1/notifications": { "get": { "tags": [ "notifications" ], "summary": "List Notifications", "description": "获取通知列表\n\nArgs:\n limit: 返回数量(最大 200)\n unread_only: 仅返回未读通知\n\nReturns:\n 通知列表(按时间倒序,最新的在前)", "operationId": "list_notifications_api_v1_notifications_get", "parameters": [ { "name": "limit", "in": "query", "required": false, "schema": { "type": "integer", "default": 50, "title": "Limit" } }, { "name": "unread_only", "in": "query", "required": false, "schema": { "type": "boolean", "default": false, "title": "Unread Only" } } ], "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/NotificationsListOut" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } } }, "post": { "tags": [ "notifications" ], "summary": "Create Notification", "description": "手动创建通知(前端\"模拟通知\"按钮调用)\n\nBody:\n type: 通知类型 (share/system/character/qq)\n title: 标题\n content: 内容", "operationId": "create_notification_api_v1_notifications_post", "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "additionalProperties": true, "title": "Payload" } } } }, "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/NotificationCreatedOut" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } } }, "delete": { "tags": [ "notifications" ], "summary": "Clear All Notifications", "description": "清除所有通知", "operationId": "clear_all_notifications_api_v1_notifications_delete", "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/NotificationsClearedOut" } } } } } } }, "/api/v1/notifications/{notif_id}/read": { "put": { "tags": [ "notifications" ], "summary": "Mark Notification Read", "description": "标记单条通知为已读", "operationId": "mark_notification_read_api_v1_notifications__notif_id__read_put", "parameters": [ { "name": "notif_id", "in": "path", "required": true, "schema": { "type": "string", "title": "Notif Id" } } ], "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/NotificationMarkedOut" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } } } }, "/api/v1/notifications/read-all": { "put": { "tags": [ "notifications" ], "summary": "Mark All Notifications Read", "description": "标记所有通知为已读", "operationId": "mark_all_notifications_read_api_v1_notifications_read_all_put", "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/NotificationsMarkedAllOut" } } } } } } }, "/api/v1/notifications/{notif_id}": { "delete": { "tags": [ "notifications" ], "summary": "Delete Notification", "description": "删除单条通知", "operationId": "delete_notification_api_v1_notifications__notif_id__delete", "parameters": [ { "name": "notif_id", "in": "path", "required": true, "schema": { "type": "string", "title": "Notif Id" } } ], "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/NotificationDeletedOut" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } } } }, "/api/v1/tools/servers": { "get": { "tags": [ "tools" ], "summary": "List Tool Servers", "description": "列出所有工具命名空间\n\nReturns:\n 命名空间列表(含描述、工具清单、启用状态)", "operationId": "list_tool_servers_api_v1_tools_servers_get", "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ServersListOut" } } } } } } }, "/api/v1/tools/servers/health": { "get": { "tags": [ "tools" ], "summary": "Check Tool Servers Health", "description": "检查所有工具命名空间的健康状态\n\n本地工具为进程内调用,始终在线。", "operationId": "check_tool_servers_health_api_v1_tools_servers_health_get", "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ServersHealthOut" } } } } } } }, "/api/v1/tools/servers/{server_name}": { "get": { "tags": [ "tools" ], "summary": "Get Tool Server Detail", "description": "获取单个命名空间详情\n\nArgs:\n server_name: 命名空间名称(如 \"shop\")", "operationId": "get_tool_server_detail_api_v1_tools_servers__server_name__get", "parameters": [ { "name": "server_name", "in": "path", "required": true, "schema": { "type": "string", "title": "Server Name" } } ], "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ServerDetailOut" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } } } }, "/api/v1/tools/tools": { "get": { "tags": [ "tools" ], "summary": "List All Tools", "description": "列出所有已启用工具\n\nReturns:\n 所有可用工具的扁平列表(仅含已启用工具)", "operationId": "list_all_tools_api_v1_tools_tools_get", "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ToolsListOut" } } } } } } }, "/api/v1/tools/servers/{server_name}/enabled": { "put": { "tags": [ "tools" ], "summary": "Toggle Tool Server", "description": "启用/禁用整个命名空间的所有工具\n\n状态持久化到 Redis hash `tools:enabled`,Character Tick 决策时\n会读取该状态过滤可用工具列表。\n\nArgs:\n server_name: 命名空间名称\n payload: {\"enabled\": true|false}\n\nReturns:\n 更新后的启用状态", "operationId": "toggle_tool_server_api_v1_tools_servers__server_name__enabled_put", "parameters": [ { "name": "server_name", "in": "path", "required": true, "schema": { "type": "string", "title": "Server Name" } } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "additionalProperties": true, "title": "Payload" } } } }, "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ServerToggleOut" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } } } }, "/api/v1/tools/tools/{tool_name}/invoke": { "post": { "tags": [ "tools" ], "summary": "Invoke Tool", "description": "调用本地工具(测试用)\n\nArgs:\n tool_name: 工具全名(如 \"shop.buy_item\")或简短名(如 \"buy_item\")\n server_name: 可选命名空间(用于消歧)\n args: 工具参数(JSON body)\n\nReturns:\n 工具执行结果", "operationId": "invoke_tool_api_v1_tools_tools__tool_name__invoke_post", "parameters": [ { "name": "tool_name", "in": "path", "required": true, "schema": { "type": "string", "title": "Tool Name" } }, { "name": "server_name", "in": "query", "required": false, "schema": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Server Name" } } ], "requestBody": { "content": { "application/json": { "schema": { "anyOf": [ { "type": "object", "additionalProperties": true }, { "type": "null" } ], "title": "Args" } } } }, "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ToolInvokeOut" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } } } }, "/api/v1/characters/{character_id}/diaries": { "get": { "tags": [ "memory-extension" ], "summary": "List Diaries", "description": "获取角色日记列表\n\nArgs:\n character_id: 角色 UUID\n period: 周期过滤(day/week/month/year)\n limit: 返回数量上限", "operationId": "list_diaries_api_v1_characters__character_id__diaries_get", "parameters": [ { "name": "character_id", "in": "path", "required": true, "schema": { "type": "string", "title": "Character Id" } }, { "name": "period", "in": "query", "required": false, "schema": { "anyOf": [ { "enum": [ "day", "week", "month", "year" ], "type": "string" }, { "type": "null" } ], "title": "Period" } }, { "name": "limit", "in": "query", "required": false, "schema": { "type": "integer", "maximum": 200, "minimum": 1, "default": 20, "title": "Limit" } } ], "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/DiariesListOut" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } } } }, "/api/v1/characters/{character_id}/diaries/generate": { "post": { "tags": [ "memory-extension" ], "summary": "Generate Diary", "description": "为角色生成指定周期的日记\n\n需 admin/operator 权限。", "operationId": "generate_diary_api_v1_characters__character_id__diaries_generate_post", "parameters": [ { "name": "character_id", "in": "path", "required": true, "schema": { "type": "string", "title": "Character Id" } }, { "name": "period", "in": "query", "required": false, "schema": { "enum": [ "day", "week", "month", "year" ], "type": "string", "default": "day", "title": "Period" } }, { "name": "character_name", "in": "query", "required": false, "schema": { "type": "string", "default": "", "title": "Character Name" } } ], "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/DiaryGeneratedOut" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } } } }, "/api/v1/characters/{character_id}/person-memory": { "get": { "tags": [ "memory-extension" ], "summary": "Get Person Memory", "description": "获取角色对某用户的记忆\n\n归属校验:仅本人或 admin/operator 可查询。", "operationId": "get_person_memory_api_v1_characters__character_id__person_memory_get", "parameters": [ { "name": "character_id", "in": "path", "required": true, "schema": { "type": "string", "title": "Character Id" } }, { "name": "user_id", "in": "query", "required": true, "schema": { "type": "string", "description": "用户标识", "title": "User Id" }, "description": "用户标识" } ], "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/PersonMemoryGetOut" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } } } }, "/api/v1/characters/{character_id}/person-memory/list": { "get": { "tags": [ "memory-extension" ], "summary": "List Person Memories", "description": "获取角色对所有用户的记忆列表(按热度倒序)\n\n跨用户记忆汇总仅限 admin/operator。", "operationId": "list_person_memories_api_v1_characters__character_id__person_memory_list_get", "parameters": [ { "name": "character_id", "in": "path", "required": true, "schema": { "type": "string", "title": "Character Id" } }, { "name": "limit", "in": "query", "required": false, "schema": { "type": "integer", "maximum": 500, "minimum": 1, "default": 50, "title": "Limit" } } ], "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/PersonMemoriesListOut" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } } } }, "/api/v1/memories/{character_id}": { "get": { "tags": [ "memory-extension" ], "summary": "Get Memories", "description": "获取角色记忆\n\nArgs:\n character_id: 角色 UUID\n limit: 返回数量限制(默认 20)\n\nReturns:\n 角色最近的记忆片段", "operationId": "get_memories_api_v1_memories__character_id__get", "parameters": [ { "name": "character_id", "in": "path", "required": true, "schema": { "type": "string", "title": "Character Id" } }, { "name": "limit", "in": "query", "required": false, "schema": { "type": "integer", "default": 20, "title": "Limit" } } ], "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/MemoriesListOut" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } } } }, "/health": { "get": { "tags": [ "system" ], "summary": "Health", "description": "健康检查\n\n返回服务状态、各模块运行状态、World Tick ID。\n必须模块失败时 status 为 \"degraded\"。", "operationId": "health_health_get", "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HealthOut" } } } } } } }, "/api/v1/auth/login": { "post": { "tags": [ "system" ], "summary": "Login", "description": "登录接口 - 账号密码换取 JWT Token\n\n请求体: {\"username\": \"admin\", \"password\": \"admin123\"}\n返回: {\"token\": \"jwt_token\", \"user_id\": \"admin\", \"expires_in\": 86400}", "operationId": "login_api_v1_auth_login_post", "requestBody": { "content": { "application/json": { "schema": { "additionalProperties": true, "type": "object", "title": "Body" } } }, "required": true }, "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/LoginOut" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } } } }, "/api/v1/system/alerts/webhook": { "post": { "tags": [ "system" ], "summary": "Receive Alerts", "description": "接收 Alertmanager webhook 告警(告警不再只进 UI)\n\n鉴权独立于 JWT 中间件(AuthMiddleware 已豁免该精确路径):\nAuthorization: Bearer ,未配置 token 时一律 403。\n每条告警记结构化 warning 并累加 ai_town_alerts_received_total 计数器,\n使告警在日志与指标两个通道可见。", "operationId": "receive_alerts_api_v1_system_alerts_webhook_post", "responses": { "204": { "description": "Successful Response" } } } }, "/api/v1/modules": { "get": { "tags": [ "system" ], "summary": "List Modules", "description": "列出所有系统模块及其运行状态\n\nReturns:\n 模块列表(含类型、状态、依赖)", "operationId": "list_modules_api_v1_modules_get", "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ModulesListOut" } } } } } } }, "/api/v1/duration/calculate": { "get": { "tags": [ "system" ], "summary": "Calculate Duration", "description": "计算动态耗时\n\nArgs:\n base_duration: 基础耗时(分钟)\n weather: 天气\n is_outdoor: 是否户外\n crowdedness: 拥挤度 0-1\n stamina: 体力 0-100\n mood: 情绪", "operationId": "calculate_duration_api_v1_duration_calculate_get", "parameters": [ { "name": "base_duration", "in": "query", "required": true, "schema": { "type": "integer", "title": "Base Duration" } }, { "name": "weather", "in": "query", "required": false, "schema": { "type": "string", "default": "sunny", "title": "Weather" } }, { "name": "is_outdoor", "in": "query", "required": false, "schema": { "type": "boolean", "default": true, "title": "Is Outdoor" } }, { "name": "crowdedness", "in": "query", "required": false, "schema": { "type": "number", "default": 0.0, "title": "Crowdedness" } }, { "name": "stamina", "in": "query", "required": false, "schema": { "type": "integer", "default": 100, "title": "Stamina" } }, { "name": "mood", "in": "query", "required": false, "schema": { "type": "string", "default": "calm", "title": "Mood" } } ], "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/DurationCalculateOut" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } } } }, "/api/v1/characters": { "get": { "tags": [ "characters" ], "summary": "List Characters", "description": "获取角色列表\n\nArgs:\n limit: 返回数量限制(默认 20)\n active_only: 是否只返回活跃角色(默认 False)\n\nReturns:\n 角色列表", "operationId": "list_characters_api_v1_characters_get", "parameters": [ { "name": "limit", "in": "query", "required": false, "schema": { "type": "integer", "default": 20, "title": "Limit" } }, { "name": "active_only", "in": "query", "required": false, "schema": { "type": "boolean", "default": false, "title": "Active Only" } } ], "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/CharacterListOut" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } } } }, "/api/v1/characters/{character_id}": { "get": { "tags": [ "characters" ], "summary": "Get Character", "description": "获取角色详情\n\nArgs:\n character_id: 角色 UUID\n\nReturns:\n 角色档案 + 实时状态", "operationId": "get_character_api_v1_characters__character_id__get", "parameters": [ { "name": "character_id", "in": "path", "required": true, "schema": { "type": "string", "title": "Character Id" } } ], "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/CharacterDetailOut" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } } } }, "/api/v1/characters/{character_id}/reflections": { "get": { "tags": [ "characters" ], "summary": "Get Reflections", "description": "获取角色反思记录\n\nArgs:\n character_id: 角色 UUID\n limit: 返回数量限制(默认 10)\n\nReturns:\n 角色最近的反思记录(按创建时间倒序)", "operationId": "get_reflections_api_v1_characters__character_id__reflections_get", "parameters": [ { "name": "character_id", "in": "path", "required": true, "schema": { "type": "string", "title": "Character Id" } }, { "name": "limit", "in": "query", "required": false, "schema": { "type": "integer", "default": 10, "title": "Limit" } } ], "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ReflectionsOut" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } } } }, "/api/v1/characters/{character_id}/plans": { "get": { "tags": [ "characters" ], "summary": "Get Plans", "description": "获取角色进行中的计划\n\nArgs:\n character_id: 角色 UUID\n\nReturns:\n 角色所有 active 状态的计划(按优先级降序)", "operationId": "get_plans_api_v1_characters__character_id__plans_get", "parameters": [ { "name": "character_id", "in": "path", "required": true, "schema": { "type": "string", "title": "Character Id" } } ], "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/PlansOut" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } } } }, "/api/v1/characters/{character_id}/actions": { "get": { "tags": [ "characters" ], "summary": "Get Action History", "description": "获取角色行为历史\n\nArgs:\n character_id: 角色 UUID\n limit: 返回数量限制(默认 50)\n\nReturns:\n 角色行为时间线(按时间倒序)", "operationId": "get_action_history_api_v1_characters__character_id__actions_get", "parameters": [ { "name": "character_id", "in": "path", "required": true, "schema": { "type": "string", "title": "Character Id" } }, { "name": "limit", "in": "query", "required": false, "schema": { "type": "integer", "default": 50, "title": "Limit" } } ], "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ActionsOut" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } } } }, "/api/v1/characters/{character_id}/move": { "post": { "tags": [ "characters" ], "summary": "Move Character", "description": "角色移动到指定场景\n\nArgs:\n character_id: 角色 ID\n to_scene: 目标场景 ID\n hour: 当前小时(用于开放判断),默认从世界状态获取", "operationId": "move_character_api_v1_characters__character_id__move_post", "parameters": [ { "name": "character_id", "in": "path", "required": true, "schema": { "type": "string", "title": "Character Id" } }, { "name": "to_scene", "in": "query", "required": true, "schema": { "type": "string", "title": "To Scene" } }, { "name": "hour", "in": "query", "required": false, "schema": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "title": "Hour" } } ], "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "type": "object", "additionalProperties": true, "title": "Response Move Character Api V1 Characters Character Id Move Post" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } } } }, "/api/v1/characters/{character_id}/schedule": { "get": { "tags": [ "characters" ], "summary": "Get Character Schedule", "description": "获取角色作息状态\n\nArgs:\n character_id: 角色 ID\n hour: 查询的小时(默认当前小时)", "operationId": "get_character_schedule_api_v1_characters__character_id__schedule_get", "parameters": [ { "name": "character_id", "in": "path", "required": true, "schema": { "type": "string", "title": "Character Id" } }, { "name": "hour", "in": "query", "required": false, "schema": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "title": "Hour" } } ], "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ScheduleOut" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } } } }, "/api/v1/characters/{character_id}/relations": { "get": { "tags": [ "characters" ], "summary": "Get Character Relations", "description": "获取角色的所有关系", "operationId": "get_character_relations_api_v1_characters__character_id__relations_get", "parameters": [ { "name": "character_id", "in": "path", "required": true, "schema": { "type": "string", "title": "Character Id" } } ], "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/RelationsOut" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } } } }, "/api/v1/characters/{character_id}/nearby": { "get": { "tags": [ "characters" ], "summary": "Get Character Nearby", "description": "获取与该角色同场景的其他角色(多智能体交互可见性)\n\n用于前端展示「当前场景中还有谁」,让用户感知到角色间的社交可能性。\n返回数据含角色档案、当前动作、与查询角色的关系强度。\n\nArgs:\n character_id: 角色 UUID\n\nReturns:\n {\n \"data\": [\n {\n \"id\": \"...\",\n \"name\": \"...\",\n \"personality\": \"...\",\n \"mood\": \"...\",\n \"current_action_name\": \"...\",\n \"relationship_type\": \"...\",\n \"strength\": 50,\n \"location\": \"cafe\"\n }\n ],\n \"total\": N,\n \"location\": \"cafe\"\n }", "operationId": "get_character_nearby_api_v1_characters__character_id__nearby_get", "parameters": [ { "name": "character_id", "in": "path", "required": true, "schema": { "type": "string", "title": "Character Id" } } ], "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/NearbyOut" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } } } }, "/api/v1/characters/{character_id}/relations/{target_id}/interact": { "post": { "tags": [ "characters" ], "summary": "Record Interaction", "description": "记录角色间互动(更新关系)", "operationId": "record_interaction_api_v1_characters__character_id__relations__target_id__interact_post", "parameters": [ { "name": "character_id", "in": "path", "required": true, "schema": { "type": "string", "title": "Character Id" } }, { "name": "target_id", "in": "path", "required": true, "schema": { "type": "string", "title": "Target Id" } }, { "name": "strength_delta", "in": "query", "required": false, "schema": { "type": "integer", "default": 0, "title": "Strength Delta" } }, { "name": "notes", "in": "query", "required": false, "schema": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Notes" } } ], "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "type": "object", "additionalProperties": true, "title": "Response Record Interaction Api V1 Characters Character Id Relations Target Id Interact Post" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } } } }, "/api/v1/characters/{character_id}/state-history": { "get": { "tags": [ "characters" ], "summary": "Get Character State History", "description": "获取角色状态历史记录(用于状态图表)\n\nArgs:\n character_id: 角色 ID\n limit: 返回记录数(默认 50)\n\nReturns:\n 状态历史列表(按时间正序,便于前端绘制曲线)", "operationId": "get_character_state_history_api_v1_characters__character_id__state_history_get", "parameters": [ { "name": "character_id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid", "title": "Character Id" } }, { "name": "limit", "in": "query", "required": false, "schema": { "type": "integer", "default": 50, "title": "Limit" } } ], "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/StateHistoryOut" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } } } }, "/api/v1/characters/{character_id}/messages": { "get": { "tags": [ "characters" ], "summary": "Get Character Messages", "description": "获取角色的消息历史(跨会话)\n\n归属校验:普通用户仅返回本人与该角色的会话消息,\nadmin/operator 可跨用户聚合。\n\nArgs:\n character_id: 角色 ID\n user: 鉴权主体(含 RBAC 角色)\n limit: 返回数量上限\n\nReturns:\n 消息列表(按时间正序)", "operationId": "get_character_messages_api_v1_characters__character_id__messages_get", "parameters": [ { "name": "character_id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid", "title": "Character Id" } }, { "name": "limit", "in": "query", "required": false, "schema": { "type": "integer", "default": 50, "title": "Limit" } } ], "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "type": "object", "additionalProperties": true, "title": "Response Get Character Messages Api V1 Characters Character Id Messages Get" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } } } }, "/api/v1/world": { "get": { "tags": [ "world" ], "summary": "Get World State", "description": "获取世界状态\n\nReturns:\n 世界当前状态(与前端 WorldState 接口对齐)", "operationId": "get_world_state_api_v1_world_get", "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/WorldStateOut" } } } } } } }, "/api/v1/world/events/{tick_id}": { "get": { "tags": [ "world" ], "summary": "Get World Events", "description": "获取指定 Tick 的世界事件\n\nArgs:\n tick_id: Tick ID\n\nReturns:\n 该 Tick 的所有世界事件(差分记录)", "operationId": "get_world_events_api_v1_world_events__tick_id__get", "parameters": [ { "name": "tick_id", "in": "path", "required": true, "schema": { "type": "integer", "title": "Tick Id" } } ], "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/WorldEventsOut" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } } } }, "/api/v1/world/events": { "get": { "tags": [ "world" ], "summary": "Get World Events Range", "description": "查询 Tick 区间内的所有世界事件(用于事件时间线)\n\nArgs:\n start_tick: 起始 Tick(默认 0)\n end_tick: 结束 Tick(默认 0 表示当前 tick_id)\n event_type: 事件类型过滤(可选)\n limit: 返回数量上限\n\nReturns:\n 世界事件列表(按 tick_id, created_at 排序)", "operationId": "get_world_events_range_api_v1_world_events_get", "parameters": [ { "name": "start_tick", "in": "query", "required": false, "schema": { "type": "integer", "default": 0, "title": "Start Tick" } }, { "name": "end_tick", "in": "query", "required": false, "schema": { "type": "integer", "default": 0, "title": "End Tick" } }, { "name": "event_type", "in": "query", "required": false, "schema": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Event Type" } }, { "name": "limit", "in": "query", "required": false, "schema": { "type": "integer", "default": 100, "title": "Limit" } } ], "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/WorldEventsRangeOut" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } } } }, "/api/v1/actions": { "get": { "tags": [ "actions" ], "summary": "List Actions", "description": "获取所有 Action\n\nReturns:\n 所有已注册的 Action 列表", "operationId": "list_actions_api_v1_actions_get", "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ActionDefsListOut" } } } } } } }, "/api/v1/actions/{action_id}": { "get": { "tags": [ "actions" ], "summary": "Get Action", "description": "获取单个 Action 详情\n\nArgs:\n action_id: Action ID\n\nReturns:\n Action 详情", "operationId": "get_action_api_v1_actions__action_id__get", "parameters": [ { "name": "action_id", "in": "path", "required": true, "schema": { "type": "string", "title": "Action Id" } } ], "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ActionDefOut" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } } } }, "/api/v1/town/scenes": { "get": { "tags": [ "town" ], "summary": "List Scenes", "description": "获取所有场景列表", "operationId": "list_scenes_api_v1_town_scenes_get", "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ScenesListOut" } } } } } } }, "/api/v1/town/scenes/{scene_id}": { "get": { "tags": [ "town" ], "summary": "Get Scene Detail", "description": "获取场景详情(含实时状态)", "operationId": "get_scene_detail_api_v1_town_scenes__scene_id__get", "parameters": [ { "name": "scene_id", "in": "path", "required": true, "schema": { "type": "string", "title": "Scene Id" } } ], "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/SceneOut" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } } } }, "/api/v1/messages/send": { "post": { "tags": [ "messages" ], "summary": "Send Message", "description": "发送消息给角色并获取回复\n\n身份绑定:JWT 用户只能以本人身份发言(user_id 必须等于 token sub);\nAPI Key 属机器对机器桥接(如 OneBot REST 调用方),允许代发任意 user_id。\n\nArgs:\n principal: 鉴权主体({\"user_id\", \"auth_method\"})\n character_id: 角色 UUID\n user_id: 用户标识\n platform: 来源平台(web/qq/lark/internal)\n content: 用户消息内容\n\nReturns:\n 角色回复内容与元数据(token/cost/conversation_id)\n\nRaises:\n HTTPException: 403 当 JWT 用户的 user_id 与 token sub 不一致", "operationId": "send_message_api_v1_messages_send_post", "parameters": [ { "name": "platform", "in": "query", "required": false, "schema": { "type": "string", "default": "web", "title": "Platform" } }, { "name": "content", "in": "query", "required": false, "schema": { "type": "string", "default": "", "title": "Content" } } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Body_send_message_api_v1_messages_send_post" } } } }, "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/SendMessageOut" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } } } }, "/api/v1/messages/history": { "get": { "tags": [ "messages" ], "summary": "Get Message History", "description": "获取会话消息历史(支持游标分页)\n\nArgs:\n conversation_id: 会话 UUID\n limit: 返回数量上限(默认 50)\n before: 游标时间(ISO 8601),仅返回该时间点之前的消息\n\nReturns:\n 消息列表(按时间倒序)", "operationId": "get_message_history_api_v1_messages_history_get", "parameters": [ { "name": "conversation_id", "in": "query", "required": true, "schema": { "type": "string", "title": "Conversation Id" } }, { "name": "limit", "in": "query", "required": false, "schema": { "type": "integer", "default": 50, "title": "Limit" } }, { "name": "before", "in": "query", "required": false, "schema": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Before" } } ], "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/MessageHistoryListOut" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } } } }, "/api/v1/conversations": { "get": { "tags": [ "messages" ], "summary": "List Conversations", "description": "查询会话列表(仅返回当前用户的会话)\n\nArgs:\n current_user: 当前认证用户(JWT/API Key)\n character_id: 可选,按角色过滤\n user_id: 可选,按用户过滤;与当前用户不一致时拒绝\n limit: 返回数量上限\n\nReturns:\n 会话列表(按 last_message_at 倒序)", "operationId": "list_conversations_api_v1_conversations_get", "parameters": [ { "name": "character_id", "in": "query", "required": false, "schema": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Character Id" } }, { "name": "user_id", "in": "query", "required": false, "schema": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "User Id" } }, { "name": "limit", "in": "query", "required": false, "schema": { "type": "integer", "default": 50, "title": "Limit" } } ], "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ConversationsListOut" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } } } }, "/api/v1/messages/stats": { "get": { "tags": [ "messages" ], "summary": "Get Message Stats", "description": "获取消息统计(token/cost 累计,供成本监控)\n\nArgs:\n character_id: 可选,按角色过滤\n start_date: 可选,起始日期(ISO 8601)\n end_date: 可选,结束日期(ISO 8601)\n\nReturns:\n 累计消息数、token 数与 cost(USD),含按角色/按日期分组", "operationId": "get_message_stats_api_v1_messages_stats_get", "parameters": [ { "name": "character_id", "in": "query", "required": false, "schema": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Character Id" } }, { "name": "start_date", "in": "query", "required": false, "schema": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Start Date" } }, { "name": "end_date", "in": "query", "required": false, "schema": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "End Date" } } ], "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/MessageStatsOut" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } } } }, "/api/v1/admin/tick": { "post": { "tags": [ "admin" ], "summary": "Force Tick", "description": "强制触发 Tick(管理接口)\n\nArgs:\n character_id: 可选,指定角色 ID。如果为空则对所有活跃角色执行 Tick\n\nReturns:\n 执行结果", "operationId": "force_tick_api_v1_admin_tick_post", "parameters": [ { "name": "character_id", "in": "query", "required": false, "schema": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Character Id" } } ], "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/FlexibleOut" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } } } }, "/api/v1/admin/world/tick": { "post": { "tags": [ "admin" ], "summary": "Force World Tick", "description": "强制触发 World Tick(管理接口)\n\nReturns:\n 执行结果", "operationId": "force_world_tick_api_v1_admin_world_tick_post", "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/FlexibleOut" } } } } } } }, "/api/v1/admin/world/reset-time": { "post": { "tags": [ "admin" ], "summary": "Reset World Time", "description": "重置世界虚拟时间(管理接口)\n\n清除 Redis 中的旧时间状态,让时间演化器在下次 Tick 时重新初始化。\n用于修复初始时间设置错误或需要重置世界时间的场景。\n\nArgs:\n new_time: 可选,ISO 格式的新初始时间(如 \"2026-07-13T08:00:00\")。\n 留空则使用当前现实日期的 08:00 或环境变量配置。\n\nReturns:\n 重置结果", "operationId": "reset_world_time_api_v1_admin_world_reset_time_post", "parameters": [ { "name": "new_time", "in": "query", "required": false, "schema": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "New Time" } } ], "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/FlexibleOut" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } } } }, "/api/v1/admin/status": { "get": { "tags": [ "admin" ], "summary": "Get Admin Status", "description": "获取系统状态(管理接口)\n\nReturns:\n 各组件运行状态", "operationId": "get_admin_status_api_v1_admin_status_get", "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/AdminStatusOut" } } } } } } }, "/api/v1/admin/characters/import": { "post": { "tags": [ "admin" ], "summary": "Import Character Card", "description": "导入角色卡 YAML 文件\n\n通过 JSON body 提供 yaml 字段(值为 YAML 字符串)。\n同名角色将更新档案与初始状态,保留历史数据(记忆/行为/关系)。\n\nArgs:\n payload: JSON body,包含 yaml 字段\n\nReturns:\n 创建或更新的角色信息", "operationId": "import_character_card_api_v1_admin_characters_import_post", "requestBody": { "content": { "application/json": { "schema": { "additionalProperties": true, "type": "object", "title": "Payload" } } }, "required": true }, "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "additionalProperties": true, "type": "object", "title": "Response Import Character Card Api V1 Admin Characters Import Post" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } } } }, "/api/v1/admin/characters/import-batch": { "post": { "tags": [ "admin" ], "summary": "Import Characters Batch", "description": "批量导入角色卡(多角色 YAML,用 --- 分隔)\n\nArgs:\n payload: JSON body,包含 yaml 字段(多角色 YAML 文本)\n\nReturns:\n 导入结果统计", "operationId": "import_characters_batch_api_v1_admin_characters_import_batch_post", "requestBody": { "content": { "application/json": { "schema": { "additionalProperties": true, "type": "object", "title": "Payload" } } }, "required": true }, "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/FlexibleOut" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } } } }, "/api/v1/admin/characters/{character_id}": { "delete": { "tags": [ "admin" ], "summary": "Delete Character", "description": "删除角色及其所有相关数据(管理接口,仅 admin)\n\n删除范围(依赖 PG ON DELETE CASCADE 自动级联):\n- characters / character_states / character_state_history\n- action_records / memory_episodes / reflections / reflection_sources\n- plans / person_memories / conversations→messages / relations / character_diaries\n- Redis 状态键 char:{id}:state\n\nArgs:\n character_id: 角色 ID\n\nReturns:\n 删除结果\n\nRaises:\n 404: 角色不存在", "operationId": "delete_character_api_v1_admin_characters__character_id__delete", "parameters": [ { "name": "character_id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid", "title": "Character Id" } } ], "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/FlexibleOut" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } } } }, "/api/v1/admin/onebot/messages": { "get": { "tags": [ "admin" ], "summary": "Get Onebot Messages", "description": "获取 QQ 消息记录(用于 QQ 消息监控)\n\n查询 platform=qq 的会话中的最近消息,包含发送者和内容。\n\nReturns:\n 消息列表(按时间倒序)", "operationId": "get_onebot_messages_api_v1_admin_onebot_messages_get", "parameters": [ { "name": "limit", "in": "query", "required": false, "schema": { "type": "integer", "default": 50, "title": "Limit" } } ], "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/OnebotMessagesListOut" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } } } }, "/api/v1/admin/proactive-shares": { "get": { "tags": [ "admin" ], "summary": "Get Proactive Shares", "description": "获取主动分享历史记录\n\n仅查询 extra_data.share_type='proactive' 的消息,\n按 share_id 去重(同一次分享投递给多个用户只显示一条)。\n\nReturns:\n 分享记录列表", "operationId": "get_proactive_shares_api_v1_admin_proactive_shares_get", "parameters": [ { "name": "limit", "in": "query", "required": false, "schema": { "type": "integer", "default": 50, "title": "Limit" } } ], "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/SharesListOut" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } } } }, "/api/v1/admin/vector-search": { "post": { "tags": [ "admin" ], "summary": "Vector Search", "description": "向量检索测试 - 调试 pgvector 检索\n\nArgs:\n query: 查询文本\n character_id: 可选角色 ID;缺省时执行跨角色全局检索(探测全部分区)\n top_k: 返回结果数\n\nReturns:\n 检索结果列表(含相似度分数;character_id/character_name 标注归属)", "operationId": "vector_search_api_v1_admin_vector_search_post", "parameters": [ { "name": "query", "in": "query", "required": true, "schema": { "type": "string", "title": "Query" } }, { "name": "character_id", "in": "query", "required": false, "schema": { "anyOf": [ { "type": "string", "format": "uuid" }, { "type": "null" } ], "title": "Character Id" } }, { "name": "top_k", "in": "query", "required": false, "schema": { "type": "integer", "default": 10, "title": "Top K" } } ], "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/_VectorSearchOut" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } } } }, "/api/v1/admin/world/snapshots": { "get": { "tags": [ "admin" ], "summary": "Get World Snapshots", "description": "获取世界快照列表(用于冷启动恢复管理)\n\nReturns:\n 快照列表(按 tick_id 倒序)", "operationId": "get_world_snapshots_api_v1_admin_world_snapshots_get", "parameters": [ { "name": "limit", "in": "query", "required": false, "schema": { "type": "integer", "default": 20, "title": "Limit" } } ], "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/SnapshotsListOut" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } } } }, "/api/v1/admin/logs": { "get": { "tags": [ "admin" ], "summary": "Get Recent Logs", "description": "获取最近的系统日志(从 data/logs/backend.log 读取)\n\nArgs:\n lines: 返回的日志行数(最大 500)\n level: 日志级别过滤(debug/info/warning/error),不传则返回所有\n\nReturns:\n 日志条目列表(按时间倒序,每条为 JSON 解析后的 dict)", "operationId": "get_recent_logs_api_v1_admin_logs_get", "parameters": [ { "name": "lines", "in": "query", "required": false, "schema": { "type": "integer", "default": 100, "title": "Lines" } }, { "name": "level", "in": "query", "required": false, "schema": { "anyOf": [ { "enum": [ "debug", "info", "warning", "error" ], "type": "string" }, { "type": "null" } ], "title": "Level" } } ], "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/LogsListOut" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } } } }, "/api/v1/admin/metrics-prometheus": { "get": { "tags": [ "admin" ], "summary": "Metrics Prometheus", "description": "Prometheus 文本格式指标(管理端专用)\n\n公网 /metrics 已被 nginx 刻意 404(防止指标泄露,见部署加固 M11);\n前端监控面板经此 RBAC 保护端点获取同一份数据。", "operationId": "metrics_prometheus_api_v1_admin_metrics_prometheus_get", "responses": { "200": { "description": "Successful Response", "content": { "text/plain": { "schema": { "type": "string" } } } } } } }, "/api/v1/admin/metrics-detail": { "get": { "tags": [ "admin" ], "summary": "Get Detailed Metrics", "description": "获取详细的系统指标(解析 Prometheus 格式,返回结构化数据)\n\n返回比 /metrics/ 端点更易消费的 JSON 结构,包含:\n- 世界引擎指标(Tick 总数/耗时/错误/当前 ID)\n- 角色引擎指标(Tick 总数/耗时/错误,按角色分组)\n- Action 指标(执行次数/耗时,按 action_id 分组)\n- LLM 指标(调用次数/Token/费用,按 model 分组)\n- 消息指标(处理次数/耗时)\n- 数据库指标(查询耗时分布)\n- 系统状态(活跃角色数/Redis 状态)\n- HTTP 请求指标(请求数/耗时,按 path 分组)", "operationId": "get_detailed_metrics_api_v1_admin_metrics_detail_get", "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/MetricsDetailOut" } } } } } } }, "/api/v1/admin/config": { "get": { "tags": [ "admin" ], "summary": "Get Runtime Config", "description": "获取运行时配置(环境变量默认值 + Redis 覆盖值)\n\nReturns:\n 各配置项的当前值、默认值、类型和说明", "operationId": "get_runtime_config_api_v1_admin_config_get", "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/FlexibleOut" } } } } } }, "put": { "tags": [ "admin" ], "summary": "Update Runtime Config", "description": "更新运行时配置(写入 Redis 覆盖值,无需重启)\n\n通过 Pydantic 校验后写入 Redis,立即生效。\n无效值或越界值会被拒绝并返回 400。\n\nArgs:\n updates: {key: value} 配置更新字典\n\nReturns:\n 更新结果", "operationId": "update_runtime_config_api_v1_admin_config_put", "requestBody": { "content": { "application/json": { "schema": { "additionalProperties": true, "type": "object", "title": "Updates" } } }, "required": true }, "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/FlexibleOut" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } } } }, "/api/v1/admin/config/{key}": { "delete": { "tags": [ "admin" ], "summary": "Reset Config Item", "description": "重置单个配置项为默认值(删除 Redis 覆盖)\n\nArgs:\n key: 配置项键名\n\nRaises:\n 400: 未知配置项", "operationId": "reset_config_item_api_v1_admin_config__key__delete", "parameters": [ { "name": "key", "in": "path", "required": true, "schema": { "type": "string", "title": "Key" } } ], "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/FlexibleOut" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } } } } }, "components": { "schemas": { "ActionDefOut": { "properties": { "id": { "type": "string", "title": "Id" }, "name": { "type": "string", "title": "Name" }, "description": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Description" }, "category": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Category" }, "duration_minutes": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "title": "Duration Minutes" } }, "type": "object", "required": [ "id", "name" ], "title": "ActionDefOut" }, "ActionDefsListOut": { "properties": { "data": { "items": { "$ref": "#/components/schemas/ActionDefOut" }, "type": "array", "title": "Data" }, "total": { "type": "integer", "title": "Total" } }, "type": "object", "required": [ "data", "total" ], "title": "ActionDefsListOut" }, "ActionRecordOut": { "properties": { "id": { "type": "string", "title": "Id" }, "action_id": { "type": "string", "title": "Action Id" }, "action_name": { "type": "string", "title": "Action Name" }, "params": { "anyOf": [ { "additionalProperties": true, "type": "object" }, { "type": "null" } ], "title": "Params" }, "reason": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Reason" }, "result": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Result" }, "duration_minutes": { "type": "integer", "title": "Duration Minutes" }, "location": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Location" }, "related_characters": { "anyOf": [ { "items": {}, "type": "array" }, { "type": "null" } ], "title": "Related Characters" }, "timestamp": { "type": "string", "title": "Timestamp" } }, "type": "object", "required": [ "id", "action_id", "action_name", "duration_minutes", "timestamp" ], "title": "ActionRecordOut" }, "ActionsOut": { "properties": { "data": { "items": { "$ref": "#/components/schemas/ActionRecordOut" }, "type": "array", "title": "Data" }, "total": { "type": "integer", "title": "Total" } }, "type": "object", "required": [ "data", "total" ], "title": "ActionsOut" }, "AdminStatusOut": { "properties": { "redis": { "type": "string", "title": "Redis" }, "world_engine": { "additionalProperties": true, "type": "object", "title": "World Engine" }, "character_engine": { "additionalProperties": true, "type": "object", "title": "Character Engine" }, "action_registry": { "additionalProperties": true, "type": "object", "title": "Action Registry" }, "llm": { "additionalProperties": true, "type": "object", "title": "Llm" } }, "type": "object", "required": [ "redis", "world_engine", "character_engine", "action_registry", "llm" ], "title": "AdminStatusOut" }, "AppNotificationOut": { "properties": { "id": { "type": "string", "title": "Id" }, "type": { "type": "string", "title": "Type" }, "title": { "type": "string", "title": "Title" }, "content": { "type": "string", "title": "Content" }, "created_at": { "type": "string", "title": "Created At" }, "read": { "type": "boolean", "title": "Read" } }, "type": "object", "required": [ "id", "type", "title", "content", "created_at", "read" ], "title": "AppNotificationOut" }, "Body_send_message_api_v1_messages_send_post": { "properties": { "character_id": { "type": "string", "title": "Character Id" }, "user_id": { "type": "string", "title": "User Id" } }, "type": "object", "required": [ "character_id", "user_id" ], "title": "Body_send_message_api_v1_messages_send_post" }, "CharacterDetail": { "properties": { "id": { "type": "string", "title": "Id" }, "name": { "type": "string", "title": "Name" }, "age": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "title": "Age" }, "occupation": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Occupation" }, "personality": { "anyOf": [ { "items": { "type": "string" }, "type": "array" }, { "type": "null" } ], "title": "Personality" }, "traits": { "anyOf": [ { "additionalProperties": true, "type": "object" }, { "type": "null" } ], "title": "Traits" }, "backstory": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Backstory" }, "is_active": { "type": "boolean", "title": "Is Active" } }, "type": "object", "required": [ "id", "name", "is_active" ], "title": "CharacterDetail" }, "CharacterDetailOut": { "properties": { "character": { "$ref": "#/components/schemas/CharacterDetail" }, "state": { "$ref": "#/components/schemas/CharacterStateOut" } }, "type": "object", "required": [ "character", "state" ], "title": "CharacterDetailOut" }, "CharacterItem": { "properties": { "id": { "type": "string", "title": "Id" }, "name": { "type": "string", "title": "Name" }, "age": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "title": "Age" }, "occupation": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Occupation" }, "is_active": { "type": "boolean", "title": "Is Active" } }, "type": "object", "required": [ "id", "name", "is_active" ], "title": "CharacterItem", "description": "角色列表项" }, "CharacterListOut": { "properties": { "data": { "items": { "$ref": "#/components/schemas/CharacterItem" }, "type": "array", "title": "Data" }, "total": { "type": "integer", "title": "Total" } }, "type": "object", "required": [ "data", "total" ], "title": "CharacterListOut" }, "CharacterStateOut": { "properties": { "location": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Location" }, "stamina": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "title": "Stamina" }, "satiety": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "title": "Satiety" }, "mood": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Mood" }, "money": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "title": "Money" }, "phone_battery": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "title": "Phone Battery" }, "social_energy": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "title": "Social Energy" }, "current_action": { "anyOf": [ { "additionalProperties": true, "type": "object" }, { "type": "null" } ], "title": "Current Action" }, "version": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "title": "Version" } }, "type": "object", "title": "CharacterStateOut" }, "ConversationOut": { "properties": { "id": { "type": "string", "title": "Id" }, "character_id": { "type": "string", "title": "Character Id" }, "user_id": { "type": "string", "title": "User Id" }, "platform": { "type": "string", "title": "Platform" }, "last_message_at": { "type": "string", "title": "Last Message At" } }, "type": "object", "required": [ "id", "character_id", "user_id", "platform", "last_message_at" ], "title": "ConversationOut" }, "ConversationsListOut": { "properties": { "data": { "items": { "$ref": "#/components/schemas/ConversationOut" }, "type": "array", "title": "Data" }, "total": { "type": "integer", "title": "Total" } }, "type": "object", "required": [ "data", "total" ], "title": "ConversationsListOut" }, "DiariesListOut": { "properties": { "data": { "items": { "$ref": "#/components/schemas/DiaryOut" }, "type": "array", "title": "Data" }, "total": { "type": "integer", "title": "Total" } }, "type": "object", "required": [ "data", "total" ], "title": "DiariesListOut" }, "DiaryGeneratedOut": { "properties": { "data": { "$ref": "#/components/schemas/DiaryOut" } }, "type": "object", "required": [ "data" ], "title": "DiaryGeneratedOut" }, "DiaryOut": { "properties": { "id": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Id" }, "character_id": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Character Id" }, "period": { "type": "string", "title": "Period" }, "diary_date": { "type": "string", "title": "Diary Date" }, "diary_end_date": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Diary End Date" }, "title": { "type": "string", "title": "Title" }, "content": { "type": "string", "title": "Content" }, "mood": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Mood" }, "generated_at": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Generated At" } }, "type": "object", "required": [ "period", "diary_date", "title", "content" ], "title": "DiaryOut" }, "DurationCalculateOut": { "properties": {}, "additionalProperties": true, "type": "object", "title": "DurationCalculateOut", "description": "动态耗时计算结果(结构随移动矩阵输出,暂透传)" }, "FlexibleOut": { "properties": {}, "additionalProperties": true, "type": "object", "title": "FlexibleOut", "description": "透传响应模型:保留全部字段(形状未命名化端点的过渡声明)" }, "HTTPValidationError": { "properties": { "detail": { "items": { "$ref": "#/components/schemas/ValidationError" }, "type": "array", "title": "Detail" } }, "type": "object", "title": "HTTPValidationError" }, "HealthOut": { "properties": { "status": { "type": "string", "title": "Status" }, "world_tick": { "type": "integer", "title": "World Tick" }, "redis": { "type": "string", "title": "Redis" }, "must_modules": { "additionalProperties": { "type": "boolean" }, "type": "object", "title": "Must Modules" }, "optional_modules": { "additionalProperties": { "type": "boolean" }, "type": "object", "title": "Optional Modules" }, "current_world_time": { "anyOf": [ { "additionalProperties": true, "type": "object" }, { "type": "null" } ], "title": "Current World Time" }, "degraded_reasons": { "items": { "type": "string" }, "type": "array", "title": "Degraded Reasons", "default": [] } }, "type": "object", "required": [ "status", "world_tick", "redis", "must_modules", "optional_modules" ], "title": "HealthOut", "description": "健康检查(api/system.py /health)" }, "LogEntryOut": { "properties": { "timestamp": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Timestamp" }, "level": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Level" }, "event": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Event" } }, "additionalProperties": true, "type": "object", "title": "LogEntryOut", "description": "日志条目(structlog 键值对不定长,透传保留)" }, "LoginOut": { "properties": { "token": { "type": "string", "title": "Token" }, "user_id": { "type": "string", "title": "User Id" } }, "type": "object", "required": [ "token", "user_id" ], "title": "LoginOut" }, "LogsListOut": { "properties": { "data": { "items": { "$ref": "#/components/schemas/LogEntryOut" }, "type": "array", "title": "Data" }, "total": { "type": "integer", "title": "Total" }, "source": { "type": "string", "title": "Source" } }, "type": "object", "required": [ "data", "total", "source" ], "title": "LogsListOut" }, "MemoriesListOut": { "properties": { "data": { "items": { "additionalProperties": true, "type": "object" }, "type": "array", "title": "Data", "default": [] }, "total": { "type": "integer", "title": "Total", "default": 0 } }, "additionalProperties": true, "type": "object", "title": "MemoriesListOut", "description": "角色记忆片段列表(字段随来源多样,暂透传)" }, "MessageHistoryListOut": { "properties": { "data": { "items": { "$ref": "#/components/schemas/MessageOut" }, "type": "array", "title": "Data" }, "total": { "type": "integer", "title": "Total" } }, "type": "object", "required": [ "data", "total" ], "title": "MessageHistoryListOut" }, "MessageOut": { "properties": { "id": { "type": "string", "title": "Id" }, "conversation_id": { "type": "string", "title": "Conversation Id" }, "sender": { "type": "string", "title": "Sender" }, "content": { "type": "string", "title": "Content" }, "tokens": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "title": "Tokens" }, "cost": { "anyOf": [ { "type": "number" }, { "type": "null" } ], "title": "Cost" }, "created_at": { "type": "string", "title": "Created At" }, "share_type": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Share Type" } }, "type": "object", "required": [ "id", "conversation_id", "sender", "content", "created_at" ], "title": "MessageOut" }, "MessageStatsOut": { "properties": { "total_messages": { "type": "integer", "title": "Total Messages" }, "total_tokens": { "type": "integer", "title": "Total Tokens" }, "total_cost": { "type": "number", "title": "Total Cost" }, "by_character": { "anyOf": [ { "additionalProperties": true, "type": "object" }, { "type": "null" } ], "title": "By Character" }, "by_day": { "anyOf": [ { "additionalProperties": true, "type": "object" }, { "type": "null" } ], "title": "By Day" } }, "type": "object", "required": [ "total_messages", "total_tokens", "total_cost" ], "title": "MessageStatsOut" }, "MetricsDetailOut": { "properties": {}, "additionalProperties": true, "type": "object", "title": "MetricsDetailOut", "description": "详细指标聚合(嵌套结构随指标扩展,透传保留)" }, "ModuleEntryOut": { "properties": { "name": { "type": "string", "title": "Name" }, "type": { "type": "string", "title": "Type" }, "status": { "type": "string", "title": "Status" }, "description": { "type": "string", "title": "Description" } }, "type": "object", "required": [ "name", "type", "status", "description" ], "title": "ModuleEntryOut" }, "ModulesListOut": { "properties": { "data": { "items": { "$ref": "#/components/schemas/ModuleEntryOut" }, "type": "array", "title": "Data" }, "total": { "type": "integer", "title": "Total" } }, "type": "object", "required": [ "data", "total" ], "title": "ModulesListOut" }, "NearbyCharacterOut": { "properties": { "id": { "type": "string", "title": "Id" }, "name": { "type": "string", "title": "Name" }, "personality": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Personality" }, "mood": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Mood" }, "current_action_name": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Current Action Name" }, "relationship_type": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Relationship Type" }, "strength": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "title": "Strength" }, "location": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Location" } }, "type": "object", "required": [ "id", "name" ], "title": "NearbyCharacterOut" }, "NearbyOut": { "properties": { "data": { "items": { "$ref": "#/components/schemas/NearbyCharacterOut" }, "type": "array", "title": "Data" }, "total": { "type": "integer", "title": "Total" } }, "type": "object", "required": [ "data", "total" ], "title": "NearbyOut" }, "NotificationCreatedOut": { "properties": { "data": { "$ref": "#/components/schemas/AppNotificationOut" } }, "type": "object", "required": [ "data" ], "title": "NotificationCreatedOut" }, "NotificationDeletedOut": { "properties": { "success": { "type": "boolean", "title": "Success" }, "id": { "type": "string", "title": "Id" } }, "type": "object", "required": [ "success", "id" ], "title": "NotificationDeletedOut" }, "NotificationMarkedOut": { "properties": { "success": { "type": "boolean", "title": "Success" }, "id": { "type": "string", "title": "Id" } }, "type": "object", "required": [ "success", "id" ], "title": "NotificationMarkedOut" }, "NotificationsClearedOut": { "properties": { "success": { "type": "boolean", "title": "Success" } }, "type": "object", "required": [ "success" ], "title": "NotificationsClearedOut" }, "NotificationsListOut": { "properties": { "data": { "items": { "$ref": "#/components/schemas/AppNotificationOut" }, "type": "array", "title": "Data" }, "total": { "type": "integer", "title": "Total" }, "unread": { "type": "integer", "title": "Unread" } }, "type": "object", "required": [ "data", "total", "unread" ], "title": "NotificationsListOut" }, "NotificationsMarkedAllOut": { "properties": { "success": { "type": "boolean", "title": "Success" }, "updated": { "type": "integer", "title": "Updated" } }, "type": "object", "required": [ "success", "updated" ], "title": "NotificationsMarkedAllOut" }, "OnebotMessageEntryOut": { "properties": { "message_id": { "type": "string", "title": "Message Id" }, "conversation_id": { "type": "string", "title": "Conversation Id" }, "character_id": { "type": "string", "title": "Character Id" }, "user_id": { "type": "string", "title": "User Id" }, "sender": { "type": "string", "title": "Sender" }, "content": { "type": "string", "title": "Content" }, "tokens": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "title": "Tokens" }, "cost": { "anyOf": [ { "type": "number" }, { "type": "null" } ], "title": "Cost" }, "created_at": { "type": "string", "title": "Created At" } }, "type": "object", "required": [ "message_id", "conversation_id", "character_id", "user_id", "sender", "content", "created_at" ], "title": "OnebotMessageEntryOut" }, "OnebotMessagesListOut": { "properties": { "data": { "items": { "$ref": "#/components/schemas/OnebotMessageEntryOut" }, "type": "array", "title": "Data" }, "total": { "type": "integer", "title": "Total" } }, "type": "object", "required": [ "data", "total" ], "title": "OnebotMessagesListOut" }, "PersonMemoriesListOut": { "properties": { "data": { "items": { "$ref": "#/components/schemas/PersonMemoryRecordOut" }, "type": "array", "title": "Data" }, "total": { "type": "integer", "title": "Total" } }, "type": "object", "required": [ "data", "total" ], "title": "PersonMemoriesListOut" }, "PersonMemoryGetOut": { "properties": { "data": { "anyOf": [ { "$ref": "#/components/schemas/PersonMemoryRecordOut" }, { "type": "null" } ] }, "exists": { "type": "boolean", "title": "Exists" } }, "type": "object", "required": [ "data", "exists" ], "title": "PersonMemoryGetOut" }, "PersonMemoryRecordOut": { "properties": { "id": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Id" }, "character_id": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Character Id" }, "user_id": { "type": "string", "title": "User Id" }, "platform": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Platform" }, "content": { "type": "string", "title": "Content" }, "heat": { "type": "integer", "title": "Heat", "default": 0 }, "last_interaction_at": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Last Interaction At" }, "created_at": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Created At" }, "updated_at": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Updated At" } }, "type": "object", "required": [ "user_id", "content" ], "title": "PersonMemoryRecordOut" }, "PlanOut": { "properties": { "id": { "type": "string", "title": "Id" }, "type": { "type": "string", "title": "Type" }, "title": { "type": "string", "title": "Title" }, "description": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Description" }, "status": { "type": "string", "title": "Status" }, "priority": { "type": "integer", "title": "Priority" }, "progress": { "type": "integer", "title": "Progress" }, "deadline": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Deadline" }, "created_at": { "type": "string", "title": "Created At" }, "updated_at": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Updated At" } }, "type": "object", "required": [ "id", "type", "title", "status", "priority", "progress", "created_at" ], "title": "PlanOut" }, "PlansOut": { "properties": { "data": { "items": { "$ref": "#/components/schemas/PlanOut" }, "type": "array", "title": "Data" }, "total": { "type": "integer", "title": "Total" } }, "type": "object", "required": [ "data", "total" ], "title": "PlansOut" }, "ReflectionOut": { "properties": { "id": { "type": "string", "title": "Id" }, "content": { "type": "string", "title": "Content" }, "created_at": { "type": "string", "title": "Created At" } }, "type": "object", "required": [ "id", "content", "created_at" ], "title": "ReflectionOut" }, "ReflectionsOut": { "properties": { "data": { "items": { "$ref": "#/components/schemas/ReflectionOut" }, "type": "array", "title": "Data" }, "total": { "type": "integer", "title": "Total" } }, "type": "object", "required": [ "data", "total" ], "title": "ReflectionsOut" }, "RelationOut": { "properties": { "target_id": { "type": "string", "title": "Target Id" }, "target_name": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Target Name" }, "strength": { "type": "integer", "title": "Strength" }, "relationship_type": { "type": "string", "title": "Relationship Type" } }, "type": "object", "required": [ "target_id", "strength", "relationship_type" ], "title": "RelationOut" }, "RelationsOut": { "properties": { "data": { "items": { "$ref": "#/components/schemas/RelationOut" }, "type": "array", "title": "Data" }, "total": { "type": "integer", "title": "Total" } }, "type": "object", "required": [ "data", "total" ], "title": "RelationsOut" }, "SceneOut": { "properties": { "id": { "type": "string", "title": "Id" }, "name": { "type": "string", "title": "Name" }, "description": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Description" }, "type": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Type" }, "capacity": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "title": "Capacity" }, "crowdedness": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "title": "Crowdedness" }, "characters_present": { "anyOf": [ { "items": { "type": "string" }, "type": "array" }, { "type": "null" } ], "title": "Characters Present" } }, "type": "object", "required": [ "id", "name" ], "title": "SceneOut" }, "ScenesListOut": { "properties": { "data": { "items": { "$ref": "#/components/schemas/SceneOut" }, "type": "array", "title": "Data" }, "total": { "type": "integer", "title": "Total" } }, "type": "object", "required": [ "data", "total" ], "title": "ScenesListOut" }, "ScheduleBlockOut": { "properties": { "name": { "type": "string", "title": "Name" }, "start_hour": { "type": "integer", "title": "Start Hour" }, "end_hour": { "type": "integer", "title": "End Hour" }, "activity_level": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Activity Level" } }, "type": "object", "required": [ "name", "start_hour", "end_hour" ], "title": "ScheduleBlockOut" }, "ScheduleOut": { "properties": { "character_id": { "type": "string", "title": "Character Id" }, "schedule_type": { "type": "string", "title": "Schedule Type" }, "blocks": { "items": { "$ref": "#/components/schemas/ScheduleBlockOut" }, "type": "array", "title": "Blocks", "default": [] } }, "type": "object", "required": [ "character_id", "schedule_type" ], "title": "ScheduleOut" }, "SendMessageDataOut": { "properties": { "conversation_id": { "type": "string", "title": "Conversation Id" }, "message_id": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Message Id" }, "content": { "type": "string", "title": "Content" }, "tokens": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "title": "Tokens" }, "cost": { "anyOf": [ { "type": "number" }, { "type": "null" } ], "title": "Cost" }, "error": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Error" } }, "type": "object", "required": [ "conversation_id", "content" ], "title": "SendMessageDataOut" }, "SendMessageOut": { "properties": { "data": { "$ref": "#/components/schemas/SendMessageDataOut" } }, "type": "object", "required": [ "data" ], "title": "SendMessageOut" }, "ServerDetailOut": { "properties": {}, "additionalProperties": true, "type": "object", "title": "ServerDetailOut", "description": "工具命名空间详情(tools 列表动态,透传保留)" }, "ServerToggleOut": { "properties": { "success": { "type": "boolean", "title": "Success" }, "server": { "type": "string", "title": "Server" }, "enabled": { "type": "boolean", "title": "Enabled" } }, "type": "object", "required": [ "success", "server", "enabled" ], "title": "ServerToggleOut" }, "ServersHealthOut": { "properties": { "data": { "items": { "additionalProperties": true, "type": "object" }, "type": "array", "title": "Data" }, "total": { "type": "integer", "title": "Total" }, "online": { "type": "integer", "title": "Online" }, "offline": { "type": "integer", "title": "Offline" } }, "type": "object", "required": [ "data", "total", "online", "offline" ], "title": "ServersHealthOut" }, "ServersListOut": { "properties": { "data": { "items": { "additionalProperties": true, "type": "object" }, "type": "array", "title": "Data" }, "total": { "type": "integer", "title": "Total" } }, "type": "object", "required": [ "data", "total" ], "title": "ServersListOut" }, "ShareEntryOut": { "properties": { "message_id": { "type": "string", "title": "Message Id" }, "conversation_id": { "type": "string", "title": "Conversation Id" }, "character_id": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Character Id" }, "character_name": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Character Name" }, "share_id": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Share Id" }, "sender": { "type": "string", "title": "Sender" }, "content": { "type": "string", "title": "Content" }, "tokens": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "title": "Tokens" }, "cost": { "anyOf": [ { "type": "number" }, { "type": "null" } ], "title": "Cost" }, "created_at": { "type": "string", "title": "Created At" } }, "type": "object", "required": [ "message_id", "conversation_id", "sender", "content", "created_at" ], "title": "ShareEntryOut" }, "SharesListOut": { "properties": { "data": { "items": { "$ref": "#/components/schemas/ShareEntryOut" }, "type": "array", "title": "Data" }, "total": { "type": "integer", "title": "Total" } }, "type": "object", "required": [ "data", "total" ], "title": "SharesListOut" }, "SnapshotEntryOut": { "properties": { "id": { "type": "string", "title": "Id" }, "tick_id": { "type": "integer", "title": "Tick Id" }, "state": { "anyOf": [ { "additionalProperties": true, "type": "object" }, { "type": "null" } ], "title": "State" }, "created_at": { "type": "string", "title": "Created At" } }, "type": "object", "required": [ "id", "tick_id", "created_at" ], "title": "SnapshotEntryOut" }, "SnapshotsListOut": { "properties": { "data": { "items": { "$ref": "#/components/schemas/SnapshotEntryOut" }, "type": "array", "title": "Data" }, "total": { "type": "integer", "title": "Total" } }, "type": "object", "required": [ "data", "total" ], "title": "SnapshotsListOut" }, "StateHistoryOut": { "properties": { "data": { "items": { "$ref": "#/components/schemas/StateHistoryPointOut" }, "type": "array", "title": "Data" }, "total": { "type": "integer", "title": "Total" }, "source": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Source" } }, "type": "object", "required": [ "data", "total" ], "title": "StateHistoryOut" }, "StateHistoryPointOut": { "properties": { "location": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Location" }, "stamina": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "title": "Stamina" }, "satiety": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "title": "Satiety" }, "money": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "title": "Money" }, "social_energy": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "title": "Social Energy" }, "phone_battery": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "title": "Phone Battery" }, "mood": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Mood" }, "action_id": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Action Id" }, "updated_at": { "type": "string", "title": "Updated At" } }, "type": "object", "required": [ "updated_at" ], "title": "StateHistoryPointOut", "description": "状态历史点(与端点实际返回对齐:时间戳字段为 updated_at)" }, "ToolInvokeOut": { "properties": { "success": { "type": "boolean", "title": "Success" }, "endpoint": { "type": "string", "title": "Endpoint" } }, "additionalProperties": true, "type": "object", "required": [ "success", "endpoint" ], "title": "ToolInvokeOut", "description": "工具调用结果(result 结构随工具各异,透传保留)" }, "ToolsListOut": { "properties": { "data": { "items": { "additionalProperties": true, "type": "object" }, "type": "array", "title": "Data" }, "total": { "type": "integer", "title": "Total" } }, "type": "object", "required": [ "data", "total" ], "title": "ToolsListOut" }, "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" }, "WorldEventEntryOut": { "properties": { "id": { "type": "string", "title": "Id" }, "tick_id": { "type": "integer", "title": "Tick Id" }, "event_type": { "type": "string", "title": "Event Type" }, "event_key": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Event Key" }, "payload": { "anyOf": [ { "additionalProperties": true, "type": "object" }, { "type": "null" } ], "title": "Payload" }, "created_at": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Created At" } }, "type": "object", "required": [ "id", "tick_id", "event_type" ], "title": "WorldEventEntryOut" }, "WorldEventOut": { "properties": { "event_type": { "type": "string", "title": "Event Type" }, "payload": { "anyOf": [ { "additionalProperties": true, "type": "object" }, { "type": "null" } ], "title": "Payload" }, "created_at": { "type": "string", "title": "Created At" } }, "type": "object", "required": [ "event_type", "created_at" ], "title": "WorldEventOut" }, "WorldEventsOut": { "properties": { "tick_id": { "type": "integer", "title": "Tick Id" }, "events": { "items": { "$ref": "#/components/schemas/WorldEventOut" }, "type": "array", "title": "Events" } }, "type": "object", "required": [ "tick_id", "events" ], "title": "WorldEventsOut" }, "WorldEventsRangeOut": { "properties": { "data": { "items": { "$ref": "#/components/schemas/WorldEventEntryOut" }, "type": "array", "title": "Data" }, "total": { "type": "integer", "title": "Total" } }, "type": "object", "required": [ "data", "total" ], "title": "WorldEventsRangeOut" }, "WorldStateOut": { "properties": { "tick_id": { "type": "integer", "title": "Tick Id" }, "world_time": { "type": "string", "title": "World Time" }, "weather": { "type": "string", "title": "Weather" }, "temperature": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "title": "Temperature" }, "active_characters": { "type": "integer", "title": "Active Characters" } }, "type": "object", "required": [ "tick_id", "world_time", "weather", "active_characters" ], "title": "WorldStateOut" }, "_VectorSearchItemOut": { "properties": { "id": { "type": "string", "title": "Id" }, "content": { "type": "string", "title": "Content" }, "importance": { "type": "integer", "title": "Importance" }, "timestamp": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Timestamp" }, "similarity": { "type": "number", "title": "Similarity" }, "is_reflected": { "type": "boolean", "title": "Is Reflected" }, "source_type": { "type": "string", "title": "Source Type" }, "character_id": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Character Id" }, "character_name": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Character Name" } }, "type": "object", "required": [ "id", "content", "importance", "similarity", "is_reflected", "source_type" ], "title": "_VectorSearchItemOut", "description": "向量检索单条结果:原字段超集 + 角色归属(单角色模式下为请求范围值/None)" }, "_VectorSearchOut": { "properties": { "data": { "items": { "$ref": "#/components/schemas/_VectorSearchItemOut" }, "type": "array", "title": "Data" }, "total": { "type": "integer", "title": "Total" }, "query": { "type": "string", "title": "Query" } }, "type": "object", "required": [ "data", "total", "query" ], "title": "_VectorSearchOut" } } } }