@eventcatalog/core 4.12.0-beta.4 → 4.12.0-beta.5
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/analytics/analytics.cjs +1 -1
- package/dist/analytics/analytics.js +2 -2
- package/dist/analytics/log-build.cjs +1 -1
- package/dist/analytics/log-build.js +3 -3
- package/dist/{chunk-ZZSCV5ZI.js → chunk-4BZILEBA.js} +1 -1
- package/dist/{chunk-M4MMC5MN.js → chunk-5U3IKG4U.js} +1 -1
- package/dist/{chunk-GTXK64UD.js → chunk-IDSVEUSL.js} +1 -1
- package/dist/{chunk-NAGVDHNB.js → chunk-UVFZAJCT.js} +1 -1
- package/dist/{chunk-AHPVNJ7S.js → chunk-YTT7Z7QA.js} +1 -1
- package/dist/constants.cjs +1 -1
- package/dist/constants.js +1 -1
- package/dist/eventcatalog.cjs +1 -1
- package/dist/eventcatalog.js +10 -10
- package/dist/federation/federate.js +2 -2
- package/dist/generate.cjs +1 -1
- package/dist/generate.js +3 -3
- package/dist/utils/cli-logger.cjs +1 -1
- package/dist/utils/cli-logger.js +2 -2
- package/eventcatalog/src/enterprise/ai/chat-api.ts +186 -183
- package/package.json +3 -3
|
@@ -146,7 +146,7 @@ var verifyRequiredFieldsAreInCatalogConfigFile = async (projectDirectory) => {
|
|
|
146
146
|
var import_os = __toESM(require("os"), 1);
|
|
147
147
|
|
|
148
148
|
// package.json
|
|
149
|
-
var version = "4.12.0-beta.
|
|
149
|
+
var version = "4.12.0-beta.5";
|
|
150
150
|
|
|
151
151
|
// src/constants.ts
|
|
152
152
|
var VERSION = version;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
log_build_default
|
|
3
|
-
} from "../chunk-
|
|
3
|
+
} from "../chunk-UVFZAJCT.js";
|
|
4
4
|
import "../chunk-ZAZHAVKB.js";
|
|
5
|
-
import "../chunk-
|
|
6
|
-
import "../chunk-
|
|
5
|
+
import "../chunk-YTT7Z7QA.js";
|
|
6
|
+
import "../chunk-4BZILEBA.js";
|
|
7
7
|
import "../chunk-JE6RX7SJ.js";
|
|
8
8
|
export {
|
|
9
9
|
log_build_default as default
|
package/dist/constants.cjs
CHANGED
package/dist/constants.js
CHANGED
package/dist/eventcatalog.cjs
CHANGED
|
@@ -151,7 +151,7 @@ var verifyRequiredFieldsAreInCatalogConfigFile = async (projectDirectory) => {
|
|
|
151
151
|
var import_picocolors = __toESM(require("picocolors"), 1);
|
|
152
152
|
|
|
153
153
|
// package.json
|
|
154
|
-
var version = "4.12.0-beta.
|
|
154
|
+
var version = "4.12.0-beta.5";
|
|
155
155
|
|
|
156
156
|
// src/constants.ts
|
|
157
157
|
var VERSION = version;
|
package/dist/eventcatalog.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
+
import {
|
|
2
|
+
log_build_default
|
|
3
|
+
} from "./chunk-UVFZAJCT.js";
|
|
4
|
+
import "./chunk-ZAZHAVKB.js";
|
|
1
5
|
import {
|
|
2
6
|
runMigrations
|
|
3
7
|
} from "./chunk-XUAF2H54.js";
|
|
4
8
|
import "./chunk-CA4U2JP7.js";
|
|
5
|
-
import {
|
|
6
|
-
log_build_default
|
|
7
|
-
} from "./chunk-NAGVDHNB.js";
|
|
8
|
-
import "./chunk-ZAZHAVKB.js";
|
|
9
9
|
import {
|
|
10
10
|
FederationConflictError,
|
|
11
11
|
FederationDiagnosticError,
|
|
@@ -14,14 +14,14 @@ import {
|
|
|
14
14
|
import "./chunk-WRNH5C3U.js";
|
|
15
15
|
import "./chunk-5EPNFDT5.js";
|
|
16
16
|
import "./chunk-A2RZR3U4.js";
|
|
17
|
+
import "./chunk-SDZQJTJW.js";
|
|
18
|
+
import "./chunk-352FGP6W.js";
|
|
17
19
|
import "./chunk-R7Z5ALYI.js";
|
|
18
20
|
import {
|
|
19
21
|
getFederationDiagnosticCounts,
|
|
20
22
|
getVisibleFederationDiagnostics
|
|
21
23
|
} from "./chunk-JJPB6EOZ.js";
|
|
22
24
|
import "./chunk-FV56YFM4.js";
|
|
23
|
-
import "./chunk-SDZQJTJW.js";
|
|
24
|
-
import "./chunk-352FGP6W.js";
|
|
25
25
|
import {
|
|
26
26
|
getProjectOutDir,
|
|
27
27
|
isAuthEnabled,
|
|
@@ -30,10 +30,10 @@ import {
|
|
|
30
30
|
} from "./chunk-3SJDIENM.js";
|
|
31
31
|
import {
|
|
32
32
|
generate
|
|
33
|
-
} from "./chunk-
|
|
33
|
+
} from "./chunk-IDSVEUSL.js";
|
|
34
34
|
import {
|
|
35
35
|
logger
|
|
36
|
-
} from "./chunk-
|
|
36
|
+
} from "./chunk-5U3IKG4U.js";
|
|
37
37
|
import {
|
|
38
38
|
resolve_catalog_dependencies_default
|
|
39
39
|
} from "./chunk-EEZXGNF6.js";
|
|
@@ -47,7 +47,7 @@ import {
|
|
|
47
47
|
import {
|
|
48
48
|
watch
|
|
49
49
|
} from "./chunk-U63GDPPY.js";
|
|
50
|
-
import "./chunk-
|
|
50
|
+
import "./chunk-YTT7Z7QA.js";
|
|
51
51
|
import {
|
|
52
52
|
getAstroConfigPath
|
|
53
53
|
} from "./chunk-VIJJ7JKH.js";
|
|
@@ -62,7 +62,7 @@ import {
|
|
|
62
62
|
} from "./chunk-SAN4U2WU.js";
|
|
63
63
|
import {
|
|
64
64
|
VERSION
|
|
65
|
-
} from "./chunk-
|
|
65
|
+
} from "./chunk-4BZILEBA.js";
|
|
66
66
|
import {
|
|
67
67
|
getEventCatalogConfigFile,
|
|
68
68
|
verifyRequiredFieldsAreInCatalogConfigFile
|
|
@@ -6,11 +6,11 @@ import {
|
|
|
6
6
|
import "../chunk-WRNH5C3U.js";
|
|
7
7
|
import "../chunk-5EPNFDT5.js";
|
|
8
8
|
import "../chunk-A2RZR3U4.js";
|
|
9
|
+
import "../chunk-SDZQJTJW.js";
|
|
10
|
+
import "../chunk-352FGP6W.js";
|
|
9
11
|
import "../chunk-R7Z5ALYI.js";
|
|
10
12
|
import "../chunk-JJPB6EOZ.js";
|
|
11
13
|
import "../chunk-FV56YFM4.js";
|
|
12
|
-
import "../chunk-SDZQJTJW.js";
|
|
13
|
-
import "../chunk-352FGP6W.js";
|
|
14
14
|
import "../chunk-JE6RX7SJ.js";
|
|
15
15
|
export {
|
|
16
16
|
FederationConflictError,
|
package/dist/generate.cjs
CHANGED
|
@@ -112,7 +112,7 @@ var getEventCatalogConfigFile = async (projectDirectory) => {
|
|
|
112
112
|
var import_picocolors = __toESM(require("picocolors"), 1);
|
|
113
113
|
|
|
114
114
|
// package.json
|
|
115
|
-
var version = "4.12.0-beta.
|
|
115
|
+
var version = "4.12.0-beta.5";
|
|
116
116
|
|
|
117
117
|
// src/constants.ts
|
|
118
118
|
var VERSION = version;
|
package/dist/generate.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
generate
|
|
3
|
-
} from "./chunk-
|
|
4
|
-
import "./chunk-
|
|
5
|
-
import "./chunk-
|
|
3
|
+
} from "./chunk-IDSVEUSL.js";
|
|
4
|
+
import "./chunk-5U3IKG4U.js";
|
|
5
|
+
import "./chunk-4BZILEBA.js";
|
|
6
6
|
import "./chunk-JE6RX7SJ.js";
|
|
7
7
|
export {
|
|
8
8
|
generate
|
package/dist/utils/cli-logger.js
CHANGED
|
@@ -4,7 +4,16 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
import type { APIContext } from 'astro';
|
|
7
|
-
import {
|
|
7
|
+
import {
|
|
8
|
+
convertToModelMessages,
|
|
9
|
+
createUIMessageStreamResponse,
|
|
10
|
+
isStepCount,
|
|
11
|
+
streamText,
|
|
12
|
+
toUIMessageStream,
|
|
13
|
+
tool,
|
|
14
|
+
type LanguageModel,
|
|
15
|
+
type UIMessage,
|
|
16
|
+
} from 'ai';
|
|
8
17
|
import { join } from 'node:path';
|
|
9
18
|
import { isEventCatalogScaleEnabled, isEventCatalogStarterEnabled } from '@utils/feature';
|
|
10
19
|
import { getCollection, getEntry } from 'astro:content';
|
|
@@ -211,204 +220,198 @@ export const POST = async ({ request }: APIContext<{ question: string; messages:
|
|
|
211
220
|
const referrer = request.headers.get('referer');
|
|
212
221
|
|
|
213
222
|
try {
|
|
214
|
-
const
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
stopWhen: stepCountIs(5),
|
|
220
|
-
// maxTokens: 4000, // Increased to handle large tool results
|
|
221
|
-
onError: (error) => {
|
|
222
|
-
console.error('[Chat] On error', error);
|
|
223
|
-
},
|
|
224
|
-
// maxOutputTokens: 40000,
|
|
225
|
-
// tools: tools,
|
|
226
|
-
tools: {
|
|
227
|
-
getResources: tool({
|
|
228
|
-
description: toolDescriptions.getResources,
|
|
229
|
-
inputSchema: z.object({
|
|
230
|
-
collection: collectionSchema.describe('The collection to get the resources from'),
|
|
231
|
-
}),
|
|
232
|
-
execute: async ({ collection }) => {
|
|
233
|
-
const result = await getResourcesImpl({ collection });
|
|
234
|
-
if ('error' in result) return result;
|
|
235
|
-
return result.resources;
|
|
236
|
-
},
|
|
223
|
+
const tools = {
|
|
224
|
+
getResources: tool({
|
|
225
|
+
description: toolDescriptions.getResources,
|
|
226
|
+
inputSchema: z.object({
|
|
227
|
+
collection: collectionSchema.describe('The collection to get the resources from'),
|
|
237
228
|
}),
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
229
|
+
execute: async ({ collection }) => {
|
|
230
|
+
const result = await getResourcesImpl({ collection });
|
|
231
|
+
if ('error' in result) return result;
|
|
232
|
+
return result.resources;
|
|
233
|
+
},
|
|
234
|
+
}),
|
|
235
|
+
getResource: tool({
|
|
236
|
+
description: toolDescriptions.getResource,
|
|
237
|
+
inputSchema: z.object({
|
|
238
|
+
collection: collectionSchema.describe('The collection to get the resource from'),
|
|
239
|
+
id: z.string().describe('The id of the resource to get'),
|
|
240
|
+
version: z.string().describe('The version of the resource to get'),
|
|
248
241
|
}),
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
const consumers = resource.data.consumers || [];
|
|
260
|
-
return {
|
|
261
|
-
producers,
|
|
262
|
-
consumers,
|
|
263
|
-
};
|
|
264
|
-
},
|
|
242
|
+
execute: async ({ collection, id, version }) => {
|
|
243
|
+
return await getResourceImpl({ collection, id, version });
|
|
244
|
+
},
|
|
245
|
+
}),
|
|
246
|
+
getProducersAndConsumersFromSchema: tool({
|
|
247
|
+
description: 'Use this tool to get the producers and consumers for a schema by its id and version',
|
|
248
|
+
inputSchema: z.object({
|
|
249
|
+
collection: messageCollectionSchema.describe('The collection to get the producers and consumers from'),
|
|
250
|
+
id: z.string().describe('The id of the message to get the producers and consumers for'),
|
|
251
|
+
version: z.string().describe('The version of the message to get the producers and consumers for'),
|
|
265
252
|
}),
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
253
|
+
execute: async ({ collection, id, version }) => {
|
|
254
|
+
const resource = await getEntry(collection as any, `${id}-${version}`);
|
|
255
|
+
const producers = resource.data.producers || [];
|
|
256
|
+
const consumers = resource.data.consumers || [];
|
|
257
|
+
return {
|
|
258
|
+
producers,
|
|
259
|
+
consumers,
|
|
260
|
+
};
|
|
261
|
+
},
|
|
262
|
+
}),
|
|
263
|
+
getMessagesProducedOrConsumedByResource: tool({
|
|
264
|
+
description: toolDescriptions.getMessagesProducedOrConsumedByResource,
|
|
265
|
+
inputSchema: z.object({
|
|
266
|
+
resourceId: z.string().describe('The id of the resource to get the messages produced or consumed for'),
|
|
267
|
+
resourceVersion: z.string().describe('The version of the resource to get the messages produced or consumed for'),
|
|
268
|
+
resourceCollection: resourceCollectionSchema
|
|
269
|
+
.describe('The collection of the resource to get the messages produced or consumed for')
|
|
270
|
+
.default('services'),
|
|
278
271
|
}),
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
const consumers = await getProducersOfMessage(services, message as any);
|
|
292
|
-
return consumers;
|
|
293
|
-
},
|
|
272
|
+
execute: async ({ resourceId, resourceVersion, resourceCollection }) => {
|
|
273
|
+
return await getMessagesImpl({ resourceId, resourceVersion, resourceCollection });
|
|
274
|
+
},
|
|
275
|
+
}),
|
|
276
|
+
getProducerAndConsumerForMessage: tool({
|
|
277
|
+
description: 'Use this tool to get the producers and consumers for a message by its id and version',
|
|
278
|
+
inputSchema: z.object({
|
|
279
|
+
messageId: z.string().describe('The id of the message to get the producers and consumers for'),
|
|
280
|
+
messageVersion: z.string().describe('The version of the message to get the producers and consumers for'),
|
|
281
|
+
messageCollection: messageCollectionSchema
|
|
282
|
+
.describe('The collection of the message to get the producers and consumers for')
|
|
283
|
+
.default('events'),
|
|
294
284
|
}),
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
285
|
+
execute: async ({ messageId, messageVersion, messageCollection }) => {
|
|
286
|
+
const services = await getCollection('services');
|
|
287
|
+
const message = await getEntry(messageCollection as any, `${messageId}-${messageVersion}`);
|
|
288
|
+
const consumers = await getProducersOfMessage(services, message as any);
|
|
289
|
+
return consumers;
|
|
290
|
+
},
|
|
291
|
+
}),
|
|
292
|
+
getConsumersOfMessage: tool({
|
|
293
|
+
description: 'Use this tool to get the consumers for a message by its id and version',
|
|
294
|
+
inputSchema: z.object({
|
|
295
|
+
messageId: z.string().describe('The id of the message to get the consumers for'),
|
|
296
|
+
messageVersion: z.string().describe('The version of the message to get the consumers for'),
|
|
297
|
+
messageCollection: messageCollectionSchema
|
|
298
|
+
.describe('The collection of the message to get the consumers for')
|
|
299
|
+
.default('events'),
|
|
310
300
|
}),
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
301
|
+
execute: async ({ messageId, messageVersion, messageCollection }) => {
|
|
302
|
+
const services = await getCollection('services');
|
|
303
|
+
const message = await getEntry(messageCollection as any, `${messageId}-${messageVersion}`);
|
|
304
|
+
const consumers = await getConsumersOfMessage(services, message as any);
|
|
305
|
+
return consumers;
|
|
306
|
+
},
|
|
307
|
+
}),
|
|
308
|
+
getSchemaForResource: tool({
|
|
309
|
+
description: toolDescriptions.getSchemaForResource,
|
|
310
|
+
inputSchema: z.object({
|
|
311
|
+
resourceId: z.string().describe('The id of the resource to get the schema for'),
|
|
312
|
+
resourceVersion: z.string().describe('The version of the resource to get the schema for'),
|
|
313
|
+
resourceCollection: resourceCollectionSchema
|
|
314
|
+
.describe('The collection of the resource to get the schema for')
|
|
315
|
+
.default('services'),
|
|
323
316
|
}),
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
317
|
+
execute: async ({ resourceId, resourceVersion, resourceCollection }) => {
|
|
318
|
+
return await getSchemaImpl({ resourceId, resourceVersion, resourceCollection });
|
|
319
|
+
},
|
|
320
|
+
}),
|
|
321
|
+
getDataProductInputs: tool({
|
|
322
|
+
description: toolDescriptions.getDataProductInputs,
|
|
323
|
+
inputSchema: z.object({
|
|
324
|
+
dataProductId: z.string().describe('The id of the data product to get the inputs for'),
|
|
325
|
+
dataProductVersion: z.string().describe('The version of the data product to get the inputs for'),
|
|
333
326
|
}),
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
327
|
+
execute: async ({ dataProductId, dataProductVersion }) => {
|
|
328
|
+
return await getDataProductInputsImpl({ dataProductId, dataProductVersion });
|
|
329
|
+
},
|
|
330
|
+
}),
|
|
331
|
+
getDataProductOutputs: tool({
|
|
332
|
+
description: toolDescriptions.getDataProductOutputs,
|
|
333
|
+
inputSchema: z.object({
|
|
334
|
+
dataProductId: z.string().describe('The id of the data product to get the outputs for'),
|
|
335
|
+
dataProductVersion: z.string().describe('The version of the data product to get the outputs for'),
|
|
343
336
|
}),
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
337
|
+
execute: async ({ dataProductId, dataProductVersion }) => {
|
|
338
|
+
return await getDataProductOutputsImpl({ dataProductId, dataProductVersion });
|
|
339
|
+
},
|
|
340
|
+
}),
|
|
341
|
+
getArchitectureDiagramAsMermaid: tool({
|
|
342
|
+
description: toolDescriptions.getArchitectureDiagramAsMermaid,
|
|
343
|
+
inputSchema: z.object({
|
|
344
|
+
resourceId: z.string().describe('The id of the resource to get the architecture diagram for'),
|
|
345
|
+
resourceVersion: z.string().describe('The version of the resource to get the architecture diagram for'),
|
|
346
|
+
resourceCollection: visualiserCollectionSchema
|
|
347
|
+
.describe(
|
|
348
|
+
'The collection of the resource (events, commands, queries, services, domains, systems, flows, containers, data-products)'
|
|
349
|
+
)
|
|
350
|
+
.default('services'),
|
|
358
351
|
}),
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
352
|
+
execute: async ({ resourceId, resourceVersion, resourceCollection }) => {
|
|
353
|
+
return await getArchitectureDiagramImpl({ resourceId, resourceVersion, resourceCollection });
|
|
354
|
+
},
|
|
355
|
+
}),
|
|
356
|
+
getCustomDocs: tool({
|
|
357
|
+
description: toolDescriptions.getCustomDocs,
|
|
358
|
+
inputSchema: z.object({
|
|
359
|
+
cursor: z.string().optional().describe('Pagination cursor from previous response'),
|
|
360
|
+
search: z.string().optional().describe('Search term to filter docs by title, id, or summary (case-insensitive)'),
|
|
368
361
|
}),
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
362
|
+
execute: async ({ cursor, search }) => {
|
|
363
|
+
return await getCustomDocsImpl({ cursor, search });
|
|
364
|
+
},
|
|
365
|
+
}),
|
|
366
|
+
searchCustomDocs: tool({
|
|
367
|
+
description: toolDescriptions.searchCustomDocs,
|
|
368
|
+
inputSchema: z.object({
|
|
369
|
+
query: z.string().describe('Full-text search query, e.g. keywords describing the topic to find'),
|
|
370
|
+
limit: z.number().optional().describe('Maximum number of results to return (default 10)'),
|
|
378
371
|
}),
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
372
|
+
execute: async ({ query, limit }) => {
|
|
373
|
+
return await searchCustomDocsImpl({ query, limit });
|
|
374
|
+
},
|
|
375
|
+
}),
|
|
376
|
+
getCustomDoc: tool({
|
|
377
|
+
description: toolDescriptions.getCustomDoc,
|
|
378
|
+
inputSchema: z.object({
|
|
379
|
+
id: z.string().describe('The id or slug of the custom documentation page'),
|
|
380
|
+
section: z.string().optional().describe('Optional section heading to return only that section of the page'),
|
|
388
381
|
}),
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
}),
|
|
399
|
-
execute: async ({ questions }) => {
|
|
400
|
-
// This tool doesn't need to do anything - it just returns the questions
|
|
401
|
-
// which will be captured by the UI
|
|
402
|
-
return { suggestions: questions };
|
|
403
|
-
},
|
|
382
|
+
execute: async ({ id, section }) => {
|
|
383
|
+
return await getCustomDocImpl({ id, section });
|
|
384
|
+
},
|
|
385
|
+
}),
|
|
386
|
+
suggestFollowUpQuestions: tool({
|
|
387
|
+
description:
|
|
388
|
+
'Use this tool after answering a question to suggest 2-3 relevant follow-up questions the user might want to ask. These will be displayed as clickable suggestions.',
|
|
389
|
+
inputSchema: z.object({
|
|
390
|
+
questions: z.array(z.string()).min(1).max(3).describe('Array of 2-3 follow-up questions relevant to the conversation'),
|
|
404
391
|
}),
|
|
405
|
-
|
|
392
|
+
execute: async ({ questions }) => {
|
|
393
|
+
// This tool doesn't need to do anything - it just returns the questions
|
|
394
|
+
// which will be captured by the UI
|
|
395
|
+
return { suggestions: questions };
|
|
396
|
+
},
|
|
397
|
+
}),
|
|
398
|
+
...extendedTools,
|
|
399
|
+
};
|
|
400
|
+
|
|
401
|
+
const result = streamText({
|
|
402
|
+
model,
|
|
403
|
+
instructions: getBaseSystemPrompt(referrer ?? ''),
|
|
404
|
+
messages: await convertToModelMessages(messages),
|
|
405
|
+
temperature: modelConfiguration?.temperature ?? 0.7,
|
|
406
|
+
stopWhen: isStepCount(5),
|
|
407
|
+
onError: (error) => {
|
|
408
|
+
console.error('[Chat] On error', error);
|
|
406
409
|
},
|
|
410
|
+
tools,
|
|
407
411
|
});
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
},
|
|
412
|
+
|
|
413
|
+
return createUIMessageStreamResponse({
|
|
414
|
+
stream: toUIMessageStream({ stream: result.stream, tools }),
|
|
412
415
|
});
|
|
413
416
|
} catch (err: any) {
|
|
414
417
|
console.error('[Chat] Error during streaming:', err);
|
package/package.json
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
},
|
|
8
8
|
"license": "SEE LICENSE IN LICENSE",
|
|
9
9
|
"type": "module",
|
|
10
|
-
"version": "4.12.0-beta.
|
|
10
|
+
"version": "4.12.0-beta.5",
|
|
11
11
|
"publishConfig": {
|
|
12
12
|
"access": "public"
|
|
13
13
|
},
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"dist/"
|
|
46
46
|
],
|
|
47
47
|
"dependencies": {
|
|
48
|
-
"@ai-sdk/react": "^
|
|
48
|
+
"@ai-sdk/react": "^4.0.109",
|
|
49
49
|
"@astrojs/markdown-remark": "^7.3.1",
|
|
50
50
|
"@astrojs/mdx": "^8.0.1",
|
|
51
51
|
"@astrojs/node": "^11.1.6",
|
|
@@ -74,7 +74,7 @@
|
|
|
74
74
|
"@tailwindcss/vite": "^4.3.1",
|
|
75
75
|
"@tanstack/react-table": "^8.17.3",
|
|
76
76
|
"@xyflow/react": "^12.3.6",
|
|
77
|
-
"ai": "^
|
|
77
|
+
"ai": "^7.0.106",
|
|
78
78
|
"astro": "7.3.3",
|
|
79
79
|
"astro-expressive-code": "^0.44.0",
|
|
80
80
|
"astro-seo": "^0.8.4",
|