@kapeta/local-cluster-service 0.63.1 → 0.64.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/CHANGELOG.md +7 -0
- package/dist/cjs/src/storm/routes.js +3 -3
- package/dist/cjs/src/storm/stormClient.d.ts +7 -3
- package/dist/esm/src/storm/routes.js +3 -3
- package/dist/esm/src/storm/stormClient.d.ts +7 -3
- package/package.json +1 -1
- package/src/storm/routes.ts +14 -7
- package/src/storm/stormClient.ts +8 -3
package/CHANGELOG.md
CHANGED
@@ -1,3 +1,10 @@
|
|
1
|
+
# [0.64.0](https://github.com/kapetacom/local-cluster-service/compare/v0.63.1...v0.64.0) (2024-08-21)
|
2
|
+
|
3
|
+
|
4
|
+
### Features
|
5
|
+
|
6
|
+
* Allow skip prompt improvement ([#220](https://github.com/kapetacom/local-cluster-service/issues/220)) ([f75847c](https://github.com/kapetacom/local-cluster-service/commit/f75847cd10549e730d2ea7efb1caa59ea0610865))
|
7
|
+
|
1
8
|
## [0.63.1](https://github.com/kapetacom/local-cluster-service/compare/v0.63.0...v0.63.1) (2024-08-20)
|
2
9
|
|
3
10
|
|
@@ -107,7 +107,7 @@ router.post('/:handle/ui/iterative', async (req, res) => {
|
|
107
107
|
try {
|
108
108
|
const conversationId = req.headers[stormClient_1.ConversationIdHeader.toLowerCase()];
|
109
109
|
const aiRequest = JSON.parse(req.stringBody ?? '{}');
|
110
|
-
const landingPagesStream = await stormClient_1.stormClient.createUILandingPages(aiRequest
|
110
|
+
const landingPagesStream = await stormClient_1.stormClient.createUILandingPages(aiRequest, conversationId);
|
111
111
|
onRequestAborted(req, res, () => {
|
112
112
|
landingPagesStream.abort();
|
113
113
|
});
|
@@ -180,7 +180,7 @@ router.post('/:handle/ui', async (req, res) => {
|
|
180
180
|
const conversationId = req.headers[stormClient_1.ConversationIdHeader.toLowerCase()];
|
181
181
|
const aiRequest = JSON.parse(req.stringBody ?? '{}');
|
182
182
|
// Get user journeys
|
183
|
-
const userJourneysStream = await stormClient_1.stormClient.createUIUserJourneys(aiRequest
|
183
|
+
const userJourneysStream = await stormClient_1.stormClient.createUIUserJourneys(aiRequest, conversationId);
|
184
184
|
const outerConversationId = userJourneysStream.getConversationId();
|
185
185
|
onRequestAborted(req, res, () => {
|
186
186
|
userJourneysStream.abort();
|
@@ -365,7 +365,7 @@ router.post('/:handle/all', async (req, res) => {
|
|
365
365
|
const eventParser = new event_parser_1.StormEventParser(stormOptions);
|
366
366
|
const conversationId = req.headers[stormClient_1.ConversationIdHeader.toLowerCase()];
|
367
367
|
const aiRequest = JSON.parse(req.stringBody ?? '{}');
|
368
|
-
const metaStream = await stormClient_1.stormClient.createMetadata(aiRequest
|
368
|
+
const metaStream = await stormClient_1.stormClient.createMetadata(aiRequest, conversationId);
|
369
369
|
onRequestAborted(req, res, () => {
|
370
370
|
metaStream.abort();
|
371
371
|
});
|
@@ -38,16 +38,20 @@ export interface UIPageEditRequest {
|
|
38
38
|
pages: StormEventPageUrl['payload'][];
|
39
39
|
prompt: string;
|
40
40
|
}
|
41
|
+
export interface BasePromptRequest {
|
42
|
+
prompt: string;
|
43
|
+
skipImprovement?: boolean;
|
44
|
+
}
|
41
45
|
declare class StormClient {
|
42
46
|
private readonly _baseUrl;
|
43
47
|
constructor();
|
44
48
|
private createOptions;
|
45
49
|
private send;
|
46
|
-
createMetadata(prompt:
|
50
|
+
createMetadata(prompt: BasePromptRequest, conversationId?: string): Promise<StormStream>;
|
47
51
|
createUIPages(prompt: string, conversationId?: string): Promise<StormStream>;
|
48
|
-
createUIUserJourneys(prompt:
|
52
|
+
createUIUserJourneys(prompt: BasePromptRequest, conversationId?: string): Promise<StormStream>;
|
49
53
|
createUIShells(prompt: UIShellsPrompt, conversationId?: string): Promise<StormStream>;
|
50
|
-
createUILandingPages(prompt:
|
54
|
+
createUILandingPages(prompt: BasePromptRequest, conversationId?: string): Promise<StormStream>;
|
51
55
|
createUIPage(prompt: UIPagePrompt, conversationId?: string, history?: ConversationItem[]): Promise<StormStream>;
|
52
56
|
classifyUIReferences(prompt: string, conversationId?: string): Promise<StormStream>;
|
53
57
|
editPages(prompt: UIPageEditPrompt, conversationId?: string): Promise<StormStream>;
|
@@ -107,7 +107,7 @@ router.post('/:handle/ui/iterative', async (req, res) => {
|
|
107
107
|
try {
|
108
108
|
const conversationId = req.headers[stormClient_1.ConversationIdHeader.toLowerCase()];
|
109
109
|
const aiRequest = JSON.parse(req.stringBody ?? '{}');
|
110
|
-
const landingPagesStream = await stormClient_1.stormClient.createUILandingPages(aiRequest
|
110
|
+
const landingPagesStream = await stormClient_1.stormClient.createUILandingPages(aiRequest, conversationId);
|
111
111
|
onRequestAborted(req, res, () => {
|
112
112
|
landingPagesStream.abort();
|
113
113
|
});
|
@@ -180,7 +180,7 @@ router.post('/:handle/ui', async (req, res) => {
|
|
180
180
|
const conversationId = req.headers[stormClient_1.ConversationIdHeader.toLowerCase()];
|
181
181
|
const aiRequest = JSON.parse(req.stringBody ?? '{}');
|
182
182
|
// Get user journeys
|
183
|
-
const userJourneysStream = await stormClient_1.stormClient.createUIUserJourneys(aiRequest
|
183
|
+
const userJourneysStream = await stormClient_1.stormClient.createUIUserJourneys(aiRequest, conversationId);
|
184
184
|
const outerConversationId = userJourneysStream.getConversationId();
|
185
185
|
onRequestAborted(req, res, () => {
|
186
186
|
userJourneysStream.abort();
|
@@ -365,7 +365,7 @@ router.post('/:handle/all', async (req, res) => {
|
|
365
365
|
const eventParser = new event_parser_1.StormEventParser(stormOptions);
|
366
366
|
const conversationId = req.headers[stormClient_1.ConversationIdHeader.toLowerCase()];
|
367
367
|
const aiRequest = JSON.parse(req.stringBody ?? '{}');
|
368
|
-
const metaStream = await stormClient_1.stormClient.createMetadata(aiRequest
|
368
|
+
const metaStream = await stormClient_1.stormClient.createMetadata(aiRequest, conversationId);
|
369
369
|
onRequestAborted(req, res, () => {
|
370
370
|
metaStream.abort();
|
371
371
|
});
|
@@ -38,16 +38,20 @@ export interface UIPageEditRequest {
|
|
38
38
|
pages: StormEventPageUrl['payload'][];
|
39
39
|
prompt: string;
|
40
40
|
}
|
41
|
+
export interface BasePromptRequest {
|
42
|
+
prompt: string;
|
43
|
+
skipImprovement?: boolean;
|
44
|
+
}
|
41
45
|
declare class StormClient {
|
42
46
|
private readonly _baseUrl;
|
43
47
|
constructor();
|
44
48
|
private createOptions;
|
45
49
|
private send;
|
46
|
-
createMetadata(prompt:
|
50
|
+
createMetadata(prompt: BasePromptRequest, conversationId?: string): Promise<StormStream>;
|
47
51
|
createUIPages(prompt: string, conversationId?: string): Promise<StormStream>;
|
48
|
-
createUIUserJourneys(prompt:
|
52
|
+
createUIUserJourneys(prompt: BasePromptRequest, conversationId?: string): Promise<StormStream>;
|
49
53
|
createUIShells(prompt: UIShellsPrompt, conversationId?: string): Promise<StormStream>;
|
50
|
-
createUILandingPages(prompt:
|
54
|
+
createUILandingPages(prompt: BasePromptRequest, conversationId?: string): Promise<StormStream>;
|
51
55
|
createUIPage(prompt: UIPagePrompt, conversationId?: string, history?: ConversationItem[]): Promise<StormStream>;
|
52
56
|
classifyUIReferences(prompt: string, conversationId?: string): Promise<StormStream>;
|
53
57
|
editPages(prompt: UIPageEditPrompt, conversationId?: string): Promise<StormStream>;
|
package/package.json
CHANGED
package/src/storm/routes.ts
CHANGED
@@ -13,7 +13,14 @@ import { stringBody } from '../middleware/stringBody';
|
|
13
13
|
import { KapetaBodyRequest } from '../types';
|
14
14
|
import { StormCodegenRequest, StormContextRequest, StormCreateBlockRequest, StormStream } from './stream';
|
15
15
|
|
16
|
-
import {
|
16
|
+
import {
|
17
|
+
ConversationIdHeader,
|
18
|
+
stormClient,
|
19
|
+
UIPagePrompt,
|
20
|
+
UIPageEditPrompt,
|
21
|
+
UIPageEditRequest,
|
22
|
+
BasePromptRequest,
|
23
|
+
} from './stormClient';
|
17
24
|
import { Page, StormEvent, StormEventPage, StormEventPhaseType, UserJourneyScreen } from './events';
|
18
25
|
|
19
26
|
import {
|
@@ -132,9 +139,9 @@ router.post('/:handle/ui/iterative', async (req: KapetaBodyRequest, res: Respons
|
|
132
139
|
try {
|
133
140
|
const conversationId = req.headers[ConversationIdHeader.toLowerCase()] as string | undefined;
|
134
141
|
|
135
|
-
const aiRequest:
|
142
|
+
const aiRequest: BasePromptRequest = JSON.parse(req.stringBody ?? '{}');
|
136
143
|
|
137
|
-
const landingPagesStream = await stormClient.createUILandingPages(aiRequest
|
144
|
+
const landingPagesStream = await stormClient.createUILandingPages(aiRequest, conversationId);
|
138
145
|
|
139
146
|
onRequestAborted(req, res, () => {
|
140
147
|
landingPagesStream.abort();
|
@@ -219,10 +226,10 @@ router.post('/:handle/ui', async (req: KapetaBodyRequest, res: Response) => {
|
|
219
226
|
try {
|
220
227
|
const conversationId = req.headers[ConversationIdHeader.toLowerCase()] as string | undefined;
|
221
228
|
|
222
|
-
const aiRequest:
|
229
|
+
const aiRequest: BasePromptRequest = JSON.parse(req.stringBody ?? '{}');
|
223
230
|
|
224
231
|
// Get user journeys
|
225
|
-
const userJourneysStream = await stormClient.createUIUserJourneys(aiRequest
|
232
|
+
const userJourneysStream = await stormClient.createUIUserJourneys(aiRequest, conversationId);
|
226
233
|
const outerConversationId = userJourneysStream.getConversationId();
|
227
234
|
|
228
235
|
onRequestAborted(req, res, () => {
|
@@ -450,8 +457,8 @@ router.post('/:handle/all', async (req: KapetaBodyRequest, res: Response) => {
|
|
450
457
|
|
451
458
|
const conversationId = req.headers[ConversationIdHeader.toLowerCase()] as string | undefined;
|
452
459
|
|
453
|
-
const aiRequest:
|
454
|
-
const metaStream = await stormClient.createMetadata(aiRequest
|
460
|
+
const aiRequest: BasePromptRequest = JSON.parse(req.stringBody ?? '{}');
|
461
|
+
const metaStream = await stormClient.createMetadata(aiRequest, conversationId);
|
455
462
|
|
456
463
|
onRequestAborted(req, res, () => {
|
457
464
|
metaStream.abort();
|
package/src/storm/stormClient.ts
CHANGED
@@ -62,6 +62,11 @@ export interface UIPageEditRequest {
|
|
62
62
|
prompt: string;
|
63
63
|
}
|
64
64
|
|
65
|
+
export interface BasePromptRequest {
|
66
|
+
prompt: string;
|
67
|
+
skipImprovement?: boolean;
|
68
|
+
}
|
69
|
+
|
65
70
|
class StormClient {
|
66
71
|
private readonly _baseUrl: string;
|
67
72
|
|
@@ -148,7 +153,7 @@ class StormClient {
|
|
148
153
|
return out;
|
149
154
|
}
|
150
155
|
|
151
|
-
public createMetadata(prompt:
|
156
|
+
public createMetadata(prompt: BasePromptRequest, conversationId?: string) {
|
152
157
|
return this.send('/v2/all', {
|
153
158
|
prompt: prompt,
|
154
159
|
conversationId,
|
@@ -162,7 +167,7 @@ class StormClient {
|
|
162
167
|
});
|
163
168
|
}
|
164
169
|
|
165
|
-
public createUIUserJourneys(prompt:
|
170
|
+
public createUIUserJourneys(prompt: BasePromptRequest, conversationId?: string) {
|
166
171
|
return this.send('/v2/ui/user-journeys', {
|
167
172
|
prompt: prompt,
|
168
173
|
conversationId,
|
@@ -175,7 +180,7 @@ class StormClient {
|
|
175
180
|
});
|
176
181
|
}
|
177
182
|
|
178
|
-
public createUILandingPages(prompt:
|
183
|
+
public createUILandingPages(prompt: BasePromptRequest, conversationId?: string) {
|
179
184
|
return this.send('/v2/ui/landing-pages', {
|
180
185
|
prompt: prompt,
|
181
186
|
conversationId,
|