mirror of
https://github.com/infiniflow/ragflow.git
synced 2025-12-08 20:42:30 +08:00
* feat: fetch file thumbnails * feat: preview reference image * feat: delete conversation * feat: rename conversation
35 lines
1.0 KiB
TypeScript
35 lines
1.0 KiB
TypeScript
import { IConversation, IReference } from '@/interfaces/database/chat';
|
|
import { EmptyConversationId, variableEnabledFieldMap } from './constants';
|
|
|
|
export const excludeUnEnabledVariables = (values: any) => {
|
|
const unEnabledFields: Array<keyof typeof variableEnabledFieldMap> =
|
|
Object.keys(variableEnabledFieldMap).filter((key) => !values[key]) as Array<
|
|
keyof typeof variableEnabledFieldMap
|
|
>;
|
|
|
|
return unEnabledFields.map(
|
|
(key) => `llm_setting.${variableEnabledFieldMap[key]}`,
|
|
);
|
|
};
|
|
|
|
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(',');
|
|
};
|