LRriver opened a new issue, #346:
URL: https://github.com/apache/hugegraph-ai/issues/346

   ### Search before asking
   
   - [x] I had searched in the 
[feature](https://github.com/apache/hugegraph-ai/issues?q=is%3Aissue+label%3A%22Feature%22)
 and found no similar feature requirement.
   
   
   ### Feature Description (功能描述)
   
   ## Feature Description
   
   The graph schema generator lets users edit query examples and few-shot schema
   examples, but those edits are not persisted. Main document text, graph 
schema,
   and graph extraction prompt header are already persisted through the prompt 
YAML
   flow. Please extend persistence to schema-generator examples.
   
   ## Current verification
   
   - `store_prompt(doc, schema, example_prompt)` only saves `doc_input_text`, 
`graph_schema`, and `extract_graph_prompt` in 
`hugegraph-llm/src/hugegraph_llm/demo/rag_demo/vector_graph_block.py:47`.
   - The schema generator UI has editable `query_example` and `few_shot` code 
blocks in 
`hugegraph-llm/src/hugegraph_llm/demo/rag_demo/vector_graph_block.py:284` and 
`:291`.
   - The build-schema click chain has an explicit TODO: `Store the updated 
examples` in 
`hugegraph-llm/src/hugegraph_llm/demo/rag_demo/vector_graph_block.py:358`.
   - `BuildSchemaFlow` already receives `query_examples` and `few_shot_schema`; 
the missing part is persistence/reload behavior, not schema generation input 
wiring.
   
   ## Suggested scope
   
   - Add config fields for schema-generator query examples and few-shot 
examples, or add a separate persisted demo state file if that better matches 
existing config conventions.
   - Load persisted examples into the UI before falling back to bundled 
resource examples.
   - Persist edited examples when users generate schema or perform related 
save-triggering actions.
   - Validate that edited examples are valid JSON before saving.
   - Keep bundled examples read-only as defaults; do not overwrite files under 
`resources/prompt_examples`.
   
   ## Mermaid reference
   
   ```mermaid
   flowchart TD
       UI[Schema generator code blocks] --> Validate[Validate JSON]
       Validate -->|valid| Save[Persist user examples]
       Validate -->|invalid| Error[Show JSON error]
       Save --> Reload[Demo reload]
       Defaults[Bundled resource examples] --> Load{User saved examples?}
       Save --> Load
       Load -->|yes| UI
       Load -->|no| Defaults
   ```
   
   ## Acceptance criteria
   
   - Edited query examples survive demo refresh/restart.
   - Edited few-shot schema examples survive demo refresh/restart.
   - Invalid JSON is not persisted and produces a clear UI error.
   - Default bundled examples still load for first-time users.
   
   ## Suggested tests
   
   - Unit test for save/load helper behavior.
   - UI helper test showing edited values are passed to the persistence 
function.
   - Config test to ensure old prompt config files without these fields still 
load.
   
   
   
   ### Are you willing to submit a PR?
   
   - [ ] Yes I am willing to submit a PR!
   
   ### Code of Conduct
   
   - [x] I agree to follow this project's [Code of 
Conduct](https://www.apache.org/foundation/policies/conduct)
   


-- 
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]

Reply via email to