@sqlrooms/ai-config 0.26.0-rc.2 → 0.26.0-rc.3

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.
Files changed (35) hide show
  1. package/dist/AiSettingsSliceConfig.d.ts +5 -69
  2. package/dist/AiSettingsSliceConfig.d.ts.map +1 -1
  3. package/dist/AiSliceConfig.d.ts +120 -329
  4. package/dist/AiSliceConfig.d.ts.map +1 -1
  5. package/dist/AiSliceConfig.js +4 -1
  6. package/dist/AiSliceConfig.js.map +1 -1
  7. package/dist/index.d.ts +2 -1
  8. package/dist/index.d.ts.map +1 -1
  9. package/dist/index.js +1 -1
  10. package/dist/index.js.map +1 -1
  11. package/dist/migration/AnalysisSession-v0.24.14.d.ts +48 -0
  12. package/dist/migration/AnalysisSession-v0.24.14.d.ts.map +1 -0
  13. package/dist/migration/AnalysisSession-v0.24.14.js +59 -0
  14. package/dist/migration/AnalysisSession-v0.24.14.js.map +1 -0
  15. package/dist/migration/AnalysisSession-v0.25.0.d.ts +86 -0
  16. package/dist/migration/AnalysisSession-v0.25.0.d.ts.map +1 -0
  17. package/dist/migration/AnalysisSession-v0.25.0.js +182 -0
  18. package/dist/migration/AnalysisSession-v0.25.0.js.map +1 -0
  19. package/dist/migration/AnalysisSession-v0.26.0.d.ts +61 -0
  20. package/dist/migration/AnalysisSession-v0.26.0.d.ts.map +1 -0
  21. package/dist/migration/AnalysisSession-v0.26.0.js +150 -0
  22. package/dist/migration/AnalysisSession-v0.26.0.js.map +1 -0
  23. package/dist/schema/AnalysisSessionSchema.d.ts +147 -0
  24. package/dist/schema/AnalysisSessionSchema.d.ts.map +1 -0
  25. package/dist/schema/AnalysisSessionSchema.js +50 -0
  26. package/dist/schema/AnalysisSessionSchema.js.map +1 -0
  27. package/dist/schema/UIMessageSchema.d.ts +252 -0
  28. package/dist/schema/UIMessageSchema.d.ts.map +1 -0
  29. package/dist/schema/UIMessageSchema.js +138 -0
  30. package/dist/schema/UIMessageSchema.js.map +1 -0
  31. package/package.json +3 -4
  32. package/dist/AnalysisSessionSchema.d.ts +0 -498
  33. package/dist/AnalysisSessionSchema.d.ts.map +0 -1
  34. package/dist/AnalysisSessionSchema.js +0 -88
  35. package/dist/AnalysisSessionSchema.js.map +0 -1
@@ -1,498 +0,0 @@
1
- import { z } from 'zod';
2
- export declare const ErrorMessageSchema: z.ZodObject<{
3
- error: z.ZodString;
4
- }, "strip", z.ZodTypeAny, {
5
- error: string;
6
- }, {
7
- error: string;
8
- }>;
9
- export type ErrorMessageSchema = z.infer<typeof ErrorMessageSchema>;
10
- export declare const AnalysisResultSchema: z.ZodObject<{
11
- id: z.ZodString;
12
- prompt: z.ZodString;
13
- streamMessage: z.ZodEffects<z.ZodObject<{
14
- parts: z.ZodOptional<z.ZodArray<z.ZodUnion<[z.ZodObject<{
15
- type: z.ZodLiteral<"text">;
16
- text: z.ZodString;
17
- additionalData: z.ZodOptional<z.ZodAny>;
18
- isCompleted: z.ZodOptional<z.ZodBoolean>;
19
- }, "strip", z.ZodTypeAny, {
20
- type: "text";
21
- text: string;
22
- isCompleted?: boolean | undefined;
23
- additionalData?: any;
24
- }, {
25
- type: "text";
26
- text: string;
27
- isCompleted?: boolean | undefined;
28
- additionalData?: any;
29
- }>, z.ZodObject<{
30
- type: z.ZodLiteral<"tool-invocation">;
31
- toolInvocation: z.ZodObject<{
32
- toolCallId: z.ZodString;
33
- toolName: z.ZodString;
34
- args: z.ZodAny;
35
- state: z.ZodString;
36
- result: z.ZodOptional<z.ZodAny>;
37
- }, "strip", z.ZodTypeAny, {
38
- toolName: string;
39
- toolCallId: string;
40
- state: string;
41
- args?: any;
42
- result?: any;
43
- }, {
44
- toolName: string;
45
- toolCallId: string;
46
- state: string;
47
- args?: any;
48
- result?: any;
49
- }>;
50
- additionalData: z.ZodOptional<z.ZodAny>;
51
- isCompleted: z.ZodOptional<z.ZodBoolean>;
52
- }, "strip", z.ZodTypeAny, {
53
- type: "tool-invocation";
54
- toolInvocation: {
55
- toolName: string;
56
- toolCallId: string;
57
- state: string;
58
- args?: any;
59
- result?: any;
60
- };
61
- isCompleted?: boolean | undefined;
62
- additionalData?: any;
63
- }, {
64
- type: "tool-invocation";
65
- toolInvocation: {
66
- toolName: string;
67
- toolCallId: string;
68
- state: string;
69
- args?: any;
70
- result?: any;
71
- };
72
- isCompleted?: boolean | undefined;
73
- additionalData?: any;
74
- }>, z.ZodObject<{
75
- type: z.ZodString;
76
- additionalData: z.ZodOptional<z.ZodAny>;
77
- isCompleted: z.ZodOptional<z.ZodBoolean>;
78
- }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
79
- type: z.ZodString;
80
- additionalData: z.ZodOptional<z.ZodAny>;
81
- isCompleted: z.ZodOptional<z.ZodBoolean>;
82
- }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
83
- type: z.ZodString;
84
- additionalData: z.ZodOptional<z.ZodAny>;
85
- isCompleted: z.ZodOptional<z.ZodBoolean>;
86
- }, z.ZodTypeAny, "passthrough">>]>, "many">>;
87
- }, "strip", z.ZodTypeAny, {
88
- parts?: ({
89
- type: "text";
90
- text: string;
91
- isCompleted?: boolean | undefined;
92
- additionalData?: any;
93
- } | {
94
- type: "tool-invocation";
95
- toolInvocation: {
96
- toolName: string;
97
- toolCallId: string;
98
- state: string;
99
- args?: any;
100
- result?: any;
101
- };
102
- isCompleted?: boolean | undefined;
103
- additionalData?: any;
104
- } | z.objectOutputType<{
105
- type: z.ZodString;
106
- additionalData: z.ZodOptional<z.ZodAny>;
107
- isCompleted: z.ZodOptional<z.ZodBoolean>;
108
- }, z.ZodTypeAny, "passthrough">)[] | undefined;
109
- }, {
110
- parts?: ({
111
- type: "text";
112
- text: string;
113
- isCompleted?: boolean | undefined;
114
- additionalData?: any;
115
- } | {
116
- type: "tool-invocation";
117
- toolInvocation: {
118
- toolName: string;
119
- toolCallId: string;
120
- state: string;
121
- args?: any;
122
- result?: any;
123
- };
124
- isCompleted?: boolean | undefined;
125
- additionalData?: any;
126
- } | z.objectInputType<{
127
- type: z.ZodString;
128
- additionalData: z.ZodOptional<z.ZodAny>;
129
- isCompleted: z.ZodOptional<z.ZodBoolean>;
130
- }, z.ZodTypeAny, "passthrough">)[] | undefined;
131
- }>, {
132
- parts?: ({
133
- type: "text";
134
- text: string;
135
- isCompleted?: boolean | undefined;
136
- additionalData?: any;
137
- } | {
138
- type: "tool-invocation";
139
- toolInvocation: {
140
- toolName: string;
141
- toolCallId: string;
142
- state: string;
143
- args?: any;
144
- result?: any;
145
- };
146
- isCompleted?: boolean | undefined;
147
- additionalData?: any;
148
- } | z.objectOutputType<{
149
- type: z.ZodString;
150
- additionalData: z.ZodOptional<z.ZodAny>;
151
- isCompleted: z.ZodOptional<z.ZodBoolean>;
152
- }, z.ZodTypeAny, "passthrough">)[] | undefined;
153
- }, unknown>;
154
- errorMessage: z.ZodOptional<z.ZodObject<{
155
- error: z.ZodString;
156
- }, "strip", z.ZodTypeAny, {
157
- error: string;
158
- }, {
159
- error: string;
160
- }>>;
161
- isCompleted: z.ZodBoolean;
162
- }, "strip", z.ZodTypeAny, {
163
- isCompleted: boolean;
164
- id: string;
165
- prompt: string;
166
- streamMessage: {
167
- parts?: ({
168
- type: "text";
169
- text: string;
170
- isCompleted?: boolean | undefined;
171
- additionalData?: any;
172
- } | {
173
- type: "tool-invocation";
174
- toolInvocation: {
175
- toolName: string;
176
- toolCallId: string;
177
- state: string;
178
- args?: any;
179
- result?: any;
180
- };
181
- isCompleted?: boolean | undefined;
182
- additionalData?: any;
183
- } | z.objectOutputType<{
184
- type: z.ZodString;
185
- additionalData: z.ZodOptional<z.ZodAny>;
186
- isCompleted: z.ZodOptional<z.ZodBoolean>;
187
- }, z.ZodTypeAny, "passthrough">)[] | undefined;
188
- };
189
- errorMessage?: {
190
- error: string;
191
- } | undefined;
192
- }, {
193
- isCompleted: boolean;
194
- id: string;
195
- prompt: string;
196
- streamMessage?: unknown;
197
- errorMessage?: {
198
- error: string;
199
- } | undefined;
200
- }>;
201
- export type AnalysisResultSchema = z.infer<typeof AnalysisResultSchema>;
202
- export declare const AnalysisSessionSchema: z.ZodEffects<z.ZodObject<{
203
- id: z.ZodString;
204
- name: z.ZodString;
205
- modelProvider: z.ZodString;
206
- model: z.ZodString;
207
- customModelName: z.ZodOptional<z.ZodString>;
208
- baseUrl: z.ZodOptional<z.ZodString>;
209
- analysisResults: z.ZodArray<z.ZodObject<{
210
- id: z.ZodString;
211
- prompt: z.ZodString;
212
- streamMessage: z.ZodEffects<z.ZodObject<{
213
- parts: z.ZodOptional<z.ZodArray<z.ZodUnion<[z.ZodObject<{
214
- type: z.ZodLiteral<"text">;
215
- text: z.ZodString;
216
- additionalData: z.ZodOptional<z.ZodAny>;
217
- isCompleted: z.ZodOptional<z.ZodBoolean>;
218
- }, "strip", z.ZodTypeAny, {
219
- type: "text";
220
- text: string;
221
- isCompleted?: boolean | undefined;
222
- additionalData?: any;
223
- }, {
224
- type: "text";
225
- text: string;
226
- isCompleted?: boolean | undefined;
227
- additionalData?: any;
228
- }>, z.ZodObject<{
229
- type: z.ZodLiteral<"tool-invocation">;
230
- toolInvocation: z.ZodObject<{
231
- toolCallId: z.ZodString;
232
- toolName: z.ZodString;
233
- args: z.ZodAny;
234
- state: z.ZodString;
235
- result: z.ZodOptional<z.ZodAny>;
236
- }, "strip", z.ZodTypeAny, {
237
- toolName: string;
238
- toolCallId: string;
239
- state: string;
240
- args?: any;
241
- result?: any;
242
- }, {
243
- toolName: string;
244
- toolCallId: string;
245
- state: string;
246
- args?: any;
247
- result?: any;
248
- }>;
249
- additionalData: z.ZodOptional<z.ZodAny>;
250
- isCompleted: z.ZodOptional<z.ZodBoolean>;
251
- }, "strip", z.ZodTypeAny, {
252
- type: "tool-invocation";
253
- toolInvocation: {
254
- toolName: string;
255
- toolCallId: string;
256
- state: string;
257
- args?: any;
258
- result?: any;
259
- };
260
- isCompleted?: boolean | undefined;
261
- additionalData?: any;
262
- }, {
263
- type: "tool-invocation";
264
- toolInvocation: {
265
- toolName: string;
266
- toolCallId: string;
267
- state: string;
268
- args?: any;
269
- result?: any;
270
- };
271
- isCompleted?: boolean | undefined;
272
- additionalData?: any;
273
- }>, z.ZodObject<{
274
- type: z.ZodString;
275
- additionalData: z.ZodOptional<z.ZodAny>;
276
- isCompleted: z.ZodOptional<z.ZodBoolean>;
277
- }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
278
- type: z.ZodString;
279
- additionalData: z.ZodOptional<z.ZodAny>;
280
- isCompleted: z.ZodOptional<z.ZodBoolean>;
281
- }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
282
- type: z.ZodString;
283
- additionalData: z.ZodOptional<z.ZodAny>;
284
- isCompleted: z.ZodOptional<z.ZodBoolean>;
285
- }, z.ZodTypeAny, "passthrough">>]>, "many">>;
286
- }, "strip", z.ZodTypeAny, {
287
- parts?: ({
288
- type: "text";
289
- text: string;
290
- isCompleted?: boolean | undefined;
291
- additionalData?: any;
292
- } | {
293
- type: "tool-invocation";
294
- toolInvocation: {
295
- toolName: string;
296
- toolCallId: string;
297
- state: string;
298
- args?: any;
299
- result?: any;
300
- };
301
- isCompleted?: boolean | undefined;
302
- additionalData?: any;
303
- } | z.objectOutputType<{
304
- type: z.ZodString;
305
- additionalData: z.ZodOptional<z.ZodAny>;
306
- isCompleted: z.ZodOptional<z.ZodBoolean>;
307
- }, z.ZodTypeAny, "passthrough">)[] | undefined;
308
- }, {
309
- parts?: ({
310
- type: "text";
311
- text: string;
312
- isCompleted?: boolean | undefined;
313
- additionalData?: any;
314
- } | {
315
- type: "tool-invocation";
316
- toolInvocation: {
317
- toolName: string;
318
- toolCallId: string;
319
- state: string;
320
- args?: any;
321
- result?: any;
322
- };
323
- isCompleted?: boolean | undefined;
324
- additionalData?: any;
325
- } | z.objectInputType<{
326
- type: z.ZodString;
327
- additionalData: z.ZodOptional<z.ZodAny>;
328
- isCompleted: z.ZodOptional<z.ZodBoolean>;
329
- }, z.ZodTypeAny, "passthrough">)[] | undefined;
330
- }>, {
331
- parts?: ({
332
- type: "text";
333
- text: string;
334
- isCompleted?: boolean | undefined;
335
- additionalData?: any;
336
- } | {
337
- type: "tool-invocation";
338
- toolInvocation: {
339
- toolName: string;
340
- toolCallId: string;
341
- state: string;
342
- args?: any;
343
- result?: any;
344
- };
345
- isCompleted?: boolean | undefined;
346
- additionalData?: any;
347
- } | z.objectOutputType<{
348
- type: z.ZodString;
349
- additionalData: z.ZodOptional<z.ZodAny>;
350
- isCompleted: z.ZodOptional<z.ZodBoolean>;
351
- }, z.ZodTypeAny, "passthrough">)[] | undefined;
352
- }, unknown>;
353
- errorMessage: z.ZodOptional<z.ZodObject<{
354
- error: z.ZodString;
355
- }, "strip", z.ZodTypeAny, {
356
- error: string;
357
- }, {
358
- error: string;
359
- }>>;
360
- isCompleted: z.ZodBoolean;
361
- }, "strip", z.ZodTypeAny, {
362
- isCompleted: boolean;
363
- id: string;
364
- prompt: string;
365
- streamMessage: {
366
- parts?: ({
367
- type: "text";
368
- text: string;
369
- isCompleted?: boolean | undefined;
370
- additionalData?: any;
371
- } | {
372
- type: "tool-invocation";
373
- toolInvocation: {
374
- toolName: string;
375
- toolCallId: string;
376
- state: string;
377
- args?: any;
378
- result?: any;
379
- };
380
- isCompleted?: boolean | undefined;
381
- additionalData?: any;
382
- } | z.objectOutputType<{
383
- type: z.ZodString;
384
- additionalData: z.ZodOptional<z.ZodAny>;
385
- isCompleted: z.ZodOptional<z.ZodBoolean>;
386
- }, z.ZodTypeAny, "passthrough">)[] | undefined;
387
- };
388
- errorMessage?: {
389
- error: string;
390
- } | undefined;
391
- }, {
392
- isCompleted: boolean;
393
- id: string;
394
- prompt: string;
395
- streamMessage?: unknown;
396
- errorMessage?: {
397
- error: string;
398
- } | undefined;
399
- }>, "many">;
400
- createdAt: z.ZodOptional<z.ZodDate>;
401
- }, "strip", z.ZodTypeAny, {
402
- id: string;
403
- name: string;
404
- modelProvider: string;
405
- model: string;
406
- analysisResults: {
407
- isCompleted: boolean;
408
- id: string;
409
- prompt: string;
410
- streamMessage: {
411
- parts?: ({
412
- type: "text";
413
- text: string;
414
- isCompleted?: boolean | undefined;
415
- additionalData?: any;
416
- } | {
417
- type: "tool-invocation";
418
- toolInvocation: {
419
- toolName: string;
420
- toolCallId: string;
421
- state: string;
422
- args?: any;
423
- result?: any;
424
- };
425
- isCompleted?: boolean | undefined;
426
- additionalData?: any;
427
- } | z.objectOutputType<{
428
- type: z.ZodString;
429
- additionalData: z.ZodOptional<z.ZodAny>;
430
- isCompleted: z.ZodOptional<z.ZodBoolean>;
431
- }, z.ZodTypeAny, "passthrough">)[] | undefined;
432
- };
433
- errorMessage?: {
434
- error: string;
435
- } | undefined;
436
- }[];
437
- baseUrl?: string | undefined;
438
- customModelName?: string | undefined;
439
- createdAt?: Date | undefined;
440
- }, {
441
- id: string;
442
- name: string;
443
- modelProvider: string;
444
- model: string;
445
- analysisResults: {
446
- isCompleted: boolean;
447
- id: string;
448
- prompt: string;
449
- streamMessage?: unknown;
450
- errorMessage?: {
451
- error: string;
452
- } | undefined;
453
- }[];
454
- baseUrl?: string | undefined;
455
- customModelName?: string | undefined;
456
- createdAt?: Date | undefined;
457
- }>, {
458
- id: string;
459
- name: string;
460
- modelProvider: string;
461
- model: string;
462
- analysisResults: {
463
- isCompleted: boolean;
464
- id: string;
465
- prompt: string;
466
- streamMessage: {
467
- parts?: ({
468
- type: "text";
469
- text: string;
470
- isCompleted?: boolean | undefined;
471
- additionalData?: any;
472
- } | {
473
- type: "tool-invocation";
474
- toolInvocation: {
475
- toolName: string;
476
- toolCallId: string;
477
- state: string;
478
- args?: any;
479
- result?: any;
480
- };
481
- isCompleted?: boolean | undefined;
482
- additionalData?: any;
483
- } | z.objectOutputType<{
484
- type: z.ZodString;
485
- additionalData: z.ZodOptional<z.ZodAny>;
486
- isCompleted: z.ZodOptional<z.ZodBoolean>;
487
- }, z.ZodTypeAny, "passthrough">)[] | undefined;
488
- };
489
- errorMessage?: {
490
- error: string;
491
- } | undefined;
492
- }[];
493
- baseUrl?: string | undefined;
494
- customModelName?: string | undefined;
495
- createdAt?: Date | undefined;
496
- }, unknown>;
497
- export type AnalysisSessionSchema = z.infer<typeof AnalysisSessionSchema>;
498
- //# sourceMappingURL=AnalysisSessionSchema.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"AnalysisSessionSchema.d.ts","sourceRoot":"","sources":["../src/AnalysisSessionSchema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AAGtB,eAAO,MAAM,kBAAkB;;;;;;EAE7B,CAAC;AACH,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAgEpE,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;oBA4CmsB,CAAC;sBAAqB,CAAC;;;;;oBAAyG,CAAC;sBAAqB,CAAC;;;;;;;;;;oBAAkR,CAAC;sBAAqB,CAAC;;;;;;;;;;oBAAgO,CAAC;sBAAqB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;oBAA9Q,CAAC;sBAAqB,CAAC;;;;;;;;;;;;;;;;;;;;;oBAAgO,CAAC;sBAAqB,CAAC;;;;;;;;;;;;;;;;;;;;;oBAA9Q,CAAC;sBAAqB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;oBAAvB,CAAC;sBAAqB,CAAC;;;;;;;;;;;;;;;;;;;;;EAtClqC,CAAC;AACH,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAmCxE,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wBAEksB,CAAC;0BAAqB,CAAC;;;;;wBAAyG,CAAC;0BAAqB,CAAC;;;;;;;;;;wBAAkR,CAAC;0BAAqB,CAAC;;;;;;;;;;wBAAgO,CAAC;0BAAqB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wBAA9Q,CAAC;0BAAqB,CAAC;;;;;;;;;;;;;;;;;;;;;wBAAgO,CAAC;0BAAqB,CAAC;;;;;;;;;;;;;;;;;;;;;wBAA9Q,CAAC;0BAAqB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wBAAvB,CAAC;0BAAqB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wBAAvB,CAAC;0BAAqB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wBAAvB,CAAC;0BAAqB,CAAC;;;;;;;;;;;;;;;;;WAFzmC,CAAC;AAC5D,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC"}
@@ -1,88 +0,0 @@
1
- import { z } from 'zod';
2
- import { StreamMessagePartSchema } from '@openassistant/core';
3
- export const ErrorMessageSchema = z.object({
4
- error: z.string(),
5
- });
6
- // migrate from old streamMessage to new streamMessage
7
- const migrateStreamMessage = z.preprocess((data) => {
8
- if (data &&
9
- typeof data === 'object' &&
10
- 'toolCallMessages' in data &&
11
- 'parts' in data) {
12
- // migrate from old streamMessage to new streamMessage
13
- const parts = data.parts;
14
- const newParts = [];
15
- for (const part of parts) {
16
- if (part.type === 'text') {
17
- const text = part.text;
18
- newParts.push({
19
- type: 'text',
20
- text,
21
- });
22
- }
23
- else if (part.type === 'tool') {
24
- const toolCallMessages = part.toolCallMessages;
25
- for (const toolCallMessage of toolCallMessages) {
26
- const toolCallId = toolCallMessage.toolCallId;
27
- const toolName = toolCallMessage.toolName;
28
- const args = toolCallMessage.args;
29
- const isCompleted = toolCallMessage.isCompleted;
30
- const llmResult = toolCallMessage.llmResult;
31
- const additionalData = toolCallMessage.additionalData;
32
- const toolInvocation = {
33
- toolCallId,
34
- toolName,
35
- args,
36
- state: isCompleted ? 'result' : 'call',
37
- result: llmResult,
38
- };
39
- newParts.push({
40
- type: 'tool-invocation',
41
- toolInvocation,
42
- additionalData,
43
- isCompleted,
44
- });
45
- }
46
- }
47
- }
48
- return {
49
- parts: newParts,
50
- };
51
- }
52
- return data;
53
- }, z.object({
54
- parts: z.array(StreamMessagePartSchema).optional(),
55
- }));
56
- export const AnalysisResultSchema = z.object({
57
- id: z.string().cuid2(),
58
- prompt: z.string(),
59
- streamMessage: migrateStreamMessage,
60
- errorMessage: ErrorMessageSchema.optional(),
61
- isCompleted: z.boolean(),
62
- });
63
- // migrate from old ollamaBaseUrl to new baseUrl
64
- const migrateAnalysisSession = z.preprocess((data) => {
65
- if (data &&
66
- typeof data === 'object' &&
67
- 'ollamaBaseUrl' in data &&
68
- !('baseUrl' in data)) {
69
- // migrate from old ollamaBaseUrl to new baseUrl
70
- const { ollamaBaseUrl, ...rest } = data;
71
- return {
72
- ...rest,
73
- baseUrl: ollamaBaseUrl,
74
- };
75
- }
76
- return data;
77
- }, z.object({
78
- id: z.string().cuid2(),
79
- name: z.string(),
80
- modelProvider: z.string(),
81
- model: z.string(),
82
- customModelName: z.string().optional(),
83
- baseUrl: z.string().optional(),
84
- analysisResults: z.array(AnalysisResultSchema),
85
- createdAt: z.coerce.date().optional(),
86
- }));
87
- export const AnalysisSessionSchema = migrateAnalysisSession;
88
- //# sourceMappingURL=AnalysisSessionSchema.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"AnalysisSessionSchema.js","sourceRoot":"","sources":["../src/AnalysisSessionSchema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AACtB,OAAO,EAAC,uBAAuB,EAAC,MAAM,qBAAqB,CAAC;AAE5D,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,CAAC,MAAM,CAAC;IACzC,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE;CAClB,CAAC,CAAC;AAGH,sDAAsD;AACtD,MAAM,oBAAoB,GAAG,CAAC,CAA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,EAAE,CAAC,QAAQ,EAAE;IACtC,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC9B,eAAe,EAAE,CAAC,CAAC,KAAK,CAAC,oBAAoB,CAAC;IAC9C,SAAS,EAAE,CAAC,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC,QAAQ,EAAE;CACtC,CAAC,CACH,CAAC;AAEF,MAAM,CAAC,MAAM,qBAAqB,GAAG,sBAAsB,CAAC","sourcesContent":["import {z} from 'zod';\nimport {StreamMessagePartSchema} from '@openassistant/core';\n\nexport const ErrorMessageSchema = z.object({\n error: z.string(),\n});\nexport type ErrorMessageSchema = z.infer<typeof ErrorMessageSchema>;\n\n// migrate from old streamMessage to new streamMessage\nconst migrateStreamMessage = z.preprocess(\n (data) => {\n if (\n data &&\n typeof data === 'object' &&\n 'toolCallMessages' in data &&\n 'parts' in data\n ) {\n // migrate from old streamMessage to new streamMessage\n const parts = (data as {parts: Record<string, unknown>[]}).parts;\n\n const newParts = [];\n for (const part of parts) {\n if (part.type === 'text') {\n const text = part.text;\n newParts.push({\n type: 'text',\n text,\n });\n } else if (part.type === 'tool') {\n const toolCallMessages = part.toolCallMessages as Record<\n string,\n unknown\n >[];\n for (const toolCallMessage of toolCallMessages) {\n const toolCallId = toolCallMessage.toolCallId;\n const toolName = toolCallMessage.toolName;\n const args = toolCallMessage.args;\n const isCompleted = toolCallMessage.isCompleted;\n const llmResult = toolCallMessage.llmResult;\n const additionalData = toolCallMessage.additionalData;\n\n const toolInvocation = {\n toolCallId,\n toolName,\n args,\n state: isCompleted ? 'result' : 'call',\n result: llmResult,\n };\n\n newParts.push({\n type: 'tool-invocation',\n toolInvocation,\n additionalData,\n isCompleted,\n });\n }\n }\n }\n\n return {\n parts: newParts,\n };\n }\n return data;\n },\n z.object({\n parts: z.array(StreamMessagePartSchema).optional(),\n }),\n);\n\nexport const AnalysisResultSchema = z.object({\n id: z.string().cuid2(),\n prompt: z.string(),\n streamMessage: migrateStreamMessage,\n errorMessage: ErrorMessageSchema.optional(),\n isCompleted: z.boolean(),\n});\nexport type AnalysisResultSchema = z.infer<typeof AnalysisResultSchema>;\n\n// migrate from old ollamaBaseUrl to new baseUrl\nconst migrateAnalysisSession = z.preprocess(\n (data) => {\n if (\n data &&\n typeof data === 'object' &&\n 'ollamaBaseUrl' in data &&\n !('baseUrl' in data)\n ) {\n // migrate from old ollamaBaseUrl to new baseUrl\n const {ollamaBaseUrl, ...rest} = data as {ollamaBaseUrl: string} & Record<\n string,\n unknown\n >;\n return {\n ...rest,\n baseUrl: ollamaBaseUrl,\n };\n }\n return data;\n },\n z.object({\n id: z.string().cuid2(),\n name: z.string(),\n modelProvider: z.string(),\n model: z.string(),\n customModelName: z.string().optional(),\n baseUrl: z.string().optional(),\n analysisResults: z.array(AnalysisResultSchema),\n createdAt: z.coerce.date().optional(),\n }),\n);\n\nexport const AnalysisSessionSchema = migrateAnalysisSession;\nexport type AnalysisSessionSchema = z.infer<typeof AnalysisSessionSchema>;\n"]}