Skip to content

Commit a717aca

Browse files
authored
fix: vector index fixes (#2864)
1 parent f1266f7 commit a717aca

File tree

3 files changed

+15
-12
lines changed

3 files changed

+15
-12
lines changed

src/components/InfoViewer/schemaInfo/TableIndexInfo.tsx

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import type {InfoViewerItem} from '..';
22
import {InfoViewer} from '..';
33
import {getEntityName} from '../../../containers/Tenant/utils';
4+
import {EIndexType} from '../../../types/api/schema';
45
import type {TEvDescribeSchemeResult} from '../../../types/api/schema';
56

67
import i18n from './i18n';
@@ -22,16 +23,17 @@ export const TableIndexInfo = ({data}: TableIndexInfoProps) => {
2223

2324
const vectorSettings = TableIndex?.VectorIndexKmeansTreeDescription?.Settings;
2425

25-
if (!vectorSettings) {
26-
return <InfoViewer title={entityName} info={info} />;
27-
}
26+
const isVectorIndex = TableIndex?.Type === EIndexType.EIndexTypeGlobalVectorKmeansTree;
2827

29-
const vectorInfo: Array<InfoViewerItem> = buildVectorIndexInfo(vectorSettings);
28+
if (isVectorIndex) {
29+
const vectorInfo: Array<InfoViewerItem> = buildVectorIndexInfo(vectorSettings);
30+
return (
31+
<>
32+
<InfoViewer title={i18n('title_vector-index')} info={info} />
33+
<InfoViewer info={vectorInfo} />
34+
</>
35+
);
36+
}
3037

31-
return (
32-
<>
33-
<InfoViewer title={entityName} info={info} />
34-
<InfoViewer title={i18n('title_vector-index')} info={vectorInfo} />
35-
</>
36-
);
38+
return <InfoViewer title={entityName} info={info} />;
3739
};

src/components/InfoViewer/schemaInfo/utils.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ export function buildVectorIndexInfo(vectorSettings?: VectorSettings): InfoViewe
6161
const settingsFormatter = createInfoFormatter<TVectorIndexKmeansTreeDescriptionSettingsInner>({
6262
values: {
6363
vector_dimension: (v) => (typeof v === 'number' ? formatNumber(v) : v),
64+
vector_type: (v) => (typeof v === 'string' ? v.replace(/^VECTOR_TYPE_/, '') : v),
6465
},
6566
labels: {
6667
vector_dimension: i18n('field_vector-dimension'),

src/types/api/schema/tableIndex.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,14 @@ export interface TIndexDescription {
2626
VectorIndexKmeansTreeDescription?: TVectorIndexKmeansTreeDescription;
2727
}
2828

29-
enum EIndexType {
29+
export enum EIndexType {
3030
EIndexTypeInvalid = 'EIndexTypeInvalid',
3131
EIndexTypeGlobal = 'EIndexTypeGlobal',
3232
EIndexTypeGlobalAsync = 'EIndexTypeGlobalAsync',
3333
EIndexTypeGlobalVectorKmeansTree = 'EIndexTypeGlobalVectorKmeansTree',
3434
}
3535

36-
enum EIndexState {
36+
export enum EIndexState {
3737
EIndexStateInvalid = 'EIndexStateInvalid',
3838
EIndexStateReady = 'EIndexStateReady',
3939
EIndexStateNotReady = 'EIndexStateNotReady',

0 commit comments

Comments
 (0)