@memberjunction/ng-dashboards 6.2.0-edge.2 → 6.2.0-edge.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/AI/components/analytics/realtime/realtime-transcripts-data.d.ts +4 -3
- package/dist/AI/components/analytics/realtime/realtime-transcripts-data.d.ts.map +1 -1
- package/dist/AI/components/analytics/realtime/realtime-transcripts-data.js +8 -5
- package/dist/AI/components/analytics/realtime/realtime-transcripts-data.js.map +1 -1
- package/dist/AI/components/duplicates/compare-value.component.d.ts +67 -0
- package/dist/AI/components/duplicates/compare-value.component.d.ts.map +1 -0
- package/dist/AI/components/duplicates/compare-value.component.js +168 -0
- package/dist/AI/components/duplicates/compare-value.component.js.map +1 -0
- package/dist/AI/components/duplicates/duplicate-detection-resource.component.d.ts +49 -3
- package/dist/AI/components/duplicates/duplicate-detection-resource.component.d.ts.map +1 -1
- package/dist/AI/components/duplicates/duplicate-detection-resource.component.js +287 -169
- package/dist/AI/components/duplicates/duplicate-detection-resource.component.js.map +1 -1
- package/dist/AI/components/duplicates/duplicate-detection-run-scope.d.ts +77 -0
- package/dist/AI/components/duplicates/duplicate-detection-run-scope.d.ts.map +1 -0
- package/dist/AI/components/duplicates/duplicate-detection-run-scope.js +116 -0
- package/dist/AI/components/duplicates/duplicate-detection-run-scope.js.map +1 -0
- package/dist/AI/components/prompts/model-prompt-priority-matrix.component.d.ts +1 -0
- package/dist/AI/components/prompts/model-prompt-priority-matrix.component.d.ts.map +1 -1
- package/dist/AI/components/prompts/model-prompt-priority-matrix.component.js +16 -4
- package/dist/AI/components/prompts/model-prompt-priority-matrix.component.js.map +1 -1
- package/dist/AI/components/tags/tags-resource.component.d.ts +2 -0
- package/dist/AI/components/tags/tags-resource.component.d.ts.map +1 -1
- package/dist/AI/components/tags/tags-resource.component.js +12 -6
- package/dist/AI/components/tags/tags-resource.component.js.map +1 -1
- package/dist/AI/components/vectors/vector-index-auto.d.ts +29 -0
- package/dist/AI/components/vectors/vector-index-auto.d.ts.map +1 -0
- package/dist/AI/components/vectors/vector-index-auto.js +59 -0
- package/dist/AI/components/vectors/vector-index-auto.js.map +1 -0
- package/dist/AI/components/vectors/vector-management-resource.component.d.ts +9 -0
- package/dist/AI/components/vectors/vector-management-resource.component.d.ts.map +1 -1
- package/dist/AI/components/vectors/vector-management-resource.component.js +65 -20
- package/dist/AI/components/vectors/vector-management-resource.component.js.map +1 -1
- package/dist/Actions/components/actions-overview.component.d.ts.map +1 -1
- package/dist/Actions/components/actions-overview.component.js +7 -3
- package/dist/Actions/components/actions-overview.component.js.map +1 -1
- package/dist/Actions/components/categories-list-view.component.d.ts.map +1 -1
- package/dist/Actions/components/categories-list-view.component.js +3 -2
- package/dist/Actions/components/categories-list-view.component.js.map +1 -1
- package/dist/ComponentStudio/component-studio-dashboard.component.d.ts.map +1 -1
- package/dist/ComponentStudio/component-studio-dashboard.component.js +1 -0
- package/dist/ComponentStudio/component-studio-dashboard.component.js.map +1 -1
- package/dist/ComponentStudio/components/ai-assistant/ai-assistant-panel.component.d.ts +0 -3
- package/dist/ComponentStudio/components/ai-assistant/ai-assistant-panel.component.d.ts.map +1 -1
- package/dist/ComponentStudio/components/ai-assistant/ai-assistant-panel.component.js +5 -14
- package/dist/ComponentStudio/components/ai-assistant/ai-assistant-panel.component.js.map +1 -1
- package/dist/ComponentStudio/components/artifact-load-dialog.component.d.ts.map +1 -1
- package/dist/ComponentStudio/components/artifact-load-dialog.component.js +1 -0
- package/dist/ComponentStudio/components/artifact-load-dialog.component.js.map +1 -1
- package/dist/ComponentStudio/components/artifact-selection-dialog.component.d.ts.map +1 -1
- package/dist/ComponentStudio/components/artifact-selection-dialog.component.js +1 -0
- package/dist/ComponentStudio/components/artifact-selection-dialog.component.js.map +1 -1
- package/dist/ComponentStudio/components/form-override-dialog.component.d.ts +12 -1
- package/dist/ComponentStudio/components/form-override-dialog.component.d.ts.map +1 -1
- package/dist/ComponentStudio/components/form-override-dialog.component.js +128 -81
- package/dist/ComponentStudio/components/form-override-dialog.component.js.map +1 -1
- package/dist/Credentials/components/credentials-list-resource.component.d.ts +2 -0
- package/dist/Credentials/components/credentials-list-resource.component.d.ts.map +1 -1
- package/dist/Credentials/components/credentials-list-resource.component.js +12 -10
- package/dist/Credentials/components/credentials-list-resource.component.js.map +1 -1
- package/dist/DashboardBrowser/dashboard-browser-agent-context.d.ts +14 -43
- package/dist/DashboardBrowser/dashboard-browser-agent-context.d.ts.map +1 -1
- package/dist/DashboardBrowser/dashboard-browser-agent-context.js +6 -29
- package/dist/DashboardBrowser/dashboard-browser-agent-context.js.map +1 -1
- package/dist/DashboardBrowser/dashboard-browser-resource.component.d.ts +174 -321
- package/dist/DashboardBrowser/dashboard-browser-resource.component.d.ts.map +1 -1
- package/dist/DashboardBrowser/dashboard-browser-resource.component.js +522 -1195
- package/dist/DashboardBrowser/dashboard-browser-resource.component.js.map +1 -1
- package/dist/DashboardBrowser/dashboard-library-filter.d.ts +116 -0
- package/dist/DashboardBrowser/dashboard-library-filter.d.ts.map +1 -0
- package/dist/DashboardBrowser/dashboard-library-filter.js +277 -0
- package/dist/DashboardBrowser/dashboard-library-filter.js.map +1 -0
- package/dist/DashboardBrowser/dashboard-share-dialog.component.d.ts +1 -1
- package/dist/DashboardBrowser/dashboard-share-dialog.component.js.map +1 -1
- package/dist/DashboardBrowser/dashboards-agent-tools.d.ts +26 -0
- package/dist/DashboardBrowser/dashboards-agent-tools.d.ts.map +1 -0
- package/dist/DashboardBrowser/dashboards-agent-tools.js +32 -0
- package/dist/DashboardBrowser/dashboards-agent-tools.js.map +1 -0
- package/dist/DashboardBrowser/dashboards-categories-resource.component.d.ts +58 -0
- package/dist/DashboardBrowser/dashboards-categories-resource.component.d.ts.map +1 -0
- package/dist/DashboardBrowser/dashboards-categories-resource.component.js +391 -0
- package/dist/DashboardBrowser/dashboards-categories-resource.component.js.map +1 -0
- package/dist/DashboardBrowser/dashboards-categories.helpers.d.ts +37 -0
- package/dist/DashboardBrowser/dashboards-categories.helpers.d.ts.map +1 -0
- package/dist/DashboardBrowser/dashboards-categories.helpers.js +68 -0
- package/dist/DashboardBrowser/dashboards-categories.helpers.js.map +1 -0
- package/dist/DashboardEditor/dashboard-editor.component.d.ts +295 -0
- package/dist/DashboardEditor/dashboard-editor.component.d.ts.map +1 -0
- package/dist/DashboardEditor/dashboard-editor.component.js +1022 -0
- package/dist/DashboardEditor/dashboard-editor.component.js.map +1 -0
- package/dist/DashboardEditor/dashboard-editor.types.d.ts +23 -0
- package/dist/DashboardEditor/dashboard-editor.types.d.ts.map +1 -0
- package/dist/DashboardEditor/dashboard-editor.types.js +3 -0
- package/dist/DashboardEditor/dashboard-editor.types.js.map +1 -0
- package/dist/DashboardEditor/dashboard-viewer-factory.d.ts +11 -0
- package/dist/DashboardEditor/dashboard-viewer-factory.d.ts.map +1 -0
- package/dist/DashboardEditor/dashboard-viewer-factory.js +17 -0
- package/dist/DashboardEditor/dashboard-viewer-factory.js.map +1 -0
- package/dist/DataExplorer/data-explorer-dashboard.component.d.ts +30 -0
- package/dist/DataExplorer/data-explorer-dashboard.component.d.ts.map +1 -1
- package/dist/DataExplorer/data-explorer-dashboard.component.js +349 -232
- package/dist/DataExplorer/data-explorer-dashboard.component.js.map +1 -1
- package/dist/DataExplorer/services/explorer-state.service.d.ts +1 -1
- package/dist/DataExplorer/services/explorer-state.service.js +2 -5
- package/dist/DataExplorer/services/explorer-state.service.js.map +1 -1
- package/dist/FormBuilder/form-builder-resource.component.d.ts +0 -14
- package/dist/FormBuilder/form-builder-resource.component.d.ts.map +1 -1
- package/dist/FormBuilder/form-builder-resource.component.js +7 -29
- package/dist/FormBuilder/form-builder-resource.component.js.map +1 -1
- package/dist/Home/home-agent-context.d.ts +29 -10
- package/dist/Home/home-agent-context.d.ts.map +1 -1
- package/dist/Home/home-agent-context.js +50 -24
- package/dist/Home/home-agent-context.js.map +1 -1
- package/dist/Home/home-dashboard-switcher.component.d.ts +95 -0
- package/dist/Home/home-dashboard-switcher.component.d.ts.map +1 -0
- package/dist/Home/home-dashboard-switcher.component.js +442 -0
- package/dist/Home/home-dashboard-switcher.component.js.map +1 -0
- package/dist/Home/home-dashboard.component.d.ts +330 -17
- package/dist/Home/home-dashboard.component.d.ts.map +1 -1
- package/dist/Home/home-dashboard.component.js +1702 -1014
- package/dist/Home/home-dashboard.component.js.map +1 -1
- package/dist/Home/home-menus.d.ts +38 -0
- package/dist/Home/home-menus.d.ts.map +1 -0
- package/dist/Home/home-menus.js +53 -0
- package/dist/Home/home-menus.js.map +1 -0
- package/dist/Home/home-pinned-dashboards.d.ts +33 -0
- package/dist/Home/home-pinned-dashboards.d.ts.map +1 -0
- package/dist/Home/home-pinned-dashboards.js +76 -0
- package/dist/Home/home-pinned-dashboards.js.map +1 -0
- package/dist/PredictiveStudio/components/ps-production.component.d.ts +5 -1
- package/dist/PredictiveStudio/components/ps-production.component.d.ts.map +1 -1
- package/dist/PredictiveStudio/components/ps-production.component.js +64 -41
- package/dist/PredictiveStudio/components/ps-production.component.js.map +1 -1
- package/dist/QueryBrowser/query-browser-resource.component.d.ts.map +1 -1
- package/dist/QueryBrowser/query-browser-resource.component.js +3 -2
- package/dist/QueryBrowser/query-browser-resource.component.js.map +1 -1
- package/dist/RealtimeRecordings/realtime-recordings-dashboard.component.js +2 -2
- package/dist/RealtimeRecordings/realtime-recordings-dashboard.component.js.map +1 -1
- package/dist/TelephonyOperations/telephony-operations-agent-context.d.ts +107 -0
- package/dist/TelephonyOperations/telephony-operations-agent-context.d.ts.map +1 -0
- package/dist/TelephonyOperations/telephony-operations-agent-context.js +216 -0
- package/dist/TelephonyOperations/telephony-operations-agent-context.js.map +1 -0
- package/dist/TelephonyOperations/telephony-operations-dashboard.component.d.ts +58 -0
- package/dist/TelephonyOperations/telephony-operations-dashboard.component.d.ts.map +1 -0
- package/dist/TelephonyOperations/telephony-operations-dashboard.component.js +812 -0
- package/dist/TelephonyOperations/telephony-operations-dashboard.component.js.map +1 -0
- package/dist/Testing/components/testing-explorer.component.d.ts.map +1 -1
- package/dist/Testing/components/testing-explorer.component.js +7 -7
- package/dist/Testing/components/testing-explorer.component.js.map +1 -1
- package/dist/WorkQueue/components/work-queue-bindings.component.d.ts +37 -0
- package/dist/WorkQueue/components/work-queue-bindings.component.d.ts.map +1 -0
- package/dist/WorkQueue/components/work-queue-bindings.component.js +210 -0
- package/dist/WorkQueue/components/work-queue-bindings.component.js.map +1 -0
- package/dist/WorkQueue/components/work-queue-dead-letters.component.d.ts +70 -0
- package/dist/WorkQueue/components/work-queue-dead-letters.component.d.ts.map +1 -0
- package/dist/WorkQueue/components/work-queue-dead-letters.component.js +496 -0
- package/dist/WorkQueue/components/work-queue-dead-letters.component.js.map +1 -0
- package/dist/WorkQueue/components/work-queue-discard-dialog.component.d.ts +22 -0
- package/dist/WorkQueue/components/work-queue-discard-dialog.component.d.ts.map +1 -0
- package/dist/WorkQueue/components/work-queue-discard-dialog.component.js +99 -0
- package/dist/WorkQueue/components/work-queue-discard-dialog.component.js.map +1 -0
- package/dist/WorkQueue/components/work-queue-overview.component.d.ts +29 -0
- package/dist/WorkQueue/components/work-queue-overview.component.d.ts.map +1 -0
- package/dist/WorkQueue/components/work-queue-overview.component.js +278 -0
- package/dist/WorkQueue/components/work-queue-overview.component.js.map +1 -0
- package/dist/WorkQueue/components/work-queue-partitions.component.d.ts +59 -0
- package/dist/WorkQueue/components/work-queue-partitions.component.d.ts.map +1 -0
- package/dist/WorkQueue/components/work-queue-partitions.component.js +359 -0
- package/dist/WorkQueue/components/work-queue-partitions.component.js.map +1 -0
- package/dist/WorkQueue/services/work-queue-operator.service.d.ts +22 -0
- package/dist/WorkQueue/services/work-queue-operator.service.d.ts.map +1 -0
- package/dist/WorkQueue/services/work-queue-operator.service.js +44 -0
- package/dist/WorkQueue/services/work-queue-operator.service.js.map +1 -0
- package/dist/WorkQueue/work-queue-agent-context.d.ts +67 -0
- package/dist/WorkQueue/work-queue-agent-context.d.ts.map +1 -0
- package/dist/WorkQueue/work-queue-agent-context.js +119 -0
- package/dist/WorkQueue/work-queue-agent-context.js.map +1 -0
- package/dist/WorkQueue/work-queue-dashboard.component.d.ts +94 -0
- package/dist/WorkQueue/work-queue-dashboard.component.d.ts.map +1 -0
- package/dist/WorkQueue/work-queue-dashboard.component.js +545 -0
- package/dist/WorkQueue/work-queue-dashboard.component.js.map +1 -0
- package/dist/WorkQueue/work-queue-types.d.ts +40 -0
- package/dist/WorkQueue/work-queue-types.d.ts.map +1 -0
- package/dist/WorkQueue/work-queue-types.js +2 -0
- package/dist/WorkQueue/work-queue-types.js.map +1 -0
- package/dist/ai-dashboards.module.d.ts +21 -20
- package/dist/ai-dashboards.module.d.ts.map +1 -1
- package/dist/ai-dashboards.module.js +4 -1
- package/dist/ai-dashboards.module.js.map +1 -1
- package/dist/core-dashboards.module.d.ts +69 -61
- package/dist/core-dashboards.module.d.ts.map +1 -1
- package/dist/core-dashboards.module.js +29 -2
- package/dist/core-dashboards.module.js.map +1 -1
- package/dist/data-explorer-dashboards.module.d.ts +1 -1
- package/dist/data-explorer-dashboards.module.d.ts.map +1 -1
- package/dist/data-explorer-dashboards.module.js +3 -1
- package/dist/data-explorer-dashboards.module.js.map +1 -1
- package/dist/module.d.ts +14 -13
- package/dist/module.d.ts.map +1 -1
- package/dist/module.js +7 -0
- package/dist/module.js.map +1 -1
- package/dist/public-api.d.ts +6 -0
- package/dist/public-api.d.ts.map +1 -1
- package/dist/public-api.js +9 -0
- package/dist/public-api.js.map +1 -1
- package/dist/shared/dashboard-library-changes.d.ts +23 -0
- package/dist/shared/dashboard-library-changes.d.ts.map +1 -0
- package/dist/shared/dashboard-library-changes.js +26 -0
- package/dist/shared/dashboard-library-changes.js.map +1 -0
- package/dist/shared/dashboard-owner-names.d.ts +17 -0
- package/dist/shared/dashboard-owner-names.d.ts.map +1 -0
- package/dist/shared/dashboard-owner-names.js +65 -0
- package/dist/shared/dashboard-owner-names.js.map +1 -0
- package/dist/shared/dashboard-recents.d.ts +34 -0
- package/dist/shared/dashboard-recents.d.ts.map +1 -0
- package/dist/shared/dashboard-recents.js +87 -0
- package/dist/shared/dashboard-recents.js.map +1 -0
- package/dist/shared/dashboards-app-install.d.ts +59 -0
- package/dist/shared/dashboards-app-install.d.ts.map +1 -0
- package/dist/shared/dashboards-app-install.js +97 -0
- package/dist/shared/dashboards-app-install.js.map +1 -0
- package/dist/shared/dashboards-app.helpers.d.ts +42 -0
- package/dist/shared/dashboards-app.helpers.d.ts.map +1 -0
- package/dist/shared/dashboards-app.helpers.js +143 -0
- package/dist/shared/dashboards-app.helpers.js.map +1 -0
- package/dist/work-queue-dashboards.module.d.ts +23 -0
- package/dist/work-queue-dashboards.module.d.ts.map +1 -0
- package/dist/work-queue-dashboards.module.js +92 -0
- package/dist/work-queue-dashboards.module.js.map +1 -0
- package/package.json +73 -66
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/** The slice of an `MJ: Vector Indexes` row needed to decide whether it fits a document. */
|
|
2
|
+
export interface VectorIndexCandidate {
|
|
3
|
+
ID: string;
|
|
4
|
+
VectorDatabaseID: string | null;
|
|
5
|
+
EmbeddingModelID: string | null;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* The provider-side cap `MJVectorIndexEntityServer.sanitizeIndexName` applies (Pinecone's limit). An
|
|
9
|
+
* auto-generated name is kept under it so the server's sanitizing is a no-op; see
|
|
10
|
+
* {@link BuildAutoVectorIndexName}.
|
|
11
|
+
*/
|
|
12
|
+
export declare const AUTO_VECTOR_INDEX_NAME_MAX_LENGTH = 45;
|
|
13
|
+
/**
|
|
14
|
+
* The index already built for this database + embedding model, or null when none exists. Never falls
|
|
15
|
+
* back to an index on the same database for a different model.
|
|
16
|
+
*/
|
|
17
|
+
export declare function FindMatchingVectorIndex<T extends VectorIndexCandidate>(indexes: readonly T[], vectorDatabaseID: string | null | undefined, embeddingModelID: string | null | undefined): T | null;
|
|
18
|
+
/**
|
|
19
|
+
* Name for an auto-created index, built so the provider index gets the SAME name.
|
|
20
|
+
*
|
|
21
|
+
* Everything downstream (the sync upserter, the duplicate detector, the vectors resolver) addresses
|
|
22
|
+
* the provider index by the record's `Name`, while `MJVectorIndexEntityServer` provisions it under
|
|
23
|
+
* `sanitizeIndexName(Name)`: lowercase letters, digits and hyphens only, at most 45 characters. A
|
|
24
|
+
* name that does not survive that sanitizing points the sync at an index that does not exist, so the
|
|
25
|
+
* name is emitted already in that form: `<entity>-<model>` as a slug, cut to fit, plus a short hash
|
|
26
|
+
* of the full slug so two long names that only differ past the cut do not collide.
|
|
27
|
+
*/
|
|
28
|
+
export declare function BuildAutoVectorIndexName(entityName: string | null | undefined, embeddingModelName: string | null | undefined): string;
|
|
29
|
+
//# sourceMappingURL=vector-index-auto.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vector-index-auto.d.ts","sourceRoot":"","sources":["../../../../src/AI/components/vectors/vector-index-auto.ts"],"names":[],"mappings":"AAUA,4FAA4F;AAC5F,MAAM,WAAW,oBAAoB;IACjC,EAAE,EAAE,MAAM,CAAC;IACX,gBAAgB,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC,gBAAgB,EAAE,MAAM,GAAG,IAAI,CAAC;CACnC;AAED;;;;GAIG;AACH,eAAO,MAAM,iCAAiC,KAAK,CAAC;AAKpD;;;GAGG;AACH,wBAAgB,uBAAuB,CAAC,CAAC,SAAS,oBAAoB,EAClE,OAAO,EAAE,SAAS,CAAC,EAAE,EACrB,gBAAgB,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EAC3C,gBAAgB,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAC5C,CAAC,GAAG,IAAI,CAOV;AAED;;;;;;;;;GASG;AACH,wBAAgB,wBAAwB,CACpC,UAAU,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EACrC,kBAAkB,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAC9C,MAAM,CAKR"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pure helpers behind the "Vector Index: Auto (create/find matching index)" choice in the AI
|
|
3
|
+
* Document Suggestion panel and the entity-document edit panel.
|
|
4
|
+
*
|
|
5
|
+
* "Matching" means the SAME vector database AND the SAME embedding model. An index built for another
|
|
6
|
+
* model has another vector width, and every upsert into it is rejected on a dimension mismatch, so a
|
|
7
|
+
* looser match (any index on that database) is worse than creating a fresh one.
|
|
8
|
+
*/
|
|
9
|
+
import { UUIDsEqual } from '@memberjunction/global';
|
|
10
|
+
/**
|
|
11
|
+
* The provider-side cap `MJVectorIndexEntityServer.sanitizeIndexName` applies (Pinecone's limit). An
|
|
12
|
+
* auto-generated name is kept under it so the server's sanitizing is a no-op; see
|
|
13
|
+
* {@link BuildAutoVectorIndexName}.
|
|
14
|
+
*/
|
|
15
|
+
export const AUTO_VECTOR_INDEX_NAME_MAX_LENGTH = 45;
|
|
16
|
+
/** Length of the hash suffix that keeps two long, truncated names from colliding. */
|
|
17
|
+
const NAME_HASH_LENGTH = 6;
|
|
18
|
+
/**
|
|
19
|
+
* The index already built for this database + embedding model, or null when none exists. Never falls
|
|
20
|
+
* back to an index on the same database for a different model.
|
|
21
|
+
*/
|
|
22
|
+
export function FindMatchingVectorIndex(indexes, vectorDatabaseID, embeddingModelID) {
|
|
23
|
+
if (!vectorDatabaseID || !embeddingModelID) {
|
|
24
|
+
return null;
|
|
25
|
+
}
|
|
26
|
+
return indexes.find(i => UUIDsEqual(i.VectorDatabaseID, vectorDatabaseID) && UUIDsEqual(i.EmbeddingModelID, embeddingModelID)) ?? null;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Name for an auto-created index, built so the provider index gets the SAME name.
|
|
30
|
+
*
|
|
31
|
+
* Everything downstream (the sync upserter, the duplicate detector, the vectors resolver) addresses
|
|
32
|
+
* the provider index by the record's `Name`, while `MJVectorIndexEntityServer` provisions it under
|
|
33
|
+
* `sanitizeIndexName(Name)`: lowercase letters, digits and hyphens only, at most 45 characters. A
|
|
34
|
+
* name that does not survive that sanitizing points the sync at an index that does not exist, so the
|
|
35
|
+
* name is emitted already in that form: `<entity>-<model>` as a slug, cut to fit, plus a short hash
|
|
36
|
+
* of the full slug so two long names that only differ past the cut do not collide.
|
|
37
|
+
*/
|
|
38
|
+
export function BuildAutoVectorIndexName(entityName, embeddingModelName) {
|
|
39
|
+
const fullSlug = slugify(`${(entityName ?? '').trim() || 'entity'} ${(embeddingModelName ?? '').trim() || 'embeddings'}`);
|
|
40
|
+
const hash = hashBase36(fullSlug).slice(0, NAME_HASH_LENGTH).padStart(NAME_HASH_LENGTH, '0');
|
|
41
|
+
const stem = fullSlug.slice(0, AUTO_VECTOR_INDEX_NAME_MAX_LENGTH - NAME_HASH_LENGTH - 1).replace(/-+$/, '');
|
|
42
|
+
return `${stem}-${hash}`;
|
|
43
|
+
}
|
|
44
|
+
/** Lowercase, runs of anything but letters and digits collapsed to one hyphen, no leading or trailing hyphen. */
|
|
45
|
+
function slugify(value) {
|
|
46
|
+
return value
|
|
47
|
+
.toLowerCase()
|
|
48
|
+
.replace(/[^a-z0-9]+/g, '-')
|
|
49
|
+
.replace(/^-|-$/g, '');
|
|
50
|
+
}
|
|
51
|
+
/** Deterministic djb2 hash rendered in base 36; stable across sessions and tenants for the same input. */
|
|
52
|
+
function hashBase36(value) {
|
|
53
|
+
let hash = 5381;
|
|
54
|
+
for (let i = 0; i < value.length; i++) {
|
|
55
|
+
hash = ((hash << 5) + hash + value.charCodeAt(i)) >>> 0;
|
|
56
|
+
}
|
|
57
|
+
return hash.toString(36);
|
|
58
|
+
}
|
|
59
|
+
//# sourceMappingURL=vector-index-auto.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vector-index-auto.js","sourceRoot":"","sources":["../../../../src/AI/components/vectors/vector-index-auto.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AASpD;;;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AAG,CAAC;SAC3B,OAAO,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;AAC/B,CAAC;AAED,0GAA0G;AAC1G,SAAS,UAAU,CAAC,KAAa;IAC7B,IAAI,IAAI,GAAG,IAAI,CAAC;IAChB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACpC,IAAI,GAAG,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,GAAG,IAAI,GAAG,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;IAC5D,CAAC;IACD,OAAO,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;AAC7B,CAAC","sourcesContent":["/**\n * Pure helpers behind the \"Vector Index: Auto (create/find matching index)\" choice in the AI\n * Document Suggestion panel and the entity-document edit panel.\n *\n * \"Matching\" means the SAME vector database AND the SAME embedding model. An index built for another\n * model has another vector width, and every upsert into it is rejected on a dimension mismatch, so a\n * looser match (any index on that database) is worse than creating a fresh one.\n */\nimport { UUIDsEqual } from '@memberjunction/global';\n\n/** The slice of an `MJ: Vector Indexes` row needed to decide whether it fits a document. */\nexport interface VectorIndexCandidate {\n ID: string;\n VectorDatabaseID: string | null;\n EmbeddingModelID: string | null;\n}\n\n/**\n * The provider-side cap `MJVectorIndexEntityServer.sanitizeIndexName` applies (Pinecone's limit). An\n * auto-generated name is kept under it so the server's sanitizing is a no-op; see\n * {@link BuildAutoVectorIndexName}.\n */\nexport const AUTO_VECTOR_INDEX_NAME_MAX_LENGTH = 45;\n\n/** Length of the hash suffix that keeps two long, truncated names from colliding. */\nconst NAME_HASH_LENGTH = 6;\n\n/**\n * The index already built for this database + embedding model, or null when none exists. Never falls\n * back to an index on the same database for a different model.\n */\nexport function FindMatchingVectorIndex<T extends VectorIndexCandidate>(\n indexes: readonly T[],\n vectorDatabaseID: string | null | undefined,\n embeddingModelID: string | null | undefined\n): T | null {\n if (!vectorDatabaseID || !embeddingModelID) {\n return null;\n }\n return indexes.find(i =>\n UUIDsEqual(i.VectorDatabaseID, vectorDatabaseID) && UUIDsEqual(i.EmbeddingModelID, embeddingModelID)\n ) ?? null;\n}\n\n/**\n * Name for an auto-created index, built so the provider index gets the SAME name.\n *\n * Everything downstream (the sync upserter, the duplicate detector, the vectors resolver) addresses\n * the provider index by the record's `Name`, while `MJVectorIndexEntityServer` provisions it under\n * `sanitizeIndexName(Name)`: lowercase letters, digits and hyphens only, at most 45 characters. A\n * name that does not survive that sanitizing points the sync at an index that does not exist, so the\n * name is emitted already in that form: `<entity>-<model>` as a slug, cut to fit, plus a short hash\n * of the full slug so two long names that only differ past the cut do not collide.\n */\nexport function BuildAutoVectorIndexName(\n entityName: string | null | undefined,\n embeddingModelName: string | null | undefined\n): string {\n const fullSlug = slugify(`${(entityName ?? '').trim() || 'entity'} ${(embeddingModelName ?? '').trim() || 'embeddings'}`);\n const hash = hashBase36(fullSlug).slice(0, NAME_HASH_LENGTH).padStart(NAME_HASH_LENGTH, '0');\n const stem = fullSlug.slice(0, AUTO_VECTOR_INDEX_NAME_MAX_LENGTH - NAME_HASH_LENGTH - 1).replace(/-+$/, '');\n return `${stem}-${hash}`;\n}\n\n/** Lowercase, runs of anything but letters and digits collapsed to one hyphen, no leading or trailing hyphen. */\nfunction slugify(value: string): string {\n return value\n .toLowerCase()\n .replace(/[^a-z0-9]+/g, '-')\n .replace(/^-|-$/g, '');\n}\n\n/** Deterministic djb2 hash rendered in base 36; stable across sessions and tenants for the same input. */\nfunction hashBase36(value: string): string {\n let hash = 5381;\n for (let i = 0; i < value.length; i++) {\n hash = ((hash << 5) + hash + value.charCodeAt(i)) >>> 0;\n }\n return hash.toString(36);\n}\n"]}
|
|
@@ -312,6 +312,15 @@ export declare class VectorManagementResourceComponent extends BaseResourceCompo
|
|
|
312
312
|
* Throws if prerequisites are not met.
|
|
313
313
|
*/
|
|
314
314
|
private populateEntityDocumentFKs;
|
|
315
|
+
/**
|
|
316
|
+
* "Auto (create/find matching index)": reuse the index already built for this vector database +
|
|
317
|
+
* embedding model, or create the `MJ: Vector Indexes` record for one. Only the metadata row is
|
|
318
|
+
* written here and the save returns as soon as it is stored; the server-side entity hook then
|
|
319
|
+
* provisions the index in the provider (bounded by its own timeout) and writes the provider
|
|
320
|
+
* metadata back, so this request is never held while the provider works.
|
|
321
|
+
* Returns the index ID to store on the document.
|
|
322
|
+
*/
|
|
323
|
+
private resolveOrCreateVectorIndex;
|
|
315
324
|
/** Create a Template + TemplateContent record for the entity document */
|
|
316
325
|
private createTemplateForDocument;
|
|
317
326
|
/** Build grouped entity list from metadata, grouped by SchemaName */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vector-management-resource.component.d.ts","sourceRoot":"","sources":["../../../../src/AI/components/vectors/vector-management-resource.component.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAgC,SAAS,EAAE,aAAa,EAAoB,UAAU,EAAU,MAAM,eAAe,CAAC;AAC7H,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAG/B,OAAO,EACH,YAAY,EAEZ,sBAAsB,EAMzB,MAAM,+BAA+B,CAAC;AAEvC,OAAO,EAAE,qBAAqB,EAAE,iBAAiB,EAAmB,MAAM,2BAA2B,CAAC;AACtG,OAAO,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AACpE,OAAO,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;;
|
|
1
|
+
{"version":3,"file":"vector-management-resource.component.d.ts","sourceRoot":"","sources":["../../../../src/AI/components/vectors/vector-management-resource.component.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAgC,SAAS,EAAE,aAAa,EAAoB,UAAU,EAAU,MAAM,eAAe,CAAC;AAC7H,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAG/B,OAAO,EACH,YAAY,EAEZ,sBAAsB,EAMzB,M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;IA0B3C,gEAAgE;IACnD,oBAAoB,IAAI,OAAO,CAAC,IAAI,CAAC;IA2DlD,0DAA0D;IACnD,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM;IAU7C,qDAAqD;IAC9C,aAAa,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM;IAU5C,sCAAsC;IAC/B,UAAU,CAAC,IAAI,EAAE,IAAI,GAAG,IAAI,GAAG,MAAM;IAY5C,qCAAqC;IACrC,IAAW,YAAY,IAAI,MAAM,CAEhC;IAED,gDAAgD;IAChD,IAAW,aAAa,IAAI,MAAM,CAOjC;YAMa,YAAY;IAyD1B,OAAO,CAAC,aAAa;IAuBrB,OAAO,CAAC,iBAAiB;IAgBzB,OAAO,CAAC,aAAa;IAsDrB,OAAO,CAAC,gBAAgB;IAMxB,OAAO,CAAC,mBAAmB;IAmB3B,OAAO,CAAC,uBAAuB;IAa/B,OAAO,CAAC,iBAAiB;IAMzB,sFAAsF;IACtF,OAAO,CAAC,kBAAkB;IA6B1B,0DAA0D;IAC1D,OAAO,CAAC,kBAAkB;IAM1B;;;OAGG;YACW,yBAAyB;IA4CvC;;;;;;;OAOG;YACW,0BAA0B;IA+BxC,yEAAyE;YAC3D,yBAAyB;IAgDvC,qEAAqE;IACrE,OAAO,CAAC,gBAAgB;IAwBxB,OAAO,CAAC,eAAe;IAOvB,OAAO,CAAC,iBAAiB;IAOzB,sEAAsE;YACxD,cAAc;IA2C5B;;;OAGG;YACW,oBAAoB;IAmClC,mEAAmE;IACnE,OAAO,CAAC,oBAAoB;IAa5B,uDAAuD;IACvD,OAAO,CAAC,eAAe;yCAhmDd,iCAAiC;2CAAjC,iCAAiC;CAqoD7C;AAED,wBAAgB,4BAA4B,IAAI,IAAI,CAEnD"}
|
|
@@ -24,6 +24,7 @@ import { AIEngineBase } from '@memberjunction/ai-engine-base';
|
|
|
24
24
|
import { MJNotificationService } from '@memberjunction/ng-notifications';
|
|
25
25
|
import { BuildSingleStaticParamConfiguration, ResolveActionJobTypeID } from '../../../shared/action-scheduled-job';
|
|
26
26
|
import { CronToHumanReadable } from '../autotagging/shared/classify.format';
|
|
27
|
+
import { BuildAutoVectorIndexName, FindMatchingVectorIndex } from './vector-index-auto';
|
|
27
28
|
import { BuildVectorAgentContext, ResolveSyncRow, } from './vector-management-agent-context';
|
|
28
29
|
import { ValidateStringParam } from '../../../shared/agent-tool-validation';
|
|
29
30
|
import * as i0 from "@angular/core";
|
|
@@ -1100,9 +1101,17 @@ let VectorManagementResourceComponent = class VectorManagementResourceComponent
|
|
|
1100
1101
|
if (!loaded)
|
|
1101
1102
|
throw new Error('Could not load entity document');
|
|
1102
1103
|
doc.Name = this.EditDocName;
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
doc.
|
|
1104
|
+
const vectorDatabaseID = this.EditDocVectorDBID || null;
|
|
1105
|
+
const aiModelID = this.EditDocAIModelID || null;
|
|
1106
|
+
doc.VectorDatabaseID = vectorDatabaseID;
|
|
1107
|
+
doc.AIModelID = aiModelID;
|
|
1108
|
+
// "Auto (create/find matching index)" resolves to a real index for this DB + model, so the
|
|
1109
|
+
// syncer always has one to write into; without both parts there is nothing to match.
|
|
1110
|
+
doc.VectorIndexID = this.EditDocVectorIndexID
|
|
1111
|
+
? this.EditDocVectorIndexID
|
|
1112
|
+
: (vectorDatabaseID && aiModelID
|
|
1113
|
+
? await this.resolveOrCreateVectorIndex(vectorDatabaseID, aiModelID, this.EditDocEntityName)
|
|
1114
|
+
: null);
|
|
1106
1115
|
doc.Status = this.EditDocStatus;
|
|
1107
1116
|
const saved = await doc.Save();
|
|
1108
1117
|
if (saved) {
|
|
@@ -2007,7 +2016,9 @@ let VectorManagementResourceComponent = class VectorManagementResourceComponent
|
|
|
2007
2016
|
}
|
|
2008
2017
|
this.entityDocuments = engine.EntityDocuments;
|
|
2009
2018
|
this.vectorDatabases = AIEngineBase.Instance.VectorDatabases;
|
|
2010
|
-
|
|
2019
|
+
// A copy: resolveOrCreateVectorIndex() appends the index it creates, and the engine's getter
|
|
2020
|
+
// hands out its own cached array, which this component must not mutate.
|
|
2021
|
+
this.vectorIndexes = [...AIEngineBase.Instance.VectorIndexes];
|
|
2011
2022
|
// Build per-EntityDocument aggregate stats (vector count + last synced).
|
|
2012
2023
|
// Each query fetches only the most recent row (MaxRows: 1) and uses
|
|
2013
2024
|
// TotalRowCount for the actual vector count — avoids loading all rows.
|
|
@@ -2224,27 +2235,61 @@ let VectorManagementResourceComponent = class VectorManagementResourceComponent
|
|
|
2224
2235
|
else {
|
|
2225
2236
|
throw new Error('Entity Document Type "Record Duplicate" not found in database');
|
|
2226
2237
|
}
|
|
2227
|
-
//
|
|
2228
|
-
//
|
|
2229
|
-
|
|
2230
|
-
|
|
2231
|
-
|
|
2232
|
-
|
|
2233
|
-
|
|
2234
|
-
|
|
2235
|
-
|
|
2236
|
-
|
|
2237
|
-
entityDoc.VectorDatabaseID = this.SelectedVectorDBID || this.vectorDatabases[0].ID;
|
|
2238
|
-
entityDoc.AIModelID = this.SelectedEmbeddingModelID || this.findEmbeddingModel().ID;
|
|
2239
|
-
}
|
|
2238
|
+
// An explicitly chosen index fixes the DB + model. "Auto (create/find matching index)" resolves
|
|
2239
|
+
// (or creates) the index for the chosen DB + model, so the syncer always has a VectorIndexID:
|
|
2240
|
+
// it refuses to run without one, which made the Auto choice a dead end before.
|
|
2241
|
+
const chosen = this.SelectedVectorIndexID
|
|
2242
|
+
? this.AvailableVectorIndexes.find(i => UUIDsEqual(i.ID, this.SelectedVectorIndexID))
|
|
2243
|
+
: undefined;
|
|
2244
|
+
if (chosen) {
|
|
2245
|
+
entityDoc.VectorDatabaseID = chosen.VectorDatabaseID;
|
|
2246
|
+
entityDoc.AIModelID = chosen.EmbeddingModelID;
|
|
2247
|
+
entityDoc.VectorIndexID = chosen.ID;
|
|
2240
2248
|
}
|
|
2241
2249
|
else {
|
|
2242
|
-
|
|
2243
|
-
|
|
2250
|
+
const vectorDatabaseID = this.SelectedVectorDBID || this.vectorDatabases[0].ID;
|
|
2251
|
+
const aiModelID = this.SelectedEmbeddingModelID || this.findEmbeddingModel().ID;
|
|
2252
|
+
entityDoc.VectorDatabaseID = vectorDatabaseID;
|
|
2253
|
+
entityDoc.AIModelID = aiModelID;
|
|
2254
|
+
entityDoc.VectorIndexID = await this.resolveOrCreateVectorIndex(vectorDatabaseID, aiModelID, this.SuggestEntityName);
|
|
2244
2255
|
}
|
|
2245
2256
|
// TemplateID — create a Template record with the generated template content
|
|
2246
2257
|
await this.createTemplateForDocument(entityDoc);
|
|
2247
2258
|
}
|
|
2259
|
+
/**
|
|
2260
|
+
* "Auto (create/find matching index)": reuse the index already built for this vector database +
|
|
2261
|
+
* embedding model, or create the `MJ: Vector Indexes` record for one. Only the metadata row is
|
|
2262
|
+
* written here and the save returns as soon as it is stored; the server-side entity hook then
|
|
2263
|
+
* provisions the index in the provider (bounded by its own timeout) and writes the provider
|
|
2264
|
+
* metadata back, so this request is never held while the provider works.
|
|
2265
|
+
* Returns the index ID to store on the document.
|
|
2266
|
+
*/
|
|
2267
|
+
async resolveOrCreateVectorIndex(vectorDatabaseID, aiModelID, entityName) {
|
|
2268
|
+
const existing = FindMatchingVectorIndex(this.vectorIndexes, vectorDatabaseID, aiModelID);
|
|
2269
|
+
if (existing) {
|
|
2270
|
+
return existing.ID;
|
|
2271
|
+
}
|
|
2272
|
+
const md = this.ProviderToUse;
|
|
2273
|
+
const modelName = this.aiModels.find(m => UUIDsEqual(m.ID, aiModelID))?.Name ?? null;
|
|
2274
|
+
const index = await md.GetEntityObject('MJ: Vector Indexes');
|
|
2275
|
+
index.NewRecord();
|
|
2276
|
+
index.Name = BuildAutoVectorIndexName(entityName, modelName);
|
|
2277
|
+
index.VectorDatabaseID = vectorDatabaseID;
|
|
2278
|
+
index.EmbeddingModelID = aiModelID;
|
|
2279
|
+
index.Description = `Auto-created for the "${entityName}" entity document (${modelName ?? 'embedding model'})`;
|
|
2280
|
+
const saved = await index.Save();
|
|
2281
|
+
if (!saved) {
|
|
2282
|
+
throw new Error(`Could not create a vector index for "${entityName}": ${index.LatestResult?.CompleteMessage || 'unknown error'}`);
|
|
2283
|
+
}
|
|
2284
|
+
this.vectorIndexes.push(index);
|
|
2285
|
+
this.AvailableVectorIndexes.push({
|
|
2286
|
+
ID: index.ID,
|
|
2287
|
+
Name: index.Name,
|
|
2288
|
+
VectorDatabaseID: index.VectorDatabaseID,
|
|
2289
|
+
EmbeddingModelID: index.EmbeddingModelID,
|
|
2290
|
+
});
|
|
2291
|
+
return index.ID;
|
|
2292
|
+
}
|
|
2248
2293
|
/** Create a Template + TemplateContent record for the entity document */
|
|
2249
2294
|
async createTemplateForDocument(entityDoc) {
|
|
2250
2295
|
const md = this.ProviderToUse;
|
|
@@ -2471,7 +2516,7 @@ export { VectorManagementResourceComponent };
|
|
|
2471
2516
|
type: ViewChild,
|
|
2472
2517
|
args: ['entitySearchInput']
|
|
2473
2518
|
}] }); })();
|
|
2474
|
-
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(VectorManagementResourceComponent, { className: "VectorManagementResourceComponent", filePath: "src/AI/components/vectors/vector-management-resource.component.ts", lineNumber:
|
|
2519
|
+
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(VectorManagementResourceComponent, { className: "VectorManagementResourceComponent", filePath: "src/AI/components/vectors/vector-management-resource.component.ts", lineNumber: 80 }); })();
|
|
2475
2520
|
export function LoadVectorManagementResource() {
|
|
2476
2521
|
// Prevents tree-shaking
|
|
2477
2522
|
}
|