@eventcatalog/core 2.35.6 → 2.35.8

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.
@@ -37,7 +37,7 @@ var import_axios = __toESM(require("axios"), 1);
37
37
  var import_os = __toESM(require("os"), 1);
38
38
 
39
39
  // package.json
40
- var version = "2.35.6";
40
+ var version = "2.35.8";
41
41
 
42
42
  // src/constants.ts
43
43
  var VERSION = version;
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  raiseEvent
3
- } from "../chunk-M63WKKQC.js";
4
- import "../chunk-242GKRAE.js";
3
+ } from "../chunk-RAHESCX4.js";
4
+ import "../chunk-3LCAKJ2U.js";
5
5
  export {
6
6
  raiseEvent
7
7
  };
@@ -106,7 +106,7 @@ var import_axios = __toESM(require("axios"), 1);
106
106
  var import_os = __toESM(require("os"), 1);
107
107
 
108
108
  // package.json
109
- var version = "2.35.6";
109
+ var version = "2.35.8";
110
110
 
111
111
  // src/constants.ts
112
112
  var VERSION = version;
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  log_build_default
3
- } from "../chunk-SAGNHURV.js";
4
- import "../chunk-M63WKKQC.js";
5
- import "../chunk-242GKRAE.js";
3
+ } from "../chunk-AS3INH2X.js";
4
+ import "../chunk-RAHESCX4.js";
5
+ import "../chunk-3LCAKJ2U.js";
6
6
  import "../chunk-E7TXTI7G.js";
7
7
  export {
8
8
  log_build_default as default
@@ -1,5 +1,5 @@
1
1
  // package.json
2
- var version = "2.35.6";
2
+ var version = "2.35.8";
3
3
 
4
4
  // src/constants.ts
5
5
  var VERSION = version;
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  raiseEvent
3
- } from "./chunk-M63WKKQC.js";
3
+ } from "./chunk-RAHESCX4.js";
4
4
  import {
5
5
  getEventCatalogConfigFile,
6
6
  verifyRequiredFieldsAreInCatalogConfigFile
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  VERSION
3
- } from "./chunk-242GKRAE.js";
3
+ } from "./chunk-3LCAKJ2U.js";
4
4
 
5
5
  // src/analytics/analytics.js
6
6
  import axios from "axios";
@@ -25,7 +25,7 @@ __export(constants_exports, {
25
25
  module.exports = __toCommonJS(constants_exports);
26
26
 
27
27
  // package.json
28
- var version = "2.35.6";
28
+ var version = "2.35.8";
29
29
 
30
30
  // src/constants.ts
31
31
  var VERSION = version;
package/dist/constants.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  VERSION
3
- } from "./chunk-242GKRAE.js";
3
+ } from "./chunk-3LCAKJ2U.js";
4
4
  export {
5
5
  VERSION
6
6
  };
@@ -157,7 +157,7 @@ var import_axios = __toESM(require("axios"), 1);
157
157
  var import_os = __toESM(require("os"), 1);
158
158
 
159
159
  // package.json
160
- var version = "2.35.6";
160
+ var version = "2.35.8";
161
161
 
162
162
  // src/constants.ts
163
163
  var VERSION = version;
@@ -6,15 +6,15 @@ import {
6
6
  } from "./chunk-DCLTVJDP.js";
7
7
  import {
8
8
  log_build_default
9
- } from "./chunk-SAGNHURV.js";
10
- import "./chunk-M63WKKQC.js";
9
+ } from "./chunk-AS3INH2X.js";
10
+ import "./chunk-RAHESCX4.js";
11
11
  import {
12
12
  catalogToAstro,
13
13
  checkAndConvertMdToMdx
14
14
  } from "./chunk-5ZG43YD2.js";
15
15
  import {
16
16
  VERSION
17
- } from "./chunk-242GKRAE.js";
17
+ } from "./chunk-3LCAKJ2U.js";
18
18
  import {
19
19
  isBackstagePluginEnabled,
20
20
  isEventCatalogScaleEnabled,
@@ -1,8 +1,12 @@
1
1
  import { HuggingFaceTransformersEmbeddings } from '@langchain/community/embeddings/huggingface_transformers';
2
2
  import { MemoryVectorStore } from 'langchain/vectorstores/memory';
3
3
  import { Document as LangChainDocument } from 'langchain/document';
4
+ import { OpenAIEmbeddings } from '@langchain/openai';
4
5
 
5
- const embeddingsInstance = new HuggingFaceTransformersEmbeddings({ model: 'Xenova/all-MiniLM-L6-v2' });
6
+ import { getConfigurationForGivenGenerator } from '@utils/generators';
7
+
8
+ const aiGeneratorConfiguration = getConfigurationForGivenGenerator('@eventcatalog/generator-ai');
9
+ const embedding = aiGeneratorConfiguration?.embedding || {};
6
10
 
7
11
  export interface Resource {
8
12
  id: string;
@@ -21,6 +25,16 @@ export class EventCatalogVectorStore {
21
25
 
22
26
  // Static async factory method
23
27
  public static async create(documents: LangChainDocument[], embeddings: number[][]): Promise<EventCatalogVectorStore> {
28
+ let embeddingsInstance: any;
29
+
30
+ if (embedding.provider === 'openai') {
31
+ const model = embedding.model || 'text-embedding-3-large';
32
+ embeddingsInstance = new OpenAIEmbeddings({ model });
33
+ } else {
34
+ const model = embedding.model || 'all-MiniLM-L6-v2';
35
+ embeddingsInstance = new HuggingFaceTransformersEmbeddings({ model });
36
+ }
37
+
24
38
  const vectorStore = new MemoryVectorStore(embeddingsInstance);
25
39
  await vectorStore.addVectors(embeddings, documents);
26
40
  return new EventCatalogVectorStore(vectorStore);
@@ -511,7 +511,7 @@ const ChatWindow = ({
511
511
  <div className="max-w-[900px] mx-auto flex justify-between">
512
512
  {/* show what model is loaded */}
513
513
  <p className="text-xs text-gray-400 mt-2">Model: {model}</p>
514
- <p className="text-xs text-gray-500 mt-2">EventCatalog AI can make mistakes. Check important info.</p>
514
+ <p className="text-xs text-gray-500 mt-2">EventCatalog Chat can make mistakes. Check important info.</p>
515
515
  </div>
516
516
  </div>
517
517
  </div>
@@ -20,6 +20,7 @@ interface Resource {
20
20
 
21
21
  interface ChatWindowProps {
22
22
  model?: string;
23
+ embeddingModel?: string;
23
24
  max_tokens?: number;
24
25
  similarityResults?: number;
25
26
  resources: Resource[];
@@ -28,6 +29,7 @@ interface ChatWindowProps {
28
29
 
29
30
  const ChatWindow = ({
30
31
  model = 'o4-mini',
32
+ embeddingModel = 'text-embedding-3-large',
31
33
  max_tokens = 4096,
32
34
  similarityResults = 50,
33
35
  resources: mentionInputResources = [],
@@ -478,8 +480,10 @@ const ChatWindow = ({
478
480
  </div>
479
481
  <div className="max-w-[900px] mx-auto flex justify-between">
480
482
  {/* show what model is loaded */}
481
- <p className="text-xs text-gray-400 mt-2">Model: {model}</p>
482
- <p className="text-xs text-gray-500 mt-2">EventCatalog AI can make mistakes. Check important info.</p>
483
+ <p className="text-xs text-gray-400 mt-2">
484
+ Model: {model}, Embedding Model: {embeddingModel}
485
+ </p>
486
+ <p className="text-xs text-gray-500 mt-2">EventCatalog Chat can make mistakes. Check important info.</p>
483
487
  </div>
484
488
  </div>
485
489
 
@@ -1,7 +1,5 @@
1
1
  import type { APIContext } from 'astro';
2
2
  import { askQuestion } from '@enterprise/eventcatalog-chat/utils/ai';
3
- import config from '@config';
4
- const output = config.output || 'static';
5
3
 
6
4
  // Map the Keys to use in the SDK, astro exports as import.meta.env
7
5
  process.env.OPENAI_API_KEY = import.meta.env.OPENAI_API_KEY || '';
@@ -10,24 +10,34 @@ import { getDomains } from '@utils/collections/domains';
10
10
  import { getEvents } from '@utils/events';
11
11
  import { getCommands } from '@utils/commands';
12
12
  import { getServices } from '@utils/collections/services';
13
+ import { getQueries } from '@utils/queries';
14
+ import { getConfigurationForGivenGenerator } from '@utils/generators';
13
15
 
14
16
  const isEnabled = config.chat?.enabled || false;
15
17
  const chatConfig = config.chat || {};
16
18
  const output = config.output || 'static';
17
19
 
20
+ const aiGeneratorConfig = getConfigurationForGivenGenerator('@eventcatalog/generator-ai');
21
+ let embeddingModel = aiGeneratorConfig?.embedding?.model || 'all-MiniLM-L6-v2';
22
+
23
+ if (aiGeneratorConfig?.embedding?.provider === 'openai') {
24
+ embeddingModel = aiGeneratorConfig?.embedding?.model || 'text-embedding-3-large';
25
+ }
26
+
18
27
  const PROJECT_DIR = path.resolve(process.env.PROJECT_DIR || process.cwd());
19
28
  const GENERATED_AI_DIR = path.resolve(PROJECT_DIR, 'public/ai');
20
29
 
21
30
  const directoryExists = fs.existsSync(GENERATED_AI_DIR);
22
31
 
23
32
  // Get all information for the mention input
24
- const [events, commands, services, domains] = await Promise.all([
33
+ const [events, commands, queries, services, domains] = await Promise.all([
25
34
  getEvents({ getAllVersions: false }),
26
35
  getCommands({ getAllVersions: false }),
36
+ getQueries({ getAllVersions: false }),
27
37
  getServices({ getAllVersions: false }),
28
38
  getDomains({ getAllVersions: false }),
29
39
  ]);
30
- const allItems = [...events, ...commands, ...services, ...domains];
40
+ const allItems = [...events, ...commands, ...queries, ...services, ...domains];
31
41
 
32
42
  const chatPrompts = await getChatPromptsGroupedByCategory();
33
43
 
@@ -67,7 +77,10 @@ const generatorConfig = `
67
77
  <div id="chatContainer" class="w-full">
68
78
  <Chat
69
79
  client:only="react"
70
- chatConfig={chatConfig}
80
+ chatConfig={{
81
+ ...chatConfig,
82
+ embeddingModel,
83
+ }}
71
84
  resources={resources}
72
85
  chatPrompts={chatPrompts}
73
86
  output={output as 'static' | 'server'}
@@ -0,0 +1,10 @@
1
+ // Should really only be used on the server side
2
+ // If users are using path or fs in the eventcatalog.config.js file, it will break the build (for now)
3
+
4
+ import config from '@config';
5
+
6
+ export const getConfigurationForGivenGenerator = (generator: string) => {
7
+ const generators = config.generators ?? [];
8
+ const generatorConfig = generators.find((g: any) => g[0] === generator);
9
+ return generatorConfig?.[1];
10
+ };
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.35.6",
9
+ "version": "2.35.8",
10
10
  "publishConfig": {
11
11
  "access": "public"
12
12
  },
@@ -31,7 +31,7 @@
31
31
  "@asyncapi/avro-schema-parser": "^3.0.24",
32
32
  "@asyncapi/parser": "^3.4.0",
33
33
  "@asyncapi/react-component": "^2.4.3",
34
- "@eventcatalog/generator-ai": "^1.0.0",
34
+ "@eventcatalog/generator-ai": "^1.0.2",
35
35
  "@eventcatalog/sdk": "^2.2.7",
36
36
  "@fontsource/inter": "^5.2.5",
37
37
  "@headlessui/react": "^2.0.3",
@@ -39,6 +39,7 @@
39
39
  "@huggingface/transformers": "^3.3.3",
40
40
  "@iconify-json/logos": "^1.2.4",
41
41
  "@langchain/community": "^0.3.32",
42
+ "@langchain/openai": "^0.5.6",
42
43
  "@mlc-ai/web-llm": "^0.2.78",
43
44
  "@parcel/watcher": "^2.4.1",
44
45
  "@radix-ui/react-context-menu": "^2.2.6",