Skip to content

TagSpaces is an offline, open source, document manager with tagging support

chore: improving ai buttons

Ilian Sapundshiev202f808c8216
diff --git a/src/renderer/components/EditDescriptionButtons.tsx b/src/renderer/components/EditDescriptionButtons.tsx
index a635ccbf5..b61feae13 100644
--- a/src/renderer/components/EditDescriptionButtons.tsx
+++ b/src/renderer/components/EditDescriptionButtons.tsx
@@ -200,26 +200,27 @@ const EditDescriptionButtons: React.FC<ButtonsProps> = ({
</TsButton>
</ProTooltip>
</ButtonGroup>
- <ButtonGroup style={{ marginLeft: AppConfig.defaultSpaceBetweenButtons }}>
- <ProTooltip
- tooltip={'Add AI generated description based on the file content'}
- >
- <AiGenDescButton variant="outlined" />
- </ProTooltip>
- {openedEntry.meta?.description && (
- <>
- <ProTooltip
- tooltip={'Add AI generated tags based on the description'}
- >
- <AiGenTagsButton
- style={{ marginLeft: AppConfig.defaultSpaceBetweenButtons }}
- fromDescription={true}
- variant="outlined"
- />
- </ProTooltip>
- </>
- )}
- </ButtonGroup>
+ <ProTooltip
+ tooltip={'Add AI generated description based on the file content'}
+ >
+ <AiGenDescButton
+ style={{ marginLeft: AppConfig.defaultSpaceBetweenButtons }}
+ variant="outlined"
+ />
+ </ProTooltip>
+ {openedEntry.meta?.description && (
+ <>
+ <ProTooltip
+ tooltip={'Add AI generated tags based on the description'}
+ >
+ <AiGenTagsButton
+ style={{ marginLeft: AppConfig.defaultSpaceBetweenButtons }}
+ fromDescription={true}
+ variant="outlined"
+ />
+ </ProTooltip>
+ </>
+ )}
<TsIconButton
tooltip={t('core:chatMore')}
onClick={handleMoreClick}
diff --git a/src/renderer/components/chat/AiGenDescButton.tsx b/src/renderer/components/chat/AiGenDescButton.tsx
index 18abadc91..ca99963de 100644
--- a/src/renderer/components/chat/AiGenDescButton.tsx
+++ b/src/renderer/components/chat/AiGenDescButton.tsx
@@ -17,13 +17,16 @@
*/
import TsButton, { TSButtonProps } from '-/components/TsButton';
+import { AIProvider } from '-/components/chat/ChatTypes';
import { useAiGenerationDialogContext } from '-/components/dialogs/hooks/useAiGenerationDialogContext';
import { TabNames } from '-/hooks/EntryPropsTabsContextProvider';
import { useChatContext } from '-/hooks/useChatContext';
+import { useCurrentLocationContext } from '-/hooks/useCurrentLocationContext';
import { useFilePropertiesContext } from '-/hooks/useFilePropertiesContext';
import { useIOActionsContext } from '-/hooks/useIOActionsContext';
import { useNotificationContext } from '-/hooks/useNotificationContext';
import { useOpenedEntryContext } from '-/hooks/useOpenedEntryContext';
+import { Pro } from '-/pro';
import { AppDispatch } from '-/reducers/app';
import {
actions as SettingsActions,
@@ -35,13 +38,11 @@ import { useState } from 'react';
import { useTranslation } from 'react-i18next';
import { useDispatch, useSelector } from 'react-redux';
import { AIIcon } from '../CommonIcons';
-import { useCurrentLocationContext } from '-/hooks/useCurrentLocationContext';
-import { Pro } from '-/pro';
-import { AIProvider } from '-/components/chat/ChatTypes';
-type Props = TSButtonProps & {};
+type Props = TSButtonProps & { style?: any };
function AiGenDescButton(props: Props) {
+ const { style } = props;
const { t } = useTranslation();
// const { disabled } = props;
const dispatch: AppDispatch = useDispatch();
@@ -89,7 +90,7 @@ function AiGenDescButton(props: Props) {
}
return (
- <ButtonGroup>
+ <ButtonGroup style={{ ...style }}>
<TsButton
loading={isLoading}
disabled={disabled}