diff --git a/.env.example b/.env.example index 45b7676b..71417426 100644 --- a/.env.example +++ b/.env.example @@ -8,7 +8,7 @@ LANGFLOW_SECRET_KEY= # flow ids for chat and ingestion flows LANGFLOW_CHAT_FLOW_ID=1098eea1-6649-4e1d-aed1-b77249fb8dd0 LANGFLOW_INGEST_FLOW_ID=5488df7c-b93f-4f87-a446-b67028bc0813 -NUDGES_FLOW_ID=ebc01d31-1976-46ce-a385-b0240327226c +LANGFLOW_NUDGES_FLOW_ID=ebc01d31-1976-46ce-a385-b0240327226c # Set a strong admin password for OpenSearch; a bcrypt hash is generated at # container startup from this value. Do not commit real secrets. diff --git a/docker-compose-cpu.yml b/docker-compose-cpu.yml index 06d44643..c7d42d0c 100644 --- a/docker-compose-cpu.yml +++ b/docker-compose-cpu.yml @@ -56,7 +56,7 @@ services: - LANGFLOW_CHAT_FLOW_ID=${LANGFLOW_CHAT_FLOW_ID} - LANGFLOW_INGEST_FLOW_ID=${LANGFLOW_INGEST_FLOW_ID} - DISABLE_INGEST_WITH_LANGFLOW=${DISABLE_INGEST_WITH_LANGFLOW:-false} - - NUDGES_FLOW_ID=${NUDGES_FLOW_ID} + - LANGFLOW_NUDGES_FLOW_ID=${LANGFLOW_NUDGES_FLOW_ID} - OPENSEARCH_PORT=9200 - OPENSEARCH_USERNAME=admin - OPENSEARCH_PASSWORD=${OPENSEARCH_PASSWORD} diff --git a/docker-compose.yml b/docker-compose.yml index 997cf463..93b7e6c9 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -55,7 +55,7 @@ services: - LANGFLOW_CHAT_FLOW_ID=${LANGFLOW_CHAT_FLOW_ID} - LANGFLOW_INGEST_FLOW_ID=${LANGFLOW_INGEST_FLOW_ID} - DISABLE_INGEST_WITH_LANGFLOW=${DISABLE_INGEST_WITH_LANGFLOW:-false} - - NUDGES_FLOW_ID=${NUDGES_FLOW_ID} + - LANGFLOW_NUDGES_FLOW_ID=${LANGFLOW_NUDGES_FLOW_ID} - OPENSEARCH_PORT=9200 - OPENSEARCH_USERNAME=admin - OPENSEARCH_PASSWORD=${OPENSEARCH_PASSWORD} diff --git a/src/api/settings.py b/src/api/settings.py index 0f49f85e..27382f74 100644 --- a/src/api/settings.py +++ b/src/api/settings.py @@ -5,6 +5,7 @@ from config.settings import ( LANGFLOW_CHAT_FLOW_ID, LANGFLOW_INGEST_FLOW_ID, LANGFLOW_PUBLIC_URL, + LANGFLOW_NUDGES_FLOW_ID, clients, ) @@ -20,6 +21,7 @@ async def get_settings(request, session_manager): "langflow_url": LANGFLOW_URL, "flow_id": LANGFLOW_CHAT_FLOW_ID, "ingest_flow_id": LANGFLOW_INGEST_FLOW_ID, + "langflow_nudges_flow_id": LANGFLOW_NUDGES_FLOW_ID, "langflow_public_url": LANGFLOW_PUBLIC_URL, } @@ -34,6 +36,11 @@ async def get_settings(request, session_manager): f"{LANGFLOW_PUBLIC_URL.rstrip('/')}/flow/{LANGFLOW_INGEST_FLOW_ID}" ) + if LANGFLOW_PUBLIC_URL and LANGFLOW_NUDGES_FLOW_ID: + settings["langflow_nudges_edit_url"] = ( + f"{LANGFLOW_PUBLIC_URL.rstrip('/')}/flow/{LANGFLOW_NUDGES_FLOW_ID}" + ) + # Fetch ingestion flow configuration to get actual component defaults if LANGFLOW_INGEST_FLOW_ID: try: diff --git a/src/config/settings.py b/src/config/settings.py index 715146fb..889b3539 100644 --- a/src/config/settings.py +++ b/src/config/settings.py @@ -30,7 +30,7 @@ _legacy_flow_id = os.getenv("FLOW_ID") LANGFLOW_CHAT_FLOW_ID = os.getenv("LANGFLOW_CHAT_FLOW_ID") or _legacy_flow_id LANGFLOW_INGEST_FLOW_ID = os.getenv("LANGFLOW_INGEST_FLOW_ID") -NUDGES_FLOW_ID = os.getenv("NUDGES_FLOW_ID") +LANGFLOW_NUDGES_FLOW_ID = os.getenv("LANGFLOW_NUDGES_FLOW_ID") if _legacy_flow_id and not os.getenv("LANGFLOW_CHAT_FLOW_ID"): logger.warning("FLOW_ID is deprecated. Please use LANGFLOW_CHAT_FLOW_ID instead") diff --git a/src/services/chat_service.py b/src/services/chat_service.py index 51da4b31..e0c2eea1 100644 --- a/src/services/chat_service.py +++ b/src/services/chat_service.py @@ -1,4 +1,4 @@ -from config.settings import NUDGES_FLOW_ID, clients, LANGFLOW_URL +from config.settings import LANGFLOW_NUDGES_FLOW_ID, clients, LANGFLOW_URL from agent import ( async_chat, async_langflow, @@ -170,9 +170,9 @@ class ChatService: ): """Handle Langflow chat requests""" - if not LANGFLOW_URL or not NUDGES_FLOW_ID: + if not LANGFLOW_URL or not LANGFLOW_NUDGES_FLOW_ID: raise ValueError( - "LANGFLOW_URL and NUDGES_FLOW_ID environment variables are required" + "LANGFLOW_URL and LANGFLOW_NUDGES_FLOW_ID environment variables are required" ) # Prepare extra headers for JWT authentication @@ -207,7 +207,7 @@ class ChatService: response_text, response_id = await async_langflow_chat( langflow_client, - NUDGES_FLOW_ID, + LANGFLOW_NUDGES_FLOW_ID, prompt, user_id, extra_headers=extra_headers, diff --git a/src/services/flows_service.py b/src/services/flows_service.py index 2df712b7..b9a2620d 100644 --- a/src/services/flows_service.py +++ b/src/services/flows_service.py @@ -1,4 +1,4 @@ -from config.settings import NUDGES_FLOW_ID, LANGFLOW_URL, LANGFLOW_CHAT_FLOW_ID, LANGFLOW_INGEST_FLOW_ID, clients +from config.settings import LANGFLOW_NUDGES_FLOW_ID, LANGFLOW_URL, LANGFLOW_CHAT_FLOW_ID, LANGFLOW_INGEST_FLOW_ID, clients import json import os from utils.logging_config import get_logger @@ -23,7 +23,7 @@ class FlowsService: # Determine flow file and ID based on type if flow_type == "nudges": flow_file = "flows/openrag_nudges.json" - flow_id = NUDGES_FLOW_ID + flow_id = LANGFLOW_NUDGES_FLOW_ID elif flow_type == "retrieval": flow_file = "flows/openrag_agent.json" flow_id = LANGFLOW_CHAT_FLOW_ID diff --git a/src/tui/managers/env_manager.py b/src/tui/managers/env_manager.py index 4c4f294d..0c06acbc 100644 --- a/src/tui/managers/env_manager.py +++ b/src/tui/managers/env_manager.py @@ -33,6 +33,7 @@ class EnvConfig: langflow_superuser_password: str = "" langflow_chat_flow_id: str = "1098eea1-6649-4e1d-aed1-b77249fb8dd0" langflow_ingest_flow_id: str = "5488df7c-b93f-4f87-a446-b67028bc0813" + langflow_nudges_flow_id: str = "ebc01d31-1976-46ce-a385-b0240327226c" # OAuth settings google_oauth_client_id: str = "" @@ -105,7 +106,7 @@ class EnvManager: "LANGFLOW_SUPERUSER_PASSWORD": "langflow_superuser_password", "LANGFLOW_CHAT_FLOW_ID": "langflow_chat_flow_id", "LANGFLOW_INGEST_FLOW_ID": "langflow_ingest_flow_id", - "NUDGES_FLOW_ID": "nudges_flow_id", + "LANGFLOW_NUDGES_FLOW_ID": "langflow_nudges_flow_id", "GOOGLE_OAUTH_CLIENT_ID": "google_oauth_client_id", "GOOGLE_OAUTH_CLIENT_SECRET": "google_oauth_client_secret", "MICROSOFT_GRAPH_OAUTH_CLIENT_ID": "microsoft_graph_oauth_client_id", @@ -246,7 +247,7 @@ class EnvManager: f.write( f"LANGFLOW_INGEST_FLOW_ID={self.config.langflow_ingest_flow_id}\n" ) - f.write(f"NUDGES_FLOW_ID={self.config.nudges_flow_id}\n") + f.write(f"LANGFLOW_NUDGES_FLOW_ID={self.config.langflow_nudges_flow_id}\n") f.write(f"OPENSEARCH_PASSWORD={self.config.opensearch_password}\n") f.write(f"OPENAI_API_KEY={self.config.openai_api_key}\n") f.write(