Skip to content

Commit

Permalink
Merge pull request microsoft#12 from Roopan-Microsoft/PSL-BUG-10171
Browse files Browse the repository at this point in the history
fix: Chat history template name is accepting empty strings as well
  • Loading branch information
Roopan-Microsoft authored Nov 7, 2024
2 parents 2f1e57b + ab935a2 commit 77eee2b
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion app.py
Original file line number Diff line number Diff line change
Expand Up @@ -682,7 +682,7 @@ async def rename_conversation():

## update the title
title = request_json.get("title", None)
if not title:
if not title or title.strip() == "":
return jsonify({"error": "title is required"}), 400
conversation["title"] = title
updated_conversation = await cosmos_conversation_client.upsert_conversation(
Expand Down
12 changes: 12 additions & 0 deletions frontend/src/components/ChatHistory/ChatHistoryListItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import { AppStateContext } from '../../state/AppProvider'
import { GroupedChatHistory } from './ChatHistoryList'

import styles from './ChatHistoryPanel.module.css'
import _ from 'lodash'

interface ChatHistoryListItemCellProps {
item?: Conversation
Expand Down Expand Up @@ -125,6 +126,17 @@ export const ChatHistoryListItemCell: React.FC<ChatHistoryListItemCellProps> = (
if (errorRename || renameLoading) {
return
}
if (_.trim(editTitle) === "") {
setErrorRename('Error: Title is required.')
setTimeout(() => {
setErrorRename(undefined)
setTextFieldFocused(true)
if (textFieldRef.current) {
textFieldRef.current.focus()
}
}, 5000)
return
}
if (editTitle == item.title) {
setErrorRename('Error: Enter a new title to proceed.')
setTimeout(() => {
Expand Down

0 comments on commit 77eee2b

Please sign in to comment.