This commit is contained in:
yihong 2025-03-21 13:44:59 +08:00 committed by GitHub
commit 025d8b0335
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 6 additions and 9 deletions

View File

@ -350,7 +350,7 @@ class AppRunner:
inputs: Mapping[str, Any],
query: str | None = None,
message_id: str,
) -> tuple[bool, Mapping[str, Any], str]:
) -> tuple[bool, dict[str, Any], str]:
"""
Process sensitive_word_avoidance.
:param app_id: app id
@ -406,7 +406,7 @@ class AppRunner:
tenant_id: str,
app_id: str,
external_data_tools: list[ExternalDataVariableEntity],
inputs: Mapping[str, Any],
inputs: dict[str, Any],
query: str,
) -> Mapping[str, Any]:
"""

View File

@ -17,9 +17,9 @@ class ExternalDataFetch:
tenant_id: str,
app_id: str,
external_data_tools: list[ExternalDataVariableEntity],
inputs: Mapping[str, Any],
inputs: dict[str, Any],
query: str,
) -> Mapping[str, Any]:
) -> dict[str, Any]:
"""
Fill in variable inputs from external data tools if exists.
@ -31,7 +31,6 @@ class ExternalDataFetch:
:return: the filled inputs
"""
results: dict[str, Any] = {}
inputs = dict(inputs)
with ThreadPoolExecutor() as executor:
futures = {}
for tool in external_data_tools:

View File

@ -1,5 +1,4 @@
import logging
from collections.abc import Mapping
from typing import Any, Optional
from core.app.app_config.entities import AppConfig
@ -18,11 +17,11 @@ class InputModeration:
app_id: str,
tenant_id: str,
app_config: AppConfig,
inputs: Mapping[str, Any],
inputs: dict[str, Any],
query: str,
message_id: str,
trace_manager: Optional[TraceQueueManager] = None,
) -> tuple[bool, Mapping[str, Any], str]:
) -> tuple[bool, dict[str, Any], str]:
"""
Process sensitive_word_avoidance.
:param app_id: app id
@ -34,7 +33,6 @@ class InputModeration:
:param trace_manager: trace manager
:return:
"""
inputs = dict(inputs)
if not app_config.sensitive_word_avoidance:
return False, inputs, query