Merge 8612510b4d
into a30945312a
This commit is contained in:
commit
025d8b0335
@ -350,7 +350,7 @@ class AppRunner:
|
|||||||
inputs: Mapping[str, Any],
|
inputs: Mapping[str, Any],
|
||||||
query: str | None = None,
|
query: str | None = None,
|
||||||
message_id: str,
|
message_id: str,
|
||||||
) -> tuple[bool, Mapping[str, Any], str]:
|
) -> tuple[bool, dict[str, Any], str]:
|
||||||
"""
|
"""
|
||||||
Process sensitive_word_avoidance.
|
Process sensitive_word_avoidance.
|
||||||
:param app_id: app id
|
:param app_id: app id
|
||||||
@ -406,7 +406,7 @@ class AppRunner:
|
|||||||
tenant_id: str,
|
tenant_id: str,
|
||||||
app_id: str,
|
app_id: str,
|
||||||
external_data_tools: list[ExternalDataVariableEntity],
|
external_data_tools: list[ExternalDataVariableEntity],
|
||||||
inputs: Mapping[str, Any],
|
inputs: dict[str, Any],
|
||||||
query: str,
|
query: str,
|
||||||
) -> Mapping[str, Any]:
|
) -> Mapping[str, Any]:
|
||||||
"""
|
"""
|
||||||
|
@ -17,9 +17,9 @@ class ExternalDataFetch:
|
|||||||
tenant_id: str,
|
tenant_id: str,
|
||||||
app_id: str,
|
app_id: str,
|
||||||
external_data_tools: list[ExternalDataVariableEntity],
|
external_data_tools: list[ExternalDataVariableEntity],
|
||||||
inputs: Mapping[str, Any],
|
inputs: dict[str, Any],
|
||||||
query: str,
|
query: str,
|
||||||
) -> Mapping[str, Any]:
|
) -> dict[str, Any]:
|
||||||
"""
|
"""
|
||||||
Fill in variable inputs from external data tools if exists.
|
Fill in variable inputs from external data tools if exists.
|
||||||
|
|
||||||
@ -31,7 +31,6 @@ class ExternalDataFetch:
|
|||||||
:return: the filled inputs
|
:return: the filled inputs
|
||||||
"""
|
"""
|
||||||
results: dict[str, Any] = {}
|
results: dict[str, Any] = {}
|
||||||
inputs = dict(inputs)
|
|
||||||
with ThreadPoolExecutor() as executor:
|
with ThreadPoolExecutor() as executor:
|
||||||
futures = {}
|
futures = {}
|
||||||
for tool in external_data_tools:
|
for tool in external_data_tools:
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
import logging
|
import logging
|
||||||
from collections.abc import Mapping
|
|
||||||
from typing import Any, Optional
|
from typing import Any, Optional
|
||||||
|
|
||||||
from core.app.app_config.entities import AppConfig
|
from core.app.app_config.entities import AppConfig
|
||||||
@ -18,11 +17,11 @@ class InputModeration:
|
|||||||
app_id: str,
|
app_id: str,
|
||||||
tenant_id: str,
|
tenant_id: str,
|
||||||
app_config: AppConfig,
|
app_config: AppConfig,
|
||||||
inputs: Mapping[str, Any],
|
inputs: dict[str, Any],
|
||||||
query: str,
|
query: str,
|
||||||
message_id: str,
|
message_id: str,
|
||||||
trace_manager: Optional[TraceQueueManager] = None,
|
trace_manager: Optional[TraceQueueManager] = None,
|
||||||
) -> tuple[bool, Mapping[str, Any], str]:
|
) -> tuple[bool, dict[str, Any], str]:
|
||||||
"""
|
"""
|
||||||
Process sensitive_word_avoidance.
|
Process sensitive_word_avoidance.
|
||||||
:param app_id: app id
|
:param app_id: app id
|
||||||
@ -34,7 +33,6 @@ class InputModeration:
|
|||||||
:param trace_manager: trace manager
|
:param trace_manager: trace manager
|
||||||
:return:
|
:return:
|
||||||
"""
|
"""
|
||||||
inputs = dict(inputs)
|
|
||||||
if not app_config.sensitive_word_avoidance:
|
if not app_config.sensitive_word_avoidance:
|
||||||
return False, inputs, query
|
return False, inputs, query
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user