@alpaca-editor/core 1.0.4174 → 1.0.4177
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/agents-view/AgentsView.js +0 -20
- package/dist/agents-view/AgentsView.js.map +1 -1
- package/dist/editor/QuickItemSwitcher.js +5 -1
- package/dist/editor/QuickItemSwitcher.js.map +1 -1
- package/dist/editor/ai/AgentTerminal.js +47 -83
- package/dist/editor/ai/AgentTerminal.js.map +1 -1
- package/dist/editor/ai/Agents.js +7 -5
- package/dist/editor/ai/Agents.js.map +1 -1
- package/dist/editor/ai/AiResponseMessage.js +1 -1
- package/dist/editor/ai/AiResponseMessage.js.map +1 -1
- package/dist/editor/ai/ContextInfoBar.js +30 -64
- package/dist/editor/ai/ContextInfoBar.js.map +1 -1
- package/dist/editor/ai/useAgentStatus.js +81 -2
- package/dist/editor/ai/useAgentStatus.js.map +1 -1
- package/dist/editor/client/EditorShell.js +44 -7
- package/dist/editor/client/EditorShell.js.map +1 -1
- package/dist/editor/client/operations.js +30 -3
- package/dist/editor/client/operations.js.map +1 -1
- package/dist/editor/control-center/WebSocketMessages.js +0 -1
- package/dist/editor/control-center/WebSocketMessages.js.map +1 -1
- package/dist/editor/page-viewer/PageViewerFrame.js +14 -3
- package/dist/editor/page-viewer/PageViewerFrame.js.map +1 -1
- package/dist/editor/reviews/commentAi.js +43 -32
- package/dist/editor/reviews/commentAi.js.map +1 -1
- package/dist/editor/services/agentService.d.ts +8 -4
- package/dist/editor/services/agentService.js +30 -53
- package/dist/editor/services/agentService.js.map +1 -1
- package/dist/editor/services/aiService.d.ts +19 -1
- package/dist/editor/services/aiService.js +78 -2
- package/dist/editor/services/aiService.js.map +1 -1
- package/dist/page-wizard/steps/ContentStep.js +35 -57
- package/dist/page-wizard/steps/ContentStep.js.map +1 -1
- package/dist/page-wizard/steps/MetaDataStep.js +14 -23
- package/dist/page-wizard/steps/MetaDataStep.js.map +1 -1
- package/dist/page-wizard/steps/SelectStep.js +12 -42
- package/dist/page-wizard/steps/SelectStep.js.map +1 -1
- package/dist/revision.d.ts +2 -2
- package/dist/revision.js +2 -2
- package/dist/styles.css +0 -8
- package/package.json +1 -1
- package/src/agents-view/AgentsView.tsx +1 -21
- package/src/editor/QuickItemSwitcher.tsx +23 -19
- package/src/editor/ai/AgentTerminal.tsx +83 -142
- package/src/editor/ai/Agents.tsx +9 -6
- package/src/editor/ai/AiResponseMessage.tsx +5 -1
- package/src/editor/ai/ContextInfoBar.tsx +34 -75
- package/src/editor/ai/useAgentStatus.ts +82 -4
- package/src/editor/client/EditorShell.tsx +62 -9
- package/src/editor/client/operations.ts +42 -4
- package/src/editor/control-center/WebSocketMessages.tsx +5 -1
- package/src/editor/page-viewer/PageViewerFrame.tsx +15 -2
- package/src/editor/reviews/commentAi.ts +48 -36
- package/src/editor/services/agentService.ts +38 -55
- package/src/editor/services/aiService.ts +110 -3
- package/src/page-wizard/steps/ContentStep.tsx +51 -81
- package/src/page-wizard/steps/MetaDataStep.tsx +52 -60
- package/src/page-wizard/steps/SelectStep.tsx +13 -51
- package/src/revision.ts +2 -2
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { useState, useEffect } from "react";
|
|
2
2
|
import { WizardData } from "../PageWizard";
|
|
3
3
|
import { useEditContext } from "../../editor/client/editContext";
|
|
4
|
-
import {
|
|
4
|
+
import { executePromptWithJsonResult } from "../../editor/services/aiService";
|
|
5
5
|
import { createWizardAiContext } from "../service";
|
|
6
6
|
import { cn } from "../../lib/utils";
|
|
7
7
|
import { Textarea } from "../../components/ui/textarea";
|
|
@@ -123,15 +123,15 @@ export function SelectStep({
|
|
|
123
123
|
2,
|
|
124
124
|
)}`;
|
|
125
125
|
|
|
126
|
-
// Call the
|
|
126
|
+
// Call the executePromptWithJsonResult function with the prompt
|
|
127
127
|
const abortController = new AbortController();
|
|
128
|
-
const
|
|
128
|
+
const options = await executePromptWithJsonResult<Option[]>(
|
|
129
129
|
[
|
|
130
130
|
{
|
|
131
131
|
content: `You are a helpful assistant that generates options for a wizard select step.
|
|
132
132
|
|
|
133
133
|
Return a JSON array of objects with the following structure:
|
|
134
|
-
[{ "value": "option_value", "label": "Option Label", "description": "Brief description" }]
|
|
134
|
+
[{ "value": "option_value", "label": "Option Label", "description": "Brief description", id: "unique_id" }]
|
|
135
135
|
|
|
136
136
|
Create ${step.fields.numberOfOptions || 5} relevant options.`,
|
|
137
137
|
name: "system",
|
|
@@ -150,54 +150,16 @@ Create ${step.fields.numberOfOptions || 5} relevant options.`,
|
|
|
150
150
|
{ signal: abortController.signal },
|
|
151
151
|
);
|
|
152
152
|
|
|
153
|
-
//
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
const optionsArray: any[] = Array.isArray(parsed)
|
|
160
|
-
? parsed
|
|
161
|
-
: Array.isArray(parsed?.options)
|
|
162
|
-
? parsed.options
|
|
163
|
-
: [];
|
|
164
|
-
|
|
165
|
-
if (!Array.isArray(optionsArray) || optionsArray.length === 0) {
|
|
166
|
-
throw new Error("Parsed response did not contain any options");
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
const normalizedOptions: Option[] = optionsArray.map(
|
|
170
|
-
(opt: any, index: number) => ({
|
|
171
|
-
id: String(opt?.id ?? opt?.value ?? index),
|
|
172
|
-
title: String(
|
|
173
|
-
opt?.title ??
|
|
174
|
-
opt?.label ??
|
|
175
|
-
opt?.name ??
|
|
176
|
-
`Option ${index + 1}`,
|
|
177
|
-
),
|
|
178
|
-
description: String(
|
|
179
|
-
opt?.description ?? opt?.details ?? opt?.summary ?? "",
|
|
180
|
-
),
|
|
181
|
-
}),
|
|
182
|
-
);
|
|
183
|
-
|
|
184
|
-
setOptions(normalizedOptions);
|
|
185
|
-
setInternalState((state: any) => ({
|
|
186
|
-
...state,
|
|
187
|
-
[step.id + "options"]: normalizedOptions,
|
|
188
|
-
}));
|
|
189
|
-
}
|
|
190
|
-
} catch (parseError) {
|
|
191
|
-
console.error("Error parsing options:", parseError);
|
|
192
|
-
setError(
|
|
193
|
-
"Failed to parse options. The response was not in the expected format.",
|
|
194
|
-
);
|
|
195
|
-
}
|
|
196
|
-
} else {
|
|
197
|
-
setError("No options were generated. Please try again.");
|
|
198
|
-
}
|
|
153
|
+
// Set the parsed options
|
|
154
|
+
setOptions(options);
|
|
155
|
+
setInternalState((state: any) => ({
|
|
156
|
+
...state,
|
|
157
|
+
[step.id + "options"]: options,
|
|
158
|
+
}));
|
|
199
159
|
} catch (err) {
|
|
200
|
-
|
|
160
|
+
const errorMessage =
|
|
161
|
+
err instanceof Error ? err.message : "Failed to generate options.";
|
|
162
|
+
setError(errorMessage);
|
|
201
163
|
console.error("Error generating options:", err);
|
|
202
164
|
} finally {
|
|
203
165
|
setLoading(false);
|
package/src/revision.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export const version = "1.0.
|
|
2
|
-
export const buildDate = "2025-10-21
|
|
1
|
+
export const version = "1.0.4177";
|
|
2
|
+
export const buildDate = "2025-10-21 14:56:45";
|