[WIP] Update Flutter app to integrate Story and Character controllers#10
Merged
Merged
Conversation
IfeyChan702
marked this pull request as ready for review
February 12, 2026 10:07
Copilot stopped work on behalf of
IfeyChan702 due to an error
February 12, 2026 10:08
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implementation Plan for Story, Character, and Search Features
Phase 1: Dependencies and Constants
Phase 2: Models
Phase 3: API Service
Phase 4: Widgets
Phase 5: Screens
Phase 6: Platform Configuration
Phase 7: Testing and Validation
Original prompt
背景
Spring 后端已经创建好了 Story(故事)、Character(主角)、Search(统一搜索)等 Controller,但
flutter_app/下的前端代码还是旧的,缺少这些功能模块。需要更新 Flutter 前端代码,使其能完整对接后端所有 API。后端已有 API 端点
Story Controller (
/api/story)POST /api/story/generate- 生成故事(上传图片+选择主角,AI 识别图片物品并生成英语故事)GET /api/story/list- 获取故事列表(支持 characterId、isFavorite 筛选)GET /api/story/{id}- 获取故事详情PUT /api/story/{id}- 更新故事(title, content)DELETE /api/story/{id}- 删除故事POST /api/story/{id}/favorite- 收藏故事DELETE /api/story/{id}/favorite- 取消收藏故事POST /api/story/{id}/share- 生成分享链接GET /api/story/shared/{shareToken}- 通过分享链接查看故事Character Controller (
/api/character)(推断自CharacterController.java,5 个端点)Search Controller (
/api/search)POST /api/search/stories- 搜索故事(keyword, threshold, maxResults)POST /api/search/characters- 搜索主角POST /api/search/all- 全局搜索(故事+主角)故事生成请求格式 (
GenerateStoryRequest){ "image": "base64编码或URL", "imageType": "base64", "characterId": 1, "title": "可选标题" }DeepseekApiClient 图片识别
analyzeImage(imageBase64, imageType)- 识别图片中的物品,返回英语名词列表当前 Flutter 前端状态
已有文件(保留不变):
lib/main.dart- 入口文件lib/services/api_service.dart- API 服务(只有 Note/RAG/Review)lib/services/auth_service.dart- 认证服务lib/services/storage_service.dart- 本地存储lib/models/note_model.dart- 笔记模型lib/models/rag_response_model.dart- RAG 响应模型lib/models/review_record_model.dart- 复习记录模型lib/screens/login_screen.dart- 登录页lib/screens/home_screen.dart- 主页(目前4个tab)lib/screens/notes_list_screen.dart- 笔记列表lib/screens/note_detail_screen.dart- 笔记详情lib/screens/add_note_screen.dart- 添加笔记lib/screens/rag_search_screen.dart- RAG 搜索lib/screens/review_screen.dart- 复习lib/screens/profile_screen.dart- 个人中心lib/widgets/note_card.dart- 笔记卡片lib/widgets/rag_result_card.dart- RAG 结果卡片lib/widgets/review_item_card.dart- 复习项卡片lib/utils/constants.dart- 常量(目前只有 Note/RAG/Review 端点)lib/utils/validators.dartlib/utils/helpers.dartlib/config/app_constants.dartpubspec.yaml- 依赖配置需要新增/修改的内容:
1.
pubspec.yaml- 添加依赖image_picker依赖(用于拍照/选择相册图片)image_cropper或类似依赖(可选)2.
lib/utils/constants.dart- 添加新端点常量3. 新增 Models
lib/models/story_model.dart- 故事模型(id, userId, characterId, title, content, isFavorite, shareToken, createdAt, updatedAt)lib/models/character_model.dart- 主角模型(id, userId, name, description, createdAt)lib/models/generate_story_request.dart- 生成故事请求模型lib/models/generate_story_response.dart- 生成故事响应模型4.
lib/services/api_service.dart- 添加新 API 方法5. 新增 Screens
lib/screens/stories_screen.dart- 故事列表页(显示所有故事,支持筛选收藏)lib/screens/story_detail_screen.dart- 故事详情页(显示完整故事内容,支持收藏/分享/删除)lib/screens/generate_story_screen.dart- 生成故事页(拍照/选择图片 → 选择主角 → 生成故事)lib/screens/characters_screen.dart- 主角管理页(列表+增删改)lib/screens/add_character_screen.dart- 添加/编辑主角页6. 新增 Widgets
lib/widgets/story_card.dart- 故事卡片(显示标题、摘要、收藏状态、创建时间)lib/widgets/character_card.dart- 主角卡片7.
lib/screens/home_screen.dart- 修改底部导航8. Android/iOS 配置
AndroidManifest.xml有相机和存储权限Info.plist有相机和相册权限描述重要注意事项
{ "code": 200, "msg": "...", "data": {...} }或 `{ "code": 200, "rows": [...], "tota...This pull request was created from Copilot chat.
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.