feat(API): 添加角色、敌人配置、APL管理相关API,并进行代码格式化#93
Merged
Conversation
This commit introduces a suite of new API endpoints for managing character and enemy configurations, laying the groundwork for more dynamic and user-driven simulation setups. Key changes include: - **Character and Enemy Config Models:** Added Pydantic models (`CharacterConfig`, `EnemyConfig`) to define the structure of character and enemy configurations. - **Database Services:** Implemented `CharacterDB` and `EnemyDB` services to handle the persistence of character and enemy configurations in the SQLite database. - **API Routes:** Created new FastAPI routers for character and enemy configurations, with endpoints for creating, reading, updating, and deleting (CRUD) these configurations. - **API Documentation:** Added a new document `API开发计划.md` to outline the API development plan. - **Testing:** Added comprehensive tests for the new character and enemy config APIs to ensure their correctness and stability. - **Dependencies:** Added `httpx` to `pyproject.toml` for testing async API endpoints. These changes enable users to create, manage, and reuse character and enemy setups, which is a crucial step towards a more flexible and powerful simulation experience.
This commit fixes the API tests for character and enemy configurations. The key changes are: - Corrected the import path for the FastAPI app instance in the test files. - Added cleanup steps to the tests to ensure they are independent and don't cause database constraint violations. - Added the `config_id` to the character config test data to fix validation errors.
- 在 Session 模型中添加 session_name 字段 - 更新数据库表结构,增加 session_name 列 - 修改相关 API 路由,支持会话名称的创建和更新 - 优化数据库查询,确保正确处理会话名称 - 新增测试用例,验证会话名称功能
- 新增角色配置相关路由,包括获取角色列表、角色信息、武器和装备列表等 - 新增敌人配置相关路由,包括获取敌人列表、敌人信息以及创建、获取、更新和删除敌人配置 - 为角色和敌人配置提供了基本的CRUD操作支持
…mports - Add apl.py to git tracking (was previously ignored due to directory rule) - Fix import order in routes/__init__.py to prevent circular imports on macOS - This should resolve the ImportError when running tests on macOS environments [CLAUDE] Resolved circular import issue in API routes
… macOS - Changed from simultaneous import to sequential import to avoid circular import issues - This should resolve the ImportError when running tests on macOS environments [CLAUDE] Resolved circular import issue in API routes
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.
No description provided.