imbajin commented on code in PR #438:
URL: https://github.com/apache/hugegraph-ai/pull/438#discussion_r4653858022


##########
hugegraph-llm/src/hugegraph_llm/config/models/base_prompt_config.py:
##########
@@ -91,12 +91,17 @@ class BasePromptConfig:
 
     def ensure_yaml_file_exists(self):
         if os.path.exists(yaml_file_path):
-            log.info("Loading prompt file '%s' successfully.", F_NAME)
             with open(yaml_file_path, "r", encoding="utf-8") as file:
                 data = yaml.safe_load(file)
-                # Load existing values from the YAML file into the class 
attributes
-                for key, value in data.items():
-                    setattr(self, key, value)
+
+            if data is None:
+                self._set_language_defaults()
+                log.info("Prompt file %s is empty; using built-in defaults 
without writing", yaml_file_path)

Review Comment:
   **Reset all prompt overrides on an empty-file reload**
   
   When a previously loaded configuration is truncated while the process is 
running, opening the UI calls this method again on the shared prompt instance. 
`_set_language_defaults()` resets only five language-dependent fields, so 
earlier overrides such as `graph_schema`, `review_graph_prompt`, and 
`repair_graph_prompt` remain active despite the message that built-in defaults 
are in use; a subsequent save can write them back. Please reset the persisted 
fields to their built-in defaults before returning, and cover the 
populated-to-empty reload.



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