feat: implement edit chat title modal

This commit is contained in:
steven
2023-03-28 18:31:56 +08:00
parent ac5f4bbcc2
commit ee20272a9e
5 changed files with 121 additions and 10 deletions

View File

@ -58,6 +58,13 @@ const ChatView = () => {
}, [lastMessage?.isGenerated, lastMessage?.content]);
useEffect(() => {
if (
currentChat?.connectionId === connectionStore.currentConnectionCtx?.connection.id &&
currentChat?.databaseName === connectionStore.currentConnectionCtx?.database?.name
) {
return;
}
// Auto select the first chat when the current connection changes.
const chatList = chatStore.chatList.filter(
(chat) =>
@ -65,7 +72,7 @@ const ChatView = () => {
chat.databaseName === connectionStore.currentConnectionCtx?.database?.name
);
chatStore.setCurrentChat(head(chatList));
}, [connectionStore.currentConnectionCtx]);
}, [currentChat, connectionStore.currentConnectionCtx]);
const sendMessageToCurrentChat = async () => {
const currentChat = chatStore.getState().currentChat;