Commit Graph

80 Commits

Author SHA1 Message Date
4thfever
bc3ebc006c Refactor/i18n (#115)
重构i18n,现在game configs的配表,除了姓名这种外,都是统一的配表了。
对应的配表的名称和desc需要去i18n里取,但是其他配置不需要重复配置了。
这大大简化了之后新增i18n的心智负担。
2026-02-01 01:09:24 +08:00
4thfever
e1091fdf5a Feat/i18n (#92)
* feat: add vue-i18n

* feat: add vue-i18n

* feat: add vue-i18n

* feat: add language class

* add: en templates and configs

* add: en names

* refactor: name gender id and sect id

* feat(i18n): add gettext infrastructure for dynamic text translation (#81)

* feat(i18n): add gettext infrastructure for dynamic text translation

- Add src/i18n/ module with t() translation function
- Add .po/.mo files for zh_CN and en_US locales
- Update LanguageManager to reload translations on language change
- Add comprehensive tests (14 tests, all passing)
- Add implementation spec at docs/specs/i18n-dynamic-text.md

Phase 1 of i18n dynamic text implementation.

* feat(i18n): expand .po files with comprehensive translation entries

Add translation messages for:
- Battle result messages (fatal/non-fatal outcomes)
- Fortune event messages (item discovery, cultivation gains)
- Misfortune event messages (losses, damage, regression)
- Death reason messages
- Item exchange messages (equip, sell, discard)
- Single choice context and option labels
- Common labels (weapon, auxiliary, technique, elixir)

Both zh_CN and en_US locales updated with matching entries.

* test: add .po file integrity tests

* feat: i18n for actions

* feat: i18n for effects

* feat: i18n for gathering

* feat: i18n for classes

* feat: i18n for classes

* feat: i18n for classes

* feat: i18n for classes

* fix bugs

* fix bugs

* fix bugs

* fix bugs

* fix bugs

* fix bugs

* fix bugs

* fix bugs

* update csv

* update world info

* update prompt

* update prompt

* fix bug

* fix bug

* fix bug

* fix bug

* fix bug

* fix bug

* fix bug

* fix bug

* fix bug

* update

* update

* update

* update

* update

* update

* update

---------

Co-authored-by: Zihao Xu <xzhseh@gmail.com>
2026-01-24 13:47:23 +08:00
Zihao Xu
666e19215d test: add comprehensive LLM failure scenario tests (#79)
* test: add comprehensive LLM failure scenario tests

Add 29 tests covering:
- HTTP errors: 401, 403, 404, 500, timeout, connection refused
- Parse errors: invalid JSON, empty response, array instead of object
- Retry logic: retry on parse failure, max retries exceeded
- Connectivity test: friendly error messages for common failures
- Configuration validation: missing base URL, URL normalization
- Async call_llm: success and error propagation
- Exception classes: LLMError, ParseError

Closes #71

* refactor: add comment explaining unreachable code for type checker
2026-01-20 23:27:04 -08:00
4thfever
6185d314af refactor: remove region_names dict, use regions traversal instead (#40)
The region_names dictionary was a redundant index that needed manual
sync when HistoryManager modified region names. This caused bugs where
resolve_query couldn't find regions by their new (history-modified) names.

Instead of maintaining two data structures (regions[id] and region_names[name]),
we now only use regions[id] as the single source of truth. The _resolve_region
function iterates over regions.values() to find matches by name.

This approach:
- Eliminates the sync bug entirely
- Simplifies the codebase
- Has negligible performance impact (region count is small)

Co-authored-by: Zihao Xu <xzhseh@gmail.com>
2026-01-18 17:13:28 +08:00
bridge
2056538375 uncomment protagonists 2026-01-11 19:56:26 +08:00
bridge
ac8c6c1c73 update tips 2026-01-10 00:50:30 +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
ff6d1b5de7 add more protagonist 2026-01-08 23:19:35 +08:00
bridge
40d8a0425b refactor self heal system 2026-01-08 00:33:41 +08:00
bridge
b2a021bf8a rename item -> material & refactor buying action 2026-01-07 22:43:26 +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
bridge
fbb32adbf6 refactor normalize and resolution 2026-01-06 22:13:47 +08:00
bridge
9f5ad04e92 refactor buy and sell 2026-01-05 23:52:38 +08:00
Zihao Xu
8f99f3edb2 fix: correct misleading docstring in to_json_str_with_intent 2026-01-04 17:22:58 -08:00
bridge
276902bca0 refactor effect system 2026-01-04 22:03:05 +08:00
bridge
806e2c1262 refactor price system 2026-01-04 21:49:58 +08:00
bridge
775d830ec3 add cast 2026-01-03 23:25:38 +08:00
bridge
3a9a9fd6f0 add choice helper 2026-01-03 22:26:55 +08:00
bridge
5b5ea31d87 refactor avatar effect desc 2026-01-03 21:45:19 +08:00
bridge
462c28fb30 fix effects 2025-12-31 22:26:44 +08:00
bridge
f14ea0b92e refactor llm config 2025-12-30 22:27:27 +08:00
bridge
d55ada7d66 refactor llm config 2025-12-30 22:20:30 +08:00
bridge
b8a4850e80 add llm config panel 2025-12-30 21:23:30 +08:00
bridge
5b0bba517a add test connectivity 2025-12-30 20:45:30 +08:00
bridge
853e74630e fix api key bug 2025-12-29 22:56:49 +08:00
bridge
ca9c0a69af support openai format api 2025-12-29 22:18:18 +08:00
bridge
05c31491c3 refactor llm task modes 2025-12-29 22:09:25 +08:00
bridge
c2cb8098ee update llm 2025-12-29 22:02:44 +08:00
bridge
162ea8efe2 refactor llm 2025-12-20 22:13:26 +08:00
bridge
fc668b3711 fix double story bugs 2025-12-13 22:18:39 +08:00
bridge
9ed511aafb add protagonist 2025-12-13 20:48:03 +08:00
bridge
1083ec3db6 add protagonist 2025-12-13 20:35:03 +08:00
bridge
8124537cff update distance 2025-12-08 22:39:44 +08:00
bridge
26038004ef udpate sect effects 2025-11-29 14:31:50 +08:00
bridge
4d245653a6 change order of events 2025-11-22 20:43:27 +08:00
bridge
0cdcb6f5e1 fix bug 2025-11-22 18:59:59 +08:00
bridge
9634ace682 fix bug 2025-11-22 18:49:15 +08:00
bridge
c25b652fbe fix bug 2025-11-22 15:59:39 +08:00
bridge
a65a23726e refactor 2025-11-22 15:57:59 +08:00
bridge
99e4871a5d update web, add clickable parts 2025-11-22 15:07:09 +08:00
bridge
73a2f1ab5a fix bug 2025-11-22 00:44:10 +08:00
bridge
52d953f565 remove litellm when pack 2025-11-22 00:41:13 +08:00
bridge
259d4a3794 update pack 2025-11-21 23:58:36 +08:00
bridge
32cb34c173 before adapt to web 2025-11-20 01:02:31 +08:00
bridge
8e72acee57 fix a bug 2025-11-19 01:50:11 +08:00
bridge
e7d6ce7879 refactor llm 2025-11-19 01:23:55 +08:00
bridge
c341a1fddd fix long events calling 2025-11-19 01:06:42 +08:00
bridge
c5c6c640b7 refactor name logic 2025-11-02 21:01:30 +08:00