refactor: extraer el router HTTP de LLM - #106
Merged
Merged
Conversation
Copy the /api/v1/llm HTTP domain out of _launch_runtime.py into app/routers/llm.py. Mount create_llm_router at ordinals 80-87 and create_llm_prompt_router at 89-91 so Director generate-music stays at 88. No WanGP imports in the router: config, routing and enhancer primitives are injected from launch. llm_service.py is unchanged.
PR Review — Loreframe StudioRisk: medium Automated review from Findings
Changed files
CONTRIBUTING checklist
Posted by the repo PR review workflow. Re-runs on each push to the PR. |
Code health
Markdown, JSON catalogs and tests are out of this table. Only Most complex functions
Trend vs baseline
Warnings
Ratchet passed. |
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.
Qué
Extrae el dominio HTTP de
/api/v1/llmfuera de_launch_runtime.pyhaciaapp/routers/llm.py, imitando el montaje de Comics (create_comics_router+ segundoinclude_routerpara no romper ordinales).Contrato (11 rutas)
create_llm_router(ordinales 80–87, misma posición que el primer/api/v1/llm):GET /api/v1/llm/statusPOST /api/v1/llm/loadPOST /api/v1/llm/unloadGET /api/v1/llm/modelsGET /api/v1/llm/stream-statusPOST /api/v1/llm/generatePOST /api/v1/llm/testPOST /api/v1/llm/write-songcreate_llm_prompt_router(ordinales 89–91, segundoinclude_routerjusto después de Director generate-music):POST /api/v1/llm/plan-h3-windowsPOST /api/v1/llm/enhance-promptPOST /api/v1/llm/describe-imageroute_table.jsonno cambia ordinales, method, path, endpoint ni status. Solosourcepasa aapp/routers/llm.pyen esas 11 rutas.Cómo se conservan los ordinales
scripts/architecture_contracts.pyexpande cada factory en suapi.include_router(...). El primer montaje sustituye el bloque control/generate/song-writer; el segundo se coloca justo donde estaban plan-h3 / enhance / describe, después dePOST /api/v1/director/generate-music(ordinal 88, sigue en launch).Qué permanece en launch
/api/v1/director/*(incluidodirector_generate_music, plan-prompts, pipeline). Director es Paso 5 y está fuera de alcance._ensure_llm_loaded(lo usan CivitAI, Director, Story Lab, Comics, describe-refs, …)._enhance_with_wangp(WanGP/offload; se inyecta en el router)._comic_writing_llm,_effective_llm_routing,_llm_provider_credentials.Director generate-music importa
_parse_song_outputy los fallbacks ACE-Step desderouters.llm.llm_service.pyno se parte (plan 6.b no es este ticket).Inyección (sin WanGP en el router)
get_services_config,effective_llm_routing,llm_provider_credentials,llm_default_device,default_llm_repo,ensure_llm_loaded,comic_writing_llm.public_llm_providers,get_model_def,get_lora_dir,get_cached_hardware,get_enhancer_enabled,enhance_with_wangp.El router no importa
wgpni_launch_runtime.Tests
No hace falta GPU ni
create_app().Los tests que rebanaban launch para song-writer / plan-h3 / enhance se retargetean a
app/routers/llm.py.test_minimax_song_writer_prompt.pydeja de ser lector de launch (sale del wire inventory).tests/test_llm_router.pycubre superficie path/method/endpoint y validación 400.Fuera de alcance
/api/v1/director/*, stories, series, audio, video-editor.ui/src/stores/useStore.ts, WanGP,app/wgp.py,app/models/**, launchers, Pinokio.docs/development/SLICE_QUEUE.md(nota post-merge: marcar el router LLM como landed en «Backend by domain»).No mezclar hasta CI verde.
Note
Cursor Bugbot is generating a summary for commit 91e80ef. Configure here.