Skip to content

feat(API): 添加角色、敌人配置、APL管理相关API,并进行代码格式化#93

Merged
TommrraraSnow merged 12 commits into
mainfrom
feat/api-resolve
Jul 26, 2025
Merged

feat(API): 添加角色、敌人配置、APL管理相关API,并进行代码格式化#93
TommrraraSnow merged 12 commits into
mainfrom
feat/api-resolve

Conversation

@TommrraraSnow

Copy link
Copy Markdown
Member

No description provided.

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
@TommrraraSnow
TommrraraSnow merged commit c68e8b3 into main Jul 26, 2025
3 checks passed
@TommrraraSnow
TommrraraSnow deleted the feat/api-resolve branch July 26, 2025 15:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant