Commit Graph

616 Commits

Author SHA1 Message Date
bridge
88cc7cd966 feat: add color to map avatar names 2026-01-11 18:54:34 +08:00
bridge
ed7d16b4f3 feature: log print version 2026-01-11 18:27:41 +08:00
bridge
a0cfb3b9da make better conversation template 2026-01-10 01:41:13 +08:00
bridge
ac8c6c1c73 update tips v1.1.0 2026-01-10 00:50:30 +08:00
bridge
33b01fa0e9 fix web 2026-01-10 00:34:44 +08:00
bridge
92fc6d4b83 update protagonist 2026-01-10 00:01:58 +08:00
bridge
79c375802d update protagonist 2026-01-09 23:48:23 +08:00
bridge
da43adac96 update icon 2026-01-09 22:01:51 +08:00
bridge
1499c0cbc8 fix unittest bug 2026-01-09 01:07:52 +08:00
bridge
e5f96b7f43 update readme and tips 2026-01-09 00:50:39 +08:00
bridge
59824d9cd5 update readme and tips 2026-01-09 00:49:16 +08:00
bridge
ff6d1b5de7 add more protagonist 2026-01-08 23:19:35 +08:00
bridge
f8f0e8a59c update tips 2026-01-08 23:06:36 +08:00
bridge
f7d6554e9b update objective front end 2026-01-08 22:49:23 +08:00
bridge
a4dd29145f update tips 2026-01-08 22:35:42 +08:00
bridge
c6a574a2ac refactor: remove switch weapon action 2026-01-08 22:19:56 +08:00
bridge
9c21259577 refactor: add store mixin into city regions & refactor buying action 2026-01-08 22:16:33 +08:00
bridge
d1d7e7d7bd fix conflict with pr-16 2026-01-08 21:23:06 +08:00
Zihao Xu
9e75d8dd2e revert: remove SaveLoadPanel.vue changes 2026-01-08 21:12:18 +08:00
Zihao Xu
9485b62cfd feat: add loading screen with progress tracking
- Add async initialization with 6 phases: scanning_assets, loading_map,
  initializing_sects, generating_avatars, checking_llm, generating_initial_events
- Add /api/init-status endpoint for frontend polling
- Add /api/control/reinit endpoint for error recovery
- Add LoadingOverlay.vue component with:
  - Progress ring with gradient
  - Phase text in xianxia style (rotating messages for LLM phase)
  - Tips that rotate every 5 seconds
  - Time-based background transparency (fades to 80% over 20s)
  - Backdrop blur effect
  - Error state with retry button
- Preload map and avatars during LLM initialization for smoother UX
- Add comprehensive tests for init status API
2026-01-08 21:12:18 +08:00
Zihao Xu
8631be501b fix: prevent game from auto-starting to avoid stale initialization events
Problem:
When loading a save (e.g., from year 106), events from year 100 would appear.
This happened because the game auto-started on server startup and client
connection, generating initialization events before the user could load a save.

Solution:
1. Backend: Keep game paused on startup even if LLM check passes
2. Backend: Remove auto-resume on first WebSocket connection
3. Frontend: Start with game paused (isManualPaused = true)

Now the user must explicitly click 'resume' to start a new game, or load a
save first. This prevents the race condition where game_loop generates events
with stale world state.
2026-01-08 21:10:05 +08:00
Zihao Xu
624f697bee fix: pause game during save load to prevent stale events
The game loop could generate events with the old world's timestamp while
loading a save, causing 100年1月 events to appear after loading a 106年
save. Now we pause the game before loading and keep it paused after,
giving the frontend time to refresh state.
2026-01-08 21:06:34 +08:00
4thfever
6b99552f08 Merge pull request #19 from AI-Cultivation/pr-12
Pr 12
2026-01-08 20:47:50 +08:00
bridge
58486f95e8 fix pytest bugs 2026-01-08 20:22:03 +08:00
bridge
c4ca92efc9 update template 2026-01-08 20:16:22 +08:00
Zihao Xu
06d1bed987 fix: integrate SQLite event storage into load/save system
- Fix load_game to use World.create_with_db() for SQLite event storage
- Add get_events_db_path() to compute event database path from save path
- Add JSON to SQLite migration for backward compatibility with old saves
- Close old EventManager before loading new save to prevent connection leaks
- Add events_db metadata to save file
- Add comprehensive tests for database switching bug and save/load cycle
2026-01-07 23:22:17 -08:00
Zihao Xu
a6b8198c3f Merge branch 'main' into xzhseh/sqlite-event-manager 2026-01-07 20:05:02 -08:00
bridge
1647494c7d update 2026-01-08 01:06:10 +08:00
bridge
a007292b60 update pytest 2026-01-08 00:53:13 +08:00
bridge
fabae13e87 update readme 2026-01-08 00:49:46 +08:00
bridge
060708bd79 update readme 2026-01-08 00:46:42 +08:00
bridge
4e95b57152 modify price system 2026-01-08 00:42:40 +08:00
bridge
40d8a0425b refactor self heal system 2026-01-08 00:33:41 +08:00
bridge
b53f428cbb update unittest 2026-01-07 23:14:48 +08:00
bridge
ea9a873589 use uv instead pip in github actions 2026-01-07 22:48:41 +08:00
bridge
345b759fff use uv instead pip in github actions 2026-01-07 22:46:08 +08:00
bridge
b2a021bf8a rename item -> material & refactor buying action 2026-01-07 22:43:26 +08:00
bridge
73c50286b7 add refine action 2026-01-07 21:28:29 +08:00
bridge
7c69d612b0 add refine action 2026-01-07 21:15:04 +08:00
4thfever
2c8f73d290 Merge pull request #15 from xzhseh/xzhseh/fix-age-exceeds-lifespan
fix: prevent character age from exceeding realm lifespan on creation
2026-01-07 20:36:53 +08:00
bridge
968625d27b fix git action 2026-01-07 20:33:25 +08:00
bridge
1dfce734ef fix occupy & gift given bug 2026-01-07 20:11:01 +08:00
4thfever
8ee0c34f6f Merge pull request #11 from xzhseh/xzhseh/add-ci-workflow
feat: add GitHub Actions CI for pytest
2026-01-07 19:08:00 +08:00
Zihao Xu
37518342fc fix: prevent character age from exceeding realm lifespan on creation 2026-01-07 01:08:12 -08:00
Zihao Xu
2e5a2c3c12 style: add comment to separate state and functions in world.ts 2026-01-07 01:02:17 -08:00
Zihao Xu
355e4d0e3c docs: add sqlite-event-manager spec 2026-01-07 00:46:27 -08:00
Zihao Xu
a1f08dd0ab feat: SQLite event storage with pagination and filtering
Implement SQLite-based event persistence as specified in sqlite-event-manager.md.

## Changes

### Backend
- **EventStorage** (`src/classes/event_storage.py`): New SQLite storage layer
  - Cursor-based pagination with compound cursor `{month_stamp}_{rowid}`
  - Avatar filtering (single and pair queries)
  - Major/minor event separation
  - Cleanup API with `keep_major` and `before_month_stamp` filters

- **EventManager** (`src/classes/event_manager.py`): Refactored to use SQLite
  - Delegates to EventStorage for persistence
  - Memory fallback mode for testing
  - New `get_events_paginated()` method

- **API** (`src/server/main.py`):
  - `GET /api/events` - Paginated event retrieval with filtering
  - `DELETE /api/events/cleanup` - User-triggered cleanup

### Frontend
- **EventPanel.vue**: Scroll-to-load pagination, dual-person filter UI
- **world.ts**: Event state management with pagination
- **game.ts**: New API client methods

### Testing
- 81 new tests for EventStorage, EventManager, and API
- Added `pytest-asyncio` and `httpx` to requirements.txt

## Known Issues: Save/Load is Currently Broken

After loading a saved game, the following issues occur:

1. **Wrong database used**: API returns events from the startup database instead
   of the loaded save's `_events.db` file
2. **Events from wrong time period**: Shows events from year 115 when loaded
   save is at year 114
3. **Pagination broken after load**: `has_more` returns `False` despite hundreds
   of events in the saved database
4. **Filter functionality broken**: Character selection filter stops working
   after loading a game

Root cause: `load_game.py` does not properly switch the EventManager's database
connection to the loaded save's events database.
2026-01-07 00:40:34 -08:00
Zihao Xu
f5c40bae3b feat: add GitHub Actions CI for pytest 2026-01-07 00:30:31 -08:00
bridge
e4ff312f58 fix action being executed 3 times bug 2026-01-06 23:41:21 +08:00
bridge
35c0756e85 refactor all gather logic 2026-01-06 23:17:21 +08:00