This commit is contained in:
phact 2025-12-17 13:02:15 -05:00
parent 66ef7a9987
commit f3e1ca673a
4 changed files with 1474 additions and 1638 deletions

View file

@ -111,6 +111,9 @@ services:
- "7860:7860"
environment:
- LANGFLOW_DEACTIVATE_TRACING=true
- LANGFUSE_SECRET_KEY=${LANGFUSE_SECRET_KEY:-}
- LANGFUSE_PUBLIC_KEY=${LANGFUSE_PUBLIC_KEY:-}
- LANGFUSE_BASE_URL=${LANGFUSE_BASE_URL:-}
- OPENAI_API_KEY=${OPENAI_API_KEY:-None}
- ANTHROPIC_API_KEY=${ANTHROPIC_API_KEY:-None}
- WATSONX_API_KEY=${WATSONX_API_KEY:-None}

View file

@ -55,6 +55,11 @@ class EnvConfig:
aws_secret_access_key: str = ""
langflow_public_url: str = ""
# Langfuse settings (optional)
langfuse_secret_key: str = ""
langfuse_public_key: str = ""
langfuse_base_url: str = ""
# Langflow auth settings
langflow_auto_login: str = "False"
langflow_new_user_is_active: str = "False"
@ -190,6 +195,9 @@ class EnvManager:
"LANGFLOW_ENABLE_SUPERUSER_CLI": "langflow_enable_superuser_cli",
"DISABLE_INGEST_WITH_LANGFLOW": "disable_ingest_with_langflow",
"OPENRAG_VERSION": "openrag_version",
"LANGFUSE_SECRET_KEY": "langfuse_secret_key", # pragma: allowlist secret
"LANGFUSE_PUBLIC_KEY": "langfuse_public_key", # pragma: allowlist secret
"LANGFUSE_BASE_URL": "langfuse_base_url",
}
loaded_from_file = False
@ -503,6 +511,24 @@ class EnvManager:
if optional_written:
f.write("\n")
# Langfuse settings (optional)
langfuse_vars = [
("LANGFUSE_SECRET_KEY", self.config.langfuse_secret_key),
("LANGFUSE_PUBLIC_KEY", self.config.langfuse_public_key),
("LANGFUSE_BASE_URL", self.config.langfuse_base_url),
]
langfuse_written = False
for var_name, var_value in langfuse_vars:
if var_value:
if not langfuse_written:
f.write("# Langfuse settings\n")
langfuse_written = True
f.write(f"{var_name}={self._quote_env_value(var_value)}\n")
if langfuse_written:
f.write("\n")
return True
except Exception as e:

View file

@ -513,6 +513,58 @@ class ConfigScreen(Screen):
self.inputs["aws_secret_access_key"] = input_widget
yield Static(" ")
# Langfuse Section (available in both basic and full mode)
yield Static("Langfuse (Tracing)", classes="tab-header")
yield Static(" ")
# Langfuse Secret Key
yield Label("Langfuse Secret Key (optional)")
yield Static(
Text("Get keys from your Langfuse project settings", 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("Langfuse 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 Base URL
yield Label("Langfuse Base URL (optional)")
yield Static(
Text("Leave empty for Langfuse Cloud, or set for self-hosted", style="dim"),
classes="helper-text",
)
current_value = getattr(self.env_manager.config, "langfuse_base_url", "")
input_widget = Input(
placeholder="https://cloud.langfuse.com",
value=current_value,
id="input-langfuse_base_url",
)
yield input_widget
self.inputs["langfuse_base_url"] = input_widget
yield Static(" ")
# Other Settings Section
@ -713,6 +765,18 @@ class ConfigScreen(Screen):
if input_widget:
input_widget.password = not input_widget.password
event.button.label = "Hide" if not input_widget.password else "Show"
elif event.button.id == "toggle-langfuse-secret-key":
# Toggle Langfuse secret key visibility
input_widget = self.inputs.get("langfuse_secret_key")
if input_widget:
input_widget.password = not input_widget.password
event.button.label = "Hide" if not input_widget.password else "Show"
elif event.button.id == "toggle-langfuse-public-key":
# Toggle Langfuse public key visibility
input_widget = self.inputs.get("langfuse_public_key")
if input_widget:
input_widget.password = not input_widget.password
event.button.label = "Hide" if not input_widget.password else "Show"
def action_generate(self) -> None:
"""Generate secure passwords for admin accounts."""

3019
uv.lock generated

File diff suppressed because it is too large Load diff