From 77e137332463ba50f6dbad25e49a961050e190d3 Mon Sep 17 00:00:00 2001 From: Bill Shi Date: Wed, 31 Jul 2024 13:30:58 -0700 Subject: [PATCH 1/5] fix(main): add alias --- eventual-consistency-service/app/main.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/eventual-consistency-service/app/main.py b/eventual-consistency-service/app/main.py index 4ca26c2c..51843a04 100644 --- a/eventual-consistency-service/app/main.py +++ b/eventual-consistency-service/app/main.py @@ -70,7 +70,8 @@ def initialize_eventual_consistency_checker(graphname: str, conn: TigerGraphConn password=milvus_config.get("password", ""), vector_field=milvus_config.get("vector_field", "document_vector"), text_field=milvus_config.get("text_field", "document_content"), - vertex_field=vertex_field + vertex_field=vertex_field, + alias=milvus_config.get("alias", "default") ) if doc_processing_config.get("chunker") == "semantic": From 74ece80215274413c0a461176fc4823a53625c67 Mon Sep 17 00:00:00 2001 From: Bill Shi Date: Wed, 31 Jul 2024 13:31:28 -0700 Subject: [PATCH 2/5] fix(supportai): change default ecc address --- copilot/app/routers/supportai.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/copilot/app/routers/supportai.py b/copilot/app/routers/supportai.py index 3c416c67..3f599b26 100644 --- a/copilot/app/routers/supportai.py +++ b/copilot/app/routers/supportai.py @@ -407,7 +407,7 @@ def ecc( from httpx import get as http_get ecc = ( - db_config.get("ecc", "http://localhost:8001") + db_config.get("ecc", "http://eventual-consistency-service:8001") + f"/{graphname}/consistency_status" ) LogWriter.info(f"Sending ECC request to: {ecc}") From 676b8537d7235083fb3c9b66c6fbcda67ee3a2c3 Mon Sep 17 00:00:00 2001 From: Bill Shi Date: Fri, 2 Aug 2024 09:35:22 -0700 Subject: [PATCH 3/5] fix: pymilvus error in CI test --- .github/workflows/pull-test-merge.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/pull-test-merge.yaml b/.github/workflows/pull-test-merge.yaml index 654703d8..abc7fbd7 100644 --- a/.github/workflows/pull-test-merge.yaml +++ b/.github/workflows/pull-test-merge.yaml @@ -66,6 +66,7 @@ jobs: source venv/bin/activate cp -r copilot/tests/*test* copilot/tests/create_wandb_report.py copilot/app/ cd copilot/app + python -c "import pymilvus;print(pymilvus.__version__)" python -m pytest --disable-warnings env: DB_CONFIG: ${{ secrets.DB_CONFIG }} From d8db8305f08ecffd4fc94c10cef3c5411507b7be Mon Sep 17 00:00:00 2001 From: Bill Shi Date: Fri, 2 Aug 2024 09:41:38 -0700 Subject: [PATCH 4/5] fix: rm print pymilvus version --- .github/workflows/pull-test-merge.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/pull-test-merge.yaml b/.github/workflows/pull-test-merge.yaml index abc7fbd7..654703d8 100644 --- a/.github/workflows/pull-test-merge.yaml +++ b/.github/workflows/pull-test-merge.yaml @@ -66,7 +66,6 @@ jobs: source venv/bin/activate cp -r copilot/tests/*test* copilot/tests/create_wandb_report.py copilot/app/ cd copilot/app - python -c "import pymilvus;print(pymilvus.__version__)" python -m pytest --disable-warnings env: DB_CONFIG: ${{ secrets.DB_CONFIG }} From 27c6b614d382cd38f14e08ca00d98d70a2a1bc1a Mon Sep 17 00:00:00 2001 From: Lu Zhou Date: Fri, 2 Aug 2024 12:11:15 -0700 Subject: [PATCH 5/5] remove tgcloud paramter --- chat-history/config/config.go | 1 - chat-history/config/config_test.go | 6 ++---- chat-history/main.go | 2 +- chat-history/routes/routes.go | 7 ++++--- chat-history/routes/routes_test.go | 4 ++-- 5 files changed, 9 insertions(+), 11 deletions(-) diff --git a/chat-history/config/config.go b/chat-history/config/config.go index e067be00..f1a14851 100644 --- a/chat-history/config/config.go +++ b/chat-history/config/config.go @@ -22,7 +22,6 @@ type TgDbConfig struct { Username string `json:"username"` Password string `json:"password"` GsPort string `json:"gsPort"` - TgCloud bool `json:"tgCloud"` // GetToken string `json:"getToken"` // DefaultTimeout string `json:"default_timeout"` // DefaultMemThreshold string `json:"default_mem_threshold"` diff --git a/chat-history/config/config_test.go b/chat-history/config/config_test.go index 9ddce8c8..26ad5819 100644 --- a/chat-history/config/config_test.go +++ b/chat-history/config/config_test.go @@ -25,8 +25,7 @@ func TestLoadConfig(t *testing.T) { } if cfg.TgDbConfig.Hostname != "https://tg-0cdef603-3760-41c3-af6f-41e95afc40de.us-east-1.i.tgcloud.io" || - cfg.TgDbConfig.GsPort != "14240" || - cfg.TgDbConfig.TgCloud != true { + cfg.TgDbConfig.GsPort != "14240" { t.Fatalf("TigerGraph config is wrong, %v", cfg.TgDbConfig) } } @@ -54,8 +53,7 @@ func setup(t *testing.T) (string, string) { "hostname": "https://tg-0cdef603-3760-41c3-af6f-41e95afc40de.us-east-1.i.tgcloud.io", "gsPort": "14240", "username": "supportai", - "password": "supportai", - "tgCloud": true + "password": "supportai" }` if err := os.WriteFile(tgConfigPath, []byte(tgConfigData), 0644); err != nil { t.Fatal("error setting up tg_config.json") diff --git a/chat-history/main.go b/chat-history/main.go index 1f82effd..08800904 100644 --- a/chat-history/main.go +++ b/chat-history/main.go @@ -36,7 +36,7 @@ func main() { router.HandleFunc("GET /user/{userId}", routes.GetUserConversations) router.HandleFunc("GET /conversation/{conversationId}", routes.GetConversation) router.HandleFunc("POST /conversation", routes.UpdateConversation) - router.HandleFunc("GET /get_feedback", routes.GetFeedback(cfg.TgDbConfig.Hostname, cfg.TgDbConfig.GsPort, cfg.ChatDbConfig.ConversationAccessRoles, cfg.TgDbConfig.TgCloud)) + router.HandleFunc("GET /get_feedback", routes.GetFeedback(cfg.TgDbConfig.Hostname, cfg.TgDbConfig.GsPort, cfg.ChatDbConfig.ConversationAccessRoles)) // create server with middleware dev := strings.ToLower(os.Getenv("DEV")) == "true" diff --git a/chat-history/routes/routes.go b/chat-history/routes/routes.go index 0524f7a4..7c3303e1 100644 --- a/chat-history/routes/routes.go +++ b/chat-history/routes/routes.go @@ -158,8 +158,9 @@ func auth(userId string, r *http.Request) (string, int, []byte, bool) { } // executeGSQL sends a GSQL query to TigerGraph with basic authentication and returns the response -func executeGSQL(hostname, username, password, query, gsPort string, tgcloud bool) (string, error) { +func executeGSQL(hostname, username, password, query, gsPort string) (string, error) { var requestURL string + tgcloud := strings.Contains(hostname, "tgcloud") // Construct the URL for the GSQL query endpoint if tgcloud { requestURL = fmt.Sprintf("%s:443/gsqlserver/gsql/file", hostname) @@ -235,7 +236,7 @@ func parseUserRoles(userInfo string, userName string) []string { // GetFeedback retrieves feedback data for conversations // "Get /get_feedback" -func GetFeedback(hostname, gsPort string, conversationAccessRoles []string, tgCloud bool) http.HandlerFunc { +func GetFeedback(hostname, gsPort string, conversationAccessRoles []string) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { usr, pass, ok := r.BasicAuth() if !ok { @@ -246,7 +247,7 @@ func GetFeedback(hostname, gsPort string, conversationAccessRoles []string, tgCl } // Verify if the user has the required role - userInfo, err := executeGSQL(hostname, usr, pass, "SHOW USER", gsPort, tgCloud) + userInfo, err := executeGSQL(hostname, usr, pass, "SHOW USER", gsPort) if err != nil { reason := []byte(`{"reason":"failed to retrieve feedback data"}`) w.Header().Add("Content-Type", "application/json") diff --git a/chat-history/routes/routes_test.go b/chat-history/routes/routes_test.go index 075bfe49..80ecb373 100644 --- a/chat-history/routes/routes_test.go +++ b/chat-history/routes/routes_test.go @@ -414,7 +414,7 @@ func TestExecuteGSQL(t *testing.T) { } query := "SHOW USER" - response, err := executeGSQL(cfg.TgDbConfig.Hostname, cfg.TgDbConfig.Username, cfg.TgDbConfig.Password, query, cfg.TgDbConfig.GsPort, cfg.TgDbConfig.TgCloud) + response, err := executeGSQL(cfg.TgDbConfig.Hostname, cfg.TgDbConfig.Username, cfg.TgDbConfig.Password, query, cfg.TgDbConfig.GsPort) if err != nil { t.Fatalf("Failed to execute GSQL query: %v", err) } @@ -518,7 +518,7 @@ func TestGetFeedback(t *testing.T) { // Record the response rr := httptest.NewRecorder() - handler := http.HandlerFunc(GetFeedback(cfg.TgDbConfig.Hostname, cfg.TgDbConfig.GsPort, cfg.ChatDbConfig.ConversationAccessRoles, cfg.TgDbConfig.TgCloud)) + handler := http.HandlerFunc(GetFeedback(cfg.TgDbConfig.Hostname, cfg.TgDbConfig.GsPort, cfg.ChatDbConfig.ConversationAccessRoles)) // Serve the request handler.ServeHTTP(rr, req)