[改善] 型注釈の追加とドキュメントの更新

- config.py, controller.py, model.py, mainloop.py, utils.py での型注釈の追加
- CODING_RULES.md と api.md のドキュメントを更新
- 不要なコードの削除とリファクタリング
This commit is contained in:
misyaguziya
2025-10-09 13:34:05 +09:00
parent e67242a0c4
commit c1cf78cda4
11 changed files with 79 additions and 52 deletions

View File

@@ -29,8 +29,6 @@
- 定数: UPPER_SNAKE_CASE`config.py` の定数に合わせる)。
- run_mapping のキー: 現在は短い key例: `transcription_mic`)を内部で使い `run_mapping``/run/...` を置いている。この慣習は維持する。Controller 内で `self.run_mapping[...]` を直接参照する実装は許容される。
例: `selected_translation_compute_device` は内部 key、`/run/selected_translation_compute_device` が外部イベント名である点を区別して使う。
## モジュール・パッケージ構成
- 各サブ領域ocr, overlay, transcription, translation, websocket 等)は `models/` 下に整理済みのため、同様の粒度で新機能は追加する。
- パッケージは必ず `__init__.py` を置くstatic analysis / mypy のため)。空の `__init__.py` でも可。これにより相対インポートが安定する。

View File

@@ -130,9 +130,6 @@ run イベント
`/run/selected_transcription_compute_type` (200)
- payload: string
`/run/selected_translation_compute_device` (200)
- payload: device descriptor (e.g. {"name":"cuda:0","type":"gpu"})
`/run/selected_translation_engines` (200)
- payload: config.SELECTED_TRANSLATION_ENGINES (list/dict per tab)