feat: Create a conversation before uploading files in it #1880 (#2057)

### What problem does this PR solve?

feat: Create a conversation before uploading files in it #1880

### Type of change


- [x] New Feature (non-breaking change which adds functionality)
This commit is contained in:
balibabu
2024-08-22 18:01:48 +08:00
committed by GitHub
parent 35e880c432
commit c739b68b29
9 changed files with 175 additions and 21 deletions

View File

@ -520,6 +520,7 @@ export const useFetchConversationOnMount = () => {
ref,
removeLatestMessage,
addNewestAnswer,
conversationId,
};
};
@ -769,4 +770,28 @@ export const useGetSendButtonDisabled = () => {
export const useSendButtonDisabled = (value: string) => {
return trim(value) === '';
};
export const useCreateConversationBeforeUploadDocument = () => {
const { setConversation } = useSetConversation();
const { dialogId } = useGetChatSearchParams();
const { handleClickConversation } = useClickConversationCard();
const createConversationBeforeUploadDocument = useCallback(
async (message: string) => {
const data = await setConversation(message);
if (data.retcode === 0) {
const id = data.data.id;
handleClickConversation(id);
}
return data;
},
[setConversation, handleClickConversation],
);
return {
createConversationBeforeUploadDocument,
dialogId,
};
};
//#endregion