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) 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}") 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":