feat: rename conversation and delete conversation and preview reference image and fetch file thumbnails (#79)

* feat: fetch file thumbnails

* feat: preview reference image

* feat: delete conversation

* feat: rename conversation
This commit is contained in:
balibabu
2024-02-28 16:28:33 +08:00
committed by GitHub
parent 22da1b1bfe
commit 01ab5b5db1
14 changed files with 487 additions and 92 deletions

View File

@ -1,3 +1,4 @@
import { IConversation, IReference } from '@/interfaces/database/chat';
import { EmptyConversationId, variableEnabledFieldMap } from './constants';
export const excludeUnEnabledVariables = (values: any) => {
@ -11,6 +12,23 @@ export const excludeUnEnabledVariables = (values: any) => {
);
};
export const isConversationIdNotExist = (conversationId: string) => {
export const isConversationIdExist = (conversationId: string) => {
return conversationId !== EmptyConversationId && conversationId !== '';
};
export const getDocumentIdsFromConversionReference = (data: IConversation) => {
const documentIds = data.reference.reduce(
(pre: Array<string>, cur: IReference) => {
cur.doc_aggs
.map((x) => x.doc_id)
.forEach((x) => {
if (pre.every((y) => y !== x)) {
pre.push(x);
}
});
return pre;
},
[],
);
return documentIds.join(',');
};