imbajin commented on code in PR #268:
URL: 
https://github.com/apache/incubator-hugegraph-ai/pull/268#discussion_r2131704649


##########
hugegraph-llm/src/hugegraph_llm/demo/rag_demo/app.py:
##########
@@ -105,6 +110,41 @@ def init_rag_ui() -> gr.Interface:
         with gr.Tab(label="5. Admin Tools 🛠"):
             create_admin_block()
 
+            def switch_language(current_lang):
+                new_lang = "CN" if current_lang == "EN" else "EN"
+                if new_lang == "CN":
+                    updates = (
+                        gr.update(value=f"prompt: {new_lang}"),
+                        gr.update(value=prompt.doc_input_text_CN),
+                        gr.update(value=prompt.extract_graph_prompt_CN),
+                        gr.update(value=prompt.answer_prompt_CN),
+                        gr.update(value=prompt.keywords_extract_prompt_CN),
+                        gr.update(value=prompt.gremlin_generate_prompt_CN),
+                    )
+                else:
+                    updates = (
+                        gr.update(value=f"prompt: {new_lang}"),
+                        gr.update(value=prompt.doc_input_text),
+                        gr.update(value=prompt.extract_graph_prompt),
+                        gr.update(value=prompt.answer_prompt),
+                        gr.update(value=prompt.keywords_extract_prompt),
+                        gr.update(value=prompt.gremlin_generate_prompt),
+                    )

Review Comment:
   Note the consistency of prompts on the **API** and **UI** to avoid reading 
inconsistent prompts when the API accesses them



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