This is an automated email from the ASF dual-hosted git repository.

jin pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-hugegraph-ai.git


The following commit(s) were added to refs/heads/main by this push:
     new e7d8f56  fix(llm): avoid generating config twice (#56)
e7d8f56 is described below

commit e7d8f56e17ae8b68a80a31789c9b413e08f5a604
Author: Liu Jiajun <[email protected]>
AuthorDate: Wed Jul 31 19:52:28 2024 +0800

    fix(llm): avoid generating config twice (#56)
    
    ---------
    
    Co-authored-by: imbajin <[email protected]>
---
 hugegraph-llm/README.md                            | 21 +++++++++++++++------
 hugegraph-llm/requirements.txt                     |  2 +-
 hugegraph-llm/src/hugegraph_llm/config/generate.py |  5 ++++-
 3 files changed, 20 insertions(+), 8 deletions(-)

diff --git a/hugegraph-llm/README.md b/hugegraph-llm/README.md
index 171f347..5009eba 100644
--- a/hugegraph-llm/README.md
+++ b/hugegraph-llm/README.md
@@ -38,20 +38,29 @@ Refer to 
[docker-link](https://hub.docker.com/r/hugegraph/hugegraph) & [deploy-d
     ```bash
     cd ./hugegraph-llm/src
     ```
-- Generate the config file
-    ```bash
-    python3 -m hugegraph_llm.config.generate
-    ```
+
 - Start the gradio interactive demo of **Graph RAG**, you can start with the 
following command, and open http://127.0.0.1:8001 after starting
     ```bash
     python3 -m hugegraph_llm.demo.rag_web_demo
-   ```
+    ```
+    The default host is `0.0.0.0` and the port is `8001`. You can change them 
by passing command line arguments`--host` and `--port`.  
+    ```bash
+    python3 -m hugegraph_llm.demo.rag_web_demo --host 127.0.0.1 --port 18001
+    ```
 
-- Or start the gradio interactive demo of **Text2Gremlin**, you can start with 
the following command, and open http://127.0.0.1:8002 after starting
+- Or start the gradio interactive demo of **Text2Gremlin**, you can start with 
the following command, and open http://127.0.0.1:8002 after starting. You can 
also change the default host `0.0.0.0` and port `8002` as above.
     ```bash
     python3 -m hugegraph_llm.demo.gremlin_generate_web_demo
    ```
 
+- After starting the web demo, the config file `.env` will be automatically 
generated. You can modify its content in the web page. Or modify the file 
directly and restart the web application.
+
+    (Optional)To regenerate the config file, you can use `config.generate` 
with `-u` or `--update`.
+    ```bash
+    python3 -m hugegraph_llm.config.generate --update
+    ```
+
+
 ## Examples
 
 ### 1.Build a knowledge graph in HugeGraph through LLM
diff --git a/hugegraph-llm/requirements.txt b/hugegraph-llm/requirements.txt
index 168ce4e..1ee9db6 100644
--- a/hugegraph-llm/requirements.txt
+++ b/hugegraph-llm/requirements.txt
@@ -4,7 +4,7 @@ qianfan~=0.3.18
 retry~=0.9.2
 tiktoken>=0.7.0
 nltk~=3.8.1
-gradio>=4.37.2
+gradio~=4.37.2
 jieba>=0.42.1
 numpy~=1.24.4
 python-docx~=1.1.2
diff --git a/hugegraph-llm/src/hugegraph_llm/config/generate.py 
b/hugegraph-llm/src/hugegraph_llm/config/generate.py
index f910d65..7016cbb 100644
--- a/hugegraph-llm/src/hugegraph_llm/config/generate.py
+++ b/hugegraph-llm/src/hugegraph_llm/config/generate.py
@@ -22,4 +22,7 @@ from hugegraph_llm.config import settings
 
 if __name__ == '__main__':
     parser = argparse.ArgumentParser(description='Generate hugegraph-llm 
config file')
-    settings.generate_env()
+    parser.add_argument("-U", "--update", action="store_true", help="Update 
the config file")
+    args = parser.parse_args()
+    if args.update:
+        settings.generate_env()

Reply via email to