mirror of
https://github.com/langgenius/dify.git
synced 2026-04-18 04:16:28 +08:00
refactor: replace bare dict with dict[str, Any] in app task_entities … (#35084)
This commit is contained in:
parent
9ed8a5ed73
commit
3c279edcf2
@ -1,5 +1,5 @@
|
|||||||
from collections.abc import Generator
|
from collections.abc import Generator
|
||||||
from typing import cast
|
from typing import Any, cast
|
||||||
|
|
||||||
from core.app.apps.base_app_generate_response_converter import AppGenerateResponseConverter
|
from core.app.apps.base_app_generate_response_converter import AppGenerateResponseConverter
|
||||||
from core.app.entities.task_entities import (
|
from core.app.entities.task_entities import (
|
||||||
@ -17,7 +17,7 @@ class WorkflowAppGenerateResponseConverter(AppGenerateResponseConverter):
|
|||||||
_blocking_response_type = WorkflowAppBlockingResponse
|
_blocking_response_type = WorkflowAppBlockingResponse
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def convert_blocking_full_response(cls, blocking_response: WorkflowAppBlockingResponse) -> dict: # type: ignore[override]
|
def convert_blocking_full_response(cls, blocking_response: WorkflowAppBlockingResponse) -> dict[str, Any]: # type: ignore[override]
|
||||||
"""
|
"""
|
||||||
Convert blocking full response.
|
Convert blocking full response.
|
||||||
:param blocking_response: blocking response
|
:param blocking_response: blocking response
|
||||||
@ -26,7 +26,7 @@ class WorkflowAppGenerateResponseConverter(AppGenerateResponseConverter):
|
|||||||
return dict(blocking_response.model_dump())
|
return dict(blocking_response.model_dump())
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def convert_blocking_simple_response(cls, blocking_response: WorkflowAppBlockingResponse) -> dict: # type: ignore[override]
|
def convert_blocking_simple_response(cls, blocking_response: WorkflowAppBlockingResponse) -> dict[str, Any]: # type: ignore[override]
|
||||||
"""
|
"""
|
||||||
Convert blocking simple response.
|
Convert blocking simple response.
|
||||||
:param blocking_response: blocking response
|
:param blocking_response: blocking response
|
||||||
|
|||||||
@ -1,3 +1,5 @@
|
|||||||
|
from typing import Any
|
||||||
|
|
||||||
from core.app.app_config.base_app_config_manager import BaseAppConfigManager
|
from core.app.app_config.base_app_config_manager import BaseAppConfigManager
|
||||||
from core.app.app_config.common.sensitive_word_avoidance.manager import SensitiveWordAvoidanceConfigManager
|
from core.app.app_config.common.sensitive_word_avoidance.manager import SensitiveWordAvoidanceConfigManager
|
||||||
from core.app.app_config.entities import RagPipelineVariableEntity, WorkflowUIBasedAppConfig
|
from core.app.app_config.entities import RagPipelineVariableEntity, WorkflowUIBasedAppConfig
|
||||||
@ -34,7 +36,9 @@ class PipelineConfigManager(BaseAppConfigManager):
|
|||||||
return pipeline_config
|
return pipeline_config
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def config_validate(cls, tenant_id: str, config: dict, only_structure_validate: bool = False) -> dict:
|
def config_validate(
|
||||||
|
cls, tenant_id: str, config: dict[str, Any], only_structure_validate: bool = False
|
||||||
|
) -> dict[str, Any]:
|
||||||
"""
|
"""
|
||||||
Validate for pipeline config
|
Validate for pipeline config
|
||||||
|
|
||||||
|
|||||||
@ -782,7 +782,7 @@ class PipelineGenerator(BaseAppGenerator):
|
|||||||
user_id: str,
|
user_id: str,
|
||||||
all_files: list,
|
all_files: list,
|
||||||
datasource_info: Mapping[str, Any],
|
datasource_info: Mapping[str, Any],
|
||||||
next_page_parameters: dict | None = None,
|
next_page_parameters: dict[str, Any] | None = None,
|
||||||
):
|
):
|
||||||
"""
|
"""
|
||||||
Get files in a folder.
|
Get files in a folder.
|
||||||
|
|||||||
@ -521,7 +521,7 @@ class IterationNodeStartStreamResponse(StreamResponse):
|
|||||||
node_type: str
|
node_type: str
|
||||||
title: str
|
title: str
|
||||||
created_at: int
|
created_at: int
|
||||||
extras: dict = Field(default_factory=dict)
|
extras: dict[str, Any] = Field(default_factory=dict)
|
||||||
metadata: Mapping = {}
|
metadata: Mapping = {}
|
||||||
inputs: Mapping = {}
|
inputs: Mapping = {}
|
||||||
inputs_truncated: bool = False
|
inputs_truncated: bool = False
|
||||||
@ -547,7 +547,7 @@ class IterationNodeNextStreamResponse(StreamResponse):
|
|||||||
title: str
|
title: str
|
||||||
index: int
|
index: int
|
||||||
created_at: int
|
created_at: int
|
||||||
extras: dict = Field(default_factory=dict)
|
extras: dict[str, Any] = Field(default_factory=dict)
|
||||||
|
|
||||||
event: StreamEvent = StreamEvent.ITERATION_NEXT
|
event: StreamEvent = StreamEvent.ITERATION_NEXT
|
||||||
workflow_run_id: str
|
workflow_run_id: str
|
||||||
@ -571,7 +571,7 @@ class IterationNodeCompletedStreamResponse(StreamResponse):
|
|||||||
outputs: Mapping | None = None
|
outputs: Mapping | None = None
|
||||||
outputs_truncated: bool = False
|
outputs_truncated: bool = False
|
||||||
created_at: int
|
created_at: int
|
||||||
extras: dict | None = None
|
extras: dict[str, Any] | None = None
|
||||||
inputs: Mapping | None = None
|
inputs: Mapping | None = None
|
||||||
inputs_truncated: bool = False
|
inputs_truncated: bool = False
|
||||||
status: WorkflowNodeExecutionStatus
|
status: WorkflowNodeExecutionStatus
|
||||||
@ -602,7 +602,7 @@ class LoopNodeStartStreamResponse(StreamResponse):
|
|||||||
node_type: str
|
node_type: str
|
||||||
title: str
|
title: str
|
||||||
created_at: int
|
created_at: int
|
||||||
extras: dict = Field(default_factory=dict)
|
extras: dict[str, Any] = Field(default_factory=dict)
|
||||||
metadata: Mapping = {}
|
metadata: Mapping = {}
|
||||||
inputs: Mapping = {}
|
inputs: Mapping = {}
|
||||||
inputs_truncated: bool = False
|
inputs_truncated: bool = False
|
||||||
@ -653,7 +653,7 @@ class LoopNodeCompletedStreamResponse(StreamResponse):
|
|||||||
outputs: Mapping | None = None
|
outputs: Mapping | None = None
|
||||||
outputs_truncated: bool = False
|
outputs_truncated: bool = False
|
||||||
created_at: int
|
created_at: int
|
||||||
extras: dict | None = None
|
extras: dict[str, Any] | None = None
|
||||||
inputs: Mapping | None = None
|
inputs: Mapping | None = None
|
||||||
inputs_truncated: bool = False
|
inputs_truncated: bool = False
|
||||||
status: WorkflowNodeExecutionStatus
|
status: WorkflowNodeExecutionStatus
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user