Skip to content

OpenRAG is a comprehensive, single package Retrieval-Augmented Generation platform built on Langflow, Docling, and Opensearch.

Python

merge

phactad357217b53a
diff --cc src/tui/screens/config.py
index 378974fdf,ed47ca169..14639b034
--- a/src/tui/screens/config.py
+++ b/src/tui/screens/config.py
@@@ -288,359 -315,92 +312,93 @@@ class ConfigScreen(Screen)
with Horizontal():
yield Label("Admin Password (optional)")
yield Checkbox("Generate password", id="generate-langflow-password")
- current_value = getattr(
- self.env_manager.config, "langflow_superuser_password", ""
- )
+ current_value = getattr(self.env_manager.config, field.name, "")
with Horizontal(id="langflow-password-row"):
input_widget = Input(
- placeholder="Langflow password",
+ placeholder=field.placeholder,
value=current_value,
password=True,
- id="input-langflow_superuser_password",
+ id=f"input-{field.name}",
)
yield input_widget
- self.inputs["langflow_superuser_password"] = input_widget
- yield Button("👁", id="toggle-langflow-password", variant="default")
+ self.inputs[field.name] = input_widget
+ yield Button("👁", id=f"toggle-{field.name}", variant="default")
yield Static(" ")
- # Langflow Admin Username - conditionally displayed based on password
+ def _render_langflow_superuser(self, field: ConfigField) -> ComposeResult:
+ """Langflow username with conditional visibility."""
yield Label("Admin Username *", id="langflow-username-label")
- current_value = getattr(self.env_manager.config, "langflow_superuser", "")
+ current_value = getattr(self.env_manager.config, field.name, field.default)
input_widget = Input(
- placeholder="admin", value=current_value, id="input-langflow_superuser"
- )
- yield input_widget
- self.inputs["langflow_superuser"] = input_widget
- yield Static(" ", id="langflow-username-spacer")
-
- # Langflow Public URL (full mode only, but grouped here)
- if self.mode == "full":
- yield Label("Public URL (optional)")
- yield Static(
- "External URL for Langflow access",
- classes="helper-text",
- )
- current_value = getattr(self.env_manager.config, "langflow_public_url", "")
- input_widget = Input(
- placeholder="http://localhost:7860",
- value=current_value,
- id="input-langflow_public_url",
- )
- yield input_widget
- self.inputs["langflow_public_url"] = input_widget
- yield Static(" ")
-
- # ===== AI Providers Section =====
- yield Static("AI Providers", classes="tab-header")
- yield Static(" ")
-
- # OpenAI API Key
- yield Label("OpenAI API Key (optional)")
- yield Static(
- Text("Get a key: https://platform.openai.com/api-keys", style="dim"),
- classes="helper-text",
- )
- current_value = getattr(self.env_manager.config, "openai_api_key", "")
- with Horizontal(id="openai-key-row"):
- input_widget = Input(
- placeholder="sk-...",
- value=current_value,
- password=True,
- validators=[OpenAIKeyValidator()],
- id="input-openai_api_key",
- )
- yield input_widget
- self.inputs["openai_api_key"] = input_widget
- yield Button("Show", id="toggle-openai-key", variant="default")
- yield Static(" ")
-
- # Anthropic API Key
- yield Label("Anthropic API Key (optional)")
- yield Static(
- Text("Get a key: https://console.anthropic.com/settings/keys", style="dim"),
- classes="helper-text",
- )
- current_value = getattr(self.env_manager.config, "anthropic_api_key", "")
- with Horizontal(id="anthropic-key-row"):
- input_widget = Input(
- placeholder="sk-ant-...",
- value=current_value,
- password=True,
- validators=[AnthropicKeyValidator()],
- id="input-anthropic_api_key",
- )
- yield input_widget
- self.inputs["anthropic_api_key"] = input_widget
- yield Button("Show", id="toggle-anthropic-key", variant="default")
- yield Static(" ")
-
- # Ollama Endpoint
- yield Label("Ollama Base URL (optional)")
- yield Static(
- Text("Endpoint of your Ollama server", style="dim"),
- classes="helper-text",
- )
- current_value = getattr(self.env_manager.config, "ollama_endpoint", "")
- input_widget = Input(
- placeholder="http://localhost:11434",
+ placeholder=field.placeholder,
value=current_value,
- validators=[OllamaEndpointValidator()],
- id="input-ollama_endpoint",
+ id=f"input-{field.name}",
)
yield input_widget
- self.inputs["ollama_endpoint"] = input_widget
- yield Static(" ")
-
- # IBM watsonx.ai API Key
- yield Label("IBM watsonx.ai API Key (optional)")
- yield Static(
- Text("Get a key: https://cloud.ibm.com/iam/apikeys", style="dim"),
- classes="helper-text",
- )
- current_value = getattr(self.env_manager.config, "watsonx_api_key", "")
- with Horizontal(id="watsonx-key-row"):
- input_widget = Input(
- placeholder="",
- value=current_value,
- password=True,
- id="input-watsonx_api_key",
- )
- yield input_widget
- self.inputs["watsonx_api_key"] = input_widget
- yield Button("Show", id="toggle-watsonx-key", variant="default")
- yield Static(" ")
+ self.inputs[field.name] = input_widget
+ yield Static(" ", id="langflow-username-spacer")
- # IBM watsonx.ai Endpoint
- yield Label("IBM watsonx.ai Endpoint (optional)")
+ def _render_google_oauth_client_id(self, field: ConfigField) -> ComposeResult:
+ """Google OAuth client ID with redirect URI helper."""
+ yield Label(field.label)
yield Static(
- Text("Example: https://us-south.ml.cloud.ibm.com", style="dim"),
+ Text(field.helper_text, style="dim"),
classes="helper-text",
)
- current_value = getattr(self.env_manager.config, "watsonx_endpoint", "")
- input_widget = Input(
- placeholder="https://us-south.ml.cloud.ibm.com",
- value=current_value,
- validators=[WatsonxEndpointValidator()],
- id="input-watsonx_endpoint",
- )
- yield input_widget
- self.inputs["watsonx_endpoint"] = input_widget
- yield Static(" ")
-
- # IBM watsonx.ai Project ID
- yield Label("IBM watsonx.ai Project ID (optional)")
+ frontend_port = os.getenv("FRONTEND_PORT", "3000")
yield Static(
- Text("Find in your IBM Cloud project settings", style="dim"),
+ Text(
+ f"Redirect URI: http://localhost:{frontend_port}/auth/callback (or your domain)",
+ style="dim",
+ ),
classes="helper-text",
)
- current_value = getattr(self.env_manager.config, "watsonx_project_id", "")
+ current_value = getattr(self.env_manager.config, field.name, "")
input_widget = Input(
- placeholder="",
+ placeholder=field.placeholder,
value=current_value,
- id="input-watsonx_project_id",
+ id=f"input-{field.name}",
)
yield input_widget
- self.inputs["watsonx_project_id"] = input_widget
+ self.inputs[field.name] = input_widget
yield Static(" ")
- # ===== Cloud Connectors Section (full mode only) =====
- if self.mode == "full":
- yield Static("Cloud Connectors", classes="tab-header")
- yield Static(" ")
-
- # Google OAuth Client ID
- yield Label("Google OAuth Client ID")
- yield Static(
- Text(
- "Create credentials: https://console.cloud.google.com/apis/credentials",
- style="dim",
- ),
- classes="helper-text",
- )
- yield Static(
- Text(
- "Redirect URI: http://localhost:3000/auth/callback (or your domain)",
- style="dim",
- ),
- classes="helper-text",
- )
- current_value = getattr(
- self.env_manager.config, "google_oauth_client_id", ""
- )
- input_widget = Input(
- placeholder="xxx.apps.googleusercontent.com",
- value=current_value,
- id="input-google_oauth_client_id",
- )
- yield input_widget
- self.inputs["google_oauth_client_id"] = input_widget
- yield Static(" ")
-
- # Google OAuth Client Secret
- yield Label("Google OAuth Client Secret")
- current_value = getattr(
- self.env_manager.config, "google_oauth_client_secret", ""
- )
- with Horizontal(id="google-secret-row"):
- input_widget = Input(
- placeholder="",
- value=current_value,
- password=True,
- id="input-google_oauth_client_secret",
- )
- yield input_widget
- self.inputs["google_oauth_client_secret"] = input_widget
- yield Button("Show", id="toggle-google-secret", variant="default")
- yield Static(" ")
-
- # Microsoft Graph Client ID
- yield Label("Microsoft Graph Client ID")
- yield Static(
- Text(
- "Create app: https://portal.azure.com/#view/Microsoft_AAD_RegisteredApps/ApplicationsListBlade",
- style="dim",
- ),
- classes="helper-text",
- )
- yield Static(
- Text(
- "Redirect URI: http://localhost:3000/auth/callback (or your domain)",
- style="dim",
- ),
- classes="helper-text",
- )
- current_value = getattr(
- self.env_manager.config, "microsoft_graph_oauth_client_id", ""
- )
- input_widget = Input(
- placeholder="",
- value=current_value,
- id="input-microsoft_graph_oauth_client_id",
- )
- yield input_widget
- self.inputs["microsoft_graph_oauth_client_id"] = input_widget
- yield Static(" ")
-
- # Microsoft Graph Client Secret
- yield Label("Microsoft Graph Client Secret")
- current_value = getattr(
- self.env_manager.config, "microsoft_graph_oauth_client_secret", ""
- )
- with Horizontal(id="microsoft-secret-row"):
- input_widget = Input(
- placeholder="",
- value=current_value,
- password=True,
- id="input-microsoft_graph_oauth_client_secret",
- )
- yield input_widget
- self.inputs["microsoft_graph_oauth_client_secret"] = input_widget
- yield Button("Show", id="toggle-microsoft-secret", variant="default")
- yield Static(" ")
-
- # AWS Access Key ID
- yield Label("AWS Access Key ID")
- yield Static(
- Text(
- "Create keys: https://console.aws.amazon.com/iam/home#/security_credentials",
- style="dim",
- ),
- classes="helper-text",
- )
- current_value = getattr(self.env_manager.config, "aws_access_key_id", "")
- input_widget = Input(
- placeholder="", value=current_value, id="input-aws_access_key_id"
- )
- yield input_widget
- self.inputs["aws_access_key_id"] = input_widget
- yield Static(" ")
-
- # AWS Secret Access Key
- yield Label("AWS Secret Access Key")
- current_value = getattr(
- self.env_manager.config, "aws_secret_access_key", ""
- )
- input_widget = Input(
- placeholder="",
- value=current_value,
- password=True,
- id="input-aws_secret_access_key",
- )
- yield input_widget
- self.inputs["aws_secret_access_key"] = input_widget
- yield Static(" ")
-
- # ===== Langfuse Section =====
- yield Static("Langfuse (Tracing)", classes="tab-header")
- yield Static(" ")
-
- # Langfuse Secret Key
- yield Label("Secret Key (optional)")
+ def _render_microsoft_graph_oauth_client_id(self, field: ConfigField) -> ComposeResult:
+ """Microsoft OAuth client ID with redirect URI helper."""
+ yield Label(field.label)
yield Static(
- Text("Get keys from your Langfuse project settings", style="dim"),
+ Text(field.helper_text, style="dim"),
classes="helper-text",
)
- current_value = getattr(self.env_manager.config, "langfuse_secret_key", "")
- with Horizontal(id="langfuse-secret-key-row"):
- input_widget = Input(
- placeholder="sk-lf-...",
- value=current_value,
- password=True,
- id="input-langfuse_secret_key",
- )
- yield input_widget
- self.inputs["langfuse_secret_key"] = input_widget
- yield Button("Show", id="toggle-langfuse-secret-key", variant="default")
- yield Static(" ")
-
- # Langfuse Public Key
- yield Label("Public Key (optional)")
- current_value = getattr(self.env_manager.config, "langfuse_public_key", "")
- with Horizontal(id="langfuse-public-key-row"):
- input_widget = Input(
- placeholder="pk-lf-...",
- value=current_value,
- password=True,
- id="input-langfuse_public_key",
- )
- yield input_widget
- self.inputs["langfuse_public_key"] = input_widget
- yield Button("Show", id="toggle-langfuse-public-key", variant="default")
- yield Static(" ")
-
- # Langfuse Host
- yield Label("Host (optional)")
+ frontend_port = os.getenv("FRONTEND_PORT", "3000")
yield Static(
- Text("Leave empty for Langfuse Cloud, or set for self-hosted", style="dim"),
+ Text(
+ f"Redirect URI: http://localhost:{frontend_port}/auth/callback (or your domain)",
+ style="dim",
+ ),
classes="helper-text",
)
- current_value = getattr(self.env_manager.config, "langfuse_host", "")
+ current_value = getattr(self.env_manager.config, field.name, "")
input_widget = Input(
- placeholder="https://cloud.langfuse.com",
+ placeholder=field.placeholder,
value=current_value,
- id="input-langfuse_host",
+ id=f"input-{field.name}",
)
yield input_widget
- self.inputs["langfuse_host"] = input_widget
- yield Static(" ")
-
- # ===== Storage Section =====
- yield Static("Storage", classes="tab-header")
+ self.inputs[field.name] = input_widget
yield Static(" ")
- # Documents Paths
- yield Label("Documents Paths")
- yield Static(
- "Directories containing documents to ingest (comma-separated)",
- classes="helper-text",
- )
- current_value = getattr(self.env_manager.config, "openrag_documents_paths", "")
+ def _render_openrag_documents_paths(self, field: ConfigField) -> ComposeResult:
+ """Documents paths with validator and file picker."""
+ yield Label(field.label)
+ yield Static(field.helper_text, classes="helper-text")
+ current_value = getattr(self.env_manager.config, field.name, "")
input_widget = Input(
- placeholder="~/.openrag/documents",
+ placeholder=field.placeholder,
value=current_value,
validators=[DocumentsPathValidator()],
+ validate_on=["submitted"],
- id="input-openrag_documents_paths",
+ id=f"input-{field.name}",
)
yield input_widget
yield Horizontal(
@@@ -648,30 -408,9 +406,10 @@@
id="docs-path-actions",
classes="controls-row",
)
- self.inputs["openrag_documents_paths"] = input_widget
+ self.inputs[field.name] = input_widget
yield Static(" ")
- # ===== Advanced Section (full mode only) =====
- if self.mode == "full":
- yield Static("Advanced", classes="tab-header")
- yield Static(" ")
-
- # Webhook Base URL
- yield Label("Webhook Base URL")
- yield Static(
- "External URL for continuous ingestion webhooks",
- classes="helper-text",
- )
- current_value = getattr(self.env_manager.config, "webhook_base_url", "")
- input_widget = Input(
- placeholder="https://your-domain.com",
- value=current_value,
- id="input-webhook_base_url",
- )
- yield input_widget
- self.inputs["webhook_base_url"] = input_widget
- yield Static(" ")
+
def on_mount(self) -> None:
"""Initialize the screen when mounted."""
# Set initial visibility of username field based on password