openapi: 3.0.0 info: title: AI小说创作平台API version: 1.0.0 description: AI自动小说创作平台API(当前版本未集成 LangGraph) servers: - url: http://localhost:8000 description: 开发服务器 paths: /api/inspiration: post: summary: 创建新的灵感创意 requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/InspirationInput' responses: '201': description: 灵感创建成功 content: application/json: schema: $ref: '#/components/schemas/Inspiration' /api/outline: post: summary: 生成小说大纲 requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/OutlineRequest' responses: '200': description: 大纲生成成功 content: application/json: schema: $ref: '#/components/schemas/Outline' '202': description: 大纲生成中 /api/novel/{novel_id}/chapter: post: summary: 创作特定章节 parameters: - name: novel_id in: path required: true schema: type: string requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/ChapterRequest' responses: '200': description: 章节创作成功 content: application/json: schema: $ref: '#/components/schemas/Chapter' /api/novel/{novel_id}/global-lines: get: summary: 获取全局线状态 parameters: - name: novel_id in: path required: true schema: type: string responses: '200': description: 全局线数据 content: application/json: schema: $ref: '#/components/schemas/GlobalLines' put: summary: 更新全局线 parameters: - name: novel_id in: path required: true schema: type: string requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/GlobalLinesUpdate' responses: '200': description: 全局线更新成功 content: application/json: schema: $ref: '#/components/schemas/GlobalLines' components: schemas: InspirationInput: type: object required: - title - description - target_chapters properties: title: type: string example: "AI的情感觉醒" description: type: string example: "一个关于人工智能获得情感和自我意识的故事" target_chapters: type: integer minimum: 1 maximum: 100 example: 12 genre: type: array items: type: string example: ["科幻", "情感"] style: type: string example: "文学性较强" OutlineRequest: type: object required: - inspiration_id properties: inspiration_id: type: string format: uuid ChapterRequest: type: object required: - chapter_number properties: chapter_number: type: integer minimum: 1 custom_prompt: type: string description: 自定义创作提示 GlobalLinesUpdate: type: object properties: world_events: type: array items: $ref: '#/components/schemas/WorldEventUpdate' character_developments: type: array items: $ref: '#/components/schemas/CharacterDevelopmentUpdate' relationship_changes: type: array items: $ref: '#/components/schemas/RelationshipChangeUpdate' Inspiration: type: object properties: id: type: string format: uuid title: type: string description: type: string target_chapters: type: integer genre: type: array items: type: string style: type: string created_at: type: string format: date-time updated_at: type: string format: date-time Outline: type: object properties: id: type: string format: uuid inspiration_id: type: string format: uuid title: type: string summary: type: string chapters: type: array items: $ref: '#/components/schemas/ChapterOutline' created_at: type: string format: date-time ChapterOutline: type: object properties: chapter_number: type: integer title: type: string summary: type: string key_events: type: array items: type: string characters_involved: type: array items: type: string Chapter: type: object properties: id: type: string format: uuid novel_id: type: string format: uuid chapter_number: type: integer title: type: string content: type: string word_count: type: integer writing_style: type: string created_at: type: string format: date-time updated_at: type: string format: date-time GlobalLines: type: object properties: world_events: type: array items: $ref: '#/components/schemas/WorldEvent' characters: type: array items: $ref: '#/components/schemas/Character' relationships: type: array items: $ref: '#/components/schemas/Relationship' WorldEvent: type: object properties: id: type: string format: uuid novel_id: type: string format: uuid event_type: type: string enum: ["geography", "history", "culture", "technology", "magic"] description: type: string timestamp: type: string importance: type: string enum: ["major", "minor", "background"] created_at: type: string format: date-time updated_at: type: string format: date-time # 其他schema定义... responses: BadRequest: description: 请求参数错误 content: application/json: schema: type: object properties: error: type: string details: type: object ServerError: description: 服务器内部错误 content: application/json: schema: type: object properties: error: type: string request_id: type: string