diff --git a/code/backend/api/chat_history.py b/code/backend/api/chat_history.py index a0a67f82d..2aba1a8a4 100644 --- a/code/backend/api/chat_history.py +++ b/code/backend/api/chat_history.py @@ -143,8 +143,8 @@ async def rename_conversation(): # update the title title = request_json.get("title", None) - if not title: - return (jsonify({"error": "title is required"}), 400) + if not title or title.strip() == "": + return jsonify({"error": "title is required"}), 400 conversation["title"] = title updated_conversation = await cosmos_conversation_client.upsert_conversation( conversation @@ -321,7 +321,10 @@ async def delete_all_conversations(): except Exception as e: logger.exception("Exception in /delete" + str(e)) - return (jsonify({"error": "Error while deleting all history conversation"}), 500) + return ( + jsonify({"error": "Error while deleting all history conversation"}), + 500, + ) @bp_chat_history_response.route("/history/update", methods=["POST"]) diff --git a/code/frontend/src/pages/chat/ChatHistoryListItem.tsx b/code/frontend/src/pages/chat/ChatHistoryListItem.tsx index 9f1af7ca1..253231d4e 100644 --- a/code/frontend/src/pages/chat/ChatHistoryListItem.tsx +++ b/code/frontend/src/pages/chat/ChatHistoryListItem.tsx @@ -126,7 +126,7 @@ export const ChatHistoryListItemCell: React.FC< const handleSaveEdit = async (e: any) => { e.preventDefault(); - if (errorRename || renameLoading) { + if (errorRename || renameLoading || _.trim(editTitle) === "") { return; } @@ -219,7 +219,7 @@ export const ChatHistoryListItemCell: React.FC< disabled={errorRename ? true : false} /> - {editTitle && ( + {_.trim(editTitle) && (