refactor(core): indexer & embedding -> embedding (#12387)

### TL;DR

refactor: rename settings, indexer embedding -> embedding

<!-- This is an auto-generated comment: release notes by coderabbit.ai -->
## Summary by CodeRabbit

- **Refactor**
  - Unified naming in workspace settings from "Indexer & Embedding" to "Embedding" for improved clarity.
  - Updated sidebar labels, tab keys, and test IDs to reflect the new naming convention.
  - Streamlined the layout and organization of the embedding settings interface for a more consistent user experience.
  - Simplified the export and component structure for embedding settings.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
yoyoyohamapi
2025-05-21 02:28:43 +00:00
parent 65a14f50c7
commit ae0dbb9faf
6 changed files with 91 additions and 111 deletions
@@ -14,7 +14,7 @@ export type SettingTab =
| 'editor'
| 'account'
| 'meetings'
| `workspace:${'preference' | 'properties' | 'members' | 'storage' | 'billing' | 'license' | 'integrations' | 'indexer-embedding' | 'search'}`;
| `workspace:${'preference' | 'properties' | 'members' | 'storage' | 'billing' | 'license' | 'integrations' | 'embedding' | 'search'}`;
export type GLOBAL_DIALOG_SCHEMA = {
'create-workspace': (props: { serverId?: string }) => {
@@ -17,4 +17,4 @@ export function configureIndexerEmbeddingModule(framework: Framework) {
.entity(Embedding, [WorkspaceService, EmbeddingStore]);
}
export { IndexerEmbeddingSettings } from './view';
export { EmbeddingSettings } from './view';
@@ -1,5 +1,6 @@
import { Button, Switch } from '@affine/component';
import {
SettingHeader,
SettingRow,
SettingWrapper,
} from '@affine/component/setting-components';
@@ -94,86 +95,85 @@ export const EmbeddingSettings: React.FC<EmbeddingSettingsProps> = () => {
]);
return (
<SettingWrapper
title={t[
'com.affine.settings.workspace.indexer-embedding.embedding.title'
]()}
testId="workspace-embedding-setting-wrapper"
>
<SettingRow
name=""
desc={t[
<>
<SettingHeader
title={t[
'com.affine.settings.workspace.indexer-embedding.embedding.title'
]()}
subtitle={t[
'com.affine.settings.workspace.indexer-embedding.embedding.description'
]()}
></SettingRow>
<SettingRow
name={t[
'com.affine.settings.workspace.indexer-embedding.embedding.switch.title'
]()}
desc={t[
'com.affine.settings.workspace.indexer-embedding.embedding.switch.description'
]()}
>
<Switch
data-testid="workspace-embedding-setting-switch"
checked={embeddingEnabled}
onChange={handleEmbeddingToggle}
/>
</SettingRow>
<SettingRow
name={t[
'com.affine.settings.workspace.indexer-embedding.embedding.additional-attachments.title'
]()}
desc={t[
'com.affine.settings.workspace.indexer-embedding.embedding.additional-attachments.description'
]()}
>
<Upload fileChange={handleAttachmentUpload}>
<Button
data-testid="workspace-embedding-setting-upload-button"
variant="primary"
>
{t['Upload']()}
</Button>
</Upload>
</SettingRow>
{attachmentNodes.length > 0 && (
<Attachments
attachments={attachmentNodes}
isLoading={isAttachmentsLoading}
onDelete={handleAttachmentsDelete}
totalCount={attachments.totalCount}
onPageChange={handleAttachmentsPageChange}
/>
)}
<SettingRow
name={t[
'com.affine.settings.workspace.indexer-embedding.embedding.ignore-docs.title'
]()}
desc={t[
'com.affine.settings.workspace.indexer-embedding.embedding.ignore-docs.description'
]()}
>
<Button
data-testid="workspace-embedding-setting-ignore-docs-button"
variant="primary"
onClick={handleSelectDoc}
>
{t[
'com.affine.settings.workspace.indexer-embedding.embedding.select-doc'
/>
<SettingWrapper title={''} testId="workspace-embedding-setting-wrapper">
<SettingRow
name={t[
'com.affine.settings.workspace.indexer-embedding.embedding.switch.title'
]()}
</Button>
</SettingRow>
desc={t[
'com.affine.settings.workspace.indexer-embedding.embedding.switch.description'
]()}
>
<Switch
data-testid="workspace-embedding-setting-switch"
checked={embeddingEnabled}
onChange={handleEmbeddingToggle}
/>
</SettingRow>
{ignoredDocNodes.length > 0 && (
<IgnoredDocs
ignoredDocs={ignoredDocNodes}
isLoading={isIgnoredDocsLoading}
/>
)}
</SettingWrapper>
<SettingRow
name={t[
'com.affine.settings.workspace.indexer-embedding.embedding.additional-attachments.title'
]()}
desc={t[
'com.affine.settings.workspace.indexer-embedding.embedding.additional-attachments.description'
]()}
>
<Upload fileChange={handleAttachmentUpload}>
<Button
data-testid="workspace-embedding-setting-upload-button"
variant="primary"
>
{t['Upload']()}
</Button>
</Upload>
</SettingRow>
{attachmentNodes.length > 0 && (
<Attachments
attachments={attachmentNodes}
isLoading={isAttachmentsLoading}
onDelete={handleAttachmentsDelete}
totalCount={attachments.totalCount}
onPageChange={handleAttachmentsPageChange}
/>
)}
<SettingRow
name={t[
'com.affine.settings.workspace.indexer-embedding.embedding.ignore-docs.title'
]()}
desc={t[
'com.affine.settings.workspace.indexer-embedding.embedding.ignore-docs.description'
]()}
>
<Button
data-testid="workspace-embedding-setting-ignore-docs-button"
variant="primary"
onClick={handleSelectDoc}
>
{t[
'com.affine.settings.workspace.indexer-embedding.embedding.select-doc'
]()}
</Button>
</SettingRow>
{ignoredDocNodes.length > 0 && (
<IgnoredDocs
ignoredDocs={ignoredDocNodes}
isLoading={isIgnoredDocsLoading}
/>
)}
</SettingWrapper>
</>
);
};
@@ -1,22 +1 @@
import { SettingHeader } from '@affine/component/setting-components';
import { useI18n } from '@affine/i18n';
import type React from 'react';
import { EmbeddingSettings } from './embedding-settings';
export const IndexerEmbeddingSettings: React.FC = () => {
const t = useI18n();
return (
<>
<SettingHeader
title={t['com.affine.settings.workspace.indexer-embedding.title']()}
subtitle={t[
'com.affine.settings.workspace.indexer-embedding.description'
]()}
/>
<EmbeddingSettings />
</>
);
};
export { EmbeddingSettings } from './embedding-settings';