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
fix: drop some type fixme (#20344)
yihong5a991295e003
diff --git a/api/core/model_runtime/utils/encoders.py b/api/core/model_runtime/utils/encoders.pyindex 03e35062714..a5c11aeeba4 100644--- a/api/core/model_runtime/utils/encoders.py+++ b/api/core/model_runtime/utils/encoders.py@@ -129,17 +129,18 @@ def jsonable_encoder(sqlalchemy_safe=sqlalchemy_safe,)if dataclasses.is_dataclass(obj):- # FIXME: mypy error, try to fix it instead of using type: ignore- obj_dict = dataclasses.asdict(obj) # type: ignore- return jsonable_encoder(- obj_dict,- by_alias=by_alias,- exclude_unset=exclude_unset,- exclude_defaults=exclude_defaults,- exclude_none=exclude_none,- custom_encoder=custom_encoder,- sqlalchemy_safe=sqlalchemy_safe,- )+ # Ensure obj is a dataclass instance, not a dataclass type+ if not isinstance(obj, type):+ obj_dict = dataclasses.asdict(obj)+ return jsonable_encoder(+ obj_dict,+ by_alias=by_alias,+ exclude_unset=exclude_unset,+ exclude_defaults=exclude_defaults,+ exclude_none=exclude_none,+ custom_encoder=custom_encoder,+ sqlalchemy_safe=sqlalchemy_safe,+ )if isinstance(obj, Enum):return obj.valueif isinstance(obj, PurePath):diff --git a/api/core/rag/datasource/vdb/baidu/baidu_vector.py b/api/core/rag/datasource/vdb/baidu/baidu_vector.pyindex 86f1f5bfe46..db7ffc9c4f7 100644--- a/api/core/rag/datasource/vdb/baidu/baidu_vector.py+++ b/api/core/rag/datasource/vdb/baidu/baidu_vector.py@@ -85,7 +85,6 @@ class BaiduVector(BaseVector):end = min(start + batch_size, total_count)rows = []assert len(metadatas) == total_count, "metadatas length should be equal to total_count"- # FIXME do you need this assert?for i in range(start, end, 1):row = Row(id=metadatas[i].get("doc_id", str(uuid.uuid4())),diff --git a/api/core/rag/datasource/vdb/tidb_on_qdrant/tidb_service.py b/api/core/rag/datasource/vdb/tidb_on_qdrant/tidb_service.pyindex 3958280bd5c..184b5f21428 100644--- a/api/core/rag/datasource/vdb/tidb_on_qdrant/tidb_service.py+++ b/api/core/rag/datasource/vdb/tidb_on_qdrant/tidb_service.py@@ -245,4 +245,4 @@ class TidbService:return cluster_infoselse:response.raise_for_status()- return [] # FIXME for mypy, This line will not be reached as raise_for_status() will raise an exception+ return []diff --git a/api/core/tools/entities/tool_entities.py b/api/core/tools/entities/tool_entities.pyindex 37375f4a71c..03047c0545b 100644--- a/api/core/tools/entities/tool_entities.py+++ b/api/core/tools/entities/tool_entities.py@@ -279,7 +279,6 @@ class ToolParameter(PluginParameter)::param options: the options of the parameter"""# convert options to ToolParameterOption- # FIXME fix the type errorif options:option_objs = [PluginParameterOption(value=option, label=I18nObject(en_US=option, zh_Hans=option))diff --git a/api/core/tools/utils/message_transformer.py b/api/core/tools/utils/message_transformer.pyindex 257d96133e5..80e8b543430 100644--- a/api/core/tools/utils/message_transformer.py+++ b/api/core/tools/utils/message_transformer.py@@ -66,7 +66,6 @@ class ToolFileMessageTransformer:if not isinstance(message.message, ToolInvokeMessage.BlobMessage):raise ValueError("unexpected message type")- # FIXME: should do a type check here.assert isinstance(message.message.blob, bytes)tool_file_manager = ToolFileManager()file = tool_file_manager.create_file_by_raw(diff --git a/api/core/workflow/nodes/parameter_extractor/parameter_extractor_node.py b/api/core/workflow/nodes/parameter_extractor/parameter_extractor_node.pyindex 3d13cf7ecdb..ea4070e224b 100644--- a/api/core/workflow/nodes/parameter_extractor/parameter_extractor_node.py+++ b/api/core/workflow/nodes/parameter_extractor/parameter_extractor_node.py@@ -816,7 +816,6 @@ class ParameterExtractorNode(LLMNode)::param node_data: node data:return:"""- # FIXME: fix the type error latervariable_mapping: dict[str, Sequence[str]] = {"query": node_data.query}if node_data.instruction:diff --git a/api/factories/variable_factory.py b/api/factories/variable_factory.pyindex bbca8448ec0..fa8a90e79ff 100644--- a/api/factories/variable_factory.py+++ b/api/factories/variable_factory.py@@ -84,8 +84,8 @@ def _build_variable_from_mapping(*, mapping: Mapping[str, Any], selector: Sequenraise VariableError("missing value type")if (value := mapping.get("value")) is None:raise VariableError("missing value")- # FIXME: using Any here, fix it later- result: Any++ result: Variablematch value_type:case SegmentType.STRING:result = StringVariable.model_validate(mapping)diff --git a/api/schedule/clean_messages.py b/api/schedule/clean_messages.pyindex f41f5264c77..d02bc81f33c 100644--- a/api/schedule/clean_messages.py+++ b/api/schedule/clean_messages.py@@ -34,9 +34,8 @@ def clean_messages():while True:try:# Main query with join and filter- # FIXME:for mypy no paginate method errormessages = (- db.session.query(Message) # type: ignore+ db.session.query(Message).filter(Message.created_at < plan_sandbox_clean_message_day).order_by(Message.created_at.desc()).limit(100)diff --git a/api/services/ops_service.py b/api/services/ops_service.pyindex a9c2b28476b..792f50703ef 100644--- a/api/services/ops_service.py+++ b/api/services/ops_service.py@@ -1,5 +1,6 @@-from typing import Optional+from typing import Any, Optional+from core.ops.entities.config_entity import BaseTracingConfigfrom core.ops.ops_trace_manager import OpsTraceManager, provider_config_mapfrom extensions.ext_database import dbfrom models.model import App, TraceAppConfig@@ -92,13 +93,12 @@ class OpsService:except KeyError:return {"error": f"Invalid tracing provider: {tracing_provider}"}- config_class, other_keys = (- provider_config_map[tracing_provider]["config_class"],- provider_config_map[tracing_provider]["other_keys"],- )- # FIXME: ignore type error- default_config_instance = config_class(**tracing_config) # type: ignore- for key in other_keys: # type: ignore+ provider_config: dict[str, Any] = provider_config_map[tracing_provider]+ config_class: type[BaseTracingConfig] = provider_config["config_class"]+ other_keys: list[str] = provider_config["other_keys"]++ default_config_instance: BaseTracingConfig = config_class(**tracing_config)+ for key in other_keys:if key in tracing_config and tracing_config[key] == "":tracing_config[key] = getattr(default_config_instance, key, None)diff --git a/api/services/website_service.py b/api/services/website_service.pyindex 3913dc2efe5..6720932a3af 100644--- a/api/services/website_service.py+++ b/api/services/website_service.py@@ -173,26 +173,27 @@ class WebsiteService:return crawl_status_data@classmethod- def get_crawl_url_data(cls, job_id: str, provider: str, url: str, tenant_id: str) -> dict[Any, Any] | None:+ def get_crawl_url_data(cls, job_id: str, provider: str, url: str, tenant_id: str) -> dict[str, Any] | None:credentials = ApiKeyAuthService.get_auth_credentials(tenant_id, "website", provider)# decrypt api_keyapi_key = encrypter.decrypt_token(tenant_id=tenant_id, token=credentials.get("config").get("api_key"))- # FIXME data is redefine too many times here, use Any to ease the type checking, fix it later- data: Any+if provider == "firecrawl":+ crawl_data: list[dict[str, Any]] | None = Nonefile_key = "website_files/" + job_id + ".txt"if storage.exists(file_key):- d = storage.load_once(file_key)- if d:- data = json.loads(d.decode("utf-8"))+ stored_data = storage.load_once(file_key)+ if stored_data:+ crawl_data = json.loads(stored_data.decode("utf-8"))else:firecrawl_app = FirecrawlApp(api_key=api_key, base_url=credentials.get("config").get("base_url", None))result = firecrawl_app.check_crawl_status(job_id)if result.get("status") != "completed":raise ValueError("Crawl job is not completed")- data = result.get("data")- if data:- for item in data:+ crawl_data = result.get("data")++ if crawl_data:+ for item in crawl_data:if item.get("source_url") == url:return dict(item)return None@@ -211,23 +212,24 @@ class WebsiteService:raise ValueError("Failed to crawl")return dict(response.json().get("data", {}))else:- api_key = encrypter.decrypt_token(tenant_id=tenant_id, token=credentials.get("config").get("api_key"))- response = requests.post(+ # Get crawl status first+ status_response = requests.post("https://adaptivecrawlstatus-kir3wx7b3a-uc.a.run.app",headers={"Content-Type": "application/json", "Authorization": f"Bearer {api_key}"},json={"taskId": job_id},)- data = response.json().get("data", {})- if data.get("status") != "completed":+ status_data = status_response.json().get("data", {})+ if status_data.get("status") != "completed":raise ValueError("Crawl job is not completed")- response = requests.post(+ # Get processed data+ data_response = requests.post("https://adaptivecrawlstatus-kir3wx7b3a-uc.a.run.app",headers={"Content-Type": "application/json", "Authorization": f"Bearer {api_key}"},- json={"taskId": job_id, "urls": list(data.get("processed", {}).keys())},+ json={"taskId": job_id, "urls": list(status_data.get("processed", {}).keys())},)- data = response.json().get("data", {})- for item in data.get("processed", {}).values():+ processed_data = data_response.json().get("data", {})+ for item in processed_data.get("processed", {}).values():if item.get("data", {}).get("url") == url:return dict(item.get("data", {}))return None