@eventcatalog/core 3.1.0 → 3.2.1
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-KBO4IL2D.js → chunk-7PHTRC72.js} +1 -1
- package/dist/{chunk-I3CW5KQI.js → chunk-LWUJQOCC.js} +1 -1
- package/dist/{chunk-ESUL7UE6.js → chunk-SFQ3BU4M.js} +1 -1
- package/dist/{chunk-URR33SNK.js → chunk-SYOF3QEG.js} +1 -1
- package/dist/{chunk-2WGZFERB.js → chunk-VBEYXPR5.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 +5 -5
- 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/components/ChatPanel/ChatPanel.tsx +488 -231
- package/eventcatalog/src/components/ChatPanel/ChatPanelButton.tsx +2 -2
- package/eventcatalog/src/components/MDX/IcePanel/IcePanel.astro +77 -0
- package/eventcatalog/src/components/MDX/components.tsx +2 -0
- package/eventcatalog/src/enterprise/ai/chat-api.ts +24 -3
- package/eventcatalog/src/pages/icepanel/index.astro +67 -0
- package/package.json +7 -6
|
@@ -9,11 +9,11 @@ const ChatPanelButton = () => {
|
|
|
9
9
|
<>
|
|
10
10
|
<button
|
|
11
11
|
onClick={() => setIsOpen(true)}
|
|
12
|
-
className="flex items-center gap-1.5 px-4 py-1.5 rounded-md bg-
|
|
12
|
+
className="flex items-center gap-1.5 px-4 py-1.5 rounded-md bg-[rgb(var(--ec-card-bg))] hover:bg-[rgb(var(--ec-content-hover))] ring-1 ring-inset ring-[rgb(var(--ec-page-border))] shadow-sm transition-colors text-sm ml-[-1px]"
|
|
13
13
|
aria-label="Open AI Assistant"
|
|
14
14
|
>
|
|
15
15
|
<BookOpen size={14} className="text-[rgb(var(--ec-accent))]" />
|
|
16
|
-
<span className="font-light text-
|
|
16
|
+
<span className="font-light text-[rgb(var(--ec-page-text-muted))]">Ask</span>
|
|
17
17
|
</button>
|
|
18
18
|
|
|
19
19
|
<ChatPanel isOpen={isOpen} onClose={() => setIsOpen(false)} />
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
---
|
|
2
|
+
import Admonition from '@components/MDX/Admonition';
|
|
3
|
+
import { buildUrl, buildUrlWithParams } from '@utils/url-builder';
|
|
4
|
+
import type { CollectionEntry } from 'astro:content';
|
|
5
|
+
import { ExpandIcon } from 'lucide-react';
|
|
6
|
+
|
|
7
|
+
interface Props {
|
|
8
|
+
title?: string;
|
|
9
|
+
description?: string;
|
|
10
|
+
height?: string;
|
|
11
|
+
width?: string;
|
|
12
|
+
url: string;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
const { title, description, height = '600', width = '100%', url, ...eventCatalogResource } = Astro.props;
|
|
16
|
+
|
|
17
|
+
const resource = eventCatalogResource as CollectionEntry<'services'>;
|
|
18
|
+
|
|
19
|
+
// Validate that the URL is from IcePanel
|
|
20
|
+
const isValidIcePanelUrl = url?.startsWith('https://s.icepanel.io/') || url?.startsWith('https://icepanel.io/');
|
|
21
|
+
|
|
22
|
+
const backUrl = resource.collection
|
|
23
|
+
? buildUrl(`/docs/${resource.collection}/${resource.data.id}/${resource.data.version}#${title}-icepanel-title`)
|
|
24
|
+
: undefined;
|
|
25
|
+
|
|
26
|
+
const fullScreenParams = {
|
|
27
|
+
url: url,
|
|
28
|
+
title: title,
|
|
29
|
+
back: backUrl,
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
const openFullScreenUrl = buildUrlWithParams(`/icepanel`, fullScreenParams);
|
|
33
|
+
---
|
|
34
|
+
|
|
35
|
+
{
|
|
36
|
+
!url && (
|
|
37
|
+
<Admonition type="warning">
|
|
38
|
+
<div>
|
|
39
|
+
<span class="block font-bold">{`<IcePanel/>`} failed to load</span>
|
|
40
|
+
<span class="block">Please provide a url to use the IcePanel component.</span>
|
|
41
|
+
</div>
|
|
42
|
+
</Admonition>
|
|
43
|
+
)
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
{
|
|
47
|
+
url && !isValidIcePanelUrl && (
|
|
48
|
+
<Admonition type="warning">
|
|
49
|
+
<div>
|
|
50
|
+
<span class="block font-bold">{`<IcePanel/>`} invalid URL</span>
|
|
51
|
+
<span class="block">Please provide a valid IcePanel URL (e.g., https://s.icepanel.io/...).</span>
|
|
52
|
+
</div>
|
|
53
|
+
</Admonition>
|
|
54
|
+
)
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
{
|
|
58
|
+
url && isValidIcePanelUrl && (
|
|
59
|
+
<div>
|
|
60
|
+
{title && (
|
|
61
|
+
<h3 id={`${title}-icepanel-title`} class="text-3xl font-bold">
|
|
62
|
+
{title}
|
|
63
|
+
</h3>
|
|
64
|
+
)}
|
|
65
|
+
{description && <p class="text-[rgb(var(--ec-page-text-muted))] mb-3">{description}</p>}
|
|
66
|
+
<div class="relative">
|
|
67
|
+
<iframe class="rounded-2xl border-none" src={url} width={width} height={height} title={title || 'IcePanel Diagram'} />
|
|
68
|
+
<a
|
|
69
|
+
href={openFullScreenUrl}
|
|
70
|
+
class="absolute bottom-[15px] right-5 bg-[rgb(var(--ec-card-bg))] border border-[rgb(var(--ec-page-border))] text-[rgb(var(--ec-page-text))] hover:bg-[rgb(var(--ec-accent-subtle))] px-4 py-2 rounded-md transition-colors"
|
|
71
|
+
>
|
|
72
|
+
<ExpandIcon className="w-5 h-5" />
|
|
73
|
+
</a>
|
|
74
|
+
</div>
|
|
75
|
+
</div>
|
|
76
|
+
)
|
|
77
|
+
}
|
|
@@ -25,6 +25,7 @@ import Miro from '@components/MDX/Miro/Miro.astro';
|
|
|
25
25
|
import Lucid from '@components/MDX/Lucid/Lucid.astro';
|
|
26
26
|
import DrawIO from '@components/MDX/DrawIO/DrawIO.astro';
|
|
27
27
|
import FigJam from '@components/MDX/FigJam/FigJam.astro';
|
|
28
|
+
import IcePanel from '@components/MDX/IcePanel/IcePanel.astro';
|
|
28
29
|
import Design from '@components/MDX/Design/Design.astro';
|
|
29
30
|
import MermaidFileLoader from '@components/MDX/MermaidFileLoader/MermaidFileLoader.astro';
|
|
30
31
|
// Portals: required for server/client components
|
|
@@ -65,6 +66,7 @@ const components = (props: any) => {
|
|
|
65
66
|
Lucid: (mdxProp: any) => jsx(Lucid, { ...props, ...mdxProp }),
|
|
66
67
|
DrawIO: (mdxProp: any) => jsx(DrawIO, { ...props, ...mdxProp }),
|
|
67
68
|
FigJam: (mdxProp: any) => jsx(FigJam, { ...props, ...mdxProp }),
|
|
69
|
+
IcePanel: (mdxProp: any) => jsx(IcePanel, { ...props, ...mdxProp }),
|
|
68
70
|
MermaidFileLoader: (mdxProp: any) => jsx(MermaidFileLoader, { ...props, ...mdxProp }),
|
|
69
71
|
};
|
|
70
72
|
};
|
|
@@ -28,7 +28,10 @@ try {
|
|
|
28
28
|
model = await providerConfiguration.default();
|
|
29
29
|
modelConfiguration = providerConfiguration.configuration || defaultConfiguration;
|
|
30
30
|
hasChatConfiguration = true;
|
|
31
|
-
|
|
31
|
+
|
|
32
|
+
if (isEventCatalogScaleEnabled()) {
|
|
33
|
+
extendedTools = providerConfiguration.tools || {};
|
|
34
|
+
}
|
|
32
35
|
} catch (error) {
|
|
33
36
|
console.error('[Chat] Error loading chat configuration', error);
|
|
34
37
|
hasChatConfiguration = false;
|
|
@@ -111,12 +114,14 @@ When responding:
|
|
|
111
114
|
5. Don't provide code examples unless specifically requested.
|
|
112
115
|
6. When you refer to a resource in EventCatalog, try and create a link to the resource in the response
|
|
113
116
|
- Example, if you return a message in the text, rather than than just the id or version you should return a markdown link to the resource e.g [MyEvent - 1.0.0](/docs/events/MyEvent/1.0.0)
|
|
114
|
-
- NEVER
|
|
117
|
+
- CRITICAL: NEVER use "latest" in any URL or link. Always use the actual semantic version number (e.g., 1.0.0, 2.1.3). The word "latest" is not a valid version and will result in broken links.
|
|
115
118
|
- The link options are:
|
|
116
119
|
- If you want to get the documentation for a resource use the /docs/ prefix (e.g /docs/{collection}/{id}/{version})
|
|
117
120
|
- If you want to let the user know they can visualize a resource use the /visualiser/ prefix (e.g /visualiser/{collection}/{id}/{version})
|
|
118
121
|
- If you want to let the user know they can see the architecture of a resource use the /architecture/ prefix (e.g /architecture/{collection}/{id}/{version})
|
|
122
|
+
- If you don't know the version, use the getResource tool to fetch the resource and get the actual version number before creating the link.
|
|
119
123
|
7. When you return a schema, use code blocks to render the schema to the user too, for example if the schema is in JSON format use \`\`\`json and if the schema is in YAML format use \`\`\`yaml
|
|
124
|
+
8. IMPORTANT: After answering each question, ALWAYS use the suggestFollowUpQuestions tool to suggest 2-3 relevant follow-up questions the user might want to ask next. These should be contextual to the conversation and help the user explore related topics.
|
|
120
125
|
|
|
121
126
|
If you have additional context, use it to answer the question.`;
|
|
122
127
|
|
|
@@ -171,7 +176,7 @@ export const POST = async ({ request }: APIContext<{ question: string; messages:
|
|
|
171
176
|
const result = await streamText({
|
|
172
177
|
model,
|
|
173
178
|
system: getBaseSystemPrompt(referrer ?? ''),
|
|
174
|
-
messages: convertToModelMessages(messages)
|
|
179
|
+
messages: await convertToModelMessages(messages),
|
|
175
180
|
temperature: modelConfiguration?.temperature ?? 0.7,
|
|
176
181
|
stopWhen: stepCountIs(5),
|
|
177
182
|
// maxTokens: 4000, // Increased to handle large tool results
|
|
@@ -320,6 +325,22 @@ export const POST = async ({ request }: APIContext<{ question: string; messages:
|
|
|
320
325
|
return [];
|
|
321
326
|
},
|
|
322
327
|
}),
|
|
328
|
+
suggestFollowUpQuestions: tool({
|
|
329
|
+
description:
|
|
330
|
+
'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.',
|
|
331
|
+
inputSchema: z.object({
|
|
332
|
+
questions: z
|
|
333
|
+
.array(z.string())
|
|
334
|
+
.min(1)
|
|
335
|
+
.max(3)
|
|
336
|
+
.describe('Array of 2-3 follow-up questions relevant to the conversation'),
|
|
337
|
+
}),
|
|
338
|
+
execute: async ({ questions }) => {
|
|
339
|
+
// This tool doesn't need to do anything - it just returns the questions
|
|
340
|
+
// which will be captured by the UI
|
|
341
|
+
return { suggestions: questions };
|
|
342
|
+
},
|
|
343
|
+
}),
|
|
323
344
|
...extendedTools,
|
|
324
345
|
},
|
|
325
346
|
});
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
---
|
|
2
|
+
import VerticalSideBarLayout from '@layouts/VerticalSideBarLayout.astro';
|
|
3
|
+
import { ClientRouter } from 'astro:transitions';
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
<VerticalSideBarLayout title="IcePanel">
|
|
7
|
+
<div class="h-[calc(100vh-80px)] bg-[rgb(var(--ec-page-bg))] p-3">
|
|
8
|
+
<div class="flex items-center justify-between mb-4">
|
|
9
|
+
<h1 id="diagramTitle" class="text-2xl font-bold text-[rgb(var(--ec-page-text))]">IcePanel Diagram</h1>
|
|
10
|
+
<div class="flex items-center gap-3">
|
|
11
|
+
<button
|
|
12
|
+
id="backButton"
|
|
13
|
+
class="hidden items-center gap-2 bg-[rgb(var(--ec-card-bg))] border border-[rgb(var(--ec-page-border))] text-[rgb(var(--ec-page-text))] hover:bg-[rgb(var(--ec-accent-subtle))] px-4 py-2 rounded-md transition-colors"
|
|
14
|
+
>
|
|
15
|
+
<svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5" viewBox="0 0 20 20" fill="currentColor">
|
|
16
|
+
<path
|
|
17
|
+
fill-rule="evenodd"
|
|
18
|
+
d="M9.707 16.707a1 1 0 01-1.414 0l-6-6a1 1 0 010-1.414l6-6a1 1 0 011.414 1.414L4.414 9H17a1 1 0 110 2H4.414l5.293 5.293a1 1 0 010 1.414z"
|
|
19
|
+
clip-rule="evenodd"></path>
|
|
20
|
+
</svg>
|
|
21
|
+
<span>Back</span>
|
|
22
|
+
</button>
|
|
23
|
+
</div>
|
|
24
|
+
</div>
|
|
25
|
+
<div class="w-full bg-[rgb(var(--ec-card-bg))] h-[calc(100%-4rem)] rounded-2xl">
|
|
26
|
+
<iframe class="w-full h-full rounded-2xl border-none"></iframe>
|
|
27
|
+
</div>
|
|
28
|
+
</div>
|
|
29
|
+
</VerticalSideBarLayout>
|
|
30
|
+
|
|
31
|
+
<ClientRouter />
|
|
32
|
+
<script>
|
|
33
|
+
function configureIcePanel() {
|
|
34
|
+
// Get url from query params and then embed into the iframe
|
|
35
|
+
const pageUrl = new URL(window.location.href);
|
|
36
|
+
const icePanelUrl = pageUrl.searchParams.get('url');
|
|
37
|
+
const title = pageUrl.searchParams.get('title') || 'IcePanel Diagram';
|
|
38
|
+
const backUrl = pageUrl.searchParams.get('back');
|
|
39
|
+
|
|
40
|
+
// Configure back button if back URL is provided
|
|
41
|
+
const backButton = document.querySelector('#backButton');
|
|
42
|
+
if (backButton && backUrl) {
|
|
43
|
+
backButton.classList.remove('hidden');
|
|
44
|
+
backButton.classList.add('flex');
|
|
45
|
+
backButton.addEventListener('click', () => {
|
|
46
|
+
window.location.href = `${decodeURIComponent(backUrl)}#${title}-icepanel-title`;
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
// Update the diagram title
|
|
51
|
+
const diagramTitleElement = document.querySelector('#diagramTitle');
|
|
52
|
+
if (diagramTitleElement) {
|
|
53
|
+
diagramTitleElement.textContent = title;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
const iframe = document.querySelector('iframe');
|
|
57
|
+
if (iframe && icePanelUrl) {
|
|
58
|
+
iframe.src = icePanelUrl;
|
|
59
|
+
iframe.width = '100%';
|
|
60
|
+
iframe.height = '100%';
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
configureIcePanel();
|
|
65
|
+
|
|
66
|
+
document.addEventListener('astro:page-load', configureIcePanel);
|
|
67
|
+
</script>
|
package/package.json
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
"url": "https://github.com/event-catalog/eventcatalog.git"
|
|
7
7
|
},
|
|
8
8
|
"type": "module",
|
|
9
|
-
"version": "3.1
|
|
9
|
+
"version": "3.2.1",
|
|
10
10
|
"publishConfig": {
|
|
11
11
|
"access": "public"
|
|
12
12
|
},
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"dist/"
|
|
21
21
|
],
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@ai-sdk/react": "^
|
|
23
|
+
"@ai-sdk/react": "^3.0.17",
|
|
24
24
|
"@astrojs/markdown-remark": "^6.3.10",
|
|
25
25
|
"@astrojs/mdx": "^4.3.13",
|
|
26
26
|
"@astrojs/node": "^9.5.1",
|
|
@@ -53,8 +53,8 @@
|
|
|
53
53
|
"@tanstack/react-query": "^5.74.3",
|
|
54
54
|
"@tanstack/react-table": "^8.17.3",
|
|
55
55
|
"@xyflow/react": "^12.3.6",
|
|
56
|
-
"ai": "^
|
|
57
|
-
"astro": "^5.16.
|
|
56
|
+
"ai": "^6.0.17",
|
|
57
|
+
"astro": "^5.16.7",
|
|
58
58
|
"astro-compress": "^2.3.8",
|
|
59
59
|
"astro-expressive-code": "^0.41.3",
|
|
60
60
|
"astro-seo": "^0.8.4",
|
|
@@ -94,7 +94,7 @@
|
|
|
94
94
|
"rehype-slug": "^6.0.0",
|
|
95
95
|
"remark-comment": "^1.0.0",
|
|
96
96
|
"remark-directive": "^3.0.0",
|
|
97
|
-
"remark-gfm": "^
|
|
97
|
+
"remark-gfm": "^4.0.1",
|
|
98
98
|
"rimraf": "^5.0.7",
|
|
99
99
|
"semver": "7.6.3",
|
|
100
100
|
"shelljs": "^0.9.0",
|
|
@@ -103,7 +103,8 @@
|
|
|
103
103
|
"typescript": "^5.4.5",
|
|
104
104
|
"unist-util-visit": "^5.0.0",
|
|
105
105
|
"update-notifier": "^7.3.1",
|
|
106
|
-
"uuid": "^10.0.0"
|
|
106
|
+
"uuid": "^10.0.0",
|
|
107
|
+
"zod": "^3.25.0"
|
|
107
108
|
},
|
|
108
109
|
"devDependencies": {
|
|
109
110
|
"@astrojs/check": "^0.9.6",
|