@memberjunction/ng-core-entity-forms 2.111.1 → 2.112.0
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/README.md +10 -10
- package/dist/lib/custom/AIAgents/FlowAgentType/flow-agent-diagram.component.d.ts.map +1 -1
- package/dist/lib/custom/AIAgents/FlowAgentType/flow-agent-diagram.component.js +45 -45
- package/dist/lib/custom/AIAgents/FlowAgentType/flow-agent-diagram.component.js.map +1 -1
- package/dist/lib/custom/AIAgents/FlowAgentType/flow-agent-form-section.component.d.ts.map +1 -1
- package/dist/lib/custom/AIAgents/FlowAgentType/flow-agent-form-section.component.js +6 -7
- package/dist/lib/custom/AIAgents/FlowAgentType/flow-agent-form-section.component.js.map +1 -1
- package/dist/lib/custom/AIAgents/FlowAgentType/mj-integrated-flow-editor.component.d.ts.map +1 -1
- package/dist/lib/custom/AIAgents/FlowAgentType/mj-integrated-flow-editor.component.js +17 -32
- package/dist/lib/custom/AIAgents/FlowAgentType/mj-integrated-flow-editor.component.js.map +1 -1
- package/dist/lib/custom/AIAgents/add-action-dialog.component.d.ts.map +1 -1
- package/dist/lib/custom/AIAgents/add-action-dialog.component.js +37 -36
- package/dist/lib/custom/AIAgents/add-action-dialog.component.js.map +1 -1
- package/dist/lib/custom/AIAgents/agent-advanced-settings-dialog.component.js +2 -2
- package/dist/lib/custom/AIAgents/agent-advanced-settings-dialog.component.js.map +1 -1
- package/dist/lib/custom/AIAgents/agent-permissions-dialog.component.d.ts +1 -1
- package/dist/lib/custom/AIAgents/agent-permissions-dialog.component.d.ts.map +1 -1
- package/dist/lib/custom/AIAgents/agent-permissions-dialog.component.js +18 -25
- package/dist/lib/custom/AIAgents/agent-permissions-dialog.component.js.map +1 -1
- package/dist/lib/custom/AIAgents/agent-prompt-advanced-settings-dialog.component.d.ts.map +1 -1
- package/dist/lib/custom/AIAgents/agent-prompt-advanced-settings-dialog.component.js +10 -11
- package/dist/lib/custom/AIAgents/agent-prompt-advanced-settings-dialog.component.js.map +1 -1
- package/dist/lib/custom/AIAgents/ai-agent-form.component.d.ts.map +1 -1
- package/dist/lib/custom/AIAgents/ai-agent-form.component.js +159 -147
- package/dist/lib/custom/AIAgents/ai-agent-form.component.js.map +1 -1
- package/dist/lib/custom/AIAgents/create-prompt-dialog.component.d.ts.map +1 -1
- package/dist/lib/custom/AIAgents/create-prompt-dialog.component.js +11 -10
- package/dist/lib/custom/AIAgents/create-prompt-dialog.component.js.map +1 -1
- package/dist/lib/custom/AIAgents/create-sub-agent-dialog.component.d.ts.map +1 -1
- package/dist/lib/custom/AIAgents/create-sub-agent-dialog.component.js +36 -32
- package/dist/lib/custom/AIAgents/create-sub-agent-dialog.component.js.map +1 -1
- package/dist/lib/custom/AIAgents/new-agent-dialog.component.js +5 -5
- package/dist/lib/custom/AIAgents/new-agent-dialog.component.js.map +1 -1
- package/dist/lib/custom/AIAgents/prompt-selector-dialog.component.d.ts.map +1 -1
- package/dist/lib/custom/AIAgents/prompt-selector-dialog.component.js +15 -13
- package/dist/lib/custom/AIAgents/prompt-selector-dialog.component.js.map +1 -1
- package/dist/lib/custom/AIAgents/sub-agent-advanced-settings-dialog.component.d.ts.map +1 -1
- package/dist/lib/custom/AIAgents/sub-agent-advanced-settings-dialog.component.js +13 -15
- package/dist/lib/custom/AIAgents/sub-agent-advanced-settings-dialog.component.js.map +1 -1
- package/dist/lib/custom/AIAgents/sub-agent-selector-dialog.component.d.ts.map +1 -1
- package/dist/lib/custom/AIAgents/sub-agent-selector-dialog.component.js +28 -23
- package/dist/lib/custom/AIAgents/sub-agent-selector-dialog.component.js.map +1 -1
- package/dist/lib/custom/AIPromptRuns/ai-prompt-run-form.component.d.ts.map +1 -1
- package/dist/lib/custom/AIPromptRuns/ai-prompt-run-form.component.js +15 -12
- package/dist/lib/custom/AIPromptRuns/ai-prompt-run-form.component.js.map +1 -1
- package/dist/lib/custom/AIPrompts/ai-prompt-form.component.d.ts.map +1 -1
- package/dist/lib/custom/AIPrompts/ai-prompt-form.component.js +105 -86
- package/dist/lib/custom/AIPrompts/ai-prompt-form.component.js.map +1 -1
- package/dist/lib/custom/AIPrompts/template-selector-dialog.component.d.ts.map +1 -1
- package/dist/lib/custom/AIPrompts/template-selector-dialog.component.js +13 -20
- package/dist/lib/custom/AIPrompts/template-selector-dialog.component.js.map +1 -1
- package/dist/lib/custom/Actions/action-execution-log-form.component.d.ts.map +1 -1
- package/dist/lib/custom/Actions/action-execution-log-form.component.js +4 -7
- package/dist/lib/custom/Actions/action-execution-log-form.component.js.map +1 -1
- package/dist/lib/custom/Actions/action-form.component.d.ts.map +1 -1
- package/dist/lib/custom/Actions/action-form.component.js +99 -80
- package/dist/lib/custom/Actions/action-form.component.js.map +1 -1
- package/dist/lib/custom/Actions/action-test-harness.component.d.ts.map +1 -1
- package/dist/lib/custom/Actions/action-test-harness.component.js +24 -17
- package/dist/lib/custom/Actions/action-test-harness.component.js.map +1 -1
- package/dist/lib/custom/Queries/query-category-dialog.component.d.ts.map +1 -1
- package/dist/lib/custom/Queries/query-category-dialog.component.js +8 -8
- package/dist/lib/custom/Queries/query-category-dialog.component.js.map +1 -1
- package/dist/lib/custom/Queries/query-form.component.d.ts +2 -2
- package/dist/lib/custom/Queries/query-form.component.d.ts.map +1 -1
- package/dist/lib/custom/Queries/query-form.component.js +32 -44
- package/dist/lib/custom/Queries/query-form.component.js.map +1 -1
- package/dist/lib/custom/Queries/query-run-dialog.component.d.ts.map +1 -1
- package/dist/lib/custom/Queries/query-run-dialog.component.js +24 -22
- package/dist/lib/custom/Queries/query-run-dialog.component.js.map +1 -1
- package/dist/lib/custom/Templates/template-param-dialog.component.d.ts.map +1 -1
- package/dist/lib/custom/Templates/template-param-dialog.component.js +15 -21
- package/dist/lib/custom/Templates/template-param-dialog.component.js.map +1 -1
- package/dist/lib/custom/Templates/template-params-grid.component.d.ts.map +1 -1
- package/dist/lib/custom/Templates/template-params-grid.component.js +29 -17
- package/dist/lib/custom/Templates/template-params-grid.component.js.map +1 -1
- package/dist/lib/custom/Templates/templates-form.component.d.ts.map +1 -1
- package/dist/lib/custom/Templates/templates-form.component.js +25 -26
- package/dist/lib/custom/Templates/templates-form.component.js.map +1 -1
- package/dist/lib/custom/ai-agent-run/ai-agent-run-analytics.component.d.ts.map +1 -1
- package/dist/lib/custom/ai-agent-run/ai-agent-run-analytics.component.js +335 -274
- package/dist/lib/custom/ai-agent-run/ai-agent-run-analytics.component.js.map +1 -1
- package/dist/lib/custom/ai-agent-run/ai-agent-run-cost.service.d.ts.map +1 -1
- package/dist/lib/custom/ai-agent-run/ai-agent-run-cost.service.js +8 -8
- package/dist/lib/custom/ai-agent-run/ai-agent-run-cost.service.js.map +1 -1
- package/dist/lib/custom/ai-agent-run/ai-agent-run-data.service.d.ts.map +1 -1
- package/dist/lib/custom/ai-agent-run/ai-agent-run-data.service.js +24 -28
- package/dist/lib/custom/ai-agent-run/ai-agent-run-data.service.js.map +1 -1
- package/dist/lib/custom/ai-agent-run/ai-agent-run-timeline.component.d.ts.map +1 -1
- package/dist/lib/custom/ai-agent-run/ai-agent-run-timeline.component.js +25 -30
- package/dist/lib/custom/ai-agent-run/ai-agent-run-timeline.component.js.map +1 -1
- package/dist/lib/custom/ai-agent-run/ai-agent-run.component.d.ts.map +1 -1
- package/dist/lib/custom/ai-agent-run/ai-agent-run.component.js +20 -21
- package/dist/lib/custom/ai-agent-run/ai-agent-run.component.js.map +1 -1
- package/dist/lib/custom/shared/entity-selector-dialog.component.d.ts.map +1 -1
- package/dist/lib/custom/shared/entity-selector-dialog.component.js +6 -7
- package/dist/lib/custom/shared/entity-selector-dialog.component.js.map +1 -1
- package/dist/lib/generated/Entities/AIAgent/sections/aiagent-form-overview.component.d.ts.map +1 -1
- package/dist/lib/generated/Entities/AIAgent/sections/aiagent-form-overview.component.js +47 -33
- package/dist/lib/generated/Entities/AIAgent/sections/aiagent-form-overview.component.js.map +1 -1
- package/dist/lib/shared/components/template-editor.component.d.ts.map +1 -1
- package/dist/lib/shared/components/template-editor.component.js +26 -27
- package/dist/lib/shared/components/template-editor.component.js.map +1 -1
- package/package.json +16 -17
|
@@ -8,7 +8,7 @@ import { Component, ViewChild } from '@angular/core';
|
|
|
8
8
|
import { RegisterClass } from '@memberjunction/global';
|
|
9
9
|
import { BaseFormComponent } from '@memberjunction/ng-base-forms';
|
|
10
10
|
import { SharedService } from '@memberjunction/ng-shared';
|
|
11
|
-
import { Metadata, RunView, CompositeKey } from '@memberjunction/
|
|
11
|
+
import { Metadata, RunView, CompositeKey } from '@memberjunction/global';
|
|
12
12
|
import { MJNotificationService } from '@memberjunction/ng-notifications';
|
|
13
13
|
import { AIPromptFormComponent } from '../../generated/Entities/AIPrompt/aiprompt.form.component';
|
|
14
14
|
import { AIEngineBase } from '@memberjunction/ai-engine-base';
|
|
@@ -1578,7 +1578,7 @@ function AIPromptFormComponentExtended_Conditional_3_Template(rf, ctx) { if (rf
|
|
|
1578
1578
|
let AIPromptFormComponentExtended = class AIPromptFormComponentExtended extends AIPromptFormComponent {
|
|
1579
1579
|
// Main AI Prompt permissions inherited from BaseFormComponent:
|
|
1580
1580
|
// - UserCanEdit (Update permission)
|
|
1581
|
-
// - UserCanRead (Read permission)
|
|
1581
|
+
// - UserCanRead (Read permission)
|
|
1582
1582
|
// - UserCanCreate (Create permission)
|
|
1583
1583
|
// - UserCanDelete (Delete permission)
|
|
1584
1584
|
/** Check if user can create Templates */
|
|
@@ -1629,7 +1629,7 @@ let AIPromptFormComponentExtended = class AIPromptFormComponentExtended extends
|
|
|
1629
1629
|
return this._permissionCache.get(cacheKey);
|
|
1630
1630
|
}
|
|
1631
1631
|
try {
|
|
1632
|
-
const entityInfo = this._metadata.Entities.find(e => e.Name === entityName);
|
|
1632
|
+
const entityInfo = this._metadata.Entities.find((e) => e.Name === entityName);
|
|
1633
1633
|
if (!entityInfo) {
|
|
1634
1634
|
console.warn(`Entity '${entityName}' not found for permission check`);
|
|
1635
1635
|
this._permissionCache.set(cacheKey, false);
|
|
@@ -1671,7 +1671,7 @@ let AIPromptFormComponentExtended = class AIPromptFormComponentExtended extends
|
|
|
1671
1671
|
return {
|
|
1672
1672
|
allowEdit: this.EditMode && this.UserCanUpdateTemplateContents,
|
|
1673
1673
|
showRunButton: false,
|
|
1674
|
-
compactMode: false
|
|
1674
|
+
compactMode: false,
|
|
1675
1675
|
};
|
|
1676
1676
|
}
|
|
1677
1677
|
constructor(elementRef, sharedService, router, route, cdr, testHarnessService, viewContainerRef, promptManagementService) {
|
|
@@ -1725,7 +1725,8 @@ let AIPromptFormComponentExtended = class AIPromptFormComponentExtended extends
|
|
|
1725
1725
|
// make sure AI Engine Base is configured, this will load stuff only if not already
|
|
1726
1726
|
// loaded in the current process space
|
|
1727
1727
|
await AIEngineBase.Instance.Config(false, this._metadata.CurrentUser);
|
|
1728
|
-
this.__InferenceProvider_VendorTypeDefinitionID =
|
|
1728
|
+
this.__InferenceProvider_VendorTypeDefinitionID =
|
|
1729
|
+
AIEngineBase.Instance.VendorTypeDefinitions.find((vtd) => vtd.Name.trim().toLowerCase() === 'inference provider')?.ID || '';
|
|
1729
1730
|
if (!this.__InferenceProvider_VendorTypeDefinitionID) {
|
|
1730
1731
|
console.error('Inference Provider Vendor Type Definition ID not found');
|
|
1731
1732
|
MJNotificationService.Instance.CreateSimpleNotification('Inference Provider Vendor Type Definition not found', 'error', 5000);
|
|
@@ -1747,7 +1748,7 @@ let AIPromptFormComponentExtended = class AIPromptFormComponentExtended extends
|
|
|
1747
1748
|
this.loadAvailablePromptTypes(),
|
|
1748
1749
|
this.loadAvailableConfigurations(),
|
|
1749
1750
|
this.loadPromptModels(),
|
|
1750
|
-
this.loadResultSelectorTreeData()
|
|
1751
|
+
this.loadResultSelectorTreeData(),
|
|
1751
1752
|
]);
|
|
1752
1753
|
// Load execution history if record is saved
|
|
1753
1754
|
if (this.record?.IsSaved) {
|
|
@@ -1775,8 +1776,7 @@ let AIPromptFormComponentExtended = class AIPromptFormComponentExtended extends
|
|
|
1775
1776
|
return;
|
|
1776
1777
|
}
|
|
1777
1778
|
// First check if we already have this template in pending records (newly created)
|
|
1778
|
-
const pendingTemplate = this.PendingRecords.find(p => p.entityObject.EntityInfo.Name === 'Templates' &&
|
|
1779
|
-
p.entityObject.Get('ID') === this.record.TemplateID);
|
|
1779
|
+
const pendingTemplate = this.PendingRecords.find((p) => p.entityObject.EntityInfo.Name === 'Templates' && p.entityObject.Get('ID') === this.record.TemplateID);
|
|
1780
1780
|
if (pendingTemplate) {
|
|
1781
1781
|
// Use the pending template
|
|
1782
1782
|
this.template = pendingTemplate.entityObject;
|
|
@@ -1799,10 +1799,7 @@ let AIPromptFormComponentExtended = class AIPromptFormComponentExtended extends
|
|
|
1799
1799
|
}
|
|
1800
1800
|
else {
|
|
1801
1801
|
// Load template content and parameters
|
|
1802
|
-
await Promise.all([
|
|
1803
|
-
this.loadTemplateContent(),
|
|
1804
|
-
this.loadTemplateParams()
|
|
1805
|
-
]);
|
|
1802
|
+
await Promise.all([this.loadTemplateContent(), this.loadTemplateParams()]);
|
|
1806
1803
|
}
|
|
1807
1804
|
}
|
|
1808
1805
|
catch (error) {
|
|
@@ -1833,14 +1830,16 @@ let AIPromptFormComponentExtended = class AIPromptFormComponentExtended extends
|
|
|
1833
1830
|
*/
|
|
1834
1831
|
async linkExistingTemplate() {
|
|
1835
1832
|
try {
|
|
1836
|
-
this.promptManagementService
|
|
1833
|
+
this.promptManagementService
|
|
1834
|
+
.openTemplateSelectorDialog({
|
|
1837
1835
|
title: 'Link Existing Template',
|
|
1838
1836
|
multiSelect: false,
|
|
1839
1837
|
showCreateNew: true,
|
|
1840
1838
|
showActiveOnly: true,
|
|
1841
1839
|
selectedTemplateIds: this.record.TemplateID ? [this.record.TemplateID] : [],
|
|
1842
|
-
viewContainerRef: this.viewContainerRef
|
|
1843
|
-
})
|
|
1840
|
+
viewContainerRef: this.viewContainerRef,
|
|
1841
|
+
})
|
|
1842
|
+
.subscribe({
|
|
1844
1843
|
next: async (result) => {
|
|
1845
1844
|
if (result && result.selectedTemplates.length > 0) {
|
|
1846
1845
|
const selectedTemplate = result.selectedTemplates[0];
|
|
@@ -1863,7 +1862,7 @@ let AIPromptFormComponentExtended = class AIPromptFormComponentExtended extends
|
|
|
1863
1862
|
error: (error) => {
|
|
1864
1863
|
console.error('Error opening template selector:', error);
|
|
1865
1864
|
MJNotificationService.Instance.CreateSimpleNotification('Error opening template selector. Please try again.', 'error', 3000);
|
|
1866
|
-
}
|
|
1865
|
+
},
|
|
1867
1866
|
});
|
|
1868
1867
|
}
|
|
1869
1868
|
catch (error) {
|
|
@@ -1889,7 +1888,7 @@ let AIPromptFormComponentExtended = class AIPromptFormComponentExtended extends
|
|
|
1889
1888
|
// First, clean up any pending changes related to the old template
|
|
1890
1889
|
this.cleanupOldTemplateRecords();
|
|
1891
1890
|
const newTemplate = await this._metadata.GetEntityObject('Templates');
|
|
1892
|
-
console.log(
|
|
1891
|
+
console.log('Record Name:', this.record.Name);
|
|
1893
1892
|
newTemplate.NewRecord();
|
|
1894
1893
|
newTemplate.Name = `${this.record.Name || 'AI Prompt'} Template`;
|
|
1895
1894
|
newTemplate.Description = `Template for AI Prompt: ${this.record.Name}`;
|
|
@@ -1897,7 +1896,7 @@ let AIPromptFormComponentExtended = class AIPromptFormComponentExtended extends
|
|
|
1897
1896
|
// Add to pending records instead of saving immediately
|
|
1898
1897
|
this.PendingRecords.push({
|
|
1899
1898
|
entityObject: newTemplate,
|
|
1900
|
-
action: 'save'
|
|
1899
|
+
action: 'save',
|
|
1901
1900
|
});
|
|
1902
1901
|
// Update the AI prompt to reference the new template
|
|
1903
1902
|
this.record.TemplateID = newTemplate.ID;
|
|
@@ -1950,7 +1949,7 @@ let AIPromptFormComponentExtended = class AIPromptFormComponentExtended extends
|
|
|
1950
1949
|
EntityName: 'Template Contents',
|
|
1951
1950
|
ExtraFilter: `TemplateID = '${this.template.ID}'`,
|
|
1952
1951
|
OrderBy: 'Priority ASC',
|
|
1953
|
-
ResultType: 'entity_object'
|
|
1952
|
+
ResultType: 'entity_object',
|
|
1954
1953
|
});
|
|
1955
1954
|
// Get the first content (highest priority)
|
|
1956
1955
|
this.templateContent = results.Results?.[0] || null;
|
|
@@ -1974,7 +1973,7 @@ let AIPromptFormComponentExtended = class AIPromptFormComponentExtended extends
|
|
|
1974
1973
|
const results = await rv.RunView({
|
|
1975
1974
|
EntityName: 'Template Params',
|
|
1976
1975
|
ExtraFilter: `TemplateID = '${this.template.ID}'`,
|
|
1977
|
-
OrderBy: 'Name ASC'
|
|
1976
|
+
OrderBy: 'Name ASC',
|
|
1978
1977
|
});
|
|
1979
1978
|
this.templateParams = results.Results || [];
|
|
1980
1979
|
}
|
|
@@ -2021,7 +2020,7 @@ let AIPromptFormComponentExtended = class AIPromptFormComponentExtended extends
|
|
|
2021
2020
|
error: (error) => {
|
|
2022
2021
|
console.error('Test harness error:', error);
|
|
2023
2022
|
MJNotificationService.Instance.CreateSimpleNotification('Test failed: ' + error.message, 'error', 5000);
|
|
2024
|
-
}
|
|
2023
|
+
},
|
|
2025
2024
|
});
|
|
2026
2025
|
}
|
|
2027
2026
|
/**
|
|
@@ -2050,7 +2049,7 @@ let AIPromptFormComponentExtended = class AIPromptFormComponentExtended extends
|
|
|
2050
2049
|
// If it's saved, add to pending deletions
|
|
2051
2050
|
this.PendingRecords.push({
|
|
2052
2051
|
entityObject: templateContent,
|
|
2053
|
-
action: 'delete'
|
|
2052
|
+
action: 'delete',
|
|
2054
2053
|
});
|
|
2055
2054
|
}
|
|
2056
2055
|
else {
|
|
@@ -2059,8 +2058,7 @@ let AIPromptFormComponentExtended = class AIPromptFormComponentExtended extends
|
|
|
2059
2058
|
for (let i = currentPendingRecords.length - 1; i >= 0; i--) {
|
|
2060
2059
|
const record = currentPendingRecords[i];
|
|
2061
2060
|
if (record.entityObject === templateContent ||
|
|
2062
|
-
(record.entityObject.EntityInfo.Name === 'Template Contents' &&
|
|
2063
|
-
record.entityObject.Get('ID') === templateContent.Get('ID'))) {
|
|
2061
|
+
(record.entityObject.EntityInfo.Name === 'Template Contents' && record.entityObject.Get('ID') === templateContent.Get('ID'))) {
|
|
2064
2062
|
currentPendingRecords.splice(i, 1);
|
|
2065
2063
|
break;
|
|
2066
2064
|
}
|
|
@@ -2077,7 +2075,7 @@ let AIPromptFormComponentExtended = class AIPromptFormComponentExtended extends
|
|
|
2077
2075
|
// Add to pending saves
|
|
2078
2076
|
this.PendingRecords.push({
|
|
2079
2077
|
entityObject: templateContent,
|
|
2080
|
-
action: 'save'
|
|
2078
|
+
action: 'save',
|
|
2081
2079
|
});
|
|
2082
2080
|
}
|
|
2083
2081
|
this.hasUnsavedChanges = true;
|
|
@@ -2116,11 +2114,16 @@ let AIPromptFormComponentExtended = class AIPromptFormComponentExtended extends
|
|
|
2116
2114
|
*/
|
|
2117
2115
|
getParallelizationModeDisplay() {
|
|
2118
2116
|
switch (this.record?.ParallelizationMode) {
|
|
2119
|
-
case 'None':
|
|
2120
|
-
|
|
2121
|
-
case '
|
|
2122
|
-
|
|
2123
|
-
|
|
2117
|
+
case 'None':
|
|
2118
|
+
return 'None';
|
|
2119
|
+
case 'StaticCount':
|
|
2120
|
+
return `Static count (${this.record.ParallelCount || 1})`;
|
|
2121
|
+
case 'ConfigParam':
|
|
2122
|
+
return `Config parameter (${this.record.ParallelConfigParam || 'not set'})`;
|
|
2123
|
+
case 'ModelSpecific':
|
|
2124
|
+
return 'Model-specific configuration';
|
|
2125
|
+
default:
|
|
2126
|
+
return 'Unknown';
|
|
2124
2127
|
}
|
|
2125
2128
|
}
|
|
2126
2129
|
/**
|
|
@@ -2141,9 +2144,12 @@ let AIPromptFormComponentExtended = class AIPromptFormComponentExtended extends
|
|
|
2141
2144
|
*/
|
|
2142
2145
|
getValidationColor() {
|
|
2143
2146
|
switch (this.record?.ValidationBehavior) {
|
|
2144
|
-
case 'Strict':
|
|
2145
|
-
|
|
2146
|
-
|
|
2147
|
+
case 'Strict':
|
|
2148
|
+
return '#dc3545'; // red
|
|
2149
|
+
case 'Warn':
|
|
2150
|
+
return '#ffc107'; // yellow
|
|
2151
|
+
default:
|
|
2152
|
+
return '#6c757d'; // default gray
|
|
2147
2153
|
}
|
|
2148
2154
|
}
|
|
2149
2155
|
/**
|
|
@@ -2168,20 +2174,21 @@ let AIPromptFormComponentExtended = class AIPromptFormComponentExtended extends
|
|
|
2168
2174
|
* Checks if the AI prompt can be executed
|
|
2169
2175
|
*/
|
|
2170
2176
|
get canExecute() {
|
|
2171
|
-
return !!(this.record?.ID &&
|
|
2172
|
-
this.record.Status === 'Active' &&
|
|
2173
|
-
this.record.TemplateID &&
|
|
2174
|
-
this.template);
|
|
2177
|
+
return !!(this.record?.ID && this.record.Status === 'Active' && this.record.TemplateID && this.template);
|
|
2175
2178
|
}
|
|
2176
2179
|
/**
|
|
2177
2180
|
* Gets status badge color
|
|
2178
2181
|
*/
|
|
2179
2182
|
getStatusBadgeColor() {
|
|
2180
2183
|
switch (this.record?.Status) {
|
|
2181
|
-
case 'Active':
|
|
2182
|
-
|
|
2183
|
-
case '
|
|
2184
|
-
|
|
2184
|
+
case 'Active':
|
|
2185
|
+
return '#28a745';
|
|
2186
|
+
case 'Pending':
|
|
2187
|
+
return '#ffc107';
|
|
2188
|
+
case 'Disabled':
|
|
2189
|
+
return '#6c757d';
|
|
2190
|
+
default:
|
|
2191
|
+
return '#6c757d';
|
|
2185
2192
|
}
|
|
2186
2193
|
}
|
|
2187
2194
|
/**
|
|
@@ -2267,9 +2274,9 @@ let AIPromptFormComponentExtended = class AIPromptFormComponentExtended extends
|
|
|
2267
2274
|
// Load model vendors for this model, filtering by TypeID for inference providers only
|
|
2268
2275
|
const engine = AIEngineBase.Instance;
|
|
2269
2276
|
await engine.Config(false);
|
|
2270
|
-
const modelVendors = engine.ModelVendors.filter(mv => mv.ModelID === modelId && mv.TypeID === this.__InferenceProvider_VendorTypeDefinitionID);
|
|
2277
|
+
const modelVendors = engine.ModelVendors.filter((mv) => mv.ModelID === modelId && mv.TypeID === this.__InferenceProvider_VendorTypeDefinitionID);
|
|
2271
2278
|
// filter vendors to just the vendors in the modelVendors array in VendorID
|
|
2272
|
-
const vendors = engine.Vendors.filter(v => modelVendors.some(mv => mv.VendorID === v.ID));
|
|
2279
|
+
const vendors = engine.Vendors.filter((v) => modelVendors.some((mv) => mv.VendorID === v.ID));
|
|
2273
2280
|
const result = { vendors, modelVendors };
|
|
2274
2281
|
this.modelVendorsMap.set(modelId, result);
|
|
2275
2282
|
return result;
|
|
@@ -2293,7 +2300,7 @@ let AIPromptFormComponentExtended = class AIPromptFormComponentExtended extends
|
|
|
2293
2300
|
const modelVendorData = this.modelVendorsMap.get(modelId);
|
|
2294
2301
|
if (!modelVendorData)
|
|
2295
2302
|
return 'Unknown';
|
|
2296
|
-
const modelVendor = modelVendorData.modelVendors.find(mv => mv.VendorID === vendorId);
|
|
2303
|
+
const modelVendor = modelVendorData.modelVendors.find((mv) => mv.VendorID === vendorId);
|
|
2297
2304
|
return modelVendor?.Status || 'Unknown';
|
|
2298
2305
|
}
|
|
2299
2306
|
/**
|
|
@@ -2302,10 +2309,14 @@ let AIPromptFormComponentExtended = class AIPromptFormComponentExtended extends
|
|
|
2302
2309
|
getVendorStatusColor(modelId, vendorId) {
|
|
2303
2310
|
const status = this.getModelVendorStatus(modelId, vendorId);
|
|
2304
2311
|
switch (status) {
|
|
2305
|
-
case 'Active':
|
|
2306
|
-
|
|
2307
|
-
case '
|
|
2308
|
-
|
|
2312
|
+
case 'Active':
|
|
2313
|
+
return '#28a745'; // green
|
|
2314
|
+
case 'Inactive':
|
|
2315
|
+
return '#dc3545'; // red
|
|
2316
|
+
case 'Pending':
|
|
2317
|
+
return '#ffc107'; // yellow
|
|
2318
|
+
default:
|
|
2319
|
+
return '#6c757d'; // gray
|
|
2309
2320
|
}
|
|
2310
2321
|
}
|
|
2311
2322
|
/**
|
|
@@ -2369,16 +2380,14 @@ let AIPromptFormComponentExtended = class AIPromptFormComponentExtended extends
|
|
|
2369
2380
|
try {
|
|
2370
2381
|
const engine = AIEngineBase.Instance;
|
|
2371
2382
|
await engine.Config(false);
|
|
2372
|
-
this.promptModels = engine.PromptModels.filter(pm => pm.PromptID === this.record.ID);
|
|
2383
|
+
this.promptModels = engine.PromptModels.filter((pm) => pm.PromptID === this.record.ID);
|
|
2373
2384
|
this.promptModels.sort((a, b) => {
|
|
2374
2385
|
// first sort on priority (descending), then by created date (ascending)
|
|
2375
2386
|
return b.Priority - a.Priority || new Date(a.__mj_CreatedAt).getTime() - new Date(b.__mj_CreatedAt).getTime();
|
|
2376
2387
|
});
|
|
2377
2388
|
// Load vendors for existing models
|
|
2378
|
-
const modelIds = this.promptModels
|
|
2379
|
-
|
|
2380
|
-
.filter(id => id); // Filter out null/undefined
|
|
2381
|
-
await Promise.all(modelIds.map(modelId => this.loadVendorsForModel(modelId)));
|
|
2389
|
+
const modelIds = this.promptModels.map((pm) => pm.ModelID).filter((id) => id); // Filter out null/undefined
|
|
2390
|
+
await Promise.all(modelIds.map((modelId) => this.loadVendorsForModel(modelId)));
|
|
2382
2391
|
}
|
|
2383
2392
|
catch (error) {
|
|
2384
2393
|
console.error('Error loading prompt models:', error);
|
|
@@ -2428,7 +2437,7 @@ let AIPromptFormComponentExtended = class AIPromptFormComponentExtended extends
|
|
|
2428
2437
|
if (model.IsSaved) {
|
|
2429
2438
|
this.PendingRecords.push({
|
|
2430
2439
|
entityObject: model,
|
|
2431
|
-
action: 'delete'
|
|
2440
|
+
action: 'delete',
|
|
2432
2441
|
});
|
|
2433
2442
|
}
|
|
2434
2443
|
// Remove from local array
|
|
@@ -2451,7 +2460,7 @@ let AIPromptFormComponentExtended = class AIPromptFormComponentExtended extends
|
|
|
2451
2460
|
getModelDisplayName(modelId) {
|
|
2452
2461
|
if (!modelId)
|
|
2453
2462
|
return '';
|
|
2454
|
-
const model = this.availableModels.find(m => m.ID === modelId);
|
|
2463
|
+
const model = this.availableModels.find((m) => m.ID === modelId);
|
|
2455
2464
|
return model ? model.Name : modelId;
|
|
2456
2465
|
}
|
|
2457
2466
|
/**
|
|
@@ -2460,7 +2469,7 @@ let AIPromptFormComponentExtended = class AIPromptFormComponentExtended extends
|
|
|
2460
2469
|
getVendorDisplayName(vendorId) {
|
|
2461
2470
|
if (!vendorId)
|
|
2462
2471
|
return '';
|
|
2463
|
-
const vendor = this.availableVendors.find(v => v.ID === vendorId);
|
|
2472
|
+
const vendor = this.availableVendors.find((v) => v.ID === vendorId);
|
|
2464
2473
|
return vendor ? vendor.Name : vendorId;
|
|
2465
2474
|
}
|
|
2466
2475
|
/**
|
|
@@ -2469,7 +2478,7 @@ let AIPromptFormComponentExtended = class AIPromptFormComponentExtended extends
|
|
|
2469
2478
|
getPromptTypeDisplayName(typeId) {
|
|
2470
2479
|
if (!typeId)
|
|
2471
2480
|
return '';
|
|
2472
|
-
const type = this.availablePromptTypes.find(t => t.ID === typeId);
|
|
2481
|
+
const type = this.availablePromptTypes.find((t) => t.ID === typeId);
|
|
2473
2482
|
return type ? type.Name : typeId;
|
|
2474
2483
|
}
|
|
2475
2484
|
/**
|
|
@@ -2478,7 +2487,7 @@ let AIPromptFormComponentExtended = class AIPromptFormComponentExtended extends
|
|
|
2478
2487
|
getConfigurationDisplayName(configurationId) {
|
|
2479
2488
|
if (!configurationId)
|
|
2480
2489
|
return 'Default';
|
|
2481
|
-
const config = this.availableConfigurations.find(c => c.ID === configurationId);
|
|
2490
|
+
const config = this.availableConfigurations.find((c) => c.ID === configurationId);
|
|
2482
2491
|
return config ? config.Name : configurationId;
|
|
2483
2492
|
}
|
|
2484
2493
|
/**
|
|
@@ -2543,7 +2552,7 @@ let AIPromptFormComponentExtended = class AIPromptFormComponentExtended extends
|
|
|
2543
2552
|
}
|
|
2544
2553
|
this.PendingRecords.push({
|
|
2545
2554
|
entityObject: model,
|
|
2546
|
-
action: 'save'
|
|
2555
|
+
action: 'save',
|
|
2547
2556
|
});
|
|
2548
2557
|
}
|
|
2549
2558
|
}
|
|
@@ -2560,7 +2569,7 @@ let AIPromptFormComponentExtended = class AIPromptFormComponentExtended extends
|
|
|
2560
2569
|
const md = new Metadata();
|
|
2561
2570
|
const transactionGroup = await md.CreateTransactionGroup();
|
|
2562
2571
|
// First, save any templates that need to be saved (they must be saved before AI Prompts)
|
|
2563
|
-
const templateRecords = this.PendingRecords.filter(p => p.entityObject.EntityInfo.Name === 'Templates');
|
|
2572
|
+
const templateRecords = this.PendingRecords.filter((p) => p.entityObject.EntityInfo.Name === 'Templates');
|
|
2564
2573
|
for (const templateRecord of templateRecords) {
|
|
2565
2574
|
templateRecord.entityObject.TransactionGroup = transactionGroup;
|
|
2566
2575
|
if (templateRecord.action === 'save') {
|
|
@@ -2582,7 +2591,7 @@ let AIPromptFormComponentExtended = class AIPromptFormComponentExtended extends
|
|
|
2582
2591
|
return false;
|
|
2583
2592
|
}
|
|
2584
2593
|
// Then save all other pending records (excluding templates which we already saved)
|
|
2585
|
-
const otherRecords = this.PendingRecords.filter(p => p.entityObject.EntityInfo.Name !== 'Templates');
|
|
2594
|
+
const otherRecords = this.PendingRecords.filter((p) => p.entityObject.EntityInfo.Name !== 'Templates');
|
|
2586
2595
|
for (const record of otherRecords) {
|
|
2587
2596
|
record.entityObject.TransactionGroup = transactionGroup;
|
|
2588
2597
|
if (record.action === 'save') {
|
|
@@ -2627,7 +2636,7 @@ let AIPromptFormComponentExtended = class AIPromptFormComponentExtended extends
|
|
|
2627
2636
|
const engine = AIEngineBase.Instance;
|
|
2628
2637
|
await engine.Config(false);
|
|
2629
2638
|
const categories = engine.PromptCategories;
|
|
2630
|
-
const prompts = engine.Prompts.filter(p => p.Status === 'Active');
|
|
2639
|
+
const prompts = engine.Prompts.filter((p) => p.Status === 'Active');
|
|
2631
2640
|
categories.sort((a, b) => a.Name.localeCompare(b.Name));
|
|
2632
2641
|
prompts.sort((a, b) => a.Name.localeCompare(b.Name));
|
|
2633
2642
|
// Build tree structure
|
|
@@ -2652,11 +2661,11 @@ let AIPromptFormComponentExtended = class AIPromptFormComponentExtended extends
|
|
|
2652
2661
|
value: null,
|
|
2653
2662
|
hasChildren: false,
|
|
2654
2663
|
isCategory: false,
|
|
2655
|
-
isClearOption: true
|
|
2664
|
+
isClearOption: true,
|
|
2656
2665
|
});
|
|
2657
2666
|
// Create category nodes
|
|
2658
2667
|
const categoryMap = new Map();
|
|
2659
|
-
categories.forEach(category => {
|
|
2668
|
+
categories.forEach((category) => {
|
|
2660
2669
|
const node = {
|
|
2661
2670
|
text: category.Name,
|
|
2662
2671
|
value: null, // Categories don't have values
|
|
@@ -2664,7 +2673,7 @@ let AIPromptFormComponentExtended = class AIPromptFormComponentExtended extends
|
|
|
2664
2673
|
hasChildren: true,
|
|
2665
2674
|
items: [],
|
|
2666
2675
|
isCategory: true,
|
|
2667
|
-
categoryId: category.ID
|
|
2676
|
+
categoryId: category.ID,
|
|
2668
2677
|
};
|
|
2669
2678
|
categoryMap.set(category.ID, node);
|
|
2670
2679
|
// Handle parent-child relationships
|
|
@@ -2684,13 +2693,13 @@ let AIPromptFormComponentExtended = class AIPromptFormComponentExtended extends
|
|
|
2684
2693
|
// Collect uncategorized prompts
|
|
2685
2694
|
const uncategorizedPrompts = [];
|
|
2686
2695
|
// Add prompts to their categories
|
|
2687
|
-
prompts.forEach(prompt => {
|
|
2696
|
+
prompts.forEach((prompt) => {
|
|
2688
2697
|
const promptNode = {
|
|
2689
2698
|
text: prompt.Name,
|
|
2690
2699
|
value: prompt.ID,
|
|
2691
2700
|
hasChildren: false,
|
|
2692
2701
|
isCategory: false,
|
|
2693
|
-
promptId: prompt.ID
|
|
2702
|
+
promptId: prompt.ID,
|
|
2694
2703
|
};
|
|
2695
2704
|
if (prompt.CategoryID) {
|
|
2696
2705
|
const categoryNode = categoryMap.get(prompt.CategoryID);
|
|
@@ -2716,7 +2725,7 @@ let AIPromptFormComponentExtended = class AIPromptFormComponentExtended extends
|
|
|
2716
2725
|
hasChildren: true,
|
|
2717
2726
|
items: uncategorizedPrompts,
|
|
2718
2727
|
isCategory: true,
|
|
2719
|
-
categoryId: 'uncategorized'
|
|
2728
|
+
categoryId: 'uncategorized',
|
|
2720
2729
|
});
|
|
2721
2730
|
}
|
|
2722
2731
|
return tree;
|
|
@@ -2756,8 +2765,7 @@ let AIPromptFormComponentExtended = class AIPromptFormComponentExtended extends
|
|
|
2756
2765
|
// Create new array to ensure Angular detects the change
|
|
2757
2766
|
const newModels = [...this.promptModels];
|
|
2758
2767
|
// Swap with previous item
|
|
2759
|
-
[newModels[index - 1], newModels[index]] =
|
|
2760
|
-
[newModels[index], newModels[index - 1]];
|
|
2768
|
+
[newModels[index - 1], newModels[index]] = [newModels[index], newModels[index - 1]];
|
|
2761
2769
|
// Replace the array and force full re-render
|
|
2762
2770
|
this.promptModels = [...newModels];
|
|
2763
2771
|
this.hasUnsavedChanges = true;
|
|
@@ -2778,8 +2786,7 @@ let AIPromptFormComponentExtended = class AIPromptFormComponentExtended extends
|
|
|
2778
2786
|
// Create new array to ensure Angular detects the change
|
|
2779
2787
|
const newModels = [...this.promptModels];
|
|
2780
2788
|
// Swap with next item
|
|
2781
|
-
[newModels[index], newModels[index + 1]] =
|
|
2782
|
-
[newModels[index + 1], newModels[index]];
|
|
2789
|
+
[newModels[index], newModels[index + 1]] = [newModels[index + 1], newModels[index]];
|
|
2783
2790
|
// Replace the array and force full re-render
|
|
2784
2791
|
this.promptModels = [...newModels];
|
|
2785
2792
|
this.hasUnsavedChanges = true;
|
|
@@ -2867,7 +2874,7 @@ let AIPromptFormComponentExtended = class AIPromptFormComponentExtended extends
|
|
|
2867
2874
|
const result = await rv.RunView({
|
|
2868
2875
|
EntityName: 'MJ: AI Prompt Runs',
|
|
2869
2876
|
ExtraFilter: `PromptID='${this.record.ID}'`,
|
|
2870
|
-
OrderBy: 'RunAt DESC'
|
|
2877
|
+
OrderBy: 'RunAt DESC',
|
|
2871
2878
|
});
|
|
2872
2879
|
this.executionHistory = result.Results;
|
|
2873
2880
|
this.sortExecutionHistory();
|
|
@@ -2994,12 +3001,18 @@ let AIPromptFormComponentExtended = class AIPromptFormComponentExtended extends
|
|
|
2994
3001
|
*/
|
|
2995
3002
|
getParamTypeIcon(type) {
|
|
2996
3003
|
switch (type) {
|
|
2997
|
-
case 'Scalar':
|
|
2998
|
-
|
|
2999
|
-
case '
|
|
3000
|
-
|
|
3001
|
-
case '
|
|
3002
|
-
|
|
3004
|
+
case 'Scalar':
|
|
3005
|
+
return 'fa-font';
|
|
3006
|
+
case 'Array':
|
|
3007
|
+
return 'fa-list';
|
|
3008
|
+
case 'Object':
|
|
3009
|
+
return 'fa-cube';
|
|
3010
|
+
case 'Record':
|
|
3011
|
+
return 'fa-file-alt';
|
|
3012
|
+
case 'Entity':
|
|
3013
|
+
return 'fa-table';
|
|
3014
|
+
default:
|
|
3015
|
+
return 'fa-question';
|
|
3003
3016
|
}
|
|
3004
3017
|
}
|
|
3005
3018
|
/**
|
|
@@ -3007,12 +3020,18 @@ let AIPromptFormComponentExtended = class AIPromptFormComponentExtended extends
|
|
|
3007
3020
|
*/
|
|
3008
3021
|
getParamTypeColor(type) {
|
|
3009
3022
|
switch (type) {
|
|
3010
|
-
case 'Scalar':
|
|
3011
|
-
|
|
3012
|
-
case '
|
|
3013
|
-
|
|
3014
|
-
case '
|
|
3015
|
-
|
|
3023
|
+
case 'Scalar':
|
|
3024
|
+
return '#17a2b8';
|
|
3025
|
+
case 'Array':
|
|
3026
|
+
return '#28a745';
|
|
3027
|
+
case 'Object':
|
|
3028
|
+
return '#6f42c1';
|
|
3029
|
+
case 'Record':
|
|
3030
|
+
return '#fd7e14';
|
|
3031
|
+
case 'Entity':
|
|
3032
|
+
return '#dc3545';
|
|
3033
|
+
default:
|
|
3034
|
+
return '#6c757d';
|
|
3016
3035
|
}
|
|
3017
3036
|
}
|
|
3018
3037
|
/**
|
|
@@ -3069,7 +3088,7 @@ export { AIPromptFormComponentExtended };
|
|
|
3069
3088
|
type: ViewChild,
|
|
3070
3089
|
args: ['templateEditor']
|
|
3071
3090
|
}] }); })();
|
|
3072
|
-
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(AIPromptFormComponentExtended, { className: "AIPromptFormComponentExtended", filePath: "src/lib/custom/AIPrompts/ai-prompt-form.component.ts", lineNumber:
|
|
3091
|
+
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(AIPromptFormComponentExtended, { className: "AIPromptFormComponentExtended", filePath: "src/lib/custom/AIPrompts/ai-prompt-form.component.ts", lineNumber: 34 }); })();
|
|
3073
3092
|
export function LoadAIPromptFormComponentExtended() {
|
|
3074
3093
|
// This function ensures the class isn't tree-shaken and registers it with MemberJunction
|
|
3075
3094
|
}
|