From 36cf226397f0634210b4e55babfe1fd1979ad3cb Mon Sep 17 00:00:00 2001 From: Drobysh Date: Fri, 25 Sep 2026 15:56:46 +0000 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=A7=20AI=20Review=20(backend):=20max?= =?UTF-8?q?=5Ftokens=2012k=E2=86=9232k=20+=20=D1=80=D0=B0=D0=B7=D0=B1?= =?UTF-8?q?=D0=B8=D0=B2=D0=BA=D0=B0=20routers?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - MAX_OUTPUT_TOKENS: 12000 → 32000 (DeepSeek обрезался на больших паках) - routers (329k, 21 файл) → 4 пака: * routers_games — game, hints, wordquiz, bubblewords, sentences, typing, pronunciation * routers_learning — learning, learning_profile, teacher, orchestrator, learning_data * routers_admin — admin, admin_content, feed, support * routers_misc — achievements, users, leaderboard, assistant, tts - core (main, database, auth, config, bot) — отдельный пак - services → scripts (убран пустой __init__.py) - __init__.py добавлен в IGNORE_FILES - Итого: 3 пака → 6 паков, максимальный ~120k символов --- scripts/ai_review.py | 67 ++++++++++++++++++++++++++++++++++++++------ 1 file changed, 59 insertions(+), 8 deletions(-) diff --git a/scripts/ai_review.py b/scripts/ai_review.py index 2e5c33f..7cb3efa 100644 --- a/scripts/ai_review.py +++ b/scripts/ai_review.py @@ -3,13 +3,14 @@ AI Code Review for Filwords PL Backend (JSON-контракт + пак-подход) Backend слишком большой (~440K символов) для одного запроса — модель уходит -в reasoning и не успевает выдать JSON. Решение: разбиваем файлы на 3 пака +в reasoning и не успевает выдать JSON. Решение: разбиваем файлы на паки по папкам, делаем отдельный запрос на каждый пак, объединяем находки. (20.09.2026) Первая версия — конвейер без tool-calling, предсказуемо по токенам. (20.09.2026, вечер) Фикс: max_tokens=16000, fallback на reasoning_content. (21.09.2026, вечер) JSON-контракт + snippet-проверка + фильтр confidence. (22.09.2026, вечер) Пак-подход: 3 пака (routers, core, services+scripts). +(25.09.2026) Разбивка routers на 4 пака, MAX_OUTPUT_TOKENS=32000. """ import json @@ -30,7 +31,11 @@ GITEA_INSTANCE = os.environ.get("GITEA_INSTANCE", "https://git.filwordspl.com") GITEA_REPO = os.environ.get("GITEA_REPO", "Drobysh/filwordspl-backend") MODEL = "deepseek-ai/DeepSeek-V4.1-Flash" -MAX_OUTPUT_TOKENS = 12000 + +# 🔧 ФИКС (25.09.2026): MAX_OUTPUT_TOKENS 12000 → 32000. +# DeepSeek V4.1 Flash поддерживает до 32k output — даём модели в 2.7× больше +# места, чтобы большие паки успевали выдать полный JSON без обрезки. +MAX_OUTPUT_TOKENS = 32000 # Что игнорировать при сборе кода IGNORE_DIRS = { @@ -41,6 +46,9 @@ IGNORE_DIRS = { IGNORE_FILES = { "ai_review.py", "conftest.py", "code_summary.py", "add_levels.py", "generate_levels_v2.py", + # 🔧 ФИКС (25.09.2026): __init__.py исключён — пустой в каждом роутере, + # нет смысла гонять его в модель. + "__init__.py", } # Расширения, которые читаем @@ -56,12 +64,55 @@ ALLOWED_SEVERITY = {"user_impact", "data_risk", "maintainability"} # 🔧 НОВОЕ (22.09.2026): паки для backend # Backend ~440K символов — не влезает в один запрос (finish=length). -# Разбиваем на 3 пака. Каждый пак — отдельный запрос к модели. +# Разбиваем на паки. Каждый пак — отдельный запрос к модели. +# +# 🔧 ФИКС (25.09.2026): разбивка паков на меньшие — +# routers (329k) → 4 пака. Пути проверены по факту (`ls routers/`). PACKS = [ { - "name": "routers", - "paths": ["routers/"], - "description": "FastAPI-роутеры: эндпоинты, бизнес-логика, работа с БД", + "name": "routers_games", + "paths": [ + "routers/game.py", + "routers/hints.py", + "routers/wordquiz.py", + "routers/bubblewords.py", + "routers/sentences.py", + "routers/typing.py", + "routers/pronunciation.py", + ], + "description": "Игры: wordsearch, hints, quiz, bubbles, sentences, typing, pronunciation", + }, + { + "name": "routers_learning", + "paths": [ + "routers/learning.py", + "routers/learning_profile.py", + "routers/teacher.py", + "routers/orchestrator.py", + "routers/learning_data/", + ], + "description": "Уроки: learning, teacher, orchestrator, learning_data", + }, + { + "name": "routers_admin", + "paths": [ + "routers/admin.py", + "routers/admin_content.py", + "routers/feed.py", + "routers/support.py", + ], + "description": "Админ: dashboard, content editor, feed, support", + }, + { + "name": "routers_misc", + "paths": [ + "routers/achievements.py", + "routers/users.py", + "routers/leaderboard.py", + "routers/assistant.py", + "routers/tts.py", + ], + "description": "Прочее: achievements, users, leaderboard, assistant, tts", }, { "name": "core", @@ -70,8 +121,8 @@ PACKS = [ }, { "name": "services", - "paths": ["services/", "scripts/"], - "description": "Сервисы и скрипты автоматизации", + "paths": ["scripts/"], + "description": "Скрипты автоматизации", }, ]