lplalbert opened a new pull request, #419:
URL: https://github.com/apache/hugegraph-ai/pull/419

   ## Problem
   
   Refreshing the rag_web_demo page (`refresh_ui_config_prompt`) only reloaded 
the HugeGraph and prompt settings. The LLM / Embedding / Reranker forms are 
`gr.render` callbacks that read the `llm_settings` / `index_settings` 
singletons, which never re-read their files after startup, and the static 
provider dropdowns / Use-Chat checkboxes keep their build-time values. After 
editing `settings.yaml` outside the UI and refreshing the page, those forms 
kept showing the old startup snapshot. This is the remaining TODO of #91 (the 
graph/prompt part was fixed in #90).
   
   ## Approach
   
   - Every form render (chat / extract / text2gql, `embedding_settings`, 
`reranker_settings`, `vector_engine_settings`) re-reads the persisted 
model/index settings via `refresh_settings_snapshot()` before building its 
widgets, under the shared `runtime_config_lock`. UI apply handlers persist on 
success, so the reload can only pick up out-of-band file edits — it never 
discards unsaved input.
   - Each render refreshes independently instead of relying on the load 
handler, because the ordering between `Blocks.load` and the initial `gr.render` 
is not guaranteed.
   - The page-load handler additionally refreshes and feeds the static provider 
dropdowns and Use-Chat checkboxes (`ui_control_values()`, appended to its 
outputs).
   - The vector-engine section had the same staleness and gets the same fix 
(sibling of the forms named in the issue); its backend forms keep their 
existing edit-in-place password semantics (blank clears) unchanged.
   - Saved API keys stay implicit: model / embedding / reranker key boxes still 
render blank ("Leave blank to keep the saved key"), never echoing the stored 
secret.
   
   This covers the issue's remaining TODO (LLM & Embedding & Reranker config) 
and removes the superseded TODO sketch in `app.py`.
   
   ## Validation
   
   - New contract tests in 
`hugegraph-llm/src/tests/api/test_ui_config_refresh.py` (8), driven through the 
real Gradio render pipeline and the load handler. Red-green verified: with the 
production changes stashed, all 8 fail on stale values; with them applied, all 
8 pass.
   - Full suite: `2 failed, 1293 passed, 16 skipped` + `5 subtests passed`. The 
2 failures are the pre-existing Windows-only file-mode assertions in 
`test_external_config.py` (they fail on `main` as well).
   - `uv run --extra dev ruff format --check .` and `uv run --extra dev ruff 
check .`: clean (589 files).
   - `uv run --extra dev ty check hugegraph-llm/src/hugegraph_llm`: 271 
diagnostics, same as the `main` baseline; none in the touched files.
   - Real-provider verification: none (offline tests only; no LLM / embedding / 
vector service was contacted).
   
   Fixes #91
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to