@memberjunction/ng-core-entity-forms 5.21.0 → 5.23.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/dist/lib/custom/AIAgents/add-action-dialog.component.d.ts +4 -5
- package/dist/lib/custom/AIAgents/add-action-dialog.component.d.ts.map +1 -1
- package/dist/lib/custom/AIAgents/add-action-dialog.component.js +55 -59
- package/dist/lib/custom/AIAgents/add-action-dialog.component.js.map +1 -1
- package/dist/lib/custom/AIAgents/agent-advanced-settings-dialog.component.js +0 -1
- package/dist/lib/custom/AIAgents/agent-advanced-settings-dialog.component.js.map +1 -1
- package/dist/lib/custom/AIAgents/agent-prompt-advanced-settings-dialog.component.d.ts +4 -5
- 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 +54 -71
- 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 +1053 -1096
- package/dist/lib/custom/AIAgents/ai-agent-form.component.js.map +1 -1
- package/dist/lib/custom/AIAgents/ai-agent-management.service.d.ts +2 -3
- package/dist/lib/custom/AIAgents/ai-agent-management.service.d.ts.map +1 -1
- package/dist/lib/custom/AIAgents/ai-agent-management.service.js +39 -82
- package/dist/lib/custom/AIAgents/ai-agent-management.service.js.map +1 -1
- package/dist/lib/custom/AIAgents/create-prompt-dialog.component.d.ts +4 -5
- package/dist/lib/custom/AIAgents/create-prompt-dialog.component.d.ts.map +1 -1
- package/dist/lib/custom/AIAgents/create-prompt-dialog.component.js +28 -31
- 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 +4 -5
- 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 +15 -14
- package/dist/lib/custom/AIAgents/create-sub-agent-dialog.component.js.map +1 -1
- package/dist/lib/custom/AIAgents/new-agent-dialog.component.d.ts +4 -7
- package/dist/lib/custom/AIAgents/new-agent-dialog.component.d.ts.map +1 -1
- package/dist/lib/custom/AIAgents/new-agent-dialog.component.js +77 -124
- package/dist/lib/custom/AIAgents/new-agent-dialog.component.js.map +1 -1
- package/dist/lib/custom/AIAgents/new-agent-dialog.service.d.ts +2 -2
- package/dist/lib/custom/AIAgents/new-agent-dialog.service.d.ts.map +1 -1
- package/dist/lib/custom/AIAgents/new-agent-dialog.service.js +10 -11
- package/dist/lib/custom/AIAgents/new-agent-dialog.service.js.map +1 -1
- package/dist/lib/custom/AIAgents/prompt-selector-dialog.component.d.ts +4 -5
- package/dist/lib/custom/AIAgents/prompt-selector-dialog.component.d.ts.map +1 -1
- package/dist/lib/custom/AIAgents/prompt-selector-dialog.component.js +18 -18
- 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 +4 -5
- 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 +59 -80
- 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 +4 -5
- 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 +23 -24
- 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 +862 -906
- package/dist/lib/custom/AIPromptRuns/ai-prompt-run-form.component.js.map +1 -1
- package/dist/lib/custom/AIPromptRuns/chat-message-viewer.component.js +4 -5
- package/dist/lib/custom/AIPromptRuns/chat-message-viewer.component.js.map +1 -1
- package/dist/lib/custom/AIPrompts/ai-prompt-form.component.js +448 -499
- package/dist/lib/custom/AIPrompts/ai-prompt-form.component.js.map +1 -1
- package/dist/lib/custom/AIPrompts/ai-prompt-management.service.d.ts +2 -2
- package/dist/lib/custom/AIPrompts/ai-prompt-management.service.d.ts.map +1 -1
- package/dist/lib/custom/AIPrompts/ai-prompt-management.service.js +6 -11
- package/dist/lib/custom/AIPrompts/ai-prompt-management.service.js.map +1 -1
- package/dist/lib/custom/AIPrompts/template-selector-dialog.component.d.ts +4 -5
- package/dist/lib/custom/AIPrompts/template-selector-dialog.component.d.ts.map +1 -1
- package/dist/lib/custom/AIPrompts/template-selector-dialog.component.js +16 -15
- package/dist/lib/custom/AIPrompts/template-selector-dialog.component.js.map +1 -1
- package/dist/lib/custom/Actions/action-execution-log-form.component.js +160 -166
- 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 +93 -94
- package/dist/lib/custom/Actions/action-form.component.js.map +1 -1
- package/dist/lib/custom/Entities/entity-form.component.js +2 -2
- package/dist/lib/custom/Lists/list-form.component.js +61 -63
- package/dist/lib/custom/Lists/list-form.component.js.map +1 -1
- package/dist/lib/custom/Queries/query-category-dialog.component.js +33 -59
- package/dist/lib/custom/Queries/query-category-dialog.component.js.map +1 -1
- package/dist/lib/custom/Queries/query-form.component.js +354 -360
- package/dist/lib/custom/Queries/query-form.component.js.map +1 -1
- package/dist/lib/custom/Queries/query-run-dialog.component.js +62 -71
- package/dist/lib/custom/Queries/query-run-dialog.component.js.map +1 -1
- package/dist/lib/custom/Templates/template-param-dialog.component.js +128 -124
- package/dist/lib/custom/Templates/template-param-dialog.component.js.map +1 -1
- package/dist/lib/custom/Templates/template-params-grid.component.d.ts +45 -22
- package/dist/lib/custom/Templates/template-params-grid.component.d.ts.map +1 -1
- package/dist/lib/custom/Templates/template-params-grid.component.js +380 -384
- package/dist/lib/custom/Templates/template-params-grid.component.js.map +1 -1
- package/dist/lib/custom/Templates/templates-form.component.js +34 -36
- package/dist/lib/custom/Templates/templates-form.component.js.map +1 -1
- package/dist/lib/custom/Tests/test-form.component.js +9 -10
- package/dist/lib/custom/Tests/test-form.component.js.map +1 -1
- package/dist/lib/custom/Tests/test-run-feedback-form.component.js +4 -4
- package/dist/lib/custom/Tests/test-run-feedback-form.component.js.map +1 -1
- package/dist/lib/custom/Tests/test-run-form.component.js +8 -8
- package/dist/lib/custom/Tests/test-run-form.component.js.map +1 -1
- package/dist/lib/custom/Tests/test-suite-form.component.js +7 -8
- package/dist/lib/custom/Tests/test-suite-form.component.js.map +1 -1
- package/dist/lib/custom/Tests/test-suite-run-form.component.js +7 -8
- package/dist/lib/custom/Tests/test-suite-run-form.component.js.map +1 -1
- package/dist/lib/custom/ai-agent-run/ai-agent-run-analytics.component.js +381 -409
- 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-data.service.d.ts.map +1 -1
- package/dist/lib/custom/ai-agent-run/ai-agent-run-data.service.js +1 -1
- 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 +74 -63
- 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-visualization.component.js +10 -10
- package/dist/lib/custom/ai-agent-run/ai-agent-run-visualization.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 +352 -332
- package/dist/lib/custom/ai-agent-run/ai-agent-run.component.js.map +1 -1
- package/dist/lib/custom/custom-forms.module.d.ts +22 -27
- package/dist/lib/custom/custom-forms.module.d.ts.map +1 -1
- package/dist/lib/custom/custom-forms.module.js +51 -81
- package/dist/lib/custom/custom-forms.module.js.map +1 -1
- package/dist/lib/custom/shared/entity-selector-dialog.component.d.ts +4 -5
- package/dist/lib/custom/shared/entity-selector-dialog.component.d.ts.map +1 -1
- package/dist/lib/custom/shared/entity-selector-dialog.component.js +59 -66
- package/dist/lib/custom/shared/entity-selector-dialog.component.js.map +1 -1
- package/dist/lib/generated/Entities/MJAIAgent/mjaiagent.form.component.d.ts.map +1 -1
- package/dist/lib/generated/Entities/MJAIAgent/mjaiagent.form.component.js +176 -156
- package/dist/lib/generated/Entities/MJAIAgent/mjaiagent.form.component.js.map +1 -1
- package/dist/lib/generated/Entities/MJAIAgentClientTool/mjaiagentclienttool.form.component.d.ts +10 -0
- package/dist/lib/generated/Entities/MJAIAgentClientTool/mjaiagentclienttool.form.component.d.ts.map +1 -0
- package/dist/lib/generated/Entities/MJAIAgentClientTool/mjaiagentclienttool.form.component.js +65 -0
- package/dist/lib/generated/Entities/MJAIAgentClientTool/mjaiagentclienttool.form.component.js.map +1 -0
- package/dist/lib/generated/Entities/MJAIClientToolDefinition/mjaiclienttooldefinition.form.component.d.ts +10 -0
- package/dist/lib/generated/Entities/MJAIClientToolDefinition/mjaiclienttooldefinition.form.component.d.ts.map +1 -0
- package/dist/lib/generated/Entities/MJAIClientToolDefinition/mjaiclienttooldefinition.form.component.js +89 -0
- package/dist/lib/generated/Entities/MJAIClientToolDefinition/mjaiclienttooldefinition.form.component.js.map +1 -0
- package/dist/lib/generated/Entities/MJAIModel/mjaimodel.form.component.d.ts.map +1 -1
- package/dist/lib/generated/Entities/MJAIModel/mjaimodel.form.component.js +80 -44
- package/dist/lib/generated/Entities/MJAIModel/mjaimodel.form.component.js.map +1 -1
- package/dist/lib/generated/Entities/MJContentItemTag/mjcontentitemtag.form.component.js +11 -8
- package/dist/lib/generated/Entities/MJContentItemTag/mjcontentitemtag.form.component.js.map +1 -1
- package/dist/lib/generated/Entities/MJContentSource/mjcontentsource.form.component.d.ts.map +1 -1
- package/dist/lib/generated/Entities/MJContentSource/mjcontentsource.form.component.js +39 -24
- package/dist/lib/generated/Entities/MJContentSource/mjcontentsource.form.component.js.map +1 -1
- package/dist/lib/generated/Entities/MJContentType/mjcontenttype.form.component.d.ts.map +1 -1
- package/dist/lib/generated/Entities/MJContentType/mjcontenttype.form.component.js +35 -17
- package/dist/lib/generated/Entities/MJContentType/mjcontenttype.form.component.js.map +1 -1
- package/dist/lib/generated/Entities/MJDuplicateRunDetail/mjduplicaterundetail.form.component.js +15 -13
- package/dist/lib/generated/Entities/MJDuplicateRunDetail/mjduplicaterundetail.form.component.js.map +1 -1
- package/dist/lib/generated/Entities/MJDuplicateRunDetailMatch/mjduplicaterundetailmatch.form.component.d.ts.map +1 -1
- package/dist/lib/generated/Entities/MJDuplicateRunDetailMatch/mjduplicaterundetailmatch.form.component.js +7 -9
- package/dist/lib/generated/Entities/MJDuplicateRunDetailMatch/mjduplicaterundetailmatch.form.component.js.map +1 -1
- package/dist/lib/generated/Entities/MJEntityDocument/mjentitydocument.form.component.js +28 -24
- package/dist/lib/generated/Entities/MJEntityDocument/mjentitydocument.form.component.js.map +1 -1
- package/dist/lib/generated/Entities/MJEntityField/mjentityfield.form.component.d.ts.map +1 -1
- package/dist/lib/generated/Entities/MJEntityField/mjentityfield.form.component.js +21 -9
- package/dist/lib/generated/Entities/MJEntityField/mjentityfield.form.component.js.map +1 -1
- package/dist/lib/generated/Entities/MJVectorDatabase/mjvectordatabase.form.component.js +19 -17
- package/dist/lib/generated/Entities/MJVectorDatabase/mjvectordatabase.form.component.js.map +1 -1
- package/dist/lib/generated/Entities/MJVectorIndex/mjvectorindex.form.component.d.ts.map +1 -1
- package/dist/lib/generated/Entities/MJVectorIndex/mjvectorindex.form.component.js +82 -14
- package/dist/lib/generated/Entities/MJVectorIndex/mjvectorindex.form.component.js.map +1 -1
- package/dist/lib/generated/generated-forms.module.d.ts +280 -279
- package/dist/lib/generated/generated-forms.module.d.ts.map +1 -1
- package/dist/lib/generated/generated-forms.module.js +102 -142
- package/dist/lib/generated/generated-forms.module.js.map +1 -1
- package/dist/lib/shared/components/template-editor.component.js +14 -15
- package/dist/lib/shared/components/template-editor.component.js.map +1 -1
- package/package.json +34 -41
|
@@ -1,17 +1,14 @@
|
|
|
1
|
-
import { Component, ViewChild } from '@angular/core';
|
|
1
|
+
import { Component, ViewChild, Output, EventEmitter } from '@angular/core';
|
|
2
2
|
import { FormControl, FormGroup, Validators } from '@angular/forms';
|
|
3
3
|
import { Subject, BehaviorSubject, takeUntil } from 'rxjs';
|
|
4
4
|
import { Metadata, RunView } from '@memberjunction/core';
|
|
5
5
|
import { MJNotificationService } from '@memberjunction/ng-notifications';
|
|
6
6
|
import * as i0 from "@angular/core";
|
|
7
|
-
import * as i1 from "
|
|
8
|
-
import * as i2 from "
|
|
9
|
-
import * as i3 from "@
|
|
10
|
-
import * as i4 from "
|
|
11
|
-
import * as i5 from "@
|
|
12
|
-
import * as i6 from "@progress/kendo-angular-buttons";
|
|
13
|
-
import * as i7 from "../../shared/components/template-editor.component";
|
|
14
|
-
import * as i8 from "@angular/common";
|
|
7
|
+
import * as i1 from "../AIPrompts/ai-prompt-management.service";
|
|
8
|
+
import * as i2 from "@angular/forms";
|
|
9
|
+
import * as i3 from "@memberjunction/ng-ui-components";
|
|
10
|
+
import * as i4 from "../../shared/components/template-editor.component";
|
|
11
|
+
import * as i5 from "@angular/common";
|
|
15
12
|
const _c0 = ["templateEditor"];
|
|
16
13
|
const _c1 = () => ["Pending", "Active", "Disabled"];
|
|
17
14
|
const _c2 = () => ["string", "object"];
|
|
@@ -105,14 +102,14 @@ function CreatePromptDialogComponent_Conditional_3_Template(rf, ctx) { if (rf &
|
|
|
105
102
|
i0.ɵɵelement(8, "i", 18);
|
|
106
103
|
i0.ɵɵtext(9, " Name ");
|
|
107
104
|
i0.ɵɵelementEnd();
|
|
108
|
-
i0.ɵɵelement(10, "
|
|
105
|
+
i0.ɵɵelement(10, "input", 19);
|
|
109
106
|
i0.ɵɵconditionalCreate(11, CreatePromptDialogComponent_Conditional_3_Conditional_11_Template, 3, 0, "div", 20);
|
|
110
107
|
i0.ɵɵelementEnd();
|
|
111
108
|
i0.ɵɵelementStart(12, "div", 16)(13, "label", 21);
|
|
112
109
|
i0.ɵɵelement(14, "i", 22);
|
|
113
110
|
i0.ɵɵtext(15, " Type ");
|
|
114
111
|
i0.ɵɵelementEnd();
|
|
115
|
-
i0.ɵɵelement(16, "
|
|
112
|
+
i0.ɵɵelement(16, "mj-dropdown", 23);
|
|
116
113
|
i0.ɵɵpipe(17, "async");
|
|
117
114
|
i0.ɵɵconditionalCreate(18, CreatePromptDialogComponent_Conditional_3_Conditional_18_Template, 3, 0, "div", 20);
|
|
118
115
|
i0.ɵɵelementEnd();
|
|
@@ -120,19 +117,19 @@ function CreatePromptDialogComponent_Conditional_3_Template(rf, ctx) { if (rf &
|
|
|
120
117
|
i0.ɵɵelement(21, "i", 25);
|
|
121
118
|
i0.ɵɵtext(22, " Status ");
|
|
122
119
|
i0.ɵɵelementEnd();
|
|
123
|
-
i0.ɵɵelement(23, "
|
|
120
|
+
i0.ɵɵelement(23, "mj-dropdown", 26);
|
|
124
121
|
i0.ɵɵelementEnd();
|
|
125
122
|
i0.ɵɵelementStart(24, "div", 16)(25, "label", 27);
|
|
126
123
|
i0.ɵɵelement(26, "i", 28);
|
|
127
124
|
i0.ɵɵtext(27, " Output Type ");
|
|
128
125
|
i0.ɵɵelementEnd();
|
|
129
|
-
i0.ɵɵelement(28, "
|
|
126
|
+
i0.ɵɵelement(28, "mj-dropdown", 29);
|
|
130
127
|
i0.ɵɵelementEnd()();
|
|
131
128
|
i0.ɵɵelementStart(29, "div", 30)(30, "label", 31);
|
|
132
129
|
i0.ɵɵelement(31, "i", 32);
|
|
133
130
|
i0.ɵɵtext(32, " Description ");
|
|
134
131
|
i0.ɵɵelementEnd();
|
|
135
|
-
i0.ɵɵelement(33, "
|
|
132
|
+
i0.ɵɵelement(33, "textarea", 33);
|
|
136
133
|
i0.ɵɵelementEnd()();
|
|
137
134
|
i0.ɵɵelementStart(34, "div", 13)(35, "h4", 14);
|
|
138
135
|
i0.ɵɵelement(36, "i", 34);
|
|
@@ -165,16 +162,14 @@ function CreatePromptDialogComponent_Conditional_3_Template(rf, ctx) { if (rf &
|
|
|
165
162
|
i0.ɵɵadvance(11);
|
|
166
163
|
i0.ɵɵconditional(((tmp_2_0 = ctx_r1.promptForm.get("name")) == null ? null : tmp_2_0.invalid) && ((tmp_2_0 = ctx_r1.promptForm.get("name")) == null ? null : tmp_2_0.touched) ? 11 : -1);
|
|
167
164
|
i0.ɵɵadvance(5);
|
|
168
|
-
i0.ɵɵproperty("
|
|
165
|
+
i0.ɵɵproperty("Data", i0.ɵɵpipeBind1(17, 11, ctx_r1.availablePromptTypes$))("ValuePrimitive", true);
|
|
169
166
|
i0.ɵɵadvance(2);
|
|
170
167
|
i0.ɵɵconditional(((tmp_5_0 = ctx_r1.promptForm.get("typeID")) == null ? null : tmp_5_0.invalid) && ((tmp_5_0 = ctx_r1.promptForm.get("typeID")) == null ? null : tmp_5_0.touched) ? 18 : -1);
|
|
171
168
|
i0.ɵɵadvance(5);
|
|
172
|
-
i0.ɵɵproperty("
|
|
169
|
+
i0.ɵɵproperty("Data", i0.ɵɵpureFunction0(13, _c1))("ValuePrimitive", true);
|
|
173
170
|
i0.ɵɵadvance(5);
|
|
174
|
-
i0.ɵɵproperty("
|
|
175
|
-
i0.ɵɵadvance(
|
|
176
|
-
i0.ɵɵproperty("rows", 3);
|
|
177
|
-
i0.ɵɵadvance(20);
|
|
171
|
+
i0.ɵɵproperty("Data", i0.ɵɵpureFunction0(14, _c2))("ValuePrimitive", true);
|
|
172
|
+
i0.ɵɵadvance(25);
|
|
178
173
|
i0.ɵɵconditional(ctx_r1.showTemplateEditor && ctx_r1.templateEntity && ctx_r1.templateMode === "new" ? 53 : -1);
|
|
179
174
|
i0.ɵɵadvance();
|
|
180
175
|
i0.ɵɵconditional(ctx_r1.templateEntity && ctx_r1.templateMode === "existing" ? 54 : -1);
|
|
@@ -199,8 +194,7 @@ function CreatePromptDialogComponent_Conditional_18_Template(rf, ctx) { if (rf &
|
|
|
199
194
|
* This ensures atomicity with the parent form's save operation.
|
|
200
195
|
*/
|
|
201
196
|
export class CreatePromptDialogComponent {
|
|
202
|
-
constructor(
|
|
203
|
-
this.dialogRef = dialogRef;
|
|
197
|
+
constructor(cdr, aiPromptManagementService) {
|
|
204
198
|
this.cdr = cdr;
|
|
205
199
|
this.aiPromptManagementService = aiPromptManagementService;
|
|
206
200
|
// Configuration
|
|
@@ -224,6 +218,7 @@ export class CreatePromptDialogComponent {
|
|
|
224
218
|
};
|
|
225
219
|
// Template state
|
|
226
220
|
this.templateMode = 'new';
|
|
221
|
+
this.DialogClose = new EventEmitter();
|
|
227
222
|
this.promptForm = this.createForm();
|
|
228
223
|
}
|
|
229
224
|
ngOnInit() {
|
|
@@ -358,7 +353,7 @@ export class CreatePromptDialogComponent {
|
|
|
358
353
|
templateContents: this.templateContents.length > 0 ? this.templateContents : undefined
|
|
359
354
|
};
|
|
360
355
|
this.result.next(result);
|
|
361
|
-
this.
|
|
356
|
+
this.DialogClose.emit();
|
|
362
357
|
}
|
|
363
358
|
catch (error) {
|
|
364
359
|
console.error('Error preparing prompt for creation:', error);
|
|
@@ -370,7 +365,7 @@ export class CreatePromptDialogComponent {
|
|
|
370
365
|
}
|
|
371
366
|
cancel() {
|
|
372
367
|
this.result.next(null);
|
|
373
|
-
this.
|
|
368
|
+
this.DialogClose.emit();
|
|
374
369
|
}
|
|
375
370
|
/**
|
|
376
371
|
* Opens the template selector dialog to link an existing template
|
|
@@ -412,17 +407,17 @@ export class CreatePromptDialogComponent {
|
|
|
412
407
|
get currentTemplate() {
|
|
413
408
|
return this.templateEntity;
|
|
414
409
|
}
|
|
415
|
-
static { this.ɵfac = function CreatePromptDialogComponent_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || CreatePromptDialogComponent)(i0.ɵɵdirectiveInject(
|
|
410
|
+
static { this.ɵfac = function CreatePromptDialogComponent_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || CreatePromptDialogComponent)(i0.ɵɵdirectiveInject(i0.ChangeDetectorRef), i0.ɵɵdirectiveInject(i1.AIPromptManagementService)); }; }
|
|
416
411
|
static { this.ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: CreatePromptDialogComponent, selectors: [["mj-create-prompt-dialog"]], viewQuery: function CreatePromptDialogComponent_Query(rf, ctx) { if (rf & 1) {
|
|
417
412
|
i0.ɵɵviewQuery(_c0, 5);
|
|
418
413
|
} if (rf & 2) {
|
|
419
414
|
let _t;
|
|
420
415
|
i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.templateEditor = _t.first);
|
|
421
|
-
} }, standalone: false, decls: 19, vars: 13, consts: [["templateEditor", ""], [1, "create-prompt-dialog"], [1, "loading-state"], [1, "dialog-content", 3, "formGroup"], [1, "dialog-footer"], [1, "footer-left"], [1, "form-hint"], [1, "fa-solid", "fa-info-circle"], [1, "footer-right"], ["
|
|
416
|
+
} }, outputs: { DialogClose: "DialogClose" }, standalone: false, decls: 19, vars: 13, consts: [["templateEditor", ""], [1, "create-prompt-dialog"], [1, "loading-state"], [1, "dialog-content", 3, "formGroup"], [1, "dialog-footer"], [1, "footer-left"], [1, "form-hint"], [1, "fa-solid", "fa-info-circle"], [1, "footer-right"], ["mjButton", "", "variant", "flat", 3, "click", "disabled"], ["mjButton", "", "variant", "primary", 3, "click", "disabled"], [1, "loading-spinner"], [1, "fa-solid", "fa-spinner", "fa-spin", "fa-2x"], [1, "form-section"], [1, "section-title"], [1, "form-grid"], [1, "form-field"], ["for", "promptName", 1, "field-label", "required"], [1, "fa-solid", "fa-tag"], ["id", "promptName", "formControlName", "name", "placeholder", "Enter prompt name...", 1, "mj-input", "full-width"], [1, "field-error"], ["for", "promptType", 1, "field-label", "required"], [1, "fa-solid", "fa-category"], ["id", "promptType", "formControlName", "typeID", "TextField", "Name", "ValueField", "ID", "Placeholder", "Select prompt type...", 1, "full-width", 3, "Data", "ValuePrimitive"], ["for", "promptStatus", 1, "field-label"], [1, "fa-solid", "fa-toggle-on"], ["id", "promptStatus", "formControlName", "status", 1, "full-width", 3, "Data", "ValuePrimitive"], ["for", "outputType", 1, "field-label"], [1, "fa-solid", "fa-file-code"], ["id", "outputType", "formControlName", "outputType", 1, "full-width", 3, "Data", "ValuePrimitive"], [1, "form-field", "full-width"], ["for", "promptDescription", 1, "field-label"], [1, "fa-solid", "fa-align-left"], ["id", "promptDescription", "formControlName", "description", "placeholder", "Enter prompt description (optional)...", "rows", "3", 1, "mj-textarea", "full-width"], [1, "fa-solid", "fa-file-alt"], [1, "template-mode-section"], [1, "field-label"], [1, "fa-solid", "fa-cog"], [1, "template-mode-options"], [1, "radio-option"], ["type", "radio", "id", "templateNew", "value", "new", "formControlName", "templateMode", 1, "radio-input"], ["for", "templateNew", 1, "radio-label"], [1, "fa-solid", "fa-plus-circle"], ["type", "radio", "id", "templateExisting", "value", "existing", "formControlName", "templateMode", 1, "radio-input"], ["for", "templateExisting", 1, "radio-label"], [1, "fa-solid", "fa-link"], [1, "template-editor-section"], [1, "existing-template-section"], [1, "fa-solid", "fa-exclamation-triangle"], [1, "template-info"], [1, "template-name"], [1, "template-description"], [1, "template-editor-container"], [3, "contentChange", "template", "config"], [1, "existing-template-info"], [1, "template-header"], [1, "template-type-badge"], [1, "template-actions"], ["mjButton", "", "variant", "flat", 3, "click"], [1, "fa-solid", "fa-sync"], [1, "fa-solid", "fa-spinner", "fa-spin"], [1, "fa-solid", "fa-plus"]], template: function CreatePromptDialogComponent_Template(rf, ctx) { if (rf & 1) {
|
|
422
417
|
i0.ɵɵelementStart(0, "div", 1);
|
|
423
418
|
i0.ɵɵconditionalCreate(1, CreatePromptDialogComponent_Conditional_1_Template, 5, 0, "div", 2);
|
|
424
419
|
i0.ɵɵpipe(2, "async");
|
|
425
|
-
i0.ɵɵconditionalBranchCreate(3, CreatePromptDialogComponent_Conditional_3_Template, 55,
|
|
420
|
+
i0.ɵɵconditionalBranchCreate(3, CreatePromptDialogComponent_Conditional_3_Template, 55, 15, "form", 3);
|
|
426
421
|
i0.ɵɵelementEnd();
|
|
427
422
|
i0.ɵɵelementStart(4, "div", 4)(5, "div", 5)(6, "span", 6);
|
|
428
423
|
i0.ɵɵelement(7, "i", 7);
|
|
@@ -451,14 +446,16 @@ export class CreatePromptDialogComponent {
|
|
|
451
446
|
i0.ɵɵproperty("disabled", !ctx.promptForm.valid || (i0.ɵɵpipeBind1(15, 9, ctx.isSaving$) || false));
|
|
452
447
|
i0.ɵɵadvance(2);
|
|
453
448
|
i0.ɵɵconditional(i0.ɵɵpipeBind1(17, 11, ctx.isSaving$) ? 16 : 18);
|
|
454
|
-
} }, dependencies: [
|
|
449
|
+
} }, dependencies: [i2.ɵNgNoValidate, i2.DefaultValueAccessor, i2.RadioControlValueAccessor, i2.NgControlStatus, i2.NgControlStatusGroup, i2.FormGroupDirective, i2.FormControlName, i3.MJButtonDirective, i3.MJDropdownComponent, i4.TemplateEditorComponent, i5.AsyncPipe], styles: ["\n\n.create-prompt-dialog[_ngcontent-%COMP%] {\n padding: 0;\n min-height: 400px;\n display: flex;\n flex-direction: column;\n}\n\n\n\n[_nghost-%COMP%] .k-dialog, \n[_nghost-%COMP%] .k-window {\n z-index: 10000 !important;\n}\n\n[_nghost-%COMP%] .k-overlay {\n z-index: 9999 !important;\n}\n\n\n\n.loading-state[_ngcontent-%COMP%] {\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n padding: 60px 20px;\n text-align: center;\n}\n\n.loading-spinner[_ngcontent-%COMP%] {\n margin-bottom: 16px;\n color: var(--mj-brand-primary);\n}\n\n\n\n.dialog-content[_ngcontent-%COMP%] {\n flex: 1;\n padding: 20px;\n overflow-y: auto;\n max-height: 70vh;\n}\n\n\n\n.form-section[_ngcontent-%COMP%] {\n margin-bottom: 24px;\n border: 1px solid var(--mj-border-default);\n border-radius: 6px;\n padding: 16px;\n background: var(--mj-bg-surface-card);\n}\n\n.section-title[_ngcontent-%COMP%] {\n margin: 0 0 16px 0;\n font-size: 14px;\n font-weight: 600;\n color: var(--mj-text-primary);\n display: flex;\n align-items: center;\n gap: 8px;\n}\n\n.section-title[_ngcontent-%COMP%] i[_ngcontent-%COMP%] {\n color: var(--mj-brand-primary);\n}\n\n\n\n.form-grid[_ngcontent-%COMP%] {\n display: grid;\n grid-template-columns: 1fr 1fr;\n gap: 16px;\n margin-bottom: 16px;\n}\n\n.form-field[_ngcontent-%COMP%] {\n display: flex;\n flex-direction: column;\n gap: 6px;\n}\n\n.form-field.full-width[_ngcontent-%COMP%] {\n grid-column: 1 / -1;\n}\n\n\n\n.field-label[_ngcontent-%COMP%] {\n font-size: 13px;\n font-weight: 500;\n color: var(--mj-text-primary);\n display: flex;\n align-items: center;\n gap: 6px;\n}\n\n.field-label.required[_ngcontent-%COMP%]::after {\n content: '*';\n color: var(--mj-status-error);\n margin-left: 2px;\n}\n\n.field-label[_ngcontent-%COMP%] i[_ngcontent-%COMP%] {\n font-size: 11px;\n color: var(--mj-text-muted);\n}\n\n\n\n.full-width[_ngcontent-%COMP%] {\n width: 100%;\n}\n\n\n\n.field-error[_ngcontent-%COMP%] {\n display: flex;\n align-items: center;\n gap: 4px;\n font-size: 12px;\n color: var(--mj-status-error);\n margin-top: 4px;\n}\n\n.field-error[_ngcontent-%COMP%] i[_ngcontent-%COMP%] {\n font-size: 11px;\n}\n\n\n\n.template-mode-section[_ngcontent-%COMP%] {\n margin-bottom: 16px;\n}\n\n.template-mode-options[_ngcontent-%COMP%] {\n display: flex;\n gap: 16px;\n margin-top: 8px;\n flex-wrap: wrap;\n}\n\n.radio-option[_ngcontent-%COMP%] {\n display: flex;\n align-items: center;\n gap: 6px;\n}\n\n.radio-input[_ngcontent-%COMP%] {\n margin: 0;\n}\n\n.radio-label[_ngcontent-%COMP%] {\n font-size: 13px;\n cursor: pointer;\n display: flex;\n align-items: center;\n gap: 6px;\n padding: 4px 8px;\n border-radius: 4px;\n transition: background-color 0.2s ease;\n}\n\n.radio-label[_ngcontent-%COMP%]:hover {\n background-color: var(--mj-bg-surface-sunken);\n}\n\n.radio-label[_ngcontent-%COMP%] i[_ngcontent-%COMP%] {\n font-size: 12px;\n color: var(--mj-text-muted);\n}\n\n\n\n.template-editor-section[_ngcontent-%COMP%] {\n margin-top: 16px;\n padding: 16px;\n border: 1px solid var(--mj-border-default);\n border-radius: 4px;\n background: var(--mj-bg-surface);\n}\n\n.template-info[_ngcontent-%COMP%] {\n margin-bottom: 12px;\n}\n\n.template-name[_ngcontent-%COMP%] {\n margin: 0 0 4px 0;\n font-size: 14px;\n font-weight: 600;\n color: var(--mj-text-primary);\n display: flex;\n align-items: center;\n gap: 6px;\n}\n\n.template-description[_ngcontent-%COMP%] {\n margin: 0;\n font-size: 12px;\n color: var(--mj-text-muted);\n}\n\n.template-editor-container[_ngcontent-%COMP%] {\n border: 1px solid var(--mj-border-default);\n border-radius: 4px;\n overflow: hidden;\n min-height: 200px;\n}\n\n\n\n.existing-template-section[_ngcontent-%COMP%] {\n margin-top: 16px;\n padding: 16px;\n border: 1px solid var(--mj-border-default);\n border-radius: 4px;\n background: var(--mj-bg-surface);\n}\n\n.existing-template-info[_ngcontent-%COMP%] {\n display: flex;\n flex-direction: column;\n gap: 12px;\n}\n\n.template-header[_ngcontent-%COMP%] {\n display: flex;\n justify-content: space-between;\n align-items: center;\n gap: 12px;\n}\n\n.template-type-badge[_ngcontent-%COMP%] {\n display: inline-flex;\n align-items: center;\n gap: 4px;\n padding: 4px 8px;\n background-color: var(--mj-brand-primary);\n color: var(--mj-text-inverse);\n border-radius: 12px;\n font-size: 11px;\n font-weight: 500;\n}\n\n.template-actions[_ngcontent-%COMP%] {\n display: flex;\n gap: 8px;\n}\n\n\n\n.dialog-footer[_ngcontent-%COMP%] {\n display: flex;\n justify-content: space-between;\n align-items: center;\n padding: 16px 20px;\n border-top: 1px solid var(--mj-border-default);\n background: var(--mj-bg-surface-card);\n gap: 16px;\n}\n\n.footer-left[_ngcontent-%COMP%] {\n flex: 1;\n}\n\n.footer-right[_ngcontent-%COMP%] {\n display: flex;\n gap: 8px;\n}\n\n.form-hint[_ngcontent-%COMP%] {\n display: flex;\n align-items: center;\n gap: 6px;\n font-size: 12px;\n color: var(--mj-text-muted);\n}\n\n.form-hint[_ngcontent-%COMP%] i[_ngcontent-%COMP%] {\n color: var(--mj-brand-primary);\n}\n\n\n\n@media (max-width: 768px) {\n .form-grid[_ngcontent-%COMP%] {\n grid-template-columns: 1fr;\n }\n\n .template-mode-options[_ngcontent-%COMP%] {\n flex-direction: column;\n gap: 8px;\n }\n\n .dialog-footer[_ngcontent-%COMP%] {\n flex-direction: column;\n align-items: stretch;\n gap: 12px;\n }\n\n .footer-right[_ngcontent-%COMP%] {\n justify-content: stretch;\n }\n\n .footer-right[_ngcontent-%COMP%] button[_ngcontent-%COMP%] {\n flex: 1;\n }\n}\n\n\n\n[_nghost-%COMP%] .template-editor-container mj-template-editor {\n --template-editor-min-height: 200px;\n}\n\n[_nghost-%COMP%] .template-editor-container .template-editor-help {\n display: none; \n\n}"] }); }
|
|
455
450
|
}
|
|
456
451
|
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(CreatePromptDialogComponent, [{
|
|
457
452
|
type: Component,
|
|
458
|
-
args: [{ standalone: false, selector: 'mj-create-prompt-dialog', template: "<!-- Create Prompt Dialog -->\n<div class=\"create-prompt-dialog\">\n \n <!-- Loading State -->\n @if (isLoading$ | async) {\n <div class=\"loading-state\">\n <div class=\"loading-spinner\">\n <i class=\"fa-solid fa-spinner fa-spin fa-2x\"></i>\n </div>\n <p>Loading prompt creation form...</p>\n </div>\n } @else {\n \n <!-- Form Content -->\n <form [formGroup]=\"promptForm\" class=\"dialog-content\">\n \n <!-- Basic Prompt Information -->\n <div class=\"form-section\">\n <h4 class=\"section-title\">\n <i class=\"fa-solid fa-info-circle\"></i>\n Basic Information\n </h4>\n \n <div class=\"form-grid\">\n \n <!-- Name Field -->\n <div class=\"form-field\">\n <label for=\"promptName\" class=\"field-label required\">\n <i class=\"fa-solid fa-tag\"></i>\n Name\n </label>\n <kendo-textbox \n id=\"promptName\"\n formControlName=\"name\"\n placeholder=\"Enter prompt name...\"\n class=\"full-width\">\n </kendo-textbox>\n @if (promptForm.get('name')?.invalid && promptForm.get('name')?.touched) {\n <div class=\"field-error\">\n <i class=\"fa-solid fa-exclamation-triangle\"></i>\n Name is required\n </div>\n }\n </div>\n\n <!-- Type Field -->\n <div class=\"form-field\">\n <label for=\"promptType\" class=\"field-label required\">\n <i class=\"fa-solid fa-category\"></i>\n Type\n </label>\n <kendo-dropdownlist \n id=\"promptType\"\n formControlName=\"typeID\"\n [data]=\"availablePromptTypes$ | async\"\n textField=\"Name\"\n valueField=\"ID\"\n [valuePrimitive]=\"true\"\n placeholder=\"Select prompt type...\"\n class=\"full-width\">\n </kendo-dropdownlist>\n @if (promptForm.get('typeID')?.invalid && promptForm.get('typeID')?.touched) {\n <div class=\"field-error\">\n <i class=\"fa-solid fa-exclamation-triangle\"></i>\n Type is required\n </div>\n }\n </div>\n\n <!-- Status Field -->\n <div class=\"form-field\">\n <label for=\"promptStatus\" class=\"field-label\">\n <i class=\"fa-solid fa-toggle-on\"></i>\n Status\n </label>\n <kendo-dropdownlist \n id=\"promptStatus\"\n formControlName=\"status\"\n [data]=\"['Pending', 'Active', 'Disabled']\"\n [valuePrimitive]=\"true\"\n class=\"full-width\">\n </kendo-dropdownlist>\n </div>\n\n <!-- Output Type Field -->\n <div class=\"form-field\">\n <label for=\"outputType\" class=\"field-label\">\n <i class=\"fa-solid fa-file-code\"></i>\n Output Type\n </label>\n <kendo-dropdownlist \n id=\"outputType\"\n formControlName=\"outputType\"\n [data]=\"['string', 'object']\"\n [valuePrimitive]=\"true\"\n class=\"full-width\">\n </kendo-dropdownlist>\n </div>\n\n </div>\n\n <!-- Description Field -->\n <div class=\"form-field full-width\">\n <label for=\"promptDescription\" class=\"field-label\">\n <i class=\"fa-solid fa-align-left\"></i>\n Description\n </label>\n <kendo-textarea \n id=\"promptDescription\"\n formControlName=\"description\"\n placeholder=\"Enter prompt description (optional)...\"\n [rows]=\"3\"\n class=\"full-width\">\n </kendo-textarea>\n </div>\n\n </div>\n\n <!-- Template Configuration -->\n <div class=\"form-section\">\n <h4 class=\"section-title\">\n <i class=\"fa-solid fa-file-alt\"></i>\n Template Configuration\n </h4>\n \n <div class=\"template-mode-section\">\n <label class=\"field-label\">\n <i class=\"fa-solid fa-cog\"></i>\n Template Mode\n </label>\n \n <div class=\"template-mode-options\">\n <div class=\"radio-option\">\n <input type=\"radio\" \n id=\"templateNew\" \n value=\"new\" \n formControlName=\"templateMode\"\n class=\"radio-input\">\n <label for=\"templateNew\" class=\"radio-label\">\n <i class=\"fa-solid fa-plus-circle\"></i>\n Create New Template\n </label>\n </div>\n \n <div class=\"radio-option\">\n <input type=\"radio\" \n id=\"templateExisting\" \n value=\"existing\" \n formControlName=\"templateMode\"\n class=\"radio-input\">\n <label for=\"templateExisting\" class=\"radio-label\">\n <i class=\"fa-solid fa-link\"></i>\n Link Existing Template\n </label>\n </div>\n </div>\n </div>\n\n <!-- Template Editor Section (New Template) -->\n @if (showTemplateEditor && templateEntity && templateMode === 'new') {\n <div class=\"template-editor-section\">\n <div class=\"template-info\">\n <h5 class=\"template-name\">\n <i class=\"fa-solid fa-file-code\"></i>\n {{ templateEntity.Name }}\n </h5>\n @if (templateEntity.Description) {\n <p class=\"template-description\">{{ templateEntity.Description }}</p>\n }\n </div>\n \n <div class=\"template-editor-container\">\n <mj-template-editor \n #templateEditor\n [template]=\"templateEntity\"\n [config]=\"templateEditorConfig\"\n (contentChange)=\"onTemplateContentChange($event)\">\n </mj-template-editor>\n </div>\n </div>\n }\n \n <!-- Existing Template Display -->\n @if (templateEntity && templateMode === 'existing') {\n <div class=\"existing-template-section\">\n <div class=\"existing-template-info\">\n <div class=\"template-header\">\n <h5 class=\"template-name\">\n <i class=\"fa-solid fa-link\"></i>\n {{ templateEntity.Name }}\n </h5>\n <span class=\"template-type-badge\">\n <i class=\"fa-solid fa-tag\"></i>\n Existing Template\n </span>\n </div>\n \n @if (templateEntity.Description) {\n <p class=\"template-description\">{{ templateEntity.Description }}</p>\n }\n \n <div class=\"template-actions\">\n <button kendoButton \n look=\"outline\" \n size=\"small\"\n (click)=\"handleTemplateModeChange('existing')\">\n <i class=\"fa-solid fa-sync\"></i>\n Change Template\n </button>\n </div>\n </div>\n </div>\n }\n\n </div>\n\n </form>\n\n }\n\n</div>\n\n<!-- Dialog Footer -->\n<div class=\"dialog-footer\">\n <div class=\"footer-left\">\n <span class=\"form-hint\">\n <i class=\"fa-solid fa-info-circle\"></i>\n @if (templateMode === 'new') {\n Created prompts and templates will be saved when you save the AI Agent\n } @else {\n Created prompt will be linked to existing template when you save the AI Agent\n }\n </span>\n </div>\n \n <div class=\"footer-right\">\n <button kendoButton \n look=\"outline\"\n (click)=\"cancel()\"\n [disabled]=\"(isSaving$ | async) || false\">\n Cancel\n </button>\n \n <button kendoButton \n themeColor=\"primary\"\n (click)=\"save()\"\n [disabled]=\"!promptForm.valid || ((isSaving$ | async) || false)\">\n @if (isSaving$ | async) {\n <i class=\"fa-solid fa-spinner fa-spin\"></i>\n Creating...\n } @else {\n <i class=\"fa-solid fa-plus\"></i>\n Create Prompt\n }\n </button>\n </div>\n</div>", styles: ["/* Create Prompt Dialog Styles */\n.create-prompt-dialog {\n padding: 0;\n min-height: 400px;\n display: flex;\n flex-direction: column;\n}\n\n/* Ensure dialog appears above banner and other elements */\n:host ::ng-deep .k-dialog,\n:host ::ng-deep .k-window {\n z-index: 10000 !important;\n}\n\n:host ::ng-deep .k-overlay {\n z-index: 9999 !important;\n}\n\n/* Loading State */\n.loading-state {\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n padding: 60px 20px;\n text-align: center;\n}\n\n.loading-spinner {\n margin-bottom: 16px;\n color: var(--mj-brand-primary);\n}\n\n/* Dialog Content */\n.dialog-content {\n flex: 1;\n padding: 20px;\n overflow-y: auto;\n max-height: 70vh;\n}\n\n/* Form Sections */\n.form-section {\n margin-bottom: 24px;\n border: 1px solid var(--mj-border-default);\n border-radius: 6px;\n padding: 16px;\n background: var(--mj-bg-surface-card);\n}\n\n.section-title {\n margin: 0 0 16px 0;\n font-size: 14px;\n font-weight: 600;\n color: var(--mj-text-primary);\n display: flex;\n align-items: center;\n gap: 8px;\n}\n\n.section-title i {\n color: var(--mj-brand-primary);\n}\n\n/* Form Grid Layout */\n.form-grid {\n display: grid;\n grid-template-columns: 1fr 1fr;\n gap: 16px;\n margin-bottom: 16px;\n}\n\n.form-field {\n display: flex;\n flex-direction: column;\n gap: 6px;\n}\n\n.form-field.full-width {\n grid-column: 1 / -1;\n}\n\n/* Field Labels */\n.field-label {\n font-size: 13px;\n font-weight: 500;\n color: var(--mj-text-primary);\n display: flex;\n align-items: center;\n gap: 6px;\n}\n\n.field-label.required::after {\n content: '*';\n color: var(--mj-status-error);\n margin-left: 2px;\n}\n\n.field-label i {\n font-size: 11px;\n color: var(--mj-text-muted);\n}\n\n/* Form Controls */\n.full-width {\n width: 100%;\n}\n\n/* Field Errors */\n.field-error {\n display: flex;\n align-items: center;\n gap: 4px;\n font-size: 12px;\n color: var(--mj-status-error);\n margin-top: 4px;\n}\n\n.field-error i {\n font-size: 11px;\n}\n\n/* Template Mode Section */\n.template-mode-section {\n margin-bottom: 16px;\n}\n\n.template-mode-options {\n display: flex;\n gap: 16px;\n margin-top: 8px;\n flex-wrap: wrap;\n}\n\n.radio-option {\n display: flex;\n align-items: center;\n gap: 6px;\n}\n\n.radio-input {\n margin: 0;\n}\n\n.radio-label {\n font-size: 13px;\n cursor: pointer;\n display: flex;\n align-items: center;\n gap: 6px;\n padding: 4px 8px;\n border-radius: 4px;\n transition: background-color 0.2s ease;\n}\n\n.radio-label:hover {\n background-color: var(--mj-bg-surface-sunken);\n}\n\n.radio-label i {\n font-size: 12px;\n color: var(--mj-text-muted);\n}\n\n/* Template Editor Section */\n.template-editor-section {\n margin-top: 16px;\n padding: 16px;\n border: 1px solid var(--mj-border-default);\n border-radius: 4px;\n background: var(--mj-bg-surface);\n}\n\n.template-info {\n margin-bottom: 12px;\n}\n\n.template-name {\n margin: 0 0 4px 0;\n font-size: 14px;\n font-weight: 600;\n color: var(--mj-text-primary);\n display: flex;\n align-items: center;\n gap: 6px;\n}\n\n.template-description {\n margin: 0;\n font-size: 12px;\n color: var(--mj-text-muted);\n}\n\n.template-editor-container {\n border: 1px solid var(--mj-border-default);\n border-radius: 4px;\n overflow: hidden;\n min-height: 200px;\n}\n\n/* Existing Template Section */\n.existing-template-section {\n margin-top: 16px;\n padding: 16px;\n border: 1px solid var(--mj-border-default);\n border-radius: 4px;\n background: var(--mj-bg-surface);\n}\n\n.existing-template-info {\n display: flex;\n flex-direction: column;\n gap: 12px;\n}\n\n.template-header {\n display: flex;\n justify-content: space-between;\n align-items: center;\n gap: 12px;\n}\n\n.template-type-badge {\n display: inline-flex;\n align-items: center;\n gap: 4px;\n padding: 4px 8px;\n background-color: var(--mj-brand-primary);\n color: var(--mj-text-inverse);\n border-radius: 12px;\n font-size: 11px;\n font-weight: 500;\n}\n\n.template-actions {\n display: flex;\n gap: 8px;\n}\n\n/* Dialog Footer */\n.dialog-footer {\n display: flex;\n justify-content: space-between;\n align-items: center;\n padding: 16px 20px;\n border-top: 1px solid var(--mj-border-default);\n background: var(--mj-bg-surface-card);\n gap: 16px;\n}\n\n.footer-left {\n flex: 1;\n}\n\n.footer-right {\n display: flex;\n gap: 8px;\n}\n\n.form-hint {\n display: flex;\n align-items: center;\n gap: 6px;\n font-size: 12px;\n color: var(--mj-text-muted);\n}\n\n.form-hint i {\n color: var(--mj-brand-primary);\n}\n\n/* Responsive Design */\n@media (max-width: 768px) {\n .form-grid {\n grid-template-columns: 1fr;\n }\n\n .template-mode-options {\n flex-direction: column;\n gap: 8px;\n }\n\n .dialog-footer {\n flex-direction: column;\n align-items: stretch;\n gap: 12px;\n }\n\n .footer-right {\n justify-content: stretch;\n }\n\n .footer-right button {\n flex: 1;\n }\n}\n\n/* Compact Template Editor Styles */\n:host ::ng-deep .template-editor-container mj-template-editor {\n --template-editor-min-height: 200px;\n}\n\n:host ::ng-deep .template-editor-container .template-editor-help {\n display: none; /* Hide help section in compact mode */\n}\n"] }]
|
|
459
|
-
}], () => [{ type:
|
|
453
|
+
args: [{ standalone: false, selector: 'mj-create-prompt-dialog', template: "<!-- Create Prompt Dialog -->\n<div class=\"create-prompt-dialog\">\n \n <!-- Loading State -->\n @if (isLoading$ | async) {\n <div class=\"loading-state\">\n <div class=\"loading-spinner\">\n <i class=\"fa-solid fa-spinner fa-spin fa-2x\"></i>\n </div>\n <p>Loading prompt creation form...</p>\n </div>\n } @else {\n \n <!-- Form Content -->\n <form [formGroup]=\"promptForm\" class=\"dialog-content\">\n \n <!-- Basic Prompt Information -->\n <div class=\"form-section\">\n <h4 class=\"section-title\">\n <i class=\"fa-solid fa-info-circle\"></i>\n Basic Information\n </h4>\n \n <div class=\"form-grid\">\n \n <!-- Name Field -->\n <div class=\"form-field\">\n <label for=\"promptName\" class=\"field-label required\">\n <i class=\"fa-solid fa-tag\"></i>\n Name\n </label>\n <input\n id=\"promptName\"\n class=\"mj-input full-width\"\n formControlName=\"name\"\n placeholder=\"Enter prompt name...\">\n @if (promptForm.get('name')?.invalid && promptForm.get('name')?.touched) {\n <div class=\"field-error\">\n <i class=\"fa-solid fa-exclamation-triangle\"></i>\n Name is required\n </div>\n }\n </div>\n\n <!-- Type Field -->\n <div class=\"form-field\">\n <label for=\"promptType\" class=\"field-label required\">\n <i class=\"fa-solid fa-category\"></i>\n Type\n </label>\n <mj-dropdown\n id=\"promptType\"\n formControlName=\"typeID\"\n [Data]=\"availablePromptTypes$ | async\"\n TextField=\"Name\"\n ValueField=\"ID\"\n [ValuePrimitive]=\"true\"\n Placeholder=\"Select prompt type...\"\n class=\"full-width\">\n </mj-dropdown>\n @if (promptForm.get('typeID')?.invalid && promptForm.get('typeID')?.touched) {\n <div class=\"field-error\">\n <i class=\"fa-solid fa-exclamation-triangle\"></i>\n Type is required\n </div>\n }\n </div>\n\n <!-- Status Field -->\n <div class=\"form-field\">\n <label for=\"promptStatus\" class=\"field-label\">\n <i class=\"fa-solid fa-toggle-on\"></i>\n Status\n </label>\n <mj-dropdown\n id=\"promptStatus\"\n formControlName=\"status\"\n [Data]=\"['Pending', 'Active', 'Disabled']\"\n [ValuePrimitive]=\"true\"\n class=\"full-width\">\n </mj-dropdown>\n </div>\n\n <!-- Output Type Field -->\n <div class=\"form-field\">\n <label for=\"outputType\" class=\"field-label\">\n <i class=\"fa-solid fa-file-code\"></i>\n Output Type\n </label>\n <mj-dropdown\n id=\"outputType\"\n formControlName=\"outputType\"\n [Data]=\"['string', 'object']\"\n [ValuePrimitive]=\"true\"\n class=\"full-width\">\n </mj-dropdown>\n </div>\n\n </div>\n\n <!-- Description Field -->\n <div class=\"form-field full-width\">\n <label for=\"promptDescription\" class=\"field-label\">\n <i class=\"fa-solid fa-align-left\"></i>\n Description\n </label>\n <textarea\n id=\"promptDescription\"\n class=\"mj-textarea full-width\"\n formControlName=\"description\"\n placeholder=\"Enter prompt description (optional)...\"\n rows=\"3\"></textarea>\n </div>\n\n </div>\n\n <!-- Template Configuration -->\n <div class=\"form-section\">\n <h4 class=\"section-title\">\n <i class=\"fa-solid fa-file-alt\"></i>\n Template Configuration\n </h4>\n \n <div class=\"template-mode-section\">\n <label class=\"field-label\">\n <i class=\"fa-solid fa-cog\"></i>\n Template Mode\n </label>\n \n <div class=\"template-mode-options\">\n <div class=\"radio-option\">\n <input type=\"radio\" \n id=\"templateNew\" \n value=\"new\" \n formControlName=\"templateMode\"\n class=\"radio-input\">\n <label for=\"templateNew\" class=\"radio-label\">\n <i class=\"fa-solid fa-plus-circle\"></i>\n Create New Template\n </label>\n </div>\n \n <div class=\"radio-option\">\n <input type=\"radio\" \n id=\"templateExisting\" \n value=\"existing\" \n formControlName=\"templateMode\"\n class=\"radio-input\">\n <label for=\"templateExisting\" class=\"radio-label\">\n <i class=\"fa-solid fa-link\"></i>\n Link Existing Template\n </label>\n </div>\n </div>\n </div>\n\n <!-- Template Editor Section (New Template) -->\n @if (showTemplateEditor && templateEntity && templateMode === 'new') {\n <div class=\"template-editor-section\">\n <div class=\"template-info\">\n <h5 class=\"template-name\">\n <i class=\"fa-solid fa-file-code\"></i>\n {{ templateEntity.Name }}\n </h5>\n @if (templateEntity.Description) {\n <p class=\"template-description\">{{ templateEntity.Description }}</p>\n }\n </div>\n \n <div class=\"template-editor-container\">\n <mj-template-editor \n #templateEditor\n [template]=\"templateEntity\"\n [config]=\"templateEditorConfig\"\n (contentChange)=\"onTemplateContentChange($event)\">\n </mj-template-editor>\n </div>\n </div>\n }\n \n <!-- Existing Template Display -->\n @if (templateEntity && templateMode === 'existing') {\n <div class=\"existing-template-section\">\n <div class=\"existing-template-info\">\n <div class=\"template-header\">\n <h5 class=\"template-name\">\n <i class=\"fa-solid fa-link\"></i>\n {{ templateEntity.Name }}\n </h5>\n <span class=\"template-type-badge\">\n <i class=\"fa-solid fa-tag\"></i>\n Existing Template\n </span>\n </div>\n \n @if (templateEntity.Description) {\n <p class=\"template-description\">{{ templateEntity.Description }}</p>\n }\n \n <div class=\"template-actions\">\n <button mjButton\n variant=\"flat\"\n (click)=\"handleTemplateModeChange('existing')\">\n <i class=\"fa-solid fa-sync\"></i>\n Change Template\n </button>\n </div>\n </div>\n </div>\n }\n\n </div>\n\n </form>\n\n }\n\n</div>\n\n<!-- Dialog Footer -->\n<div class=\"dialog-footer\">\n <div class=\"footer-left\">\n <span class=\"form-hint\">\n <i class=\"fa-solid fa-info-circle\"></i>\n @if (templateMode === 'new') {\n Created prompts and templates will be saved when you save the AI Agent\n } @else {\n Created prompt will be linked to existing template when you save the AI Agent\n }\n </span>\n </div>\n \n <div class=\"footer-right\">\n <button mjButton\n variant=\"flat\"\n (click)=\"cancel()\"\n [disabled]=\"(isSaving$ | async) || false\">\n Cancel\n </button>\n\n <button mjButton\n variant=\"primary\"\n (click)=\"save()\"\n [disabled]=\"!promptForm.valid || ((isSaving$ | async) || false)\">\n @if (isSaving$ | async) {\n <i class=\"fa-solid fa-spinner fa-spin\"></i>\n Creating...\n } @else {\n <i class=\"fa-solid fa-plus\"></i>\n Create Prompt\n }\n </button>\n </div>\n</div>", styles: ["/* Create Prompt Dialog Styles */\n.create-prompt-dialog {\n padding: 0;\n min-height: 400px;\n display: flex;\n flex-direction: column;\n}\n\n/* Ensure dialog appears above banner and other elements */\n:host ::ng-deep .k-dialog,\n:host ::ng-deep .k-window {\n z-index: 10000 !important;\n}\n\n:host ::ng-deep .k-overlay {\n z-index: 9999 !important;\n}\n\n/* Loading State */\n.loading-state {\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n padding: 60px 20px;\n text-align: center;\n}\n\n.loading-spinner {\n margin-bottom: 16px;\n color: var(--mj-brand-primary);\n}\n\n/* Dialog Content */\n.dialog-content {\n flex: 1;\n padding: 20px;\n overflow-y: auto;\n max-height: 70vh;\n}\n\n/* Form Sections */\n.form-section {\n margin-bottom: 24px;\n border: 1px solid var(--mj-border-default);\n border-radius: 6px;\n padding: 16px;\n background: var(--mj-bg-surface-card);\n}\n\n.section-title {\n margin: 0 0 16px 0;\n font-size: 14px;\n font-weight: 600;\n color: var(--mj-text-primary);\n display: flex;\n align-items: center;\n gap: 8px;\n}\n\n.section-title i {\n color: var(--mj-brand-primary);\n}\n\n/* Form Grid Layout */\n.form-grid {\n display: grid;\n grid-template-columns: 1fr 1fr;\n gap: 16px;\n margin-bottom: 16px;\n}\n\n.form-field {\n display: flex;\n flex-direction: column;\n gap: 6px;\n}\n\n.form-field.full-width {\n grid-column: 1 / -1;\n}\n\n/* Field Labels */\n.field-label {\n font-size: 13px;\n font-weight: 500;\n color: var(--mj-text-primary);\n display: flex;\n align-items: center;\n gap: 6px;\n}\n\n.field-label.required::after {\n content: '*';\n color: var(--mj-status-error);\n margin-left: 2px;\n}\n\n.field-label i {\n font-size: 11px;\n color: var(--mj-text-muted);\n}\n\n/* Form Controls */\n.full-width {\n width: 100%;\n}\n\n/* Field Errors */\n.field-error {\n display: flex;\n align-items: center;\n gap: 4px;\n font-size: 12px;\n color: var(--mj-status-error);\n margin-top: 4px;\n}\n\n.field-error i {\n font-size: 11px;\n}\n\n/* Template Mode Section */\n.template-mode-section {\n margin-bottom: 16px;\n}\n\n.template-mode-options {\n display: flex;\n gap: 16px;\n margin-top: 8px;\n flex-wrap: wrap;\n}\n\n.radio-option {\n display: flex;\n align-items: center;\n gap: 6px;\n}\n\n.radio-input {\n margin: 0;\n}\n\n.radio-label {\n font-size: 13px;\n cursor: pointer;\n display: flex;\n align-items: center;\n gap: 6px;\n padding: 4px 8px;\n border-radius: 4px;\n transition: background-color 0.2s ease;\n}\n\n.radio-label:hover {\n background-color: var(--mj-bg-surface-sunken);\n}\n\n.radio-label i {\n font-size: 12px;\n color: var(--mj-text-muted);\n}\n\n/* Template Editor Section */\n.template-editor-section {\n margin-top: 16px;\n padding: 16px;\n border: 1px solid var(--mj-border-default);\n border-radius: 4px;\n background: var(--mj-bg-surface);\n}\n\n.template-info {\n margin-bottom: 12px;\n}\n\n.template-name {\n margin: 0 0 4px 0;\n font-size: 14px;\n font-weight: 600;\n color: var(--mj-text-primary);\n display: flex;\n align-items: center;\n gap: 6px;\n}\n\n.template-description {\n margin: 0;\n font-size: 12px;\n color: var(--mj-text-muted);\n}\n\n.template-editor-container {\n border: 1px solid var(--mj-border-default);\n border-radius: 4px;\n overflow: hidden;\n min-height: 200px;\n}\n\n/* Existing Template Section */\n.existing-template-section {\n margin-top: 16px;\n padding: 16px;\n border: 1px solid var(--mj-border-default);\n border-radius: 4px;\n background: var(--mj-bg-surface);\n}\n\n.existing-template-info {\n display: flex;\n flex-direction: column;\n gap: 12px;\n}\n\n.template-header {\n display: flex;\n justify-content: space-between;\n align-items: center;\n gap: 12px;\n}\n\n.template-type-badge {\n display: inline-flex;\n align-items: center;\n gap: 4px;\n padding: 4px 8px;\n background-color: var(--mj-brand-primary);\n color: var(--mj-text-inverse);\n border-radius: 12px;\n font-size: 11px;\n font-weight: 500;\n}\n\n.template-actions {\n display: flex;\n gap: 8px;\n}\n\n/* Dialog Footer */\n.dialog-footer {\n display: flex;\n justify-content: space-between;\n align-items: center;\n padding: 16px 20px;\n border-top: 1px solid var(--mj-border-default);\n background: var(--mj-bg-surface-card);\n gap: 16px;\n}\n\n.footer-left {\n flex: 1;\n}\n\n.footer-right {\n display: flex;\n gap: 8px;\n}\n\n.form-hint {\n display: flex;\n align-items: center;\n gap: 6px;\n font-size: 12px;\n color: var(--mj-text-muted);\n}\n\n.form-hint i {\n color: var(--mj-brand-primary);\n}\n\n/* Responsive Design */\n@media (max-width: 768px) {\n .form-grid {\n grid-template-columns: 1fr;\n }\n\n .template-mode-options {\n flex-direction: column;\n gap: 8px;\n }\n\n .dialog-footer {\n flex-direction: column;\n align-items: stretch;\n gap: 12px;\n }\n\n .footer-right {\n justify-content: stretch;\n }\n\n .footer-right button {\n flex: 1;\n }\n}\n\n/* Compact Template Editor Styles */\n:host ::ng-deep .template-editor-container mj-template-editor {\n --template-editor-min-height: 200px;\n}\n\n:host ::ng-deep .template-editor-container .template-editor-help {\n display: none; /* Hide help section in compact mode */\n}\n"] }]
|
|
454
|
+
}], () => [{ type: i0.ChangeDetectorRef }, { type: i1.AIPromptManagementService }], { templateEditor: [{
|
|
460
455
|
type: ViewChild,
|
|
461
456
|
args: ['templateEditor']
|
|
457
|
+
}], DialogClose: [{
|
|
458
|
+
type: Output
|
|
462
459
|
}] }); })();
|
|
463
|
-
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(CreatePromptDialogComponent, { className: "CreatePromptDialogComponent", filePath: "src/lib/custom/AIAgents/create-prompt-dialog.component.ts", lineNumber:
|
|
460
|
+
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(CreatePromptDialogComponent, { className: "CreatePromptDialogComponent", filePath: "src/lib/custom/AIAgents/create-prompt-dialog.component.ts", lineNumber: 41 }); })();
|
|
464
461
|
//# sourceMappingURL=create-prompt-dialog.component.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-prompt-dialog.component.js","sourceRoot":"","sources":["../../../../src/lib/custom/AIAgents/create-prompt-dialog.component.ts","../../../../src/lib/custom/AIAgents/create-prompt-dialog.component.html"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAwC,SAAS,EAAE,MAAM,eAAe,CAAC;AAC3F,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAEpE,OAAO,EAAE,OAAO,EAAE,eAAe,EAAE,SAAS,EAAE,MAAM,MAAM,CAAC;AAC3D,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAGzD,OAAO,EAAE,qBAAqB,EAAE,MAAM,kCAAkC,CAAC;;;;;;;;;;;;;;ICDnE,AADF,8BAA2B,cACI;IAC3B,wBAAiD;IACnD,iBAAM;IACN,yBAAG;IAAA,+CAA+B;IACpC,AADoC,iBAAI,EAClC;;;IA4BI,+BAAyB;IACvB,wBAAgD;IAChD,kCACF;IAAA,iBAAM;;;IAqBN,+BAAyB;IACvB,wBAAgD;IAChD,kCACF;IAAA,iBAAM;;;IAsGJ,6BAAgC;IAAA,YAAgC;IAAA,iBAAI;;;IAApC,cAAgC;IAAhC,uDAAgC;;;;IALlE,AADF,AADF,+BAAqC,cACR,aACC;IACxB,wBAAqC;IACrC,YACF;IAAA,iBAAK;IACL,yHAAkC;IAGpC,iBAAM;IAGJ,AADF,+BAAuC,gCAKe;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, ViewChild } from '@angular/core';\nimport { FormControl, FormGroup, Validators } from '@angular/forms';\nimport { WindowRef } from '@progress/kendo-angular-dialog';\nimport { Subject, BehaviorSubject, takeUntil } from 'rxjs';\nimport { Metadata, RunView } from '@memberjunction/core';\nimport { MJTemplateEntity, MJAIPromptTypeEntity, MJTemplateContentEntity } from '@memberjunction/core-entities';\nimport { MJAIPromptEntityExtended } from \"@memberjunction/ai-core-plus\";\nimport { MJNotificationService } from '@memberjunction/ng-notifications';\nimport { TemplateEditorConfig } from '../../shared/components/template-editor.component';\nimport { AIPromptManagementService } from '../AIPrompts/ai-prompt-management.service';\nimport { TemplateSelectorConfig } from '../AIPrompts/template-selector-dialog.component';\n\nexport interface CreatePromptConfig {\n /** Title for the dialog */\n title?: string;\n /** Initial name for the prompt */\n initialName?: string;\n /** Pre-selected prompt type ID */\n initialTypeID?: string;\n}\n\nexport interface CreatePromptResult {\n /** Created prompt entity (not saved to database) */\n prompt: MJAIPromptEntityExtended;\n /** Created template entity (not saved to database) */\n template?: MJTemplateEntity;\n /** Template content entities (not saved to database) */\n templateContents?: MJTemplateContentEntity[];\n}\n\n/**\n * Dialog for creating new AI Prompts with essential fields and basic template editing.\n * Creates entities but does not save them - returns entities for parent to add to PendingRecords.\n * This ensures atomicity with the parent form's save operation.\n */\n@Component({\n standalone: false,\n selector: 'mj-create-prompt-dialog',\n templateUrl: './create-prompt-dialog.component.html',\n styleUrls: ['./create-prompt-dialog.component.css']\n})\nexport class CreatePromptDialogComponent implements OnInit, OnDestroy {\n \n // Configuration\n config: CreatePromptConfig = {};\n \n // State management\n private destroy$ = new Subject<void>();\n public result = new Subject<CreatePromptResult | null>();\n \n // Form and validation\n promptForm: FormGroup;\n isLoading$ = new BehaviorSubject<boolean>(false);\n isSaving$ = new BehaviorSubject<boolean>(false);\n \n // Data\n availablePromptTypes$ = new BehaviorSubject<MJAIPromptTypeEntity[]>([]);\n \n // Entities (not saved to database)\n promptEntity: MJAIPromptEntityExtended | null = null;\n templateEntity: MJTemplateEntity | null = null;\n templateContents: MJTemplateContentEntity[] = [];\n \n // Template editor\n @ViewChild('templateEditor') templateEditor: any; // Template editor component reference\n showTemplateEditor = false;\n templateEditorConfig: TemplateEditorConfig = {\n allowEdit: true,\n showRunButton: false,\n compactMode: true // Compact mode for dialog\n };\n \n // Template state\n templateMode: 'new' | 'existing' = 'new';\n\n constructor(\n private dialogRef: WindowRef,\n private cdr: ChangeDetectorRef,\n private aiPromptManagementService: AIPromptManagementService\n ) {\n this.promptForm = this.createForm();\n }\n\n ngOnInit() {\n this.loadInitialData();\n this.setupFormWatching();\n }\n\n ngOnDestroy() {\n this.destroy$.next();\n this.destroy$.complete();\n }\n\n private createForm(): FormGroup {\n return new FormGroup({\n name: new FormControl(this.config.initialName || '', [Validators.required]),\n description: new FormControl(''),\n typeID: new FormControl(this.config.initialTypeID || '', [Validators.required]),\n status: new FormControl('Pending'),\n outputType: new FormControl('string'),\n templateMode: new FormControl('new')\n });\n }\n\n private setupFormWatching() {\n // Watch template mode changes\n this.promptForm.get('templateMode')?.valueChanges\n .pipe(takeUntil(this.destroy$))\n .subscribe(mode => {\n this.templateMode = mode;\n this.handleTemplateModeChange(mode);\n });\n }\n\n private async loadInitialData() {\n this.isLoading$.next(true);\n \n try {\n // Load prompt types\n const rv = new RunView();\n const typesResult = await rv.RunView<MJAIPromptTypeEntity>({\n EntityName: 'MJ: AI Prompt Types',\n OrderBy: 'Name ASC',\n ResultType: 'entity_object'\n });\n\n if (typesResult.Success && typesResult.Results) {\n this.availablePromptTypes$.next(typesResult.Results);\n \n // Set default type if not specified\n if (!this.config.initialTypeID && typesResult.Results.length > 0) {\n this.promptForm.patchValue({ typeID: typesResult.Results[0].ID });\n }\n }\n\n // Create the prompt entity\n const md = new Metadata();\n this.promptEntity = await md.GetEntityObject<MJAIPromptEntityExtended>('MJ: AI Prompts');\n this.promptEntity.NewRecord();\n \n // Set default values\n this.promptEntity.Status = 'Pending';\n this.promptEntity.OutputType = 'string';\n this.promptEntity.ValidationBehavior = 'None';\n this.promptEntity.EnableCaching = false;\n\n // Create default template since it's required\n await this.createNewTemplate();\n this.showTemplateEditor = true;\n\n } catch (error) {\n console.error('Error loading prompt creation data:', error);\n MJNotificationService.Instance.CreateSimpleNotification(\n 'Error loading data for prompt creation',\n 'error',\n 3000\n );\n } finally {\n this.isLoading$.next(false);\n }\n }\n\n public async handleTemplateModeChange(mode: string) {\n if (mode === 'new') {\n await this.createNewTemplate();\n this.showTemplateEditor = true;\n } else if (mode === 'existing') {\n await this.openTemplateSelector();\n }\n \n this.cdr.detectChanges();\n }\n\n private async createNewTemplate() {\n if (!this.promptEntity) return;\n\n try {\n const md = new Metadata();\n \n // Create template entity\n this.templateEntity = await md.GetEntityObject<MJTemplateEntity>('MJ: Templates');\n this.templateEntity.NewRecord();\n \n const promptName = this.promptForm.get('name')?.value || 'New Prompt';\n this.templateEntity.Name = `${promptName} Template`;\n this.templateEntity.Description = `Template for ${promptName}`;\n // Set UserID on template (required field)\n this.templateEntity.UserID = md.CurrentUser.ID;\n \n // Link template to prompt\n this.promptEntity.TemplateID = this.templateEntity.ID;\n\n } catch (error) {\n console.error('Error creating new template:', error);\n MJNotificationService.Instance.CreateSimpleNotification(\n 'Error creating template',\n 'error',\n 3000\n );\n }\n }\n\n public onTemplateContentChange(contents: MJTemplateContentEntity[]) {\n this.templateContents = contents || [];\n }\n\n public async save() {\n if (!this.promptForm.valid || !this.promptEntity) {\n MJNotificationService.Instance.CreateSimpleNotification(\n 'Please fill in all required fields',\n 'warning',\n 3000\n );\n return;\n }\n\n this.isSaving$.next(true);\n\n try {\n // Update prompt entity with form values\n const formValue = this.promptForm.value;\n this.promptEntity.Name = formValue.name;\n this.promptEntity.Description = formValue.description || '';\n this.promptEntity.TypeID = formValue.typeID;\n this.promptEntity.Status = formValue.status;\n this.promptEntity.OutputType = formValue.outputType;\n\n // Get template contents if template editor is active\n if (this.templateEditor && this.showTemplateEditor) {\n // Get the template contents from the editor without saving\n // The parent form will handle saving in the proper order\n this.templateContents = this.templateEditor.templateContents || [];\n \n // Ensure the template contents have the correct TemplateID\n if (this.templateContents && this.templateEntity) {\n this.templateContents.forEach(content => {\n content.TemplateID = this.templateEntity!.ID;\n });\n }\n }\n\n // Return the created entities (not saved to database)\n const result: CreatePromptResult = {\n prompt: this.promptEntity,\n template: this.templateEntity || undefined,\n templateContents: this.templateContents.length > 0 ? this.templateContents : undefined\n };\n\n this.result.next(result);\n this.dialogRef.close();\n\n } catch (error) {\n console.error('Error preparing prompt for creation:', error);\n MJNotificationService.Instance.CreateSimpleNotification(\n 'Error preparing prompt for creation',\n 'error',\n 3000\n );\n } finally {\n this.isSaving$.next(false);\n }\n }\n\n public cancel() {\n this.result.next(null);\n this.dialogRef.close();\n }\n\n /**\n * Opens the template selector dialog to link an existing template\n */\n private async openTemplateSelector() {\n const config: TemplateSelectorConfig = {\n title: 'Select Template for AI Prompt',\n showCreateNew: false,\n multiSelect: false,\n showActiveOnly: true\n };\n\n try {\n const result = await this.aiPromptManagementService.openTemplateSelectorDialog(config).toPromise();\n \n if (result && result.selectedTemplates && result.selectedTemplates.length > 0) {\n // Link the selected template\n this.templateEntity = result.selectedTemplates[0];\n this.promptEntity!.TemplateID = this.templateEntity.ID;\n \n // Update UI to show selected template info\n this.showTemplateEditor = false;\n \n MJNotificationService.Instance.CreateSimpleNotification(\n `Template \"${this.templateEntity.Name}\" linked successfully`,\n 'success',\n 3000\n );\n } else {\n // User cancelled, revert to new template mode\n this.promptForm.patchValue({ templateMode: 'new' });\n await this.createNewTemplate();\n this.showTemplateEditor = true;\n }\n } catch (error) {\n console.error('Error opening template selector:', error);\n MJNotificationService.Instance.CreateSimpleNotification(\n 'Error opening template selector',\n 'error',\n 3000\n );\n \n // Revert to new template mode\n this.promptForm.patchValue({ templateMode: 'new' });\n await this.createNewTemplate();\n this.showTemplateEditor = true;\n }\n }\n\n // Getter for template debugging\n public get currentTemplate(): MJTemplateEntity | null {\n return this.templateEntity;\n }\n}","<!-- Create Prompt Dialog -->\n<div class=\"create-prompt-dialog\">\n \n <!-- Loading State -->\n @if (isLoading$ | async) {\n <div class=\"loading-state\">\n <div class=\"loading-spinner\">\n <i class=\"fa-solid fa-spinner fa-spin fa-2x\"></i>\n </div>\n <p>Loading prompt creation form...</p>\n </div>\n } @else {\n \n <!-- Form Content -->\n <form [formGroup]=\"promptForm\" class=\"dialog-content\">\n \n <!-- Basic Prompt Information -->\n <div class=\"form-section\">\n <h4 class=\"section-title\">\n <i class=\"fa-solid fa-info-circle\"></i>\n Basic Information\n </h4>\n \n <div class=\"form-grid\">\n \n <!-- Name Field -->\n <div class=\"form-field\">\n <label for=\"promptName\" class=\"field-label required\">\n <i class=\"fa-solid fa-tag\"></i>\n Name\n </label>\n <kendo-textbox \n id=\"promptName\"\n formControlName=\"name\"\n placeholder=\"Enter prompt name...\"\n class=\"full-width\">\n </kendo-textbox>\n @if (promptForm.get('name')?.invalid && promptForm.get('name')?.touched) {\n <div class=\"field-error\">\n <i class=\"fa-solid fa-exclamation-triangle\"></i>\n Name is required\n </div>\n }\n </div>\n\n <!-- Type Field -->\n <div class=\"form-field\">\n <label for=\"promptType\" class=\"field-label required\">\n <i class=\"fa-solid fa-category\"></i>\n Type\n </label>\n <kendo-dropdownlist \n id=\"promptType\"\n formControlName=\"typeID\"\n [data]=\"availablePromptTypes$ | async\"\n textField=\"Name\"\n valueField=\"ID\"\n [valuePrimitive]=\"true\"\n placeholder=\"Select prompt type...\"\n class=\"full-width\">\n </kendo-dropdownlist>\n @if (promptForm.get('typeID')?.invalid && promptForm.get('typeID')?.touched) {\n <div class=\"field-error\">\n <i class=\"fa-solid fa-exclamation-triangle\"></i>\n Type is required\n </div>\n }\n </div>\n\n <!-- Status Field -->\n <div class=\"form-field\">\n <label for=\"promptStatus\" class=\"field-label\">\n <i class=\"fa-solid fa-toggle-on\"></i>\n Status\n </label>\n <kendo-dropdownlist \n id=\"promptStatus\"\n formControlName=\"status\"\n [data]=\"['Pending', 'Active', 'Disabled']\"\n [valuePrimitive]=\"true\"\n class=\"full-width\">\n </kendo-dropdownlist>\n </div>\n\n <!-- Output Type Field -->\n <div class=\"form-field\">\n <label for=\"outputType\" class=\"field-label\">\n <i class=\"fa-solid fa-file-code\"></i>\n Output Type\n </label>\n <kendo-dropdownlist \n id=\"outputType\"\n formControlName=\"outputType\"\n [data]=\"['string', 'object']\"\n [valuePrimitive]=\"true\"\n class=\"full-width\">\n </kendo-dropdownlist>\n </div>\n\n </div>\n\n <!-- Description Field -->\n <div class=\"form-field full-width\">\n <label for=\"promptDescription\" class=\"field-label\">\n <i class=\"fa-solid fa-align-left\"></i>\n Description\n </label>\n <kendo-textarea \n id=\"promptDescription\"\n formControlName=\"description\"\n placeholder=\"Enter prompt description (optional)...\"\n [rows]=\"3\"\n class=\"full-width\">\n </kendo-textarea>\n </div>\n\n </div>\n\n <!-- Template Configuration -->\n <div class=\"form-section\">\n <h4 class=\"section-title\">\n <i class=\"fa-solid fa-file-alt\"></i>\n Template Configuration\n </h4>\n \n <div class=\"template-mode-section\">\n <label class=\"field-label\">\n <i class=\"fa-solid fa-cog\"></i>\n Template Mode\n </label>\n \n <div class=\"template-mode-options\">\n <div class=\"radio-option\">\n <input type=\"radio\" \n id=\"templateNew\" \n value=\"new\" \n formControlName=\"templateMode\"\n class=\"radio-input\">\n <label for=\"templateNew\" class=\"radio-label\">\n <i class=\"fa-solid fa-plus-circle\"></i>\n Create New Template\n </label>\n </div>\n \n <div class=\"radio-option\">\n <input type=\"radio\" \n id=\"templateExisting\" \n value=\"existing\" \n formControlName=\"templateMode\"\n class=\"radio-input\">\n <label for=\"templateExisting\" class=\"radio-label\">\n <i class=\"fa-solid fa-link\"></i>\n Link Existing Template\n </label>\n </div>\n </div>\n </div>\n\n <!-- Template Editor Section (New Template) -->\n @if (showTemplateEditor && templateEntity && templateMode === 'new') {\n <div class=\"template-editor-section\">\n <div class=\"template-info\">\n <h5 class=\"template-name\">\n <i class=\"fa-solid fa-file-code\"></i>\n {{ templateEntity.Name }}\n </h5>\n @if (templateEntity.Description) {\n <p class=\"template-description\">{{ templateEntity.Description }}</p>\n }\n </div>\n \n <div class=\"template-editor-container\">\n <mj-template-editor \n #templateEditor\n [template]=\"templateEntity\"\n [config]=\"templateEditorConfig\"\n (contentChange)=\"onTemplateContentChange($event)\">\n </mj-template-editor>\n </div>\n </div>\n }\n \n <!-- Existing Template Display -->\n @if (templateEntity && templateMode === 'existing') {\n <div class=\"existing-template-section\">\n <div class=\"existing-template-info\">\n <div class=\"template-header\">\n <h5 class=\"template-name\">\n <i class=\"fa-solid fa-link\"></i>\n {{ templateEntity.Name }}\n </h5>\n <span class=\"template-type-badge\">\n <i class=\"fa-solid fa-tag\"></i>\n Existing Template\n </span>\n </div>\n \n @if (templateEntity.Description) {\n <p class=\"template-description\">{{ templateEntity.Description }}</p>\n }\n \n <div class=\"template-actions\">\n <button kendoButton \n look=\"outline\" \n size=\"small\"\n (click)=\"handleTemplateModeChange('existing')\">\n <i class=\"fa-solid fa-sync\"></i>\n Change Template\n </button>\n </div>\n </div>\n </div>\n }\n\n </div>\n\n </form>\n\n }\n\n</div>\n\n<!-- Dialog Footer -->\n<div class=\"dialog-footer\">\n <div class=\"footer-left\">\n <span class=\"form-hint\">\n <i class=\"fa-solid fa-info-circle\"></i>\n @if (templateMode === 'new') {\n Created prompts and templates will be saved when you save the AI Agent\n } @else {\n Created prompt will be linked to existing template when you save the AI Agent\n }\n </span>\n </div>\n \n <div class=\"footer-right\">\n <button kendoButton \n look=\"outline\"\n (click)=\"cancel()\"\n [disabled]=\"(isSaving$ | async) || false\">\n Cancel\n </button>\n \n <button kendoButton \n themeColor=\"primary\"\n (click)=\"save()\"\n [disabled]=\"!promptForm.valid || ((isSaving$ | async) || false)\">\n @if (isSaving$ | async) {\n <i class=\"fa-solid fa-spinner fa-spin\"></i>\n Creating...\n } @else {\n <i class=\"fa-solid fa-plus\"></i>\n Create Prompt\n }\n </button>\n </div>\n</div>"]}
|
|
1
|
+
{"version":3,"file":"create-prompt-dialog.component.js","sourceRoot":"","sources":["../../../../src/lib/custom/AIAgents/create-prompt-dialog.component.ts","../../../../src/lib/custom/AIAgents/create-prompt-dialog.component.html"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAwC,SAAS,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AACjH,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AACpE,OAAO,EAAE,OAAO,EAAE,eAAe,EAAE,SAAS,EAAE,MAAM,MAAM,CAAC;AAC3D,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAGzD,OAAO,EAAE,qBAAqB,EAAE,MAAM,kCAAkC,CAAC;;;;;;;;;;;ICAnE,AADF,8BAA2B,cACI;IAC3B,wBAAiD;IACnD,iBAAM;IACN,yBAAG;IAAA,+CAA+B;IACpC,AADoC,iBAAI,EAClC;;;IA2BI,+BAAyB;IACvB,wBAAgD;IAChD,kCACF;IAAA,iBAAM;;;IAqBN,+BAAyB;IACvB,wBAAgD;IAChD,kCACF;IAAA,iBAAM;;;IAqGJ,6BAAgC;IAAA,YAAgC;IAAA,iBAAI;;;IAApC,cAAgC;IAAhC,uDAAgC;;;;IALlE,AADF,AADF,+BAAqC,cACR,aACC;IACxB,wBAAqC;IACrC,YACF;IAAA,iBAAK;IACL,yHAAkC;IAGpC,iBAAM;IAGJ,AADF,+BAAuC,gCAKe;IAAlD,iPAAiB,sCAA+B,KAAC;IAGvD,AADE,AADE,iBAAqB,EACjB,EACF;;;IAfA,eACF;IADE,2DACF;IACA,cAEC;IAFD,4DAEC;IAMC,eAA2B;IAC3B,AADA,gDAA2B,uCACI;;;IAuB/B,6BAAgC;IAAA,YAAgC;IAAA,iBAAI;;;IAApC,cAAgC;IAAhC,uDAAgC;;;;IAXhE,AADF,AADF,AADF,+BAAuC,cACD,cACL,aACD;IACxB,wBAAgC;IAChC,YACF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AE,KAAK,EAAE,CAAC,CAAC;YACpD,MAAM,IAAI,CAAC,iBAAiB,EAAE,CAAC;YAC/B,IAAI,CAAC,kBAAkB,GAAG,IAAI,CAAC;QACjC,CAAC;IACH,CAAC;IAED,gCAAgC;IAChC,IAAW,eAAe;QACxB,OAAO,IAAI,CAAC,cAAc,CAAC;IAC7B,CAAC;4HAvRU,2BAA2B;oEAA3B,2BAA2B;;;;;;YCvCxC,8BAAkC;YAGhC,6FAA0B;;YAOxB,sGAAO;YA8MX,iBAAM;YAKF,AADF,AADF,8BAA2B,aACA,cACC;YACtB,uBAAuC;YAGrC,AAFF,mFAA8B,6DAErB;YAIb,AADE,iBAAO,EACH;YAGJ,AADF,+BAA0B,iBAI0B;;YAD1C,yGAAS,YAAQ,IAAC;YAExB,yBACF;YAAA,iBAAS;YAET,mCAGyE;;YADjE,yGAAS,UAAM,IAAC;YAEtB,qFAAyB;;YAGvB,2FAAO;YAMf,AADE,AADE,iBAAS,EACL,EACF;;YAzPJ,cAmNC;YAnND,8DAmNC;YASG,eAIC;YAJD,oDAIC;YAQK,eAAyC;YAAzC,wEAAyC;YAOzC,eAAgE;YAAhE,mGAAgE;YACtE,eAMC;YAND,iEAMC;;;iFDlNM,2BAA2B;cANvC,SAAS;6BACI,KAAK,YACP,yBAAyB;;kBA2BlC,SAAS;mBAAC,gBAAgB;;kBAW1B,MAAM;;kFAlCI,2BAA2B","sourcesContent":["import { Component, OnInit, OnDestroy, ChangeDetectorRef, ViewChild, Output, EventEmitter } from '@angular/core';\nimport { FormControl, FormGroup, Validators } from '@angular/forms';\nimport { Subject, BehaviorSubject, takeUntil } from 'rxjs';\nimport { Metadata, RunView } from '@memberjunction/core';\nimport { MJTemplateEntity, MJAIPromptTypeEntity, MJTemplateContentEntity } from '@memberjunction/core-entities';\nimport { MJAIPromptEntityExtended } from \"@memberjunction/ai-core-plus\";\nimport { MJNotificationService } from '@memberjunction/ng-notifications';\nimport { TemplateEditorConfig } from '../../shared/components/template-editor.component';\nimport { AIPromptManagementService } from '../AIPrompts/ai-prompt-management.service';\nimport { TemplateSelectorConfig } from '../AIPrompts/template-selector-dialog.component';\n\nexport interface CreatePromptConfig {\n /** Title for the dialog */\n title?: string;\n /** Initial name for the prompt */\n initialName?: string;\n /** Pre-selected prompt type ID */\n initialTypeID?: string;\n}\n\nexport interface CreatePromptResult {\n /** Created prompt entity (not saved to database) */\n prompt: MJAIPromptEntityExtended;\n /** Created template entity (not saved to database) */\n template?: MJTemplateEntity;\n /** Template content entities (not saved to database) */\n templateContents?: MJTemplateContentEntity[];\n}\n\n/**\n * Dialog for creating new AI Prompts with essential fields and basic template editing.\n * Creates entities but does not save them - returns entities for parent to add to PendingRecords.\n * This ensures atomicity with the parent form's save operation.\n */\n@Component({\n standalone: false,\n selector: 'mj-create-prompt-dialog',\n templateUrl: './create-prompt-dialog.component.html',\n styleUrls: ['./create-prompt-dialog.component.css']\n})\nexport class CreatePromptDialogComponent implements OnInit, OnDestroy {\n \n // Configuration\n config: CreatePromptConfig = {};\n \n // State management\n private destroy$ = new Subject<void>();\n public result = new Subject<CreatePromptResult | null>();\n \n // Form and validation\n promptForm: FormGroup;\n isLoading$ = new BehaviorSubject<boolean>(false);\n isSaving$ = new BehaviorSubject<boolean>(false);\n \n // Data\n availablePromptTypes$ = new BehaviorSubject<MJAIPromptTypeEntity[]>([]);\n \n // Entities (not saved to database)\n promptEntity: MJAIPromptEntityExtended | null = null;\n templateEntity: MJTemplateEntity | null = null;\n templateContents: MJTemplateContentEntity[] = [];\n \n // Template editor\n @ViewChild('templateEditor') templateEditor: any; // Template editor component reference\n showTemplateEditor = false;\n templateEditorConfig: TemplateEditorConfig = {\n allowEdit: true,\n showRunButton: false,\n compactMode: true // Compact mode for dialog\n };\n \n // Template state\n templateMode: 'new' | 'existing' = 'new';\n\n @Output() DialogClose = new EventEmitter<void>();\n\n constructor(\n private cdr: ChangeDetectorRef,\n private aiPromptManagementService: AIPromptManagementService\n ) {\n this.promptForm = this.createForm();\n }\n\n ngOnInit() {\n this.loadInitialData();\n this.setupFormWatching();\n }\n\n ngOnDestroy() {\n this.destroy$.next();\n this.destroy$.complete();\n }\n\n private createForm(): FormGroup {\n return new FormGroup({\n name: new FormControl(this.config.initialName || '', [Validators.required]),\n description: new FormControl(''),\n typeID: new FormControl(this.config.initialTypeID || '', [Validators.required]),\n status: new FormControl('Pending'),\n outputType: new FormControl('string'),\n templateMode: new FormControl('new')\n });\n }\n\n private setupFormWatching() {\n // Watch template mode changes\n this.promptForm.get('templateMode')?.valueChanges\n .pipe(takeUntil(this.destroy$))\n .subscribe(mode => {\n this.templateMode = mode;\n this.handleTemplateModeChange(mode);\n });\n }\n\n private async loadInitialData() {\n this.isLoading$.next(true);\n \n try {\n // Load prompt types\n const rv = new RunView();\n const typesResult = await rv.RunView<MJAIPromptTypeEntity>({\n EntityName: 'MJ: AI Prompt Types',\n OrderBy: 'Name ASC',\n ResultType: 'entity_object'\n });\n\n if (typesResult.Success && typesResult.Results) {\n this.availablePromptTypes$.next(typesResult.Results);\n \n // Set default type if not specified\n if (!this.config.initialTypeID && typesResult.Results.length > 0) {\n this.promptForm.patchValue({ typeID: typesResult.Results[0].ID });\n }\n }\n\n // Create the prompt entity\n const md = new Metadata();\n this.promptEntity = await md.GetEntityObject<MJAIPromptEntityExtended>('MJ: AI Prompts');\n this.promptEntity.NewRecord();\n \n // Set default values\n this.promptEntity.Status = 'Pending';\n this.promptEntity.OutputType = 'string';\n this.promptEntity.ValidationBehavior = 'None';\n this.promptEntity.EnableCaching = false;\n\n // Create default template since it's required\n await this.createNewTemplate();\n this.showTemplateEditor = true;\n\n } catch (error) {\n console.error('Error loading prompt creation data:', error);\n MJNotificationService.Instance.CreateSimpleNotification(\n 'Error loading data for prompt creation',\n 'error',\n 3000\n );\n } finally {\n this.isLoading$.next(false);\n }\n }\n\n public async handleTemplateModeChange(mode: string) {\n if (mode === 'new') {\n await this.createNewTemplate();\n this.showTemplateEditor = true;\n } else if (mode === 'existing') {\n await this.openTemplateSelector();\n }\n \n this.cdr.detectChanges();\n }\n\n private async createNewTemplate() {\n if (!this.promptEntity) return;\n\n try {\n const md = new Metadata();\n \n // Create template entity\n this.templateEntity = await md.GetEntityObject<MJTemplateEntity>('MJ: Templates');\n this.templateEntity.NewRecord();\n \n const promptName = this.promptForm.get('name')?.value || 'New Prompt';\n this.templateEntity.Name = `${promptName} Template`;\n this.templateEntity.Description = `Template for ${promptName}`;\n // Set UserID on template (required field)\n this.templateEntity.UserID = md.CurrentUser.ID;\n \n // Link template to prompt\n this.promptEntity.TemplateID = this.templateEntity.ID;\n\n } catch (error) {\n console.error('Error creating new template:', error);\n MJNotificationService.Instance.CreateSimpleNotification(\n 'Error creating template',\n 'error',\n 3000\n );\n }\n }\n\n public onTemplateContentChange(contents: MJTemplateContentEntity[]) {\n this.templateContents = contents || [];\n }\n\n public async save() {\n if (!this.promptForm.valid || !this.promptEntity) {\n MJNotificationService.Instance.CreateSimpleNotification(\n 'Please fill in all required fields',\n 'warning',\n 3000\n );\n return;\n }\n\n this.isSaving$.next(true);\n\n try {\n // Update prompt entity with form values\n const formValue = this.promptForm.value;\n this.promptEntity.Name = formValue.name;\n this.promptEntity.Description = formValue.description || '';\n this.promptEntity.TypeID = formValue.typeID;\n this.promptEntity.Status = formValue.status;\n this.promptEntity.OutputType = formValue.outputType;\n\n // Get template contents if template editor is active\n if (this.templateEditor && this.showTemplateEditor) {\n // Get the template contents from the editor without saving\n // The parent form will handle saving in the proper order\n this.templateContents = this.templateEditor.templateContents || [];\n \n // Ensure the template contents have the correct TemplateID\n if (this.templateContents && this.templateEntity) {\n this.templateContents.forEach(content => {\n content.TemplateID = this.templateEntity!.ID;\n });\n }\n }\n\n // Return the created entities (not saved to database)\n const result: CreatePromptResult = {\n prompt: this.promptEntity,\n template: this.templateEntity || undefined,\n templateContents: this.templateContents.length > 0 ? this.templateContents : undefined\n };\n\n this.result.next(result);\n this.DialogClose.emit();\n\n } catch (error) {\n console.error('Error preparing prompt for creation:', error);\n MJNotificationService.Instance.CreateSimpleNotification(\n 'Error preparing prompt for creation',\n 'error',\n 3000\n );\n } finally {\n this.isSaving$.next(false);\n }\n }\n\n public cancel() {\n this.result.next(null);\n this.DialogClose.emit();\n }\n\n /**\n * Opens the template selector dialog to link an existing template\n */\n private async openTemplateSelector() {\n const config: TemplateSelectorConfig = {\n title: 'Select Template for AI Prompt',\n showCreateNew: false,\n multiSelect: false,\n showActiveOnly: true\n };\n\n try {\n const result = await this.aiPromptManagementService.openTemplateSelectorDialog(config).toPromise();\n \n if (result && result.selectedTemplates && result.selectedTemplates.length > 0) {\n // Link the selected template\n this.templateEntity = result.selectedTemplates[0];\n this.promptEntity!.TemplateID = this.templateEntity.ID;\n \n // Update UI to show selected template info\n this.showTemplateEditor = false;\n \n MJNotificationService.Instance.CreateSimpleNotification(\n `Template \"${this.templateEntity.Name}\" linked successfully`,\n 'success',\n 3000\n );\n } else {\n // User cancelled, revert to new template mode\n this.promptForm.patchValue({ templateMode: 'new' });\n await this.createNewTemplate();\n this.showTemplateEditor = true;\n }\n } catch (error) {\n console.error('Error opening template selector:', error);\n MJNotificationService.Instance.CreateSimpleNotification(\n 'Error opening template selector',\n 'error',\n 3000\n );\n \n // Revert to new template mode\n this.promptForm.patchValue({ templateMode: 'new' });\n await this.createNewTemplate();\n this.showTemplateEditor = true;\n }\n }\n\n // Getter for template debugging\n public get currentTemplate(): MJTemplateEntity | null {\n return this.templateEntity;\n }\n}","<!-- Create Prompt Dialog -->\n<div class=\"create-prompt-dialog\">\n \n <!-- Loading State -->\n @if (isLoading$ | async) {\n <div class=\"loading-state\">\n <div class=\"loading-spinner\">\n <i class=\"fa-solid fa-spinner fa-spin fa-2x\"></i>\n </div>\n <p>Loading prompt creation form...</p>\n </div>\n } @else {\n \n <!-- Form Content -->\n <form [formGroup]=\"promptForm\" class=\"dialog-content\">\n \n <!-- Basic Prompt Information -->\n <div class=\"form-section\">\n <h4 class=\"section-title\">\n <i class=\"fa-solid fa-info-circle\"></i>\n Basic Information\n </h4>\n \n <div class=\"form-grid\">\n \n <!-- Name Field -->\n <div class=\"form-field\">\n <label for=\"promptName\" class=\"field-label required\">\n <i class=\"fa-solid fa-tag\"></i>\n Name\n </label>\n <input\n id=\"promptName\"\n class=\"mj-input full-width\"\n formControlName=\"name\"\n placeholder=\"Enter prompt name...\">\n @if (promptForm.get('name')?.invalid && promptForm.get('name')?.touched) {\n <div class=\"field-error\">\n <i class=\"fa-solid fa-exclamation-triangle\"></i>\n Name is required\n </div>\n }\n </div>\n\n <!-- Type Field -->\n <div class=\"form-field\">\n <label for=\"promptType\" class=\"field-label required\">\n <i class=\"fa-solid fa-category\"></i>\n Type\n </label>\n <mj-dropdown\n id=\"promptType\"\n formControlName=\"typeID\"\n [Data]=\"availablePromptTypes$ | async\"\n TextField=\"Name\"\n ValueField=\"ID\"\n [ValuePrimitive]=\"true\"\n Placeholder=\"Select prompt type...\"\n class=\"full-width\">\n </mj-dropdown>\n @if (promptForm.get('typeID')?.invalid && promptForm.get('typeID')?.touched) {\n <div class=\"field-error\">\n <i class=\"fa-solid fa-exclamation-triangle\"></i>\n Type is required\n </div>\n }\n </div>\n\n <!-- Status Field -->\n <div class=\"form-field\">\n <label for=\"promptStatus\" class=\"field-label\">\n <i class=\"fa-solid fa-toggle-on\"></i>\n Status\n </label>\n <mj-dropdown\n id=\"promptStatus\"\n formControlName=\"status\"\n [Data]=\"['Pending', 'Active', 'Disabled']\"\n [ValuePrimitive]=\"true\"\n class=\"full-width\">\n </mj-dropdown>\n </div>\n\n <!-- Output Type Field -->\n <div class=\"form-field\">\n <label for=\"outputType\" class=\"field-label\">\n <i class=\"fa-solid fa-file-code\"></i>\n Output Type\n </label>\n <mj-dropdown\n id=\"outputType\"\n formControlName=\"outputType\"\n [Data]=\"['string', 'object']\"\n [ValuePrimitive]=\"true\"\n class=\"full-width\">\n </mj-dropdown>\n </div>\n\n </div>\n\n <!-- Description Field -->\n <div class=\"form-field full-width\">\n <label for=\"promptDescription\" class=\"field-label\">\n <i class=\"fa-solid fa-align-left\"></i>\n Description\n </label>\n <textarea\n id=\"promptDescription\"\n class=\"mj-textarea full-width\"\n formControlName=\"description\"\n placeholder=\"Enter prompt description (optional)...\"\n rows=\"3\"></textarea>\n </div>\n\n </div>\n\n <!-- Template Configuration -->\n <div class=\"form-section\">\n <h4 class=\"section-title\">\n <i class=\"fa-solid fa-file-alt\"></i>\n Template Configuration\n </h4>\n \n <div class=\"template-mode-section\">\n <label class=\"field-label\">\n <i class=\"fa-solid fa-cog\"></i>\n Template Mode\n </label>\n \n <div class=\"template-mode-options\">\n <div class=\"radio-option\">\n <input type=\"radio\" \n id=\"templateNew\" \n value=\"new\" \n formControlName=\"templateMode\"\n class=\"radio-input\">\n <label for=\"templateNew\" class=\"radio-label\">\n <i class=\"fa-solid fa-plus-circle\"></i>\n Create New Template\n </label>\n </div>\n \n <div class=\"radio-option\">\n <input type=\"radio\" \n id=\"templateExisting\" \n value=\"existing\" \n formControlName=\"templateMode\"\n class=\"radio-input\">\n <label for=\"templateExisting\" class=\"radio-label\">\n <i class=\"fa-solid fa-link\"></i>\n Link Existing Template\n </label>\n </div>\n </div>\n </div>\n\n <!-- Template Editor Section (New Template) -->\n @if (showTemplateEditor && templateEntity && templateMode === 'new') {\n <div class=\"template-editor-section\">\n <div class=\"template-info\">\n <h5 class=\"template-name\">\n <i class=\"fa-solid fa-file-code\"></i>\n {{ templateEntity.Name }}\n </h5>\n @if (templateEntity.Description) {\n <p class=\"template-description\">{{ templateEntity.Description }}</p>\n }\n </div>\n \n <div class=\"template-editor-container\">\n <mj-template-editor \n #templateEditor\n [template]=\"templateEntity\"\n [config]=\"templateEditorConfig\"\n (contentChange)=\"onTemplateContentChange($event)\">\n </mj-template-editor>\n </div>\n </div>\n }\n \n <!-- Existing Template Display -->\n @if (templateEntity && templateMode === 'existing') {\n <div class=\"existing-template-section\">\n <div class=\"existing-template-info\">\n <div class=\"template-header\">\n <h5 class=\"template-name\">\n <i class=\"fa-solid fa-link\"></i>\n {{ templateEntity.Name }}\n </h5>\n <span class=\"template-type-badge\">\n <i class=\"fa-solid fa-tag\"></i>\n Existing Template\n </span>\n </div>\n \n @if (templateEntity.Description) {\n <p class=\"template-description\">{{ templateEntity.Description }}</p>\n }\n \n <div class=\"template-actions\">\n <button mjButton\n variant=\"flat\"\n (click)=\"handleTemplateModeChange('existing')\">\n <i class=\"fa-solid fa-sync\"></i>\n Change Template\n </button>\n </div>\n </div>\n </div>\n }\n\n </div>\n\n </form>\n\n }\n\n</div>\n\n<!-- Dialog Footer -->\n<div class=\"dialog-footer\">\n <div class=\"footer-left\">\n <span class=\"form-hint\">\n <i class=\"fa-solid fa-info-circle\"></i>\n @if (templateMode === 'new') {\n Created prompts and templates will be saved when you save the AI Agent\n } @else {\n Created prompt will be linked to existing template when you save the AI Agent\n }\n </span>\n </div>\n \n <div class=\"footer-right\">\n <button mjButton\n variant=\"flat\"\n (click)=\"cancel()\"\n [disabled]=\"(isSaving$ | async) || false\">\n Cancel\n </button>\n\n <button mjButton\n variant=\"primary\"\n (click)=\"save()\"\n [disabled]=\"!promptForm.valid || ((isSaving$ | async) || false)\">\n @if (isSaving$ | async) {\n <i class=\"fa-solid fa-spinner fa-spin\"></i>\n Creating...\n } @else {\n <i class=\"fa-solid fa-plus\"></i>\n Create Prompt\n }\n </button>\n </div>\n</div>"]}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { OnInit, OnDestroy, ChangeDetectorRef, ViewContainerRef } from '@angular/core';
|
|
1
|
+
import { OnInit, OnDestroy, ChangeDetectorRef, ViewContainerRef, EventEmitter } from '@angular/core';
|
|
2
2
|
import { FormGroup } from '@angular/forms';
|
|
3
|
-
import { WindowRef } from '@progress/kendo-angular-dialog';
|
|
4
3
|
import { Subject, BehaviorSubject } from 'rxjs';
|
|
5
4
|
import { MJAIAgentTypeEntity, MJAIAgentPromptEntity, MJAIAgentActionEntity, MJActionEntity } from '@memberjunction/core-entities';
|
|
6
5
|
import { AIAgentManagementService } from './ai-agent-management.service';
|
|
@@ -38,7 +37,6 @@ export interface CreateSubAgentResult {
|
|
|
38
37
|
* This ensures atomicity with the parent form's save operation.
|
|
39
38
|
*/
|
|
40
39
|
export declare class CreateSubAgentDialogComponent implements OnInit, OnDestroy {
|
|
41
|
-
private dialogRef;
|
|
42
40
|
private cdr;
|
|
43
41
|
private agentManagementService;
|
|
44
42
|
private viewContainerRef;
|
|
@@ -59,7 +57,8 @@ export declare class CreateSubAgentDialogComponent implements OnInit, OnDestroy
|
|
|
59
57
|
newlyCreatedPrompts: MJAIPromptEntityExtended[];
|
|
60
58
|
newlyCreatedPromptTemplates: any[];
|
|
61
59
|
newlyCreatedTemplateContents: any[];
|
|
62
|
-
|
|
60
|
+
DialogClose: EventEmitter<void>;
|
|
61
|
+
constructor(cdr: ChangeDetectorRef, agentManagementService: AIAgentManagementService, viewContainerRef: ViewContainerRef);
|
|
63
62
|
ngOnInit(): void;
|
|
64
63
|
ngOnDestroy(): void;
|
|
65
64
|
private createForm;
|
|
@@ -79,6 +78,6 @@ export declare class CreateSubAgentDialogComponent implements OnInit, OnDestroy
|
|
|
79
78
|
get linkedPromptCount(): number;
|
|
80
79
|
get linkedActionCount(): number;
|
|
81
80
|
static ɵfac: i0.ɵɵFactoryDeclaration<CreateSubAgentDialogComponent, never>;
|
|
82
|
-
static ɵcmp: i0.ɵɵComponentDeclaration<CreateSubAgentDialogComponent, "mj-create-sub-agent-dialog", never, {}, {}, never, never, false, never>;
|
|
81
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<CreateSubAgentDialogComponent, "mj-create-sub-agent-dialog", never, {}, { "DialogClose": "DialogClose"; }, never, never, false, never>;
|
|
83
82
|
}
|
|
84
83
|
//# sourceMappingURL=create-sub-agent-dialog.component.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-sub-agent-dialog.component.d.ts","sourceRoot":"","sources":["../../../../src/lib/custom/AIAgents/create-sub-agent-dialog.component.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,MAAM,EAAE,SAAS,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"create-sub-agent-dialog.component.d.ts","sourceRoot":"","sources":["../../../../src/lib/custom/AIAgents/create-sub-agent-dialog.component.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,MAAM,EAAE,SAAS,EAAE,iBAAiB,EAAE,gBAAgB,EAAU,YAAY,EAAE,MAAM,eAAe,CAAC;AACxH,OAAO,EAAe,SAAS,EAAc,MAAM,gBAAgB,CAAC;AACpE,OAAO,EAAE,OAAO,EAAE,eAAe,EAAa,MAAM,MAAM,CAAC;AAE3D,OAAO,EAAE,mBAAmB,EAAE,qBAAqB,EAAE,qBAAqB,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAElI,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AACzE,OAAO,EAAE,wBAAwB,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;;AAEjG,MAAM,WAAW,oBAAoB;IACnC,2BAA2B;IAC3B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,qCAAqC;IACrC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,iCAAiC;IACjC,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,uCAAuC;IACvC,aAAa,EAAE,MAAM,CAAC;IACtB,oCAAoC;IACpC,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED,MAAM,WAAW,oBAAoB;IACnC,uDAAuD;IACvD,QAAQ,EAAE,uBAAuB,CAAC;IAClC,yDAAyD;IACzD,YAAY,CAAC,EAAE,qBAAqB,EAAE,CAAC;IACvC,yDAAyD;IACzD,YAAY,CAAC,EAAE,qBAAqB,EAAE,CAAC;IACvC,gDAAgD;IAChD,UAAU,CAAC,EAAE,wBAAwB,EAAE,CAAC;IACxC,yDAAyD;IACzD,kBAAkB,CAAC,EAAE,GAAG,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