Skip to content

Commit

Permalink
Langfuse view button (langgenius#7684)
Browse files Browse the repository at this point in the history
  • Loading branch information
charli117 authored and cuiks committed Sep 2, 2024
1 parent b9492fc commit 5c4ff25
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
1 change: 0 additions & 1 deletion api/core/ops/entities/config_entity.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ class LangfuseConfig(BaseTracingConfig):
"""
public_key: str
secret_key: str
project_key: str
host: str = 'https://api.langfuse.com'

@field_validator("host")
Expand Down
11 changes: 5 additions & 6 deletions api/services/ops_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,15 @@ def get_tracing_app_config(cls, app_id: str, tracing_provider: str):
decrypt_tracing_config = OpsTraceManager.decrypt_tracing_config(
tenant_id, tracing_provider, trace_config_data.tracing_config
)
new_decrypt_tracing_config = OpsTraceManager.obfuscated_decrypt_token(tracing_provider, decrypt_tracing_config)

if tracing_provider == "langfuse" and (
"project_key" not in decrypt_tracing_config or not decrypt_tracing_config.get("project_key")
):
project_key = OpsTraceManager.get_trace_config_project_key(decrypt_tracing_config, tracing_provider)
decrypt_tracing_config["project_key"] = project_key

decrypt_tracing_config = OpsTraceManager.obfuscated_decrypt_token(tracing_provider, decrypt_tracing_config)

trace_config_data.tracing_config = decrypt_tracing_config
new_decrypt_tracing_config.update({"project_key": project_key})

trace_config_data.tracing_config = new_decrypt_tracing_config
return trace_config_data.to_dict()

@classmethod
Expand Down Expand Up @@ -79,7 +78,7 @@ def create_tracing_app_config(cls, app_id: str, tracing_provider: str, tracing_c
# get tenant id
tenant_id = db.session.query(App).filter(App.id == app_id).first().tenant_id
tracing_config = OpsTraceManager.encrypt_tracing_config(tenant_id, tracing_provider, tracing_config)
if tracing_provider == "langfuse":
if tracing_provider == "langfuse" and project_key:
tracing_config["project_key"] = project_key
trace_config_data = TraceAppConfig(
app_id=app_id,
Expand Down

0 comments on commit 5c4ff25

Please sign in to comment.