diff --git a/.codebuddy/rules/rules.mdc b/.codebuddy/rules/rules.mdc
deleted file mode 100644
index 2e10553..0000000
--- a/.codebuddy/rules/rules.mdc
+++ /dev/null
@@ -1,85 +0,0 @@
----
-description:
-alwaysApply: true
-enabled: true
-updatedAt: 2025-12-24T03:15:40.776Z
-provider:
----
-
-# 项目开发规则
-
-## 基础设置
-
-1. 保持对话语言为中文
-2. 不允许在未经允许的情况下删除代码和文件,不允许破坏已经正常的业务代码
-3. 执行终端命令时要关注执行情况,避免无效等待
-
-## 代码规范
-
-4. 生成代码时必须添加类级和函数级注释
-5. 使用import导包,禁止使用全限定名称引用类
-6. 禁止使用枚举类型作为entity、request、response、dto对象的字段类型,禁止以枚举类作为方法的入参,确保接口的通用性和可扩展性
-7. 新增数据的id使用已存在的雪花算法生成器生成
-
-## 架构规范
-
-8. 所有开发必须遵循当前项目规范和代码规范
-9. Controller层禁止添加业务逻辑
-10. 使用全局异常处理,禁止使用try-catch
-11. 前端接口访问尽可能走网关调用
-
-## 接口设计规范
-
-12. Controller层接口定义要完整:
- - 入参使用request封装传递到service层
- - service层的方法命名与controller层定义的接口的方法名称保持一致
- - 出参使用response封装由service层传递到controller层
- - 禁止在controller层做entity/domain对象与request/response的转换
- - 使用项目已有的Result做接口返回
-13. 接口和方法参数不允许超过两个,超过时使用request或DTO对象封装
-14. Controller层路由禁止添加/api前缀
-15. Controller层接口的Mapping注解value属性值不允许重复且不允许为空,必须明确指定value属性值且使用驼峰结构命名,避免使用下划线分隔符。所有接口注解必须显式指定value属性,如@GetMapping(value = "/page")、@PostMapping(value = "/create")等,禁止使用@GetMapping()或@PostMapping等空注解形式
-16. 用户相关接口禁止直接传递用户id,需要后端根据token获取当前登录用户信息
-17. 禁止使用/{param}格式的路径参数,避免网关路由冲突和分发错误
-18. 路径参数统一使用@RequestParam而非@PathVariable,确保网关分发准确性
-19. 接口路径命名应具有明确的语义,避免使用通用词汇如/get、/list等
-20. 批量操作接口应使用专门的Request对象封装参数,而非直接传递List
-21. 接口路径应避免层级过深,建议不超过3级路径结构
-22. 更新操作应直接使用封装了ID和其他数据的Request对象,而不是单独传递ID参数。Service层方法应保持参数简洁,业务逻辑所需数据应全部包含在Request对象中
-23. Controller层接口应保持简洁,避免为特定字段创建独立的更新方法(如updateStatus等),应只保留一个通用的update方法,具体的业务逻辑在Service层实现
-24. Service层在执行更新操作时,应对每个字段进行空值检查,只更新非空字段,避免空字段覆盖原有值,确保数据完整性
-25. Controller层应避免创建多个特定条件的查询接口,只保留一个分页查询方法,通过在请求对象中包含所有可查询字段来支持不同的查询需求
-26. 分页查询接口应支持模糊查询和精确查询,通过在Service层根据字段类型和业务需求判断查询方式
-
-## 环境配置
-
-27. 为不同环境(local、dev、prod)创建单独配置文件,部署时通过参数选择
-28. 启动服务时禁止擅自修改端口号,使用配置文件中的端口设置
-
-## 数据库规范
-
-29. 所有数据表必须包含创建时间(create_time)和更新时间(update_time)字段
-30. 删除操作优先使用逻辑删除,添加deleted字段标识
-31. 数据库字段命名使用下划线分隔,Java实体类使用驼峰命名
-32. 优先使用LambdaQueryWrapper构造条件查询,避免硬编码字段名
-33. 使用Lambda表达式引用实体类属性,提高代码可维护性和类型安全
-34. 复杂查询条件应使用LambdaQueryWrapper的链式调用,保持代码清晰
-35. 避免在查询条件中使用字符串字段名,防止字段名变更导致的运行时错误
-
-## 安全规范
-
-36. 所有外部输入必须进行参数校验
-37. 敏感信息不得在日志中输出
-38. 数据库操作必须使用参数化查询,防止SQL注入
-
-## 性能规范
-
-39. 避免N+1查询问题,合理使用批量查询
-40. 大数据量查询必须分页处理
-41. 缓存策略要考虑数据一致性问题
-
-## 日志规范
-
-42. 关键业务操作必须记录操作日志
-43. 异常信息要包含足够的上下文信息
-44. 生产环境禁止输出debug级别日志
\ No newline at end of file
diff --git a/.idea/compiler.xml b/.idea/compiler.xml
index f6a7d7d..c31c83b 100644
--- a/.idea/compiler.xml
+++ b/.idea/compiler.xml
@@ -9,6 +9,7 @@
+
diff --git a/.idea/dataSources.xml b/.idea/dataSources.xml
index c634ce5..50f60ed 100644
--- a/.idea/dataSources.xml
+++ b/.idea/dataSources.xml
@@ -28,5 +28,34 @@
$ProjectFileDir$
+
+ mysql.8
+ true
+ true
+ $PROJECT_DIR$/backend-single/src/main/resources/application-local.yml
+ com.mysql.cj.jdbc.Driver
+ jdbc:mysql://localhost:3306/?useUnicode=true&characterEncoding=utf8&serverTimezone=Asia/Shanghai&useSSL=false&allowPublicKeyRetrieval=true
+
+
+
+
+
+ $ProjectFileDir$
+
+
+ mysql.8
+ true
+ true
+ $PROJECT_DIR$/backend-single/src/main/resources/application-prod.yml
+ com.mysql.cj.jdbc.Driver
+ jdbc:mysql://101.200.208.45:3306/emotion_museum?useUnicode=true&characterEncoding=utf8&serverTimezone=Asia/Shanghai&useSSL=false&allowPublicKeyRetrieval=true
+
+
+
+
+
+
+ $ProjectFileDir$
+
\ No newline at end of file
diff --git a/.idea/jarRepositories.xml b/.idea/jarRepositories.xml
index 1069ab2..4219231 100644
--- a/.idea/jarRepositories.xml
+++ b/.idea/jarRepositories.xml
@@ -6,6 +6,11 @@
+
+
+
+
+
diff --git a/.idea/vcs.xml b/.idea/vcs.xml
index b2799fa..35eb1dd 100644
--- a/.idea/vcs.xml
+++ b/.idea/vcs.xml
@@ -2,6 +2,5 @@
-
\ No newline at end of file
diff --git a/.kiro/specs/admin-frontend/design.md b/.kiro/specs/admin-frontend/design.md
deleted file mode 100644
index e69de29..0000000
diff --git a/.kiro/specs/coze-ai-integration/design.md b/.kiro/specs/coze-ai-integration/design.md
deleted file mode 100644
index 2666a86..0000000
--- a/.kiro/specs/coze-ai-integration/design.md
+++ /dev/null
@@ -1,294 +0,0 @@
-# Design Document
-
-## Overview
-
-本设计文档描述了Coze AI通用接口调用服务的架构设计,以及爽文剧本AI生成功能的实现方案。核心目标是重构AiChatServiceImpl,提供一个通用的、可配置的AI接口调用方法,支持通过config_key获取配置并调用Coze工作流API。
-
-## Architecture
-
-### 系统架构图
-
-```mermaid
-graph TB
- subgraph "Controller Layer"
- EC[EpicScriptController]
- end
-
- subgraph "Service Layer"
- ESS[EpicScriptServiceImpl]
- ACS[AiChatServiceImpl]
- AICS[AiConfigServiceImpl]
- end
-
- subgraph "Data Layer"
- ACM[AiConfigMapper]
- ESM[EpicScriptMapper]
- end
-
- subgraph "External"
- COZE[Coze API]
- end
-
- EC --> ESS
- ESS --> ACS
- ACS --> AICS
- AICS --> ACM
- ESS --> ESM
- ACS --> COZE
-```
-
-### 调用流程图
-
-```mermaid
-sequenceDiagram
- participant C as Controller
- participant ESS as EpicScriptService
- participant ACS as AiChatService
- participant AICS as AiConfigService
- participant DB as Database
- participant COZE as Coze API
-
- C->>ESS: createScript(request)
- ESS->>ESS: assembleInput(request)
- ESS->>ACS: callWorkflowByConfigKey(configKey, input, userId)
- ACS->>AICS: getByConfigKey(configKey)
- AICS->>DB: SELECT * FROM t_ai_config WHERE config_key = ?
- DB-->>AICS: AiConfig
- AICS-->>ACS: AiConfig
- ACS->>ACS: buildWorkflowRequest(config, input, userId)
- ACS->>COZE: POST /v1/workflow/stream_run
- COZE-->>ACS: SSE Stream Response
- ACS->>ACS: parseStreamResponse(response)
- ACS-->>ESS: AI Generated Content
- ESS->>ESS: parseAndSaveScript(content)
- ESS->>DB: INSERT INTO t_epic_script
- ESS-->>C: EpicScriptResponse
-```
-
-## Components and Interfaces
-
-### 1. AiChatService 接口扩展
-
-```java
-/**
- * AI聊天服务接口 - 新增通用工作流调用方法
- */
-public interface AiChatService {
-
- // ... 现有方法 ...
-
- /**
- * 通过配置键调用Coze工作流API
- *
- * @param configKey AI配置键(如:coze.course.life.generate)
- * @param input 输入参数,将作为parameters.input传递给工作流
- * @param userId 用户ID
- * @return AI生成的内容
- */
- String callWorkflowByConfigKey(String configKey, String input, String userId);
-
- /**
- * 通过配置键调用Coze工作流API(带自定义参数)
- *
- * @param configKey AI配置键
- * @param parameters 自定义参数Map,将合并到请求的parameters中
- * @param userId 用户ID
- * @return AI生成的内容
- */
- String callWorkflowByConfigKey(String configKey, Map parameters, String userId);
-}
-```
-
-### 2. AiConfigService 接口扩展
-
-```java
-/**
- * AI配置服务接口 - 新增按配置键获取方法
- */
-public interface AiConfigService {
-
- // ... 现有方法 ...
-
- /**
- * 根据配置键获取AI配置
- *
- * @param configKey 配置键
- * @return AI配置,如果不存在或已禁用则返回null
- */
- AiConfig getByConfigKey(String configKey);
-}
-```
-
-### 3. EpicScriptService 接口(无变化)
-
-现有接口保持不变,实现层调用新的AI服务方法。
-
-## Data Models
-
-### Coze工作流请求格式
-
-```json
-{
- "workflow_id": "7586262962160762926",
- "user_id": "user_123",
- "stream": true,
- "parameters": {
- "input": "用户填写的信息组装后的字符串",
- "user_id": "user_123"
- }
-}
-```
-
-### Coze工作流响应格式(SSE)
-
-```
-id: 0
-event: Message
-data: {"node_title":"End","node_execute_uuid":"","usage":{"token_count":1571,"output_count":812,"input_count":759},"node_is_finish":true,"node_seq_id":"0","content":"{\"output\":\"AI生成的内容...\"}","content_type":"text","node_type":"End","node_id":"900001"}
-
-id: 1
-event: Done
-data: {"node_execute_uuid":"","debug_url":"..."}
-```
-
-### 用户输入组装格式
-
-```
-剧本标题:{title}
-主题/渴望:{theme}
-风格:{style}
-篇幅:{length}
-序幕(低谷回响):{plotIntro}
-转折(契机出现):{plotTurning}
-高潮(命运抉择):{plotClimax}
-结局(新的开始):{plotEnding}
-```
-
-## Correctness Properties
-
-*A property is a characteristic or behavior that should hold true across all valid executions of a system-essentially, a formal statement about what the system should do. Properties serve as the bridge between human-readable specifications and machine-verifiable correctness guarantees.*
-
-### Property 1: Request Format Correctness (请求格式正确性)
-
-*For any* valid AiConfig and input parameters, the generated Coze workflow request SHALL contain:
-- workflow_id from the AiConfig
-- user_id from the call parameters
-- stream set to true
-- parameters.input containing the input string
-- Authorization header with "Bearer {api_token}"
-- Content-Type header set to "application/json"
-
-**Validates: Requirements 2.1, 2.2, 2.3, 2.4, 2.5, 2.6**
-
-### Property 2: Stream Response Parsing (流式响应解析)
-
-*For any* valid Coze SSE stream response containing an "event: Message" line followed by a "data:" line with JSON containing "node_type": "End" and a "content" field with nested JSON containing "output", the parser SHALL extract and return the output value.
-
-**Validates: Requirements 3.1, 3.2, 3.3**
-
-### Property 3: Input Assembly Completeness (输入组装完整性)
-
-*For any* EpicScriptCreateRequest with non-null field values, the assembled input string SHALL contain all provided field values (title, theme, style, length, plotIntro, plotTurning, plotClimax, plotEnding).
-
-**Validates: Requirements 4.2**
-
-### Property 4: Configuration Application (配置应用正确性)
-
-*For any* AiConfig retrieved by config_key:
-- If is_enabled = 0, the system SHALL reject the config and throw an exception
-- The api_base_url, api_token, and workflow_id SHALL be used in the request construction
-- The custom_params SHALL be merged with runtime parameters
-
-**Validates: Requirements 1.3, 5.2, 5.3**
-
-### Property 5: Error Message Quality (错误消息质量)
-
-*For any* error that occurs during AI API calls:
-- The error message SHALL be meaningful and descriptive
-- The error message SHALL NOT contain sensitive information such as API tokens
-- The error message SHALL include relevant context (config_key, status code if applicable)
-
-**Validates: Requirements 6.4, 6.5**
-
-## Error Handling
-
-### 错误类型和处理策略
-
-| 错误类型 | 处理策略 | 返回值 |
-|---------|---------|--------|
-| 配置不存在 | 抛出RuntimeException | "未找到AI配置: {configKey}" |
-| 配置已禁用 | 抛出RuntimeException | "AI配置已禁用: {configKey}" |
-| API调用超时 | 重试(根据配置) | 重试失败后返回错误消息 |
-| HTTP非200响应 | 记录日志,返回错误 | "AI服务调用失败: {statusCode}" |
-| 流式解析失败 | 记录原始数据,返回错误 | "AI响应解析失败" |
-| JSON解析失败 | 返回原始内容 | 原始content字符串 |
-
-### 日志记录规范
-
-```java
-// 请求日志
-log.info("调用Coze工作流: configKey={}, workflowId={}, userId={}", configKey, workflowId, userId);
-
-// 响应日志
-log.info("Coze工作流响应: configKey={}, contentLength={}", configKey, content.length());
-
-// 错误日志
-log.error("Coze工作流调用失败: configKey={}, statusCode={}, error={}", configKey, statusCode, errorMsg);
-```
-
-## Testing Strategy
-
-### 单元测试
-
-1. **AiConfigService测试**
- - 测试getByConfigKey返回正确配置
- - 测试配置不存在时返回null
- - 测试配置禁用时返回null
-
-2. **请求构建测试**
- - 测试buildWorkflowRequest生成正确的请求格式
- - 测试参数合并逻辑
-
-3. **响应解析测试**
- - 测试parseStreamResponse正确解析SSE格式
- - 测试extractOutputFromContent正确提取output字段
-
-4. **输入组装测试**
- - 测试assembleInput正确组装用户输入
-
-### 属性测试
-
-使用JUnit 5进行属性测试,每个属性测试至少运行100次迭代:
-
-1. **Property 1: Request Format Correctness**
- - 生成随机的AiConfig和输入参数
- - 验证生成的请求包含所有必需字段
- - 验证请求头正确设置
- - **Feature: coze-ai-integration, Property 1: Request Format Correctness**
-
-2. **Property 2: Stream Response Parsing**
- - 生成各种有效的SSE格式响应
- - 验证正确提取output内容
- - 测试边界情况(空content、嵌套JSON等)
- - **Feature: coze-ai-integration, Property 2: Stream Response Parsing**
-
-3. **Property 3: Input Assembly Completeness**
- - 生成随机的EpicScriptCreateRequest
- - 验证所有非空字段都出现在组装结果中
- - **Feature: coze-ai-integration, Property 3: Input Assembly Completeness**
-
-4. **Property 4: Configuration Application**
- - 生成随机的AiConfig
- - 验证配置值正确应用到请求
- - 验证禁用配置被拒绝
- - **Feature: coze-ai-integration, Property 4: Configuration Application**
-
-5. **Property 5: Error Message Quality**
- - 模拟各种错误场景
- - 验证错误消息有意义且不包含敏感信息
- - **Feature: coze-ai-integration, Property 5: Error Message Quality**
-
-### 集成测试
-
-1. 端到端测试:从Controller到Coze API的完整调用流程
-2. 配置变更测试:验证配置更新后立即生效
diff --git a/.kiro/specs/coze-ai-integration/requirements.md b/.kiro/specs/coze-ai-integration/requirements.md
deleted file mode 100644
index 303b024..0000000
--- a/.kiro/specs/coze-ai-integration/requirements.md
+++ /dev/null
@@ -1,91 +0,0 @@
-# Requirements Document
-
-## Introduction
-
-本文档定义了优化爽文剧本创建接口(EpicScriptServiceImpl#createScript)的需求,通过调用Coze AI API来生成剧本内容。同时重构AiChatServiceImpl中的AI调用封装,使其成为通用的AI接口调用服务,支持根据配置信息调用不同的AI接口。
-
-## Glossary
-
-- **Coze_API**: 扣子AI平台提供的工作流流式调用接口
-- **AiConfig**: AI配置实体,存储在t_ai_config表中,包含API地址、Token、工作流ID等配置信息
-- **config_key**: AI配置的唯一标识键,用于获取特定场景的配置
-- **workflow_id**: Coze工作流ID,用于指定调用哪个AI工作流
-- **Stream_Response**: 流式响应,Coze API以SSE(Server-Sent Events)格式返回数据
-- **EpicScript**: 爽文剧本实体,存储用户创建的剧本信息
-- **input_parameter**: 传递给Coze工作流的输入参数,包含用户填写的信息
-
-## Requirements
-
-### Requirement 1: 通用AI接口调用服务
-
-**User Story:** As a developer, I want to have a generic AI API calling service, so that I can easily call different AI configurations without duplicating code.
-
-#### Acceptance Criteria
-
-1. THE AiChatService SHALL provide a generic method to call Coze workflow API by config_key
-2. WHEN a config_key is provided, THE AiChatService SHALL retrieve the corresponding AiConfig from database
-3. WHEN the AiConfig is retrieved, THE AiChatService SHALL construct the request using api_base_url, api_token, and workflow_id from the config
-4. THE AiChatService SHALL support passing custom input parameters to the workflow
-5. THE AiChatService SHALL handle stream response by default and extract the output content from the response
-6. IF the AiConfig is not found or disabled, THEN THE AiChatService SHALL throw an appropriate exception with clear error message
-
-### Requirement 2: Coze工作流请求构建
-
-**User Story:** As a developer, I want the system to correctly build Coze workflow requests, so that the AI can process my input and return expected results.
-
-#### Acceptance Criteria
-
-1. WHEN building a Coze workflow request, THE System SHALL include workflow_id from AiConfig
-2. WHEN building a Coze workflow request, THE System SHALL include user_id parameter
-3. WHEN building a Coze workflow request, THE System SHALL set stream to true for streaming response
-4. WHEN building a Coze workflow request, THE System SHALL include the input parameter in the parameters object
-5. THE System SHALL set Authorization header with Bearer token from AiConfig.api_token
-6. THE System SHALL set Content-Type header to application/json
-
-### Requirement 3: 流式响应解析
-
-**User Story:** As a developer, I want the system to correctly parse Coze streaming responses, so that I can get the AI-generated content.
-
-#### Acceptance Criteria
-
-1. WHEN receiving a stream response, THE System SHALL parse SSE format data (event: and data: lines)
-2. WHEN the event is "Message" and node_type is "End", THE System SHALL extract the content field
-3. WHEN the content contains JSON with output field, THE System SHALL extract the output value as the final result
-4. WHEN the event is "Done", THE System SHALL complete the stream processing
-5. IF parsing fails, THEN THE System SHALL log the error and return an appropriate error message
-
-### Requirement 4: 爽文剧本AI生成
-
-**User Story:** As a user, I want to create epic scripts using AI, so that I can get professionally generated story content based on my input.
-
-#### Acceptance Criteria
-
-1. WHEN creating an epic script, THE EpicScriptService SHALL call Coze AI using config_key "coze.course.life.generate"
-2. THE EpicScriptService SHALL assemble user input (title, theme, style, length, plotIntro, plotTurning, plotClimax, plotEnding) into a formatted input string
-3. WHEN the AI returns the generated content, THE EpicScriptService SHALL parse and store the result in the EpicScript entity
-4. THE EpicScriptService SHALL store the AI-generated content in appropriate fields (plotJson or dedicated content field)
-5. IF the AI call fails, THEN THE EpicScriptService SHALL log the error and return null or throw an exception
-
-### Requirement 5: 配置管理
-
-**User Story:** As an administrator, I want to manage AI configurations in the database, so that I can easily update API settings without code changes.
-
-#### Acceptance Criteria
-
-1. THE System SHALL retrieve AiConfig by config_key using AiConfigService
-2. THE System SHALL validate that the AiConfig is enabled (is_enabled = 1) before use
-3. THE System SHALL use custom_params from AiConfig to merge with runtime parameters
-4. THE System SHALL respect timeout_ms setting from AiConfig for API calls
-5. THE System SHALL support retry logic based on retry_count and retry_delay_ms from AiConfig
-
-### Requirement 6: 错误处理
-
-**User Story:** As a developer, I want proper error handling for AI API calls, so that I can diagnose and fix issues quickly.
-
-#### Acceptance Criteria
-
-1. IF the API returns non-200 status code, THEN THE System SHALL log the error with status code and response body
-2. IF the stream parsing fails, THEN THE System SHALL log the raw stream data for debugging
-3. IF the network request times out, THEN THE System SHALL retry based on configuration
-4. THE System SHALL provide meaningful error messages to the caller
-5. THE System SHALL not expose sensitive information (like API tokens) in error messages
diff --git a/.kiro/specs/coze-ai-integration/tasks.md b/.kiro/specs/coze-ai-integration/tasks.md
deleted file mode 100644
index 39b966f..0000000
--- a/.kiro/specs/coze-ai-integration/tasks.md
+++ /dev/null
@@ -1,107 +0,0 @@
-# Implementation Plan: Coze AI Integration
-
-## Overview
-
-本实现计划将重构AiChatServiceImpl,添加通用的Coze工作流调用方法,并优化EpicScriptServiceImpl#createScript接口以调用Coze AI生成剧本内容。实现采用增量方式,每个任务都建立在前一个任务的基础上。
-
-## Tasks
-
-- [x] 1. 扩展AiConfigService接口和实现
- - [x] 1.1 在AiConfigService接口中添加getByConfigKey方法
- - 添加方法签名:`AiConfig getByConfigKey(String configKey)`
- - 添加方法级注释说明功能和参数
- - _Requirements: 5.1_
- - [x] 1.2 在AiConfigServiceImpl中实现getByConfigKey方法
- - 使用LambdaQueryWrapper查询config_key匹配且is_enabled=1的配置
- - 返回查询结果,不存在则返回null
- - _Requirements: 1.2, 5.1, 5.2_
-
-- [x] 2. 扩展AiChatService接口
- - [x] 2.1 在AiChatService接口中添加callWorkflowByConfigKey方法
- - 添加方法签名:`String callWorkflowByConfigKey(String configKey, String input, String userId)`
- - 添加重载方法:`String callWorkflowByConfigKey(String configKey, Map parameters, String userId)`
- - 添加方法级注释说明功能、参数和返回值
- - _Requirements: 1.1, 1.4_
-
-- [x] 3. 实现通用工作流调用方法
- - [x] 3.1 在AiChatServiceImpl中实现callWorkflowByConfigKey方法
- - 调用aiConfigService.getByConfigKey获取配置
- - 验证配置存在且启用,否则抛出异常
- - 构建工作流请求(workflow_id, user_id, stream=true, parameters.input)
- - 设置请求头(Authorization, Content-Type)
- - _Requirements: 1.2, 1.3, 1.6, 2.1, 2.2, 2.3, 2.4, 2.5, 2.6_
- - [x] 3.2 实现流式响应处理方法
- - 解析SSE格式响应(event:和data:行)
- - 提取event为Message且node_type为End的content
- - 从content的JSON中提取output字段
- - 处理Done事件完成流处理
- - _Requirements: 3.1, 3.2, 3.3, 3.4_
- - [x] 3.3 实现错误处理逻辑
- - 处理配置不存在/禁用的情况
- - 处理API调用失败(非200状态码)
- - 处理流式解析失败
- - 确保错误消息不包含敏感信息
- - _Requirements: 1.6, 3.5, 6.1, 6.2, 6.4, 6.5_
- - [x] 3.4 编写Property 1属性测试:请求格式正确性
- - **Property 1: Request Format Correctness**
- - **Validates: Requirements 2.1, 2.2, 2.3, 2.4, 2.5, 2.6**
- - [x] 3.5 编写Property 2属性测试:流式响应解析
- - **Property 2: Stream Response Parsing**
- - **Validates: Requirements 3.1, 3.2, 3.3**
-
-- [x] 4. Checkpoint - 验证通用AI调用服务
- - 确保所有测试通过,如有问题请询问用户
-
-- [x] 5. 实现爽文剧本AI生成
- - [x] 5.1 在EpicScriptServiceImpl中添加输入组装方法
- - 创建assembleScriptInput方法
- - 将EpicScriptCreateRequest的字段组装为格式化字符串
- - 包含title, theme, style, length, plotIntro, plotTurning, plotClimax, plotEnding
- - _Requirements: 4.2_
- - [x] 5.2 修改createScript方法调用AI生成
- - 调用assembleScriptInput组装输入
- - 调用aiChatService.callWorkflowByConfigKey("coze.course.life.generate", input, userId)
- - 解析AI返回的内容并存储到EpicScript实体
- - 处理AI调用失败的情况
- - _Requirements: 4.1, 4.3, 4.4, 4.5_
- - [x] 5.3 编写Property 3属性测试:输入组装完整性
- - **Property 3: Input Assembly Completeness**
- - **Validates: Requirements 4.2**
-
-- [x] 6. 实现配置参数合并
- - [x] 6.1 实现custom_params合并逻辑
- - 解析AiConfig.customParams JSON字符串
- - 将custom_params与运行时参数合并
- - 运行时参数优先级高于custom_params
- - _Requirements: 5.3_
- - [x] 6.2 实现超时和重试配置
- - 应用AiConfig.timeoutMs设置
- - 实现基于retry_count和retry_delay_ms的重试逻辑
- - _Requirements: 5.4, 5.5, 6.3_
- - [x] 6.3 编写Property 4属性测试:配置应用正确性
- - **Property 4: Configuration Application**
- - **Validates: Requirements 1.3, 5.2, 5.3**
-
-- [x] 7. 完善错误处理和日志
- - [x] 7.1 完善错误消息格式
- - 确保错误消息包含config_key和状态码
- - 确保不暴露API token等敏感信息
- - 添加详细的日志记录
- - _Requirements: 6.1, 6.2, 6.4, 6.5_
- - [x] 7.2 编写Property 5属性测试:错误消息质量
- - **Property 5: Error Message Quality**
- - **Validates: Requirements 6.4, 6.5**
-
-- [x] 8. Final Checkpoint - 确保所有测试通过
- - 运行所有单元测试和属性测试
- - 确保所有测试通过,如有问题请询问用户
-
-## Notes
-
-- All tasks are required for comprehensive implementation
-- Each task references specific requirements for traceability
-- Checkpoints ensure incremental validation
-- Property tests validate universal correctness properties
-- Unit tests validate specific examples and edge cases
-- 实现语言:Java (Spring Boot)
-- 测试框架:JUnit 5
diff --git a/.kiro/specs/life-script-frontend/design.md b/.kiro/specs/life-script-frontend/design.md
deleted file mode 100644
index 3b0aa12..0000000
--- a/.kiro/specs/life-script-frontend/design.md
+++ /dev/null
@@ -1,611 +0,0 @@
-# Design Document: Life Script Frontend
-
-## Overview
-
-本设计文档描述了基于 React + Tailwind CSS + Headless UI/Radix UI 技术栈,完整还原 PncyssD 原型设计的前端应用架构。应用采用组件化架构,使用 Zustand 进行状态管理,Framer Motion 实现动画效果,并通过 React Router 管理路由。
-
-## Architecture
-
-### 技术栈选型
-
-| 类别 | 技术 | 说明 |
-|------|------|------|
-| 框架 | React 18 + Vite | 现代化构建工具,快速开发体验 |
-| 样式 | Tailwind CSS 3.x | 原子化CSS,完美还原毛玻璃设计 |
-| UI组件 | Radix UI | 无样式可访问组件库 |
-| 状态管理 | Zustand | 轻量级状态管理,支持持久化 |
-| 路由 | React Router v6 | 声明式路由管理 |
-| 动画 | Framer Motion | 声明式动画库,替代GSAP |
-| 图标 | Lucide React | 与原型一致的图标库 |
-| HTTP | Axios | API请求封装 |
-
-### 应用架构图
-
-```mermaid
-graph TB
- subgraph "Application Layer"
- App[App.jsx]
- Router[React Router]
- end
-
- subgraph "Pages"
- Login[LoginPage]
- Onboarding[OnboardingPage]
- Dashboard[DashboardPage]
- end
-
- subgraph "Dashboard Views"
- Timeline[TimelineView]
- Script[ScriptView]
- Path[PathView]
- end
-
- subgraph "Shared Components"
- GlassCard[GlassCard]
- GlassButton[GlassButton]
- GlassInput[GlassInput]
- Modal[Modal]
- Header[Header]
- Sidebar[Sidebar]
- end
-
- subgraph "State Management"
- Store[Zustand Store]
- Persist[localStorage Persist]
- end
-
- subgraph "Services"
- AIService[AI Service]
- AuthService[Auth Service]
- end
-
- App --> Router
- Router --> Login
- Router --> Onboarding
- Router --> Dashboard
-
- Dashboard --> Timeline
- Dashboard --> Script
- Dashboard --> Path
-
- Login --> GlassCard
- Login --> GlassInput
- Onboarding --> GlassCard
- Dashboard --> Sidebar
- Dashboard --> Header
-
- Timeline --> Modal
- Script --> GlassCard
- Path --> GlassCard
-
- Store --> Persist
- Timeline --> AIService
- Script --> AIService
- Path --> AIService
-```
-
-### 目录结构
-
-```
-life-script/
-├── public/
-│ └── assets/
-│ └── images/ # 背景图片、logo等
-├── src/
-│ ├── components/
-│ │ ├── ui/ # 基础UI组件
-│ │ │ ├── GlassCard.jsx
-│ │ │ ├── GlassButton.jsx
-│ │ │ ├── GlassInput.jsx
-│ │ │ ├── GlassTextarea.jsx
-│ │ │ ├── GlassSelect.jsx
-│ │ │ └── index.js
-│ │ ├── layout/ # 布局组件
-│ │ │ ├── Header.jsx
-│ │ │ ├── Sidebar.jsx
-│ │ │ ├── Background.jsx
-│ │ │ └── index.js
-│ │ ├── Modal.jsx # 模态弹窗
-│ │ ├── Loader.jsx # 加载动画
-│ │ └── PromptTag.jsx # 灵感标签
-│ ├── pages/
-│ │ ├── LoginPage.jsx
-│ │ ├── OnboardingPage.jsx
-│ │ └── DashboardPage.jsx
-│ ├── views/ # Dashboard子视图
-│ │ ├── TimelineView.jsx
-│ │ ├── ScriptView.jsx
-│ │ ├── PathView.jsx
-│ │ └── ProfileModal.jsx
-│ ├── store/
-│ │ └── useStore.js # Zustand store
-│ ├── services/
-│ │ ├── ai.js # AI服务
-│ │ └── api.js # API封装
-│ ├── hooks/
-│ │ ├── useTransition.js # 页面过渡hook
-│ │ └── useCountdown.js # 倒计时hook
-│ ├── styles/
-│ │ └── index.css # 全局样式
-│ ├── utils/
-│ │ └── constants.js # 常量定义
-│ ├── App.jsx
-│ └── main.jsx
-├── index.html
-├── tailwind.config.js
-├── vite.config.js
-└── package.json
-```
-
-## Components and Interfaces
-
-### 1. 基础UI组件
-
-#### GlassCard
-
-```typescript
-interface GlassCardProps {
- children: React.ReactNode;
- className?: string;
- variant?: 'default' | 'highlight' | 'ai';
- padding?: 'sm' | 'md' | 'lg';
-}
-```
-
-样式规范:
-- 背景: `rgba(15, 17, 26, 0.4)`
-- 模糊: `backdrop-filter: blur(25px) saturate(180%)`
-- 边框: `1px solid rgba(255, 255, 255, 0.08)`
-- 圆角: `32px` (移动端 `20px`)
-- 阴影: `0 20px 50px -12px rgba(0, 0, 0, 0.5)`
-
-#### GlassButton
-
-```typescript
-interface GlassButtonProps {
- children: React.ReactNode;
- onClick?: () => void;
- variant?: 'default' | 'primary' | 'icon';
- disabled?: boolean;
- loading?: boolean;
- className?: string;
-}
-```
-
-样式规范:
-- 背景: `rgba(255, 255, 255, 0.03)`
-- Hover: `rgba(255, 255, 255, 0.08)`
-- Primary变体: `bg-orange-200/5 text-orange-200 border-orange-200/20`
-- 过渡: `all 0.5s cubic-bezier(0.23, 1, 0.32, 1)`
-
-#### GlassInput
-
-```typescript
-interface GlassInputProps {
- label?: string;
- type?: 'text' | 'tel' | 'date';
- placeholder?: string;
- value: string;
- onChange: (value: string) => void;
- maxLength?: number;
- className?: string;
-}
-```
-
-样式规范:
-- 背景: `rgba(0, 0, 0, 0.2)`
-- 边框: `1px solid rgba(255, 255, 255, 0.05)`
-- Focus: `border-color: #FFAB91; box-shadow: 0 0 20px rgba(255, 171, 145, 0.1)`
-- 圆角: `16px`
-- 内边距: `14px 20px`
-
-#### GlassTextarea
-
-```typescript
-interface GlassTextareaProps {
- label?: string;
- placeholder?: string;
- value: string;
- onChange: (value: string) => void;
- rows?: number;
- className?: string;
-}
-```
-
-#### GlassSelect
-
-```typescript
-interface GlassSelectProps {
- label?: string;
- options: Array<{ value: string; label: string }>;
- value: string;
- onChange: (value: string) => void;
- className?: string;
-}
-```
-
-### 2. 布局组件
-
-#### Background
-
-动态流体背景组件,包含:
-- 渐变底层: `from-[#1a1c2c] via-[#0a0c10] to-[#2d1b10]`
-- 浮动模糊圆: 蓝色 (`bg-blue-900/20`) 和橙色 (`bg-orange-900/10`)
-- 纹理叠加层: `mix-blend-overlay opacity-30`
-
-#### Header
-
-```typescript
-interface HeaderProps {
- showNav?: boolean;
- onProfileClick?: () => void;
-}
-```
-
-固定定位,包含logo和用户按钮。
-
-#### Sidebar
-
-```typescript
-interface SidebarProps {
- activeView: 'timeline' | 'script' | 'path';
- onViewChange: (view: string) => void;
-}
-```
-
-导航分组:
-- 回溯过去: 生命长河
-- 创造未来: 爽文剧本, 实现路径
-
-### 3. 模态弹窗
-
-#### Modal
-
-```typescript
-interface ModalProps {
- isOpen: boolean;
- onClose: () => void;
- children: React.ReactNode;
- maxWidth?: 'sm' | 'md' | 'lg';
-}
-```
-
-使用 Radix UI Dialog 实现,样式:
-- 遮罩: `bg-black/60 backdrop-blur-xl`
-- 内容: GlassCard样式
-- 关闭按钮: 右上角X图标
-
-### 4. 页面组件
-
-#### LoginPage
-
-状态:
-- phone: string
-- code: string
-- countdown: number
-- isLoading: boolean
-
-流程:
-1. 输入手机号 → 点击获取验证码 → 60秒倒计时
-2. 输入验证码 → 点击登录 → 验证成功跳转Onboarding
-
-#### OnboardingPage
-
-状态:
-- currentStep: 1-5
-- formData: RegistrationData
-
-步骤内容:
-1. 基础信息 (nickname, gender, mbti, zodiac, hobbies)
-2. 童年记忆 (date, text) + 灵感标签
-3. 开心经历 (date, text) + 灵感标签
-4. 低谷时刻 (date, text) + 灵感标签
-5. 未来愿景 (vision, ideal)
-
-#### DashboardPage
-
-状态:
-- activeView: 'timeline' | 'script' | 'path'
-- isProfileOpen: boolean
-
-布局:
-- 左侧: Sidebar (3/12 列)
-- 右侧: 内容区 (9/12 列)
-
-### 5. 视图组件
-
-#### TimelineView
-
-```typescript
-interface LifeEvent {
- id: number;
- title: string;
- time: string;
- content: string;
- aiFeedback: string;
-}
-```
-
-功能:
-- 显示事件列表(时间线样式)
-- 添加新事件模态框
-- AI分析反馈
-
-#### ScriptView
-
-```typescript
-interface Script {
- id: number;
- theme: string;
- style: string;
- length: string;
- content: string;
- date: string;
-}
-```
-
-布局:
-- 左侧面板: 角色设定卡片 + 创作需求表单 + 历史卷轴列表
-- 右侧面板: 剧本内容展示
-
-#### PathView
-
-功能:
-- 检查是否有选中的剧本
-- 生成路径步骤
-- 展示路径卡片列表
-
-## Data Models
-
-### State Schema
-
-```typescript
-interface AppState {
- // 认证状态
- isLoggedIn: boolean;
- phone: string;
-
- // 视图状态
- view: 'login' | 'onboarding' | 'dashboard';
- currentStep: number;
-
- // 用户注册数据
- registrationData: {
- nickname: string;
- gender: string;
- zodiac: string;
- mbti: string;
- profession: string;
- hobbies: string[];
- childhood: { date: string; text: string };
- joy: { date: string; text: string };
- low: { date: string; text: string };
- future: { vision: string; ideal: string };
- };
-
- // 生命事件
- lifeEvents: LifeEvent[];
-
- // 剧本
- scripts: Script[];
- selectedScriptId: number | null;
-
- // 路径
- selectedPath: string | null;
-
- // Actions
- save: () => void;
- load: () => void;
- updateRegistration: (data: Partial) => void;
- addLifeEvent: (event: Omit) => void;
- addScript: (script: Omit
-
-
-
-
-
-
-
-
-
-
-

-
-
-
-
-
-

-
人生轨迹
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-