refactor(gui-personalization): extract endpoint to a module + fix model defaults - #578
Merged
ArmenSl merged 1 commit intoJul 21, 2026
Conversation
… cleanup Addresses review feedback on #577 (organization + correctness): - Extract the ~150-line /personalize-gui-page endpoint body into a new services/utils/gui_personalization_utils.py, mirroring the agent_personalization pattern: the ~40-line LLM system prompt is now a module constant, and personalize_gui_page() owns validation, prompt building, the OpenAI call and response parsing. The router endpoint is now a thin validate -> delegate -> shape-response handler. - Consolidate the OpenAI model default into one DEFAULT_OPENAI_MODEL = 'gpt-5' constant. Removes the inconsistent/invalid defaults the PR introduced (gpt-5.4-mini x7, gpt-5.6-luna) that would 404 at runtime. - Remove a leftover print('calling now') debug statement. - Remove two dead '... and False' branches in replace_reply_batch. - Add test_gui_personalization.py (10 tests, LLM mocked) covering validation, model selection, response parsing and error mapping. Left as-is: the translate-before-style reorder in replace_reply_batch (appears intentional); pre-existing gpt-5.5 default at generation_router line 172 (out of scope).
ArmenSl
added a commit
that referenced
this pull request
Jul 22, 2026
- Bump setup.cfg 7.12.0 -> 7.13.0 and add v7.13.0 release notes. - Frontend submodule bump 360dcfa6 -> b14dadec: the GUI-personalization UI (user-profile form editor, per-profile page variants + switching, web-app version selection in the generation dialog) plus review cleanups. All GUI-personalization work; no multilingual changes. - Backend: the GUI-personalization feature (#577), the extract-to-service cleanup (#578), and the user-profile OCL/parsing fixes + regression tests (#579) are already on development.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Cleanup on top of #577, addressing the organization + correctness review. Targets
feature/gui_personalizationso it lands before #577 merges todevelopment.Organization (the main concern)
The new
/personalize-gui-pageendpoint inlined ~150 lines intogeneration_router.py— validation, a ~40-line LLM system prompt, the OpenAI call and response parsing — which breaks the codebase's own pattern (agent_personalization.pyholds that logic; the router just calls it).services/utils/gui_personalization_utils.py— mirrorsagent_personalization: the system prompt is a module constant, andpersonalize_gui_page()owns validation → prompt → LLM call → parse.asyncio.to_thread(run_gui_personalization, …), shape the response;@handle_endpoint_errorsmapsValidationError/GenerationError.Correctness
gpt-5.4-mini(×7) andgpt-5.6-luna, neither a real OpenAI id (would 404 at runtime). Consolidated to a singleDEFAULT_OPENAI_MODEL = "gpt-5"constant, used everywhere.print("calling now")debug statement.… and Falsebranches inreplace_reply_batch(a disabledtranslate_text_apiexperiment).Tests
test_gui_personalization.py— 10 tests (LLM mocked, offline): input validation, default-vs-explicit model, response parsing, and error mapping (missing key →ValidationError, unparseable/invalid response →GenerationError).Deliberately left
replace_reply_batch— appears intentional; flag for @Aran30 to confirm.gpt-5.5default atgeneration_router.py:172(a different, older endpoint) — out of this PR's scope.translate_text_apihelper is left in place (removing it is separate).