Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.
Python agentagentic-aiagentic-frameworkagentic-workflowaiautomationclaudedeepseekgenaigptllmlow-codemcpnextjsno-codeopenaipythonskillsworkflow
fix(api): resolve "Message not exists" error in admin feedback creation (#23232)
QuantumGhost7286b4ad0610
diff --git a/api/controllers/console/app/message.py b/api/controllers/console/app/message.pyindex d4ce5921c26..680ac4a64c1 100644--- a/api/controllers/console/app/message.py+++ b/api/controllers/console/app/message.py@@ -27,7 +27,7 @@ from fields.conversation_fields import annotation_fields, message_detail_fieldsfrom libs.helper import uuid_valuefrom libs.infinite_scroll_pagination import InfiniteScrollPaginationfrom libs.login import login_required-from models.model import AppMode, Conversation, Message, MessageAnnotation+from models.model import AppMode, Conversation, Message, MessageAnnotation, MessageFeedbackfrom services.annotation_service import AppAnnotationServicefrom services.errors.conversation import ConversationNotExistsErrorfrom services.errors.message import MessageNotExistsError, SuggestedQuestionsAfterAnswerDisabledError@@ -124,17 +124,34 @@ class MessageFeedbackApi(Resource):parser.add_argument("rating", type=str, choices=["like", "dislike", None], location="json")args = parser.parse_args()- try:- MessageService.create_feedback(- app_model=app_model,- message_id=str(args["message_id"]),- user=current_user,- rating=args.get("rating"),- content=None,- )- except MessageNotExistsError:+ message_id = str(args["message_id"])++ message = db.session.query(Message).filter(Message.id == message_id, Message.app_id == app_model.id).first()++ if not message:raise NotFound("Message Not Exists.")+ feedback = message.admin_feedback++ if not args["rating"] and feedback:+ db.session.delete(feedback)+ elif args["rating"] and feedback:+ feedback.rating = args["rating"]+ elif not args["rating"] and not feedback:+ raise ValueError("rating cannot be None when feedback not exists")+ else:+ feedback = MessageFeedback(+ app_id=app_model.id,+ conversation_id=message.conversation_id,+ message_id=message.id,+ rating=args["rating"],+ from_source="admin",+ from_account_id=current_user.id,+ )+ db.session.add(feedback)++ db.session.commit()+return {"result": "success"}