feat: gen title by sperate api call

feat:

fix: rename of convo should based on real request.
This commit is contained in:
Wentao Lyu 2023-03-13 14:04:47 +08:00
parent 8773878be2
commit 9f8e9cb091
8 changed files with 65 additions and 28 deletions

View file

@ -8,13 +8,14 @@ import { setMessages, setEmptyMessage } from '~/store/messageSlice';
import { setText } from '~/store/textSlice';
import manualSWR from '~/utils/fetchers';
import ConvoIcon from '../svg/ConvoIcon';
import { refreshConversation } from '../../store/convoSlice';
export default function Conversation({
id,
model,
parentMessageId,
conversationId,
title = 'New conversation',
title,
chatGptLabel = null,
promptPrefix = null,
bingData,
@ -95,6 +96,7 @@ export default function Conversation({
const renameHandler = (e) => {
e.preventDefault();
setTitleInput(title);
setRenaming(true);
setTimeout(() => {
inputRef.current.focus();
@ -112,7 +114,10 @@ export default function Conversation({
if (titleInput === title) {
return;
}
rename.trigger({ conversationId, title: titleInput });
rename.trigger({ conversationId, title: titleInput })
.then(() => {
dispatch(refreshConversation())
});
};
const handleKeyDown = (e) => {
@ -149,7 +154,7 @@ export default function Conversation({
onKeyDown={handleKeyDown}
/>
) : (
titleInput
title
)}
</div>
{conversationId === id ? (