diff --git a/api/controllers/service_api/app/conversation.py b/api/controllers/service_api/app/conversation.py index a0bd1b7412..815fd6a27a 100644 --- a/api/controllers/service_api/app/conversation.py +++ b/api/controllers/service_api/app/conversation.py @@ -7,7 +7,11 @@ from controllers.service_api import api from controllers.service_api.app.error import NotChatAppError from controllers.service_api.wraps import FetchUserArg, WhereisUserArg, validate_app_token from core.app.entities.app_invoke_entities import InvokeFrom -from fields.conversation_fields import conversation_infinite_scroll_pagination_fields, simple_conversation_fields +from fields.conversation_fields import ( + conversation_delete_fields, + conversation_infinite_scroll_pagination_fields, + simple_conversation_fields, +) from libs.helper import uuid_value from models.model import App, AppMode, EndUser from services.conversation_service import ConversationService @@ -49,7 +53,7 @@ class ConversationApi(Resource): class ConversationDetailApi(Resource): @validate_app_token(fetch_user_arg=FetchUserArg(fetch_from=WhereisUserArg.JSON)) - @marshal_with(simple_conversation_fields) + @marshal_with(conversation_delete_fields) def delete(self, app_model: App, end_user: EndUser, c_id): app_mode = AppMode.value_of(app_model.mode) if app_mode not in {AppMode.CHAT, AppMode.AGENT_CHAT, AppMode.ADVANCED_CHAT}: diff --git a/api/fields/conversation_fields.py b/api/fields/conversation_fields.py index 2eb19c2667..5bd21be807 100644 --- a/api/fields/conversation_fields.py +++ b/api/fields/conversation_fields.py @@ -202,6 +202,10 @@ simple_conversation_fields = { "updated_at": TimestampField, } +conversation_delete_fields = { + "result": fields.String, +} + conversation_infinite_scroll_pagination_fields = { "limit": fields.Integer, "has_more": fields.Boolean, diff --git a/api/services/conversation_service.py b/api/services/conversation_service.py index ac9f577c32..f9e41988c0 100644 --- a/api/services/conversation_service.py +++ b/api/services/conversation_service.py @@ -162,5 +162,3 @@ class ConversationService: conversation.is_deleted = True conversation.updated_at = datetime.now(timezone.utc).replace(tzinfo=None) db.session.commit() - - return {"result": "success"}, 200