Skip to content

Commit

Permalink
added AI into the demo catalog
Browse files Browse the repository at this point in the history
  • Loading branch information
boyney123 committed Feb 25, 2025
1 parent 5cc528e commit 75ab3cc
Show file tree
Hide file tree
Showing 6 changed files with 179 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@ const ChatWindow = ({ catalogPath }: { catalogPath: string }) => {
const handleSubmit = async () => {
if (!inputValue.trim() || !engine) return;

// Add to messages
setMessages((prev) => [...prev, { content: inputValue, isUser: true }]);

// Add message to session store only
if (currentSession) {
addMessageToSession(currentSession.id, inputValue, true);
Expand Down
2 changes: 2 additions & 0 deletions examples/default/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@

generated-ai/
7 changes: 7 additions & 0 deletions examples/default/eventcatalog.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,11 @@ export default {
chat: {
enabled: true,
},
generators: [
[
"@eventcatalog/generator-ai", {
splitMarkdownFiles: false
}
],
],
};
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
"preview": "astro preview",
"astro": "astro",
"start:catalog": "node scripts/start-catalog-locally.js",
"generate:catalog": "node scripts/generate-catalog-locally.js",
"verify-build:catalog": "rimraf dist && pnpm run build:cd",
"changeset": "changeset",
"generate": "pnpm run build:bin && npx . generate",
Expand All @@ -49,6 +50,7 @@
"@asyncapi/avro-schema-parser": "^3.0.24",
"@asyncapi/parser": "^3.4.0",
"@asyncapi/react-component": "^2.4.3",
"@eventcatalog/generator-ai": "^0.1.1",
"@headlessui/react": "^2.0.3",
"@heroicons/react": "^2.1.3",
"@huggingface/transformers": "^3.3.3",
Expand Down
139 changes: 139 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

26 changes: 26 additions & 0 deletions scripts/generate-catalog-locally.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/usr/bin/env node
import { join } from 'node:path';
import { execSync } from 'node:child_process';

async function main() {
const __dirname = import.meta.dirname;

const args = process.argv.slice(2);
const catalog = args[0] || 'default';

const catalogDir = join(__dirname, '../eventcatalog/');
const projectDIR = join(__dirname, `../examples/${catalog}`);

execSync('pnpm run build:bin', { stdio: 'inherit' });

execSync(`cross-env NODE_ENV=development PROJECT_DIR=${projectDIR} CATALOG_DIR=${catalogDir} npx . generate`, {
stdio: 'inherit',
});
}

main()
.then(() => process.exit(0))
.catch((err) => {
console.error(err);
process.exit(1);
});

0 comments on commit 75ab3cc

Please sign in to comment.