Skip to content

armgit / dify

Public Imported from GitHub
0

Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.

fix(api): resolve type errors in BaseTraceInstance and OpsTraceManager (#32773)

Br1ancfdf16c49e34
diff --git a/api/core/ops/base_trace_instance.py b/api/core/ops/base_trace_instance.py
index 04b46d67a82..8c081ae2253 100644
--- a/api/core/ops/base_trace_instance.py
+++ b/api/core/ops/base_trace_instance.py
@@ -14,10 +14,9 @@ class BaseTraceInstance(ABC):
Base trace instance for ops trace services
"""
- @abstractmethod
def __init__(self, trace_config: BaseTracingConfig):
"""
- Abstract initializer for the trace instance.
+ Initializer for the trace instance.
Distribute trace tasks by matching entities
"""
self.trace_config = trace_config
diff --git a/api/core/ops/ops_trace_manager.py b/api/core/ops/ops_trace_manager.py
index 549e428f886..177991e6459 100644
--- a/api/core/ops/ops_trace_manager.py
+++ b/api/core/ops/ops_trace_manager.py
@@ -41,8 +41,8 @@ logger = logging.getLogger(__name__)
class OpsTraceProviderConfigMap(collections.UserDict[str, dict[str, Any]]):
- def __getitem__(self, provider: str) -> dict[str, Any]:
- match provider:
+ def __getitem__(self, key: str) -> dict[str, Any]:
+ match key:
case TracingProviderEnum.LANGFUSE:
from core.ops.entities.config_entity import LangfuseConfig
from core.ops.langfuse_trace.langfuse_trace import LangFuseDataTrace
@@ -149,7 +149,7 @@ class OpsTraceProviderConfigMap(collections.UserDict[str, dict[str, Any]]):
}
case _:
- raise KeyError(f"Unsupported tracing provider: {provider}")
+ raise KeyError(f"Unsupported tracing provider: {key}")
provider_config_map = OpsTraceProviderConfigMap()