TagSpaces is an offline, open source, document manager with tagging support
Click on the AI button in entry should ignore the selected files in the perspective (#2253)
Stanimira183b2c34507
diff --git a/src/renderer/components/chat/AiGenDescButton.tsx b/src/renderer/components/chat/AiGenDescButton.tsxindex 82e30c922..def0e89b4 100644--- a/src/renderer/components/chat/AiGenDescButton.tsx+++ b/src/renderer/components/chat/AiGenDescButton.tsx@@ -105,7 +105,7 @@ function AiGenDescButton(props: Props) {aria-label={t('core:openGenSettings')}data-tid="fileContainerPrevFile"onClick={() => {- openAiGenerationDialog('summary');+ openAiGenerationDialog('summary', [openedEntry]);}}style={{borderTopLeftRadius: 0,diff --git a/src/renderer/components/dialogs/hooks/AiGenerationDialogContextProvider.tsx b/src/renderer/components/dialogs/hooks/AiGenerationDialogContextProvider.tsxindex b42ea16e5..73d21c413 100644--- a/src/renderer/components/dialogs/hooks/AiGenerationDialogContextProvider.tsx+++ b/src/renderer/components/dialogs/hooks/AiGenerationDialogContextProvider.tsx@@ -19,9 +19,13 @@import { Pro } from '-/pro';import React, { createContext, useMemo, useReducer, useRef } from 'react';import { useProTeaserDialogContext } from '-/components/dialogs/hooks/useProTeaserDialogContext';+import { TS } from '-/tagspaces.namespace';type AiGenerationDialogContextData = {- openAiGenerationDialog: (optionSelected?: generateOptionType) => void;+ openAiGenerationDialog: (+ optionSelected?: generateOptionType,+ selectedEntries?: TS.FileSystemEntry[],+ ) => void;closeAiGenerationDialog: () => void;};@@ -43,13 +47,18 @@ export const AiGenerationDialogContextProvider = ({const { openProTeaserDialog } = useProTeaserDialogContext();const open = useRef<boolean>(false);const option = useRef<generateOptionType>(undefined);+ const selected = useRef<TS.FileSystemEntry[]>(undefined);const AiGenerationDialog = Pro && Pro.UI ? Pro.UI.AiGenerationDialog : false;const [ignored, forceUpdate] = useReducer((x) => x + 1, 0, undefined);- function openDialog(optionSelected: generateOptionType = undefined) {+ function openDialog(+ optionSelected: generateOptionType = undefined,+ selectedEntries: TS.FileSystemEntry[] = undefined,+ ) {if (AiGenerationDialog) {open.current = true;option.current = optionSelected;+ selected.current = selectedEntries;forceUpdate();} else {openProTeaserDialog('ai');@@ -75,6 +84,7 @@ export const AiGenerationDialogContextProvider = ({open={open.current}onClose={closeDialog}option={option.current}+ selected={selected.current}/>)}{children}