@alpaca-editor/core 1.0.4013 → 1.0.4015
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/components/ui/popover.js +6 -3
- package/dist/components/ui/popover.js.map +1 -1
- package/dist/editor/Terminal.d.ts +6 -0
- package/dist/editor/Terminal.js +10 -4
- package/dist/editor/Terminal.js.map +1 -1
- package/dist/editor/ai/Agents.js +133 -13
- package/dist/editor/ai/Agents.js.map +1 -1
- package/dist/editor/ai/AiTerminal.d.ts +2 -1
- package/dist/editor/ai/AiTerminal.js +86 -139
- package/dist/editor/ai/AiTerminal.js.map +1 -1
- package/dist/editor/media-selector/AiImageSearch.js +2 -1
- package/dist/editor/media-selector/AiImageSearch.js.map +1 -1
- package/dist/editor/media-selector/AiImageSearchPrompt.js +2 -1
- package/dist/editor/media-selector/AiImageSearchPrompt.js.map +1 -1
- package/dist/editor/page-editor-chrome/useInlineAICompletion.js +4 -2
- package/dist/editor/page-editor-chrome/useInlineAICompletion.js.map +1 -1
- package/dist/editor/services/agentService.d.ts +59 -0
- package/dist/editor/services/agentService.js +26 -0
- package/dist/editor/services/agentService.js.map +1 -0
- package/dist/editor/services/aiService.d.ts +22 -4
- package/dist/editor/services/aiService.js +131 -20
- package/dist/editor/services/aiService.js.map +1 -1
- package/dist/editor/services/contextService.js +6 -4
- package/dist/editor/services/contextService.js.map +1 -1
- package/dist/editor/sidebar/SidebarView.js +2 -5
- package/dist/editor/sidebar/SidebarView.js.map +1 -1
- package/dist/editor/sidebar/ViewSelector.js +1 -1
- package/dist/editor/sidebar/ViewSelector.js.map +1 -1
- package/dist/editor/ui/SimpleIconButton.d.ts +2 -2
- package/dist/editor/ui/SimpleIconButton.js +5 -3
- package/dist/editor/ui/SimpleIconButton.js.map +1 -1
- package/dist/editor/utils/jsonCleaner.d.ts +8 -0
- package/dist/editor/utils/jsonCleaner.js +76 -0
- package/dist/editor/utils/jsonCleaner.js.map +1 -0
- package/dist/editor/views/CompareView.js +2 -2
- package/dist/editor/views/CompareView.js.map +1 -1
- package/dist/page-wizard/steps/ContentStep.js +7 -2
- package/dist/page-wizard/steps/ContentStep.js.map +1 -1
- package/dist/page-wizard/steps/FindItemsStep.js +4 -1
- package/dist/page-wizard/steps/FindItemsStep.js.map +1 -1
- package/dist/page-wizard/steps/ImagesStep.js +13 -7
- package/dist/page-wizard/steps/ImagesStep.js.map +1 -1
- package/dist/page-wizard/steps/LayoutStep.d.ts +1 -1
- package/dist/page-wizard/steps/LayoutStep.js +22 -20
- package/dist/page-wizard/steps/LayoutStep.js.map +1 -1
- package/dist/page-wizard/steps/MetaDataStep.js +8 -15
- package/dist/page-wizard/steps/MetaDataStep.js.map +1 -1
- package/dist/page-wizard/steps/SelectStep.js +9 -4
- package/dist/page-wizard/steps/SelectStep.js.map +1 -1
- package/dist/page-wizard/steps/StructureStep.js +3 -1
- package/dist/page-wizard/steps/StructureStep.js.map +1 -1
- package/dist/revision.d.ts +2 -2
- package/dist/revision.js +2 -2
- package/dist/styles.css +10 -11
- package/package.json +1 -1
- package/src/components/ui/popover.tsx +6 -3
- package/src/editor/Terminal.tsx +12 -3
- package/src/editor/ai/Agents.tsx +212 -16
- package/src/editor/ai/AiTerminal.tsx +113 -173
- package/src/editor/ai/GhostWriter.tsx_ +3 -3
- package/src/editor/media-selector/AiImageSearch.tsx +2 -2
- package/src/editor/media-selector/AiImageSearchPrompt.tsx +2 -2
- package/src/editor/page-editor-chrome/useInlineAICompletion.tsx +5 -5
- package/src/editor/services/agentService.ts +83 -0
- package/src/editor/services/aiService.ts +176 -33
- package/src/editor/services/contextService.ts +5 -6
- package/src/editor/sidebar/SidebarView.tsx +10 -6
- package/src/editor/sidebar/ViewSelector.tsx +2 -2
- package/src/editor/ui/SimpleIconButton.tsx +20 -14
- package/src/editor/utils/jsonCleaner.ts +92 -0
- package/src/editor/views/CompareView.tsx +2 -2
- package/src/page-wizard/steps/ContentStep.tsx +10 -9
- package/src/page-wizard/steps/FindItemsStep.tsx +7 -5
- package/src/page-wizard/steps/ImagesStep.tsx +16 -11
- package/src/page-wizard/steps/LayoutStep.tsx +24 -28
- package/src/page-wizard/steps/MetaDataStep.tsx +11 -21
- package/src/page-wizard/steps/SelectStep.tsx +11 -8
- package/src/page-wizard/steps/StructureStep.tsx +4 -5
- package/src/revision.ts +2 -2
|
@@ -18,6 +18,7 @@ export function LayoutStep({
|
|
|
18
18
|
setStepCompleted,
|
|
19
19
|
internalState,
|
|
20
20
|
setInternalState,
|
|
21
|
+
setPageModel, // Add missing prop
|
|
21
22
|
}: StepComponentProps) {
|
|
22
23
|
const editContext = useEditContext();
|
|
23
24
|
const abortController = new AbortController();
|
|
@@ -66,31 +67,31 @@ export function LayoutStep({
|
|
|
66
67
|
const result = await executePrompt(
|
|
67
68
|
[
|
|
68
69
|
{
|
|
69
|
-
content: `${customInstructions?.trim()} Reply with a json object of type PageModel = { name: string; metaDescription: string; components: Component[]; message: string; };
|
|
70
|
-
Component = {
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
70
|
+
content: `${customInstructions?.trim()} Reply with a json object of type PageModel = { name: string; metaDescription: string; components: Component[]; message: string; };
|
|
71
|
+
Where components are of type Component = { id: string; name: string; fields: FieldDefinition[]; styles: string; };
|
|
72
|
+
And fields are of type FieldDefinition = { name: string; type: string; value: string; };
|
|
73
|
+
|
|
74
|
+
Input data: ${JSON.stringify(data)}
|
|
75
|
+
|
|
76
|
+
Types: Row: Use this to group components horizontally. Section: Use this to group components with a background color or spacing. Title: Use for titles and headings. Text: Use for general text content. Quote: Use for quotes and callouts. Image: Use for images and media. TeaserList: Use for lists of items with images and descriptions. Test: Component for testing and prototyping.
|
|
77
|
+
|
|
78
|
+
Component Guidelines:
|
|
79
|
+
- Use Row components to group related content horizontally
|
|
80
|
+
- Use Section components as containers for logical page sections
|
|
81
|
+
- Populate all required fields with realistic content
|
|
82
|
+
- Use appropriate HTML structure within styles
|
|
83
|
+
- Make the content relevant to: ${JSON.stringify(data)}
|
|
84
|
+
|
|
85
|
+
Please create a well-structured page layout with proper content hierarchy.`,
|
|
84
86
|
name: "system",
|
|
85
87
|
role: "system",
|
|
88
|
+
id: crypto.randomUUID(), // Use proper UUID instead of Date.now()
|
|
86
89
|
},
|
|
87
90
|
],
|
|
88
|
-
editContext,
|
|
89
|
-
|
|
90
|
-
{},
|
|
91
|
-
|
|
92
|
-
"gpt-4.1",
|
|
93
|
-
(response) => {
|
|
91
|
+
{ editContext, createAiContext: createWizardAiContext },
|
|
92
|
+
{ model: "gpt-4.1" },
|
|
93
|
+
{ signal: abortController.signal },
|
|
94
|
+
(response: any) => {
|
|
94
95
|
try {
|
|
95
96
|
// Handle streaming response - might have different structure during streaming
|
|
96
97
|
const content =
|
|
@@ -99,14 +100,9 @@ export function LayoutStep({
|
|
|
99
100
|
if (content) {
|
|
100
101
|
const newLayout = JSON.parse(content) as WizardPageModel;
|
|
101
102
|
|
|
102
|
-
if (newLayout) {
|
|
103
|
-
|
|
104
|
-
...prev,
|
|
105
|
-
pageModel: newLayout,
|
|
106
|
-
}));
|
|
103
|
+
if (newLayout && setPageModel) {
|
|
104
|
+
setPageModel(newLayout);
|
|
107
105
|
}
|
|
108
|
-
|
|
109
|
-
setMessage(newLayout.message);
|
|
110
106
|
}
|
|
111
107
|
} catch (parseError: unknown) {}
|
|
112
108
|
},
|
|
@@ -60,33 +60,23 @@ export function MetaDataStep({
|
|
|
60
60
|
const result = await executePrompt(
|
|
61
61
|
[
|
|
62
62
|
{
|
|
63
|
-
content: `${metaInstructions?.trim()} Reply with a json object of type PageModel = { metaDescription: string; metaKeywords: string; };
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
Input data: ${JSON.stringify(data)}`,
|
|
63
|
+
content: `${metaInstructions?.trim()} Reply with a json object of type PageModel = { metaDescription: string; metaKeywords: string; };
|
|
64
|
+
The language of the page is ${parentItem?.language || "en"}.
|
|
65
|
+
Input data: ${JSON.stringify(data)}`,
|
|
67
66
|
name: "system",
|
|
68
67
|
role: "system",
|
|
68
|
+
id: crypto.randomUUID(), // Use proper UUID instead of Date.now()
|
|
69
69
|
},
|
|
70
70
|
],
|
|
71
|
-
editContext,
|
|
72
|
-
|
|
73
|
-
{},
|
|
71
|
+
{ editContext, createAiContext: createWizardAiContext },
|
|
72
|
+
{ model: "gpt-4.1" },
|
|
74
73
|
{ signal: abortController.signal },
|
|
75
|
-
|
|
76
|
-
(response) => {
|
|
74
|
+
(response: any) => {
|
|
77
75
|
try {
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
if (content) {
|
|
83
|
-
const newLayout = JSON.parse(content) as WizardPageModel;
|
|
84
|
-
|
|
85
|
-
setPageModel({
|
|
86
|
-
...pageModel,
|
|
87
|
-
metaDescription: newLayout.metaDescription,
|
|
88
|
-
metaKeywords: newLayout.metaKeywords,
|
|
89
|
-
});
|
|
76
|
+
const newLayout = JSON.parse(response.content) as WizardPageModel;
|
|
77
|
+
|
|
78
|
+
if (newLayout && setPageModel) {
|
|
79
|
+
setPageModel(newLayout);
|
|
90
80
|
}
|
|
91
81
|
} catch (parseError: unknown) {}
|
|
92
82
|
},
|
|
@@ -92,27 +92,30 @@ export function SelectStep({
|
|
|
92
92
|
)}`;
|
|
93
93
|
|
|
94
94
|
// Call the executePrompt function with the prompt
|
|
95
|
+
const abortController = new AbortController();
|
|
95
96
|
const result = await executePrompt(
|
|
96
97
|
[
|
|
97
98
|
{
|
|
98
99
|
content: `You are a helpful assistant that generates options for a wizard select step.
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
100
|
+
|
|
101
|
+
Return a JSON array of objects with the following structure:
|
|
102
|
+
[{ "value": "option_value", "label": "Option Label", "description": "Brief description" }]
|
|
103
|
+
|
|
104
|
+
Create ${step.fields.numberOfOptions || 5} relevant options.`,
|
|
102
105
|
name: "system",
|
|
103
106
|
role: "system",
|
|
107
|
+
id: crypto.randomUUID(), // Use proper UUID instead of Date.now()
|
|
104
108
|
},
|
|
105
109
|
{
|
|
106
110
|
content: prompt,
|
|
107
111
|
name: "user",
|
|
108
112
|
role: "user",
|
|
113
|
+
id: crypto.randomUUID(), // Use proper UUID instead of Date.now()
|
|
109
114
|
},
|
|
110
115
|
],
|
|
111
|
-
editContext,
|
|
112
|
-
|
|
113
|
-
{
|
|
114
|
-
undefined,
|
|
115
|
-
step.fields.aiModel || "gpt-4.1",
|
|
116
|
+
{ editContext, createAiContext: createWizardAiContext },
|
|
117
|
+
{ model: step.fields.aiModel || "gpt-4.1" },
|
|
118
|
+
{ signal: abortController.signal },
|
|
116
119
|
);
|
|
117
120
|
|
|
118
121
|
// Parse the result and set options
|
|
@@ -130,18 +130,17 @@ ${JSON.stringify(data)}`;
|
|
|
130
130
|
content: `You are an expert content strategist helping to structure content. Return ONLY a valid JSON array with section objects in this exact format: {sections: [{type: string, content: string, description: string}] }`,
|
|
131
131
|
name: "system",
|
|
132
132
|
role: "system",
|
|
133
|
+
id: crypto.randomUUID(), // Use proper UUID instead of Date.now()
|
|
133
134
|
},
|
|
134
135
|
{
|
|
135
136
|
content: basePrompt,
|
|
136
137
|
name: "user",
|
|
137
138
|
role: "user",
|
|
139
|
+
id: crypto.randomUUID(), // Use proper UUID instead of Date.now()
|
|
138
140
|
},
|
|
139
141
|
],
|
|
140
|
-
editContext,
|
|
141
|
-
|
|
142
|
-
{ allowedFunctions: [] },
|
|
143
|
-
undefined,
|
|
144
|
-
step.fields.aiModel || "gpt-4.1",
|
|
142
|
+
{ editContext, createAiContext: createWizardAiContext },
|
|
143
|
+
{ allowedFunctions: [], model: step.fields.aiModel || "gpt-4.1" },
|
|
145
144
|
);
|
|
146
145
|
|
|
147
146
|
console.log("AI RESULT: ", result);
|
package/src/revision.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export const version = "1.0.
|
|
2
|
-
export const buildDate = "2025-07-
|
|
1
|
+
export const version = "1.0.4015";
|
|
2
|
+
export const buildDate = "2025-07-24 09:45:13";
|