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.
Python agentagentic-aiagentic-frameworkagentic-workflowaiautomationclaudedeepseekgenaigptllmlow-codemcpnextjsno-codeopenaipythonskillsworkflow
refactor(api): type DatasourceProviderApiEntity.to_dict with TypedDict (#34879)
volcano30340e23ce8dc4d
diff --git a/api/core/datasource/entities/api_entities.py b/api/core/datasource/entities/api_entities.pyindex 14d1af2e8b4..5f90ba067c6 100644--- a/api/core/datasource/entities/api_entities.py+++ b/api/core/datasource/entities/api_entities.py@@ -1,10 +1,10 @@-from typing import Literal, Optional+from typing import Any, Literal, Optional, TypedDictfrom graphon.model_runtime.utils.encoders import jsonable_encoderfrom pydantic import BaseModel, Field, field_validatorfrom core.datasource.entities.datasource_entities import DatasourceParameter-from core.tools.entities.common_entities import I18nObject+from core.tools.entities.common_entities import I18nObject, I18nObjectDictclass DatasourceApiEntity(BaseModel):@@ -20,6 +20,23 @@ class DatasourceApiEntity(BaseModel):ToolProviderTypeApiLiteral = Optional[Literal["builtin", "api", "workflow"]]+class DatasourceProviderApiEntityDict(TypedDict):+ id: str+ author: str+ name: str+ plugin_id: str | None+ plugin_unique_identifier: str | None+ description: I18nObjectDict+ icon: str | dict+ label: I18nObjectDict+ type: str+ team_credentials: dict | None+ is_team_authorization: bool+ allow_delete: bool+ datasources: list[Any]+ labels: list[str]++class DatasourceProviderApiEntity(BaseModel):id: strauthor: str@@ -42,7 +59,7 @@ class DatasourceProviderApiEntity(BaseModel):def convert_none_to_empty_list(cls, v):return v if v is not None else []- def to_dict(self) -> dict:+ def to_dict(self) -> DatasourceProviderApiEntityDict:# -------------# overwrite datasource parameter types for temp fixdatasources = jsonable_encoder(self.datasources)@@ -53,7 +70,7 @@ class DatasourceProviderApiEntity(BaseModel):parameter["type"] = "files"# -------------- return {+ result: DatasourceProviderApiEntityDict = {"id": self.id,"author": self.author,"name": self.name,@@ -69,3 +86,4 @@ class DatasourceProviderApiEntity(BaseModel):"datasources": datasources,"labels": self.labels,}+ return result