@eventcatalog/core 2.37.3 → 2.38.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/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-RXERG5SL.js → chunk-2WN6WIV6.js} +1 -1
- package/dist/{chunk-JCZFOKW3.js → chunk-QTN3KJEE.js} +1 -1
- package/dist/{chunk-KC74WARE.js → chunk-XJ2PHUZU.js} +1 -1
- package/dist/constants.cjs +1 -1
- package/dist/constants.js +1 -1
- package/dist/eventcatalog.cjs +1 -1
- package/dist/eventcatalog.config.d.cts +6 -0
- package/dist/eventcatalog.config.d.ts +6 -0
- package/dist/eventcatalog.js +3 -3
- package/eventcatalog/src/components/Lists/ProtocolList.tsx +1 -15
- package/eventcatalog/src/components/MDX/ChannelInformation/ChannelInformation.tsx +2 -16
- package/eventcatalog/src/components/MDX/NodeGraph/Nodes/Channel.tsx +2 -17
- package/eventcatalog/src/enterprise/eventcatalog-chat/components/windows/ChatWindow.server.tsx +5 -2
- package/eventcatalog/src/enterprise/eventcatalog-chat/providers/ai-provider.ts +58 -0
- package/eventcatalog/src/enterprise/eventcatalog-chat/providers/anthropic.ts +28 -0
- package/eventcatalog/src/enterprise/eventcatalog-chat/providers/google.ts +41 -0
- package/eventcatalog/src/enterprise/eventcatalog-chat/providers/index.ts +26 -0
- package/eventcatalog/src/enterprise/eventcatalog-chat/providers/openai.ts +61 -0
- package/eventcatalog/src/enterprise/eventcatalog-chat/utils/ai.ts +19 -61
- package/eventcatalog/src/icons/protocols/azure-eventgrid.svg +1 -0
- package/eventcatalog/src/icons/protocols/azure-eventhubs.svg +1 -0
- package/eventcatalog/src/icons/protocols/azure-servicebus.svg +1 -0
- package/eventcatalog/src/icons/protocols/index.ts +3 -0
- package/eventcatalog/src/utils/protocols.tsx +15 -0
- package/eventcatalog/tailwind.config.mjs +2 -0
- package/package.json +3 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
log_build_default
|
|
3
|
-
} from "../chunk-
|
|
4
|
-
import "../chunk-
|
|
5
|
-
import "../chunk-
|
|
3
|
+
} from "../chunk-QTN3KJEE.js";
|
|
4
|
+
import "../chunk-2WN6WIV6.js";
|
|
5
|
+
import "../chunk-XJ2PHUZU.js";
|
|
6
6
|
import "../chunk-E7TXTI7G.js";
|
|
7
7
|
export {
|
|
8
8
|
log_build_default as default
|
package/dist/constants.cjs
CHANGED
package/dist/constants.js
CHANGED
package/dist/eventcatalog.cjs
CHANGED
|
@@ -75,9 +75,15 @@ interface Config {
|
|
|
75
75
|
};
|
|
76
76
|
chat?: {
|
|
77
77
|
enabled: boolean;
|
|
78
|
+
provider?: 'openai' | 'anthropic' | 'google';
|
|
78
79
|
model?: string;
|
|
79
80
|
max_tokens?: number;
|
|
80
81
|
similarityResults?: number;
|
|
82
|
+
temperature?: number;
|
|
83
|
+
topP?: number;
|
|
84
|
+
topK?: number;
|
|
85
|
+
frequencyPenalty?: number;
|
|
86
|
+
presencePenalty?: number;
|
|
81
87
|
};
|
|
82
88
|
customDocs?: {
|
|
83
89
|
sidebar?: (ManualSideBarConfig | AutoGeneratedSideBarConfig)[];
|
|
@@ -75,9 +75,15 @@ interface Config {
|
|
|
75
75
|
};
|
|
76
76
|
chat?: {
|
|
77
77
|
enabled: boolean;
|
|
78
|
+
provider?: 'openai' | 'anthropic' | 'google';
|
|
78
79
|
model?: string;
|
|
79
80
|
max_tokens?: number;
|
|
80
81
|
similarityResults?: number;
|
|
82
|
+
temperature?: number;
|
|
83
|
+
topP?: number;
|
|
84
|
+
topK?: number;
|
|
85
|
+
frequencyPenalty?: number;
|
|
86
|
+
presencePenalty?: number;
|
|
81
87
|
};
|
|
82
88
|
customDocs?: {
|
|
83
89
|
sidebar?: (ManualSideBarConfig | AutoGeneratedSideBarConfig)[];
|
package/dist/eventcatalog.js
CHANGED
|
@@ -6,15 +6,15 @@ import {
|
|
|
6
6
|
} from "./chunk-DCLTVJDP.js";
|
|
7
7
|
import {
|
|
8
8
|
log_build_default
|
|
9
|
-
} from "./chunk-
|
|
10
|
-
import "./chunk-
|
|
9
|
+
} from "./chunk-QTN3KJEE.js";
|
|
10
|
+
import "./chunk-2WN6WIV6.js";
|
|
11
11
|
import {
|
|
12
12
|
catalogToAstro,
|
|
13
13
|
checkAndConvertMdToMdx
|
|
14
14
|
} from "./chunk-SLEMYHTU.js";
|
|
15
15
|
import {
|
|
16
16
|
VERSION
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-XJ2PHUZU.js";
|
|
18
18
|
import {
|
|
19
19
|
isBackstagePluginEnabled,
|
|
20
20
|
isEventCatalogScaleEnabled,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Disclosure, DisclosureButton, DisclosurePanel } from '@headlessui/react';
|
|
2
2
|
import { ChevronDownIcon } from '@heroicons/react/20/solid';
|
|
3
|
-
import
|
|
3
|
+
import { getIconForProtocol } from '@utils/protocols';
|
|
4
4
|
|
|
5
5
|
import './PillListFlat.styles.css';
|
|
6
6
|
|
|
@@ -21,20 +21,6 @@ interface Props {
|
|
|
21
21
|
emptyMessage?: string;
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
-
const protocolIcons = Object.keys(ProtocolIcons).reduce(
|
|
25
|
-
(icons, key) => {
|
|
26
|
-
const iconKey = key as keyof typeof ProtocolIcons;
|
|
27
|
-
icons[key.toLowerCase()] = ProtocolIcons[iconKey];
|
|
28
|
-
return icons;
|
|
29
|
-
},
|
|
30
|
-
{} as { [key: string]: string }
|
|
31
|
-
);
|
|
32
|
-
|
|
33
|
-
const getIconForProtocol = (icon: keyof typeof protocolIcons) => {
|
|
34
|
-
const Icon = protocolIcons[icon];
|
|
35
|
-
return Icon ? (props: any) => <span {...props} dangerouslySetInnerHTML={{ __html: Icon }} /> : null;
|
|
36
|
-
};
|
|
37
|
-
|
|
38
24
|
const ProtocolList = ({ title, pills, emptyMessage, color = 'gray', ...props }: Props) => {
|
|
39
25
|
return (
|
|
40
26
|
<div>
|
|
@@ -1,19 +1,5 @@
|
|
|
1
1
|
import type { CollectionEntry } from 'astro:content';
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
const protocolIcons = Object.keys(ProtocolIcons).reduce(
|
|
5
|
-
(icons, key) => {
|
|
6
|
-
const iconKey = key as keyof typeof ProtocolIcons;
|
|
7
|
-
icons[key.toLowerCase()] = ProtocolIcons[iconKey];
|
|
8
|
-
return icons;
|
|
9
|
-
},
|
|
10
|
-
{} as { [key: string]: string }
|
|
11
|
-
);
|
|
12
|
-
|
|
13
|
-
const getIconForProtocol = (icon: keyof typeof protocolIcons) => {
|
|
14
|
-
const Icon = protocolIcons[icon];
|
|
15
|
-
return Icon ? (props: any) => <span {...props} dangerouslySetInnerHTML={{ __html: Icon }} /> : null;
|
|
16
|
-
};
|
|
2
|
+
import { getIconForProtocol } from '@utils/protocols';
|
|
17
3
|
|
|
18
4
|
const ChannelParameters = (data: CollectionEntry<'channels'>['data']) => {
|
|
19
5
|
return (
|
|
@@ -34,7 +20,7 @@ const ChannelParameters = (data: CollectionEntry<'channels'>['data']) => {
|
|
|
34
20
|
<span className="font-semibold">{data.protocols.length > 1 ? 'Protocols:' : 'Protocol:'}</span>
|
|
35
21
|
<ul className="space-x-2 flex">
|
|
36
22
|
{data.protocols.map((protocol) => {
|
|
37
|
-
const IconComponent = getIconForProtocol(protocol.toLowerCase()
|
|
23
|
+
const IconComponent = getIconForProtocol(protocol.toLowerCase());
|
|
38
24
|
return (
|
|
39
25
|
<li key={protocol} className=" text-sm flex items-center space-x-1 bg-gray-100 rounded-md px-1">
|
|
40
26
|
{IconComponent && <IconComponent className="w-4 h-4" />}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { ArrowsRightLeftIcon } from '@heroicons/react/20/solid';
|
|
2
1
|
import type { CollectionMessageTypes } from '@types';
|
|
3
2
|
import type { CollectionEntry } from 'astro:content';
|
|
4
3
|
import { Handle } from '@xyflow/react';
|
|
@@ -22,22 +21,8 @@ function classNames(...classes: any) {
|
|
|
22
21
|
return classes.filter(Boolean).join(' ');
|
|
23
22
|
}
|
|
24
23
|
|
|
25
|
-
import * as ProtocolIcons from '@icons/protocols';
|
|
26
24
|
import { LinkIcon } from '@heroicons/react/24/outline';
|
|
27
|
-
|
|
28
|
-
const protocolIcons = Object.keys(ProtocolIcons).reduce(
|
|
29
|
-
(icons, key) => {
|
|
30
|
-
const iconKey = key as keyof typeof ProtocolIcons;
|
|
31
|
-
icons[key.toLowerCase()] = ProtocolIcons[iconKey];
|
|
32
|
-
return icons;
|
|
33
|
-
},
|
|
34
|
-
{} as { [key: string]: string }
|
|
35
|
-
);
|
|
36
|
-
|
|
37
|
-
const getIconForProtocol = (icon: keyof typeof protocolIcons) => {
|
|
38
|
-
const Icon = protocolIcons[icon];
|
|
39
|
-
return Icon ? (props: any) => <span {...props} dangerouslySetInnerHTML={{ __html: Icon }} /> : null;
|
|
40
|
-
};
|
|
25
|
+
import { getIconForProtocol } from '@utils/protocols';
|
|
41
26
|
|
|
42
27
|
export default function ChannelNode({ data, sourcePosition, targetPosition }: any) {
|
|
43
28
|
const { mode, channel, source, target } = data as Data;
|
|
@@ -50,7 +35,7 @@ export default function ChannelNode({ data, sourcePosition, targetPosition }: an
|
|
|
50
35
|
|
|
51
36
|
const SideBarIcon = getIcon(icon);
|
|
52
37
|
const nodeLabel = label || channel?.data?.sidebar?.badge || 'Channel';
|
|
53
|
-
const fontSize = nodeLabel.length > 10 ? '
|
|
38
|
+
const fontSize = nodeLabel.length > 10 ? '5px' : '9px';
|
|
54
39
|
|
|
55
40
|
const getAddress = () => {
|
|
56
41
|
const sourceChannel = source.data.channels?.find((channel) => channel.id === id);
|
package/eventcatalog/src/enterprise/eventcatalog-chat/components/windows/ChatWindow.server.tsx
CHANGED
|
@@ -20,6 +20,7 @@ interface Resource {
|
|
|
20
20
|
|
|
21
21
|
interface ChatWindowProps {
|
|
22
22
|
model?: string;
|
|
23
|
+
provider?: string;
|
|
23
24
|
embeddingModel?: string;
|
|
24
25
|
max_tokens?: number;
|
|
25
26
|
similarityResults?: number;
|
|
@@ -30,6 +31,7 @@ interface ChatWindowProps {
|
|
|
30
31
|
const ChatWindow = ({
|
|
31
32
|
model = 'o4-mini',
|
|
32
33
|
embeddingModel = 'text-embedding-3-large',
|
|
34
|
+
provider = 'openai',
|
|
33
35
|
max_tokens = 4096,
|
|
34
36
|
similarityResults = 50,
|
|
35
37
|
resources: mentionInputResources = [],
|
|
@@ -492,8 +494,9 @@ const ChatWindow = ({
|
|
|
492
494
|
</div>
|
|
493
495
|
<div className="max-w-[900px] mx-auto flex justify-between">
|
|
494
496
|
{/* show what model is loaded */}
|
|
495
|
-
<p className="text-
|
|
496
|
-
|
|
497
|
+
<p className="text-[10px] text-gray-400 mt-2">
|
|
498
|
+
Provider: {provider.charAt(0).toUpperCase() + provider.slice(1)} | Model: {model}
|
|
499
|
+
{/* Embedding Model: {embeddingModel} */}
|
|
497
500
|
</p>
|
|
498
501
|
<p className="text-xs text-gray-500 mt-2">EventCatalog Chat can make mistakes. Check important info.</p>
|
|
499
502
|
</div>
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { streamText, type CoreMessage, type LanguageModel, type Message } from 'ai';
|
|
2
|
+
|
|
3
|
+
// base class for AI providers
|
|
4
|
+
export interface AIProviderOptions {
|
|
5
|
+
modelId: string;
|
|
6
|
+
model?: LanguageModel;
|
|
7
|
+
temperature?: number;
|
|
8
|
+
topP?: number | undefined;
|
|
9
|
+
topK?: number | undefined;
|
|
10
|
+
frequencyPenalty?: number | undefined;
|
|
11
|
+
presencePenalty?: number | undefined;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export class AIProvider {
|
|
15
|
+
private model?: LanguageModel;
|
|
16
|
+
private modelId: string;
|
|
17
|
+
private temperature: number;
|
|
18
|
+
private topP: number | undefined;
|
|
19
|
+
private topK: number | undefined;
|
|
20
|
+
private frequencyPenalty: number | undefined;
|
|
21
|
+
private presencePenalty: number | undefined;
|
|
22
|
+
public models: string[];
|
|
23
|
+
|
|
24
|
+
constructor({ modelId, model, temperature, topP, topK, frequencyPenalty, presencePenalty }: AIProviderOptions) {
|
|
25
|
+
this.modelId = modelId;
|
|
26
|
+
this.temperature = temperature ?? 0.2;
|
|
27
|
+
this.topP = topP;
|
|
28
|
+
this.topK = topK;
|
|
29
|
+
this.frequencyPenalty = frequencyPenalty;
|
|
30
|
+
this.presencePenalty = presencePenalty;
|
|
31
|
+
this.models = [];
|
|
32
|
+
|
|
33
|
+
if (model) {
|
|
34
|
+
this.model = model;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
async validateModel(model: string): Promise<{ isValidModel: boolean; listOfModels: string[] }> {
|
|
39
|
+
const isValidModel = this.models.includes(model);
|
|
40
|
+
return { isValidModel, listOfModels: this.models };
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
async streamText(messages: Array<CoreMessage> | Array<Omit<Message, 'id'>>) {
|
|
44
|
+
if (!this.model) {
|
|
45
|
+
throw new Error('Model not set');
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
return await streamText({
|
|
49
|
+
model: this.model,
|
|
50
|
+
messages: messages,
|
|
51
|
+
temperature: this.temperature,
|
|
52
|
+
...(this.topP && { topP: this.topP }),
|
|
53
|
+
...(this.topK && { topK: this.topK }),
|
|
54
|
+
...(this.frequencyPenalty && { frequencyPenalty: this.frequencyPenalty }),
|
|
55
|
+
...(this.presencePenalty && { presencePenalty: this.presencePenalty }),
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { anthropic } from '@ai-sdk/anthropic';
|
|
2
|
+
import { AIProvider, type AIProviderOptions } from './ai-provider';
|
|
3
|
+
|
|
4
|
+
const AVAILABLE_GOOGLE_MODELS = [
|
|
5
|
+
'claude-3-7-sonnet-20250219',
|
|
6
|
+
'claude-3-5-sonnet-latest',
|
|
7
|
+
'claude-3-5-sonnet-20241022',
|
|
8
|
+
'claude-3-5-sonnet-20240620',
|
|
9
|
+
'claude-3-5-haiku-latest',
|
|
10
|
+
'claude-3-5-haiku-20241022',
|
|
11
|
+
'claude-3-opus-latest',
|
|
12
|
+
'claude-3-opus-20240229',
|
|
13
|
+
'claude-3-sonnet-20240229',
|
|
14
|
+
'claude-3-haiku-20240307',
|
|
15
|
+
] as const;
|
|
16
|
+
|
|
17
|
+
export class AnthropicProvider extends AIProvider {
|
|
18
|
+
public models: string[] = [...AVAILABLE_GOOGLE_MODELS];
|
|
19
|
+
|
|
20
|
+
constructor(options: AIProviderOptions) {
|
|
21
|
+
const languageModel = anthropic(options.modelId || 'claude-3-7-sonnet-20250219');
|
|
22
|
+
|
|
23
|
+
super({
|
|
24
|
+
...options,
|
|
25
|
+
model: languageModel,
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { google } from '@ai-sdk/google';
|
|
2
|
+
import { AIProvider, type AIProviderOptions } from './ai-provider';
|
|
3
|
+
|
|
4
|
+
const AVAILABLE_GOOGLE_MODELS = [
|
|
5
|
+
'gemini-1.5-flash',
|
|
6
|
+
'gemini-1.5-flash-latest',
|
|
7
|
+
'gemini-1.5-flash-001',
|
|
8
|
+
'gemini-1.5-flash-002',
|
|
9
|
+
'gemini-1.5-flash-8b',
|
|
10
|
+
'gemini-1.5-flash-8b-latest',
|
|
11
|
+
'gemini-1.5-flash-8b-001',
|
|
12
|
+
'gemini-1.5-pro',
|
|
13
|
+
'gemini-1.5-pro-latest',
|
|
14
|
+
'gemini-1.5-pro-001',
|
|
15
|
+
'gemini-1.5-pro-002',
|
|
16
|
+
'gemini-2.0-flash',
|
|
17
|
+
'gemini-2.0-flash-001',
|
|
18
|
+
'gemini-2.0-flash-live-001',
|
|
19
|
+
'gemini-2.0-flash-lite',
|
|
20
|
+
'gemini-2.0-pro-exp-02-05',
|
|
21
|
+
'gemini-2.0-flash-thinking-exp-01-21',
|
|
22
|
+
'gemini-2.0-flash-exp',
|
|
23
|
+
'gemini-2.5-pro-exp-03-25',
|
|
24
|
+
'gemini-2.5-pro-preview-05-06',
|
|
25
|
+
'gemini-2.5-flash-preview-04-17',
|
|
26
|
+
'gemini-exp-1206',
|
|
27
|
+
'gemma-3-27b-it',
|
|
28
|
+
'learnlm-1.5-pro-experimental',
|
|
29
|
+
] as const;
|
|
30
|
+
|
|
31
|
+
export class GoogleProvider extends AIProvider {
|
|
32
|
+
public models: string[] = [...AVAILABLE_GOOGLE_MODELS];
|
|
33
|
+
|
|
34
|
+
constructor(options: AIProviderOptions) {
|
|
35
|
+
const languageModel = google(options.modelId || 'gemini-1.5-flash');
|
|
36
|
+
super({
|
|
37
|
+
...options,
|
|
38
|
+
model: languageModel,
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { OpenAIProvider } from './openai';
|
|
2
|
+
import { GoogleProvider } from './google';
|
|
3
|
+
import { AnthropicProvider } from './anthropic';
|
|
4
|
+
import type { AIProviderOptions } from './ai-provider';
|
|
5
|
+
|
|
6
|
+
export function getProvider(provider: string, options: AIProviderOptions) {
|
|
7
|
+
switch (provider) {
|
|
8
|
+
case 'openai':
|
|
9
|
+
return new OpenAIProvider({
|
|
10
|
+
...options,
|
|
11
|
+
modelId: options.modelId,
|
|
12
|
+
});
|
|
13
|
+
case 'google':
|
|
14
|
+
return new GoogleProvider({
|
|
15
|
+
...options,
|
|
16
|
+
modelId: options.modelId,
|
|
17
|
+
});
|
|
18
|
+
case 'anthropic':
|
|
19
|
+
return new AnthropicProvider({
|
|
20
|
+
...options,
|
|
21
|
+
modelId: options.modelId,
|
|
22
|
+
});
|
|
23
|
+
default:
|
|
24
|
+
throw new Error(`Provider ${provider} not supported`);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { openai } from '@ai-sdk/openai';
|
|
2
|
+
import { AIProvider, type AIProviderOptions } from './ai-provider';
|
|
3
|
+
|
|
4
|
+
const AVAILABLE_OPENAI_MODELS = [
|
|
5
|
+
'o1',
|
|
6
|
+
'o1-2024-12-17',
|
|
7
|
+
'o1-mini',
|
|
8
|
+
'o1-mini-2024-09-12',
|
|
9
|
+
'o1-preview',
|
|
10
|
+
'o1-preview-2024-09-12',
|
|
11
|
+
'o3-mini',
|
|
12
|
+
'o3-mini-2025-01-31',
|
|
13
|
+
'o3',
|
|
14
|
+
'o3-2025-04-16',
|
|
15
|
+
'o4-mini',
|
|
16
|
+
'o4-mini-2025-04-16',
|
|
17
|
+
'gpt-4.1',
|
|
18
|
+
'gpt-4.1-2025-04-14',
|
|
19
|
+
'gpt-4.1-mini',
|
|
20
|
+
'gpt-4.1-mini-2025-04-14',
|
|
21
|
+
'gpt-4.1-nano',
|
|
22
|
+
'gpt-4.1-nano-2025-04-14',
|
|
23
|
+
'gpt-4o',
|
|
24
|
+
'gpt-4o-2024-05-13',
|
|
25
|
+
'gpt-4o-2024-08-06',
|
|
26
|
+
'gpt-4o-2024-11-20',
|
|
27
|
+
'gpt-4o-audio-preview',
|
|
28
|
+
'gpt-4o-audio-preview-2024-10-01',
|
|
29
|
+
'gpt-4o-audio-preview-2024-12-17',
|
|
30
|
+
'gpt-4o-search-preview',
|
|
31
|
+
'gpt-4o-search-preview-2025-03-11',
|
|
32
|
+
'gpt-4o-mini-search-preview',
|
|
33
|
+
'gpt-4o-mini-search-preview-2025-03-11',
|
|
34
|
+
'gpt-4o-mini',
|
|
35
|
+
'gpt-4o-mini-2024-07-18',
|
|
36
|
+
'gpt-4-turbo',
|
|
37
|
+
'gpt-4-turbo-2024-04-09',
|
|
38
|
+
'gpt-4-turbo-preview',
|
|
39
|
+
'gpt-4-0125-preview',
|
|
40
|
+
'gpt-4-1106-preview',
|
|
41
|
+
'gpt-4',
|
|
42
|
+
'gpt-4-0613',
|
|
43
|
+
'gpt-4.5-preview',
|
|
44
|
+
'gpt-4.5-preview-2025-02-27',
|
|
45
|
+
'gpt-3.5-turbo-0125',
|
|
46
|
+
'gpt-3.5-turbo',
|
|
47
|
+
'gpt-3.5-turbo-1106',
|
|
48
|
+
'chatgpt-4o-latest',
|
|
49
|
+
] as const;
|
|
50
|
+
|
|
51
|
+
export class OpenAIProvider extends AIProvider {
|
|
52
|
+
public models: string[] = [...AVAILABLE_OPENAI_MODELS];
|
|
53
|
+
|
|
54
|
+
constructor(options: AIProviderOptions) {
|
|
55
|
+
const languageModel = openai(options.modelId || 'o4-mini');
|
|
56
|
+
super({
|
|
57
|
+
...options,
|
|
58
|
+
model: languageModel,
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
}
|
|
@@ -1,62 +1,15 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { openai } from '@ai-sdk/openai';
|
|
1
|
+
import { generateText, type CoreMessage, type Message } from 'ai';
|
|
3
2
|
import { EventCatalogVectorStore, type Resource } from '@enterprise/eventcatalog-chat/EventCatalogVectorStore';
|
|
4
3
|
import fs from 'fs';
|
|
5
4
|
import path from 'path';
|
|
6
5
|
import config from '@config';
|
|
6
|
+
import { anthropic } from '@ai-sdk/anthropic';
|
|
7
|
+
import { getProvider } from '@enterprise/eventcatalog-chat/providers';
|
|
7
8
|
|
|
8
9
|
const AI_EMBEDDINGS_PATH = path.join(process.env.PROJECT_DIR || process.cwd(), 'public/ai');
|
|
9
|
-
|
|
10
10
|
const documents = JSON.parse(fs.readFileSync(path.join(AI_EMBEDDINGS_PATH, 'documents.json'), 'utf8'));
|
|
11
11
|
const embeddings = JSON.parse(fs.readFileSync(path.join(AI_EMBEDDINGS_PATH, 'embeddings.json'), 'utf8'));
|
|
12
12
|
|
|
13
|
-
const OpenAIChatModelIds = [
|
|
14
|
-
'o1',
|
|
15
|
-
'o1-2024-12-17',
|
|
16
|
-
'o1-mini',
|
|
17
|
-
'o1-mini-2024-09-12',
|
|
18
|
-
'o1-preview',
|
|
19
|
-
'o1-preview-2024-09-12',
|
|
20
|
-
'o3-mini',
|
|
21
|
-
'o3-mini-2025-01-31',
|
|
22
|
-
'o3',
|
|
23
|
-
'o3-2025-04-16',
|
|
24
|
-
'o4-mini',
|
|
25
|
-
'o4-mini-2025-04-16',
|
|
26
|
-
'gpt-4.1',
|
|
27
|
-
'gpt-4.1-2025-04-14',
|
|
28
|
-
'gpt-4.1-mini',
|
|
29
|
-
'gpt-4.1-mini-2025-04-14',
|
|
30
|
-
'gpt-4.1-nano',
|
|
31
|
-
'gpt-4.1-nano-2025-04-14',
|
|
32
|
-
'gpt-4o',
|
|
33
|
-
'gpt-4o-2024-05-13',
|
|
34
|
-
'gpt-4o-2024-08-06',
|
|
35
|
-
'gpt-4o-2024-11-20',
|
|
36
|
-
'gpt-4o-audio-preview',
|
|
37
|
-
'gpt-4o-audio-preview-2024-10-01',
|
|
38
|
-
'gpt-4o-audio-preview-2024-12-17',
|
|
39
|
-
'gpt-4o-search-preview',
|
|
40
|
-
'gpt-4o-search-preview-2025-03-11',
|
|
41
|
-
'gpt-4o-mini-search-preview',
|
|
42
|
-
'gpt-4o-mini-search-preview-2025-03-11',
|
|
43
|
-
'gpt-4o-mini',
|
|
44
|
-
'gpt-4o-mini-2024-07-18',
|
|
45
|
-
'gpt-4-turbo',
|
|
46
|
-
'gpt-4-turbo-2024-04-09',
|
|
47
|
-
'gpt-4-turbo-preview',
|
|
48
|
-
'gpt-4-0125-preview',
|
|
49
|
-
'gpt-4-1106-preview',
|
|
50
|
-
'gpt-4',
|
|
51
|
-
'gpt-4-0613',
|
|
52
|
-
'gpt-4.5-preview',
|
|
53
|
-
'gpt-4.5-preview-2025-02-27',
|
|
54
|
-
'gpt-3.5-turbo-0125',
|
|
55
|
-
'gpt-3.5-turbo',
|
|
56
|
-
'gpt-3.5-turbo-1106',
|
|
57
|
-
'chatgpt-4o-latest',
|
|
58
|
-
];
|
|
59
|
-
|
|
60
13
|
export const getResources = async (question: string) => {
|
|
61
14
|
const vectorStore = await EventCatalogVectorStore.create(documents, embeddings);
|
|
62
15
|
const resources = await vectorStore.getEventCatalogResources(question);
|
|
@@ -134,18 +87,23 @@ ${resourceStrings.join('\n')}
|
|
|
134
87
|
},
|
|
135
88
|
] as CoreMessage[];
|
|
136
89
|
|
|
137
|
-
const
|
|
90
|
+
const modelId = config?.chat?.model;
|
|
91
|
+
|
|
92
|
+
// setup the model and provider
|
|
93
|
+
const aiProvider = getProvider(config?.chat?.provider || 'openai', {
|
|
94
|
+
modelId,
|
|
95
|
+
temperature: config?.chat?.temperature,
|
|
96
|
+
topP: config?.chat?.topP,
|
|
97
|
+
topK: config?.chat?.topK,
|
|
98
|
+
frequencyPenalty: config?.chat?.frequencyPenalty,
|
|
99
|
+
presencePenalty: config?.chat?.presencePenalty,
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
const { isValidModel, listOfModels } = await aiProvider.validateModel(modelId);
|
|
138
103
|
|
|
139
|
-
if (!
|
|
140
|
-
throw new Error(`Invalid model: ${
|
|
104
|
+
if (!isValidModel) {
|
|
105
|
+
throw new Error(`Invalid model: "${modelId}", please use a valid model from the following list: ${listOfModels.join(', ')}`);
|
|
141
106
|
}
|
|
142
107
|
|
|
143
|
-
return await streamText(
|
|
144
|
-
model: openai(model),
|
|
145
|
-
messages: messages,
|
|
146
|
-
temperature: 0.2,
|
|
147
|
-
topP: 1,
|
|
148
|
-
frequencyPenalty: 0,
|
|
149
|
-
presencePenalty: 0,
|
|
150
|
-
});
|
|
108
|
+
return await aiProvider.streamText(messages);
|
|
151
109
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 18 18"><defs><linearGradient id="a20547e5-d6af-456b-afbc-05d22ff8cb9d" x1="4589.72" y1="-5180.02" x2="4589.72" y2="-5184.21" gradientTransform="matrix(0.5, 0, 0, -0.5, -2275.31, -2589.32)" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#c69aeb" /><stop offset="1" stop-color="#6f4bb2" /></linearGradient><linearGradient id="a4745f51-5e75-4126-812d-6bb8a5130e16" x1="4587.99" y1="-5188.47" x2="4587.99" y2="-5192.65" href="#a20547e5-d6af-456b-afbc-05d22ff8cb9d" /></defs><title>Icon-integration-215</title><g><g id="b30b0bd5-e4d2-456b-8d49-c2df20200912"><path id="b51878b5-8d50-4b8b-bc48-74f5f7315a99" d="M12.7,8.15v-.6H8.18L6.06,9.66H4.5L8.12,6h2.47V5.43H7.87L3.65,9.66h-.6v.6H4.86L7,12.37H12.1v-.6H7.22L5.71,10.26H9.38v-.6H6.92l1.5-1.51Z" fill="#32bedd" /><circle id="ad0ed4eb-cd5f-4cc0-bd19-2830d27ec806" cx="9.98" cy="9.96" r="0.87" fill="#fff" /><circle id="a2746b4a-0ae4-4308-876e-5b82657e1872" cx="10.89" cy="5.74" r="0.87" fill="#fff" /><circle id="fc3316e0-7094-4ce0-99ed-43f1e6e4350c" cx="13" cy="7.85" r="0.87" fill="#fff" /><circle id="b5d18443-d50e-4590-8e8f-80b6a7f6d348" cx="12.1" cy="12.07" r="0.87" fill="#fff" /><circle cx="10.86" cy="5.74" r="1.05" fill="#50e6ff" /><circle cx="12.97" cy="7.85" r="1.05" fill="url(#a20547e5-d6af-456b-afbc-05d22ff8cb9d)" /><circle cx="12.1" cy="12.07" r="1.05" fill="url(#a4745f51-5e75-4126-812d-6bb8a5130e16)" /><circle cx="9.98" cy="9.96" r="1.05" fill="#50e6ff" /><g><path d="M1.07,1.43H2.36a0,0,0,0,1,0,0V5a.29.29,0,0,1-.29.29H.79A.29.29,0,0,1,.5,5V2A.57.57,0,0,1,1.07,1.43Z" fill="#999" /><path d="M1.07,1.43H2.36a0,0,0,0,1,0,0V5a.29.29,0,0,1-.29.29H.79A.29.29,0,0,1,.5,5V2A.57.57,0,0,1,1.07,1.43Z" fill="#999" opacity="0.5" /></g><g><path d="M15.64,1.43h1.29A.57.57,0,0,1,17.5,2V5a.29.29,0,0,1-.29.29H15.92A.29.29,0,0,1,15.64,5V1.43A0,0,0,0,1,15.64,1.43Z" fill="#999" /><path d="M15.64,1.43h1.29A.57.57,0,0,1,17.5,2V5a.29.29,0,0,1-.29.29H15.92A.29.29,0,0,1,15.64,5V1.43A0,0,0,0,1,15.64,1.43Z" fill="#999" opacity="0.5" /></g><path d="M8.66-6.16H9.91a0,0,0,0,1,0,0v17a0,0,0,0,1,0,0H8.66a.57.57,0,0,1-.57-.57V-5.6A.57.57,0,0,1,8.66-6.16Z" transform="translate(11.34 -6.66) rotate(90)" fill="#949494" /><g><path d="M.79,12.68H2.08a.29.29,0,0,1,.29.29v3.6a0,0,0,0,1,0,0H1.07A.57.57,0,0,1,.5,16V13A.29.29,0,0,1,.79,12.68Z" fill="#999" /><path d="M.79,12.68H2.08a.29.29,0,0,1,.29.29v3.6a0,0,0,0,1,0,0H1.07A.57.57,0,0,1,.5,16V13A.29.29,0,0,1,.79,12.68Z" fill="#999" opacity="0.5" /></g><g><path d="M15.92,12.68h1.29a.29.29,0,0,1,.29.29v3a.57.57,0,0,1-.57.57H15.64a0,0,0,0,1,0,0V13A.29.29,0,0,1,15.92,12.68Z" fill="#999" /><path d="M15.92,12.68h1.29a.29.29,0,0,1,.29.29v3a.57.57,0,0,1-.57.57H15.64a0,0,0,0,1,0,0V13A.29.29,0,0,1,15.92,12.68Z" fill="#999" opacity="0.5" /></g><path d="M8.66,7.16H9.91a0,0,0,0,1,0,0v17a0,0,0,0,1,0,0H8.66a.57.57,0,0,1-.57-.57V7.73A.57.57,0,0,1,8.66,7.16Z" transform="translate(-6.66 24.66) rotate(-90)" fill="#949494" /></g></g></svg>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 18 18"><title>Icon-analytics-144</title><g><g id="a53a4de8-371c-49da-a662-c4631299fc03"><path d="M10.83,8.42a.26.26,0,0,1-.24.27H8.5a.26.26,0,0,1-.27-.24V6.89a.26.26,0,0,1,.24-.27h2.09a.26.26,0,0,1,.27.24V8.42Z" fill="#76bc2d" /><path d="M14.54,10a.26.26,0,0,1-.24.27H12.21a.26.26,0,0,1-.27-.24V8.48a.26.26,0,0,1,.24-.27h2.09a.26.26,0,0,1,.27.24V10Z" fill="#76bc2d" /><path d="M10.83,11.6a.26.26,0,0,1-.24.27H8.5a.26.26,0,0,1-.27-.24V10.07a.26.26,0,0,1,.24-.27h2.09a.26.26,0,0,1,.27.24V11.6Z" fill="#76bc2d" /><path d="M7.12,6.84a.25.25,0,0,1-.23.26H4.74a.26.26,0,0,1-.27-.23V5.25A.26.26,0,0,1,4.71,5H6.8c.22,0,.32.11.32.27Z" fill="#86d633" /><path d="M7.12,10a.25.25,0,0,1-.23.27H4.74A.26.26,0,0,1,4.47,10V8.42a.26.26,0,0,1,.24-.26H6.8c.22,0,.32.11.32.26Z" fill="#76bc2d" /><path d="M7.12,13.19a.25.25,0,0,1-.23.27H4.74a.26.26,0,0,1-.27-.24V11.6a.25.25,0,0,1,.24-.26H6.8c.22,0,.32.1.32.26Z" fill="#76bc2d" /><g><path d="M1.07,1.51H2.36a0,0,0,0,1,0,0v3.6a.29.29,0,0,1-.29.29H.79A.29.29,0,0,1,.5,5.11v-3A.57.57,0,0,1,1.07,1.51Z" fill="#999" /><path d="M1.07,1.51H2.36a0,0,0,0,1,0,0v3.6a.29.29,0,0,1-.29.29H.79A.29.29,0,0,1,.5,5.11v-3A.57.57,0,0,1,1.07,1.51Z" fill="#999" opacity="0.5" /></g><g><path d="M15.64,1.51h1.29a.57.57,0,0,1,.57.57v3a.29.29,0,0,1-.29.29H15.92a.29.29,0,0,1-.29-.29V1.51A0,0,0,0,1,15.64,1.51Z" fill="#999" /><path d="M15.64,1.51h1.29a.57.57,0,0,1,.57.57v3a.29.29,0,0,1-.29.29H15.92a.29.29,0,0,1-.29-.29V1.51A0,0,0,0,1,15.64,1.51Z" fill="#999" opacity="0.5" /></g><path d="M8.66-6.08H9.91a0,0,0,0,1,0,0v17a0,0,0,0,1,0,0H8.66a.57.57,0,0,1-.57-.57V-5.52A.57.57,0,0,1,8.66-6.08Z" transform="translate(11.42 -6.58) rotate(90)" fill="#949494" /><g><path d="M.79,12.76H2.08a.29.29,0,0,1,.29.29v3.6a0,0,0,0,1,0,0H1.07a.57.57,0,0,1-.57-.57V13A.29.29,0,0,1,.79,12.76Z" fill="#999" /><path d="M.79,12.76H2.08a.29.29,0,0,1,.29.29v3.6a0,0,0,0,1,0,0H1.07a.57.57,0,0,1-.57-.57V13A.29.29,0,0,1,.79,12.76Z" fill="#999" opacity="0.5" /></g><g><path d="M15.92,12.76h1.29a.29.29,0,0,1,.29.29v3a.57.57,0,0,1-.57.57H15.64a0,0,0,0,1,0,0V13A.29.29,0,0,1,15.92,12.76Z" fill="#999" /><path d="M15.92,12.76h1.29a.29.29,0,0,1,.29.29v3a.57.57,0,0,1-.57.57H15.64a0,0,0,0,1,0,0V13A.29.29,0,0,1,15.92,12.76Z" fill="#999" opacity="0.5" /></g><path d="M8.66,7.24H9.91a0,0,0,0,1,0,0v17a0,0,0,0,1,0,0H8.66a.57.57,0,0,1-.57-.57V7.81A.57.57,0,0,1,8.66,7.24Z" transform="translate(-6.74 24.74) rotate(-90)" fill="#949494" /></g></g></svg>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 18 18"><defs><linearGradient id="bbd02878-309a-4490-8196-946338d0f593" x1="8.995" y1="10.299" x2="8.995" y2="13.199" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#005ba1" /><stop offset="0.258" stop-color="#00589d" /><stop offset="0.525" stop-color="#004f90" /><stop offset="0.796" stop-color="#003f7c" /><stop offset="1" stop-color="#003067" /></linearGradient></defs><g><g id="b532e600-3623-4be6-9fa6-30d05fff56b1"><polygon points="13.387 7.4 13.382 7.396 13.382 7.384 13.363 7.384 8.997 4.405 4.631 7.384 4.612 7.384 4.612 7.396 4.606 7.4 4.612 7.4 4.612 13.201 13.382 13.201 13.382 7.4 13.387 7.4" fill="#50e6ff" /><path d="M4.606,7.4c0-.1.008,5.681.008,5.8L8.995,10.3Z" fill="#32bedd" /><path d="M13.384,7.4,8.995,10.3,13.376,13.2C13.376,13.083,13.384,7.3,13.384,7.4Z" fill="#198ab3" /><polygon points="8.995 10.299 4.614 13.194 4.614 13.199 13.376 13.199 13.376 13.194 8.995 10.299" fill="url(#bbd02878-309a-4490-8196-946338d0f593)" /><g><path d="M1.072,1.43h1.29a0,0,0,0,1,0,0v3.6a.286.286,0,0,1-.286.286H.786A.286.286,0,0,1,.5,5.035V2A.572.572,0,0,1,1.072,1.43Z" fill="#999" /><path d="M1.072,1.43h1.29a0,0,0,0,1,0,0v3.6a.286.286,0,0,1-.286.286H.786A.286.286,0,0,1,.5,5.035V2A.572.572,0,0,1,1.072,1.43Z" fill="#999" opacity="0.5" /></g><g><path d="M15.638,1.43h1.29A.572.572,0,0,1,17.5,2V5.035a.286.286,0,0,1-.286.286h-1.29a.286.286,0,0,1-.286-.286V1.43A0,0,0,0,1,15.638,1.43Z" fill="#999" /><path d="M15.638,1.43h1.29A.572.572,0,0,1,17.5,2V5.035a.286.286,0,0,1-.286.286h-1.29a.286.286,0,0,1-.286-.286V1.43A0,0,0,0,1,15.638,1.43Z" fill="#999" opacity="0.5" /></g><path d="M8.66-6.163H9.907a0,0,0,0,1,0,0v17a0,0,0,0,1,0,0H8.66a.567.567,0,0,1-.567-.567V-5.6A.567.567,0,0,1,8.66-6.163Z" transform="translate(11.337 -6.663) rotate(90)" fill="#949494" /><g><path d="M.786,12.679h1.29a.286.286,0,0,1,.286.286v3.6a0,0,0,0,1,0,0H1.072A.572.572,0,0,1,.5,16V12.965A.286.286,0,0,1,.786,12.679Z" fill="#999" /><path d="M.786,12.679h1.29a.286.286,0,0,1,.286.286v3.6a0,0,0,0,1,0,0H1.072A.572.572,0,0,1,.5,16V12.965A.286.286,0,0,1,.786,12.679Z" fill="#999" opacity="0.5" /></g><g><path d="M15.924,12.679h1.29a.286.286,0,0,1,.286.286V16a.572.572,0,0,1-.572.572h-1.29a0,0,0,0,1,0,0v-3.6A.286.286,0,0,1,15.924,12.679Z" fill="#999" /><path d="M15.924,12.679h1.29a.286.286,0,0,1,.286.286V16a.572.572,0,0,1-.572.572h-1.29a0,0,0,0,1,0,0v-3.6A.286.286,0,0,1,15.924,12.679Z" fill="#999" opacity="0.5" /></g><path d="M8.66,7.163H9.907a0,0,0,0,1,0,0v17a0,0,0,0,1,0,0H8.66a.567.567,0,0,1-.567-.567V7.73A.567.567,0,0,1,8.66,7.163Z" transform="translate(-6.663 24.663) rotate(-90)" fill="#949494" /></g></g></svg>
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
export { default as AzureEventGrid } from '@icons/protocols/azure-eventgrid.svg?raw';
|
|
2
|
+
export { default as AzureEventHubs } from '@icons/protocols/azure-eventhubs.svg?raw';
|
|
3
|
+
export { default as AzureServiceBus } from '@icons/protocols/azure-servicebus.svg?raw';
|
|
1
4
|
export { default as Kafka } from '@icons/protocols/kafka.svg?raw';
|
|
2
5
|
export { default as Http } from '@icons/protocols/http.svg?raw';
|
|
3
6
|
export { default as JMS } from '@icons/protocols/jms.svg?raw';
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import * as ProtocolIcons from '@icons/protocols';
|
|
2
|
+
|
|
3
|
+
const protocolIcons = Object.keys(ProtocolIcons).reduce(
|
|
4
|
+
(icons, key) => {
|
|
5
|
+
const iconKey = key as keyof typeof ProtocolIcons;
|
|
6
|
+
icons[key.toLowerCase()] = ProtocolIcons[iconKey];
|
|
7
|
+
return icons;
|
|
8
|
+
},
|
|
9
|
+
{} as { [key: string]: string }
|
|
10
|
+
);
|
|
11
|
+
|
|
12
|
+
export const getIconForProtocol = (icon: string) => {
|
|
13
|
+
const Icon = protocolIcons[icon?.replace('-', '').toLowerCase()];
|
|
14
|
+
return Icon ? (props: any) => <span {...props} dangerouslySetInnerHTML={{ __html: Icon }} /> : null;
|
|
15
|
+
};
|
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": "2.
|
|
9
|
+
"version": "2.38.0",
|
|
10
10
|
"publishConfig": {
|
|
11
11
|
"access": "public"
|
|
12
12
|
},
|
|
@@ -21,6 +21,8 @@
|
|
|
21
21
|
"default-files-for-collections/"
|
|
22
22
|
],
|
|
23
23
|
"dependencies": {
|
|
24
|
+
"@ai-sdk/anthropic": "^1.2.11",
|
|
25
|
+
"@ai-sdk/google": "^1.2.17",
|
|
24
26
|
"@ai-sdk/openai": "^1.3.16",
|
|
25
27
|
"@astrojs/markdown-remark": "^6.3.1",
|
|
26
28
|
"@astrojs/mdx": "^4.2.4",
|