feat: Wordgun API v2 — новая модель и выбор сложности - #127
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (4)
🚧 Files skipped from review as they are similar to previous changes (3)
📝 WalkthroughWalkthroughWordgun now uses versioned v1/v2 API endpoints, supports model and difficulty metadata, and exposes a lazily loaded difficulty setting. Selected difficulty values are persisted and included in generated OBS links, with dismissible fullscreen error messages. ChangesWordgun integration
Estimated code review effort: 3 (Moderate) | ~25 minutes Sequence Diagram(s)sequenceDiagram
participant SettingsPanel
participant wordgun_list_models
participant WordgunAPI
SettingsPanel->>wordgun_list_models: Load difficulty options when Wordgun settings open
wordgun_list_models->>WordgunAPI: Request /v2/list_model
WordgunAPI-->>wordgun_list_models: Return models and difficulties
wordgun_list_models-->>SettingsPanel: Populate difficulty selector
SettingsPanel->>SettingsPanel: Persist selection and update OBS link
Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches 💡 1🛠️ Fix failing CI checks 💡
Comment |
Greptile SummaryThis PR migrates Wordgun game creation and hints to API v2 and adds configurable game difficulty.
Confidence Score: 4/5The PR appears safe to merge, with only the previously reported redundant concurrent model-list requests remaining. The stale-difficulty behavior is fixed because a Wordgun OBS URL without wg_difficulty now clears the local value before game creation; however, overlapping option-loading calls can still issue duplicate requests because the loaded and API cache flags are populated only after awaiting the network response. Files Needing Attention: js/settings.js, js/api.js
|
| Filename | Overview |
|---|---|
| js/api.js | Migrates Wordgun creation and hint operations to v2, adds model discovery, and improves unsupported-difficulty error handling. |
| js/settings.js | Adds difficulty loading, persistence, visibility, and OBS-link integration; the stale OBS difficulty behavior is corrected. |
| js/init.js | Lazily loads Wordgun options when the settings panel is initially displayed. |
| js/config.js | Defines the fixed Wordgun model and mutable difficulty setting. |
| index.html | Adds the Wordgun difficulty control and reorganizes backend-specific settings. |
| css/style.css | Adjusts error-overlay typography and styles its new close button. |
Reviews (2): Last reviewed commit: "возможность сохранить форму при изменени..." | Re-trigger Greptile
Не использовать сохраненную сложность, если она отсутствует в OBS-ссылке. Прерывать повторные запросы при unknown difficulty и показывать закрываемое сообщение с просьбой обновить настройки и ссылку OBS.
…бы не хардкодить это)
…. раньше сохранение было недоступно
|
Пофиксила потенциальную ошибку при изменении списка сложностей на беке. |
✨Новое:
Игра на бэкенде wordgun.ru теперь создаётся через
POST /v2/create_gameна моделиru-context-v1, подсказки идут наPOST /v2/hint.В настройках появился выбор сложности: список тянется из
GET /v2/list_model, значение сохраняется в localStorage и уезжает в ссылку для OBS параметромwg_difficulty. Пустое значение означает загадывание из всего словаря.Поля «Источник слов» и «Сложность» перенесены в правую колонку настроек — сложность видна только при выбранном wordgun.ru.
Summary by CodeRabbit
New Features
Bug Fixes
UI/Style