Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>tags/1.7.2
| from flask_restful.inputs import int_range | from flask_restful.inputs import int_range | ||||
| from werkzeug.exceptions import Forbidden, InternalServerError, NotFound | from werkzeug.exceptions import Forbidden, InternalServerError, NotFound | ||||
| import services | |||||
| from controllers.console import api | from controllers.console import api | ||||
| from controllers.console.app.error import ( | from controllers.console.app.error import ( | ||||
| CompletionRequestError, | CompletionRequestError, | ||||
| rating=args.get("rating"), | rating=args.get("rating"), | ||||
| content=None, | content=None, | ||||
| ) | ) | ||||
| except services.errors.message.MessageNotExistsError: | |||||
| except MessageNotExistsError: | |||||
| raise NotFound("Message Not Exists.") | raise NotFound("Message Not Exists.") | ||||
| return {"result": "success"} | return {"result": "success"} |
| from flask_restful.inputs import int_range | from flask_restful.inputs import int_range | ||||
| from werkzeug.exceptions import InternalServerError, NotFound | from werkzeug.exceptions import InternalServerError, NotFound | ||||
| import services | |||||
| from controllers.console.app.error import ( | from controllers.console.app.error import ( | ||||
| AppMoreLikeThisDisabledError, | AppMoreLikeThisDisabledError, | ||||
| CompletionRequestError, | CompletionRequestError, | ||||
| from services.app_generate_service import AppGenerateService | from services.app_generate_service import AppGenerateService | ||||
| from services.errors.app import MoreLikeThisDisabledError | from services.errors.app import MoreLikeThisDisabledError | ||||
| from services.errors.conversation import ConversationNotExistsError | from services.errors.conversation import ConversationNotExistsError | ||||
| from services.errors.message import MessageNotExistsError, SuggestedQuestionsAfterAnswerDisabledError | |||||
| from services.errors.message import ( | |||||
| FirstMessageNotExistsError, | |||||
| MessageNotExistsError, | |||||
| SuggestedQuestionsAfterAnswerDisabledError, | |||||
| ) | |||||
| from services.message_service import MessageService | from services.message_service import MessageService | ||||
| return MessageService.pagination_by_first_id( | return MessageService.pagination_by_first_id( | ||||
| app_model, current_user, args["conversation_id"], args["first_id"], args["limit"] | app_model, current_user, args["conversation_id"], args["first_id"], args["limit"] | ||||
| ) | ) | ||||
| except services.errors.conversation.ConversationNotExistsError: | |||||
| except ConversationNotExistsError: | |||||
| raise NotFound("Conversation Not Exists.") | raise NotFound("Conversation Not Exists.") | ||||
| except services.errors.message.FirstMessageNotExistsError: | |||||
| except FirstMessageNotExistsError: | |||||
| raise NotFound("First Message Not Exists.") | raise NotFound("First Message Not Exists.") | ||||
| rating=args.get("rating"), | rating=args.get("rating"), | ||||
| content=args.get("content"), | content=args.get("content"), | ||||
| ) | ) | ||||
| except services.errors.message.MessageNotExistsError: | |||||
| except MessageNotExistsError: | |||||
| raise NotFound("Message Not Exists.") | raise NotFound("Message Not Exists.") | ||||
| return {"result": "success"} | return {"result": "success"} |
| from fields.raws import FilesContainedField | from fields.raws import FilesContainedField | ||||
| from libs.helper import TimestampField, uuid_value | from libs.helper import TimestampField, uuid_value | ||||
| from models.model import App, AppMode, EndUser | from models.model import App, AppMode, EndUser | ||||
| from services.errors.message import SuggestedQuestionsAfterAnswerDisabledError | |||||
| from services.errors.message import ( | |||||
| FirstMessageNotExistsError, | |||||
| MessageNotExistsError, | |||||
| SuggestedQuestionsAfterAnswerDisabledError, | |||||
| ) | |||||
| from services.message_service import MessageService | from services.message_service import MessageService | ||||
| ) | ) | ||||
| except services.errors.conversation.ConversationNotExistsError: | except services.errors.conversation.ConversationNotExistsError: | ||||
| raise NotFound("Conversation Not Exists.") | raise NotFound("Conversation Not Exists.") | ||||
| except services.errors.message.FirstMessageNotExistsError: | |||||
| except FirstMessageNotExistsError: | |||||
| raise NotFound("First Message Not Exists.") | raise NotFound("First Message Not Exists.") | ||||
| rating=args.get("rating"), | rating=args.get("rating"), | ||||
| content=args.get("content"), | content=args.get("content"), | ||||
| ) | ) | ||||
| except services.errors.message.MessageNotExistsError: | |||||
| except MessageNotExistsError: | |||||
| raise NotFound("Message Not Exists.") | raise NotFound("Message Not Exists.") | ||||
| return {"result": "success"} | return {"result": "success"} | ||||
| questions = MessageService.get_suggested_questions_after_answer( | questions = MessageService.get_suggested_questions_after_answer( | ||||
| app_model=app_model, user=end_user, message_id=message_id, invoke_from=InvokeFrom.SERVICE_API | app_model=app_model, user=end_user, message_id=message_id, invoke_from=InvokeFrom.SERVICE_API | ||||
| ) | ) | ||||
| except services.errors.message.MessageNotExistsError: | |||||
| except MessageNotExistsError: | |||||
| raise NotFound("Message Not Exists.") | raise NotFound("Message Not Exists.") | ||||
| except SuggestedQuestionsAfterAnswerDisabledError: | except SuggestedQuestionsAfterAnswerDisabledError: | ||||
| raise BadRequest("Suggested Questions Is Disabled.") | raise BadRequest("Suggested Questions Is Disabled.") |
| from flask_restful.inputs import int_range | from flask_restful.inputs import int_range | ||||
| from werkzeug.exceptions import InternalServerError, NotFound | from werkzeug.exceptions import InternalServerError, NotFound | ||||
| import services | |||||
| from controllers.web import api | from controllers.web import api | ||||
| from controllers.web.error import ( | from controllers.web.error import ( | ||||
| AppMoreLikeThisDisabledError, | AppMoreLikeThisDisabledError, | ||||
| from services.app_generate_service import AppGenerateService | from services.app_generate_service import AppGenerateService | ||||
| from services.errors.app import MoreLikeThisDisabledError | from services.errors.app import MoreLikeThisDisabledError | ||||
| from services.errors.conversation import ConversationNotExistsError | from services.errors.conversation import ConversationNotExistsError | ||||
| from services.errors.message import MessageNotExistsError, SuggestedQuestionsAfterAnswerDisabledError | |||||
| from services.errors.message import ( | |||||
| FirstMessageNotExistsError, | |||||
| MessageNotExistsError, | |||||
| SuggestedQuestionsAfterAnswerDisabledError, | |||||
| ) | |||||
| from services.message_service import MessageService | from services.message_service import MessageService | ||||
| return MessageService.pagination_by_first_id( | return MessageService.pagination_by_first_id( | ||||
| app_model, end_user, args["conversation_id"], args["first_id"], args["limit"] | app_model, end_user, args["conversation_id"], args["first_id"], args["limit"] | ||||
| ) | ) | ||||
| except services.errors.conversation.ConversationNotExistsError: | |||||
| except ConversationNotExistsError: | |||||
| raise NotFound("Conversation Not Exists.") | raise NotFound("Conversation Not Exists.") | ||||
| except services.errors.message.FirstMessageNotExistsError: | |||||
| except FirstMessageNotExistsError: | |||||
| raise NotFound("First Message Not Exists.") | raise NotFound("First Message Not Exists.") | ||||
| rating=args.get("rating"), | rating=args.get("rating"), | ||||
| content=args.get("content"), | content=args.get("content"), | ||||
| ) | ) | ||||
| except services.errors.message.MessageNotExistsError: | |||||
| except MessageNotExistsError: | |||||
| raise NotFound("Message Not Exists.") | raise NotFound("Message Not Exists.") | ||||
| return {"result": "success"} | return {"result": "success"} |