diff --git a/api/core/ops/ops_trace_manager.py b/api/core/ops/ops_trace_manager.py index f99429b038..79704c115f 100644 --- a/api/core/ops/ops_trace_manager.py +++ b/api/core/ops/ops_trace_manager.py @@ -30,7 +30,7 @@ from core.ops.entities.trace_entity import ( ) from core.ops.langfuse_trace.langfuse_trace import LangFuseDataTrace from core.ops.langsmith_trace.langsmith_trace import LangSmithDataTrace -from core.ops.utils import convert_datetime_to_str, get_message_data +from core.ops.utils import get_message_data from extensions.ext_database import db from extensions.ext_storage import storage from models.model import App, AppModelConfig, Conversation, Message, MessageAgentThought, MessageFile, TraceAppConfig @@ -756,12 +756,4 @@ class TraceQueueManager: "file_id": file_id, "app_id": task.app_id, } - task_data = convert_datetime_to_str(task_data) - json_data = json.dumps(task_data, ensure_ascii=False).encode("utf-8") - file_path = f"{OPS_FILE_PATH}{task.app_id}/{file_id}.json" - storage.save(file_path, json_data) - file_info = { - "file_id": file_id, - "app_id": task.app_id, - } process_trace_tasks.delay(file_info) diff --git a/api/core/ops/utils.py b/api/core/ops/utils.py index 82401a9de8..3cd3fb5756 100644 --- a/api/core/ops/utils.py +++ b/api/core/ops/utils.py @@ -43,17 +43,3 @@ def replace_text_with_content(data): return [replace_text_with_content(item) for item in data] else: return data - - -def convert_datetime_to_str(data): - if isinstance(data, dict): - for key, value in data.items(): - if isinstance(value, datetime): - data[key] = value.isoformat() - elif isinstance(value, dict): - data[key] = convert_datetime_to_str(value) - elif isinstance(value, list): - data[key] = [convert_datetime_to_str(item) if isinstance(item, dict | list) else item for item in value] - elif isinstance(data, list): - data = [convert_datetime_to_str(item) if isinstance(item, dict | list) else item for item in data] - return data