Merge branch 'fix/ops-trace-celery' into deploy/dev
Some checks are pending
Build and Push API & Web / build (api, DIFY_API_IMAGE_NAME, linux/amd64, build-api-amd64) (push) Waiting to run
Build and Push API & Web / build (api, DIFY_API_IMAGE_NAME, linux/arm64, build-api-arm64) (push) Waiting to run
Build and Push API & Web / build (web, DIFY_WEB_IMAGE_NAME, linux/amd64, build-web-amd64) (push) Waiting to run
Build and Push API & Web / build (web, DIFY_WEB_IMAGE_NAME, linux/arm64, build-web-arm64) (push) Waiting to run
Build and Push API & Web / create-manifest (api, DIFY_API_IMAGE_NAME, merge-api-images) (push) Blocked by required conditions
Build and Push API & Web / create-manifest (web, DIFY_WEB_IMAGE_NAME, merge-web-images) (push) Blocked by required conditions

* fix/ops-trace-celery:
  feat: add delete file finally
  chore: remove convert_datetime_to_str
  fix: optimizing code
This commit is contained in:
Joe 2024-11-15 11:04:33 +08:00
commit f21f88afbd
2 changed files with 1 additions and 23 deletions

View File

@ -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)

View File

@ -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