@eventcatalog/core 3.0.0-beta.2 → 3.0.0-beta.21

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.
Files changed (103) hide show
  1. package/README.md +10 -0
  2. package/dist/__mocks__/astro-content.cjs +32 -0
  3. package/dist/__mocks__/astro-content.d.cts +13 -0
  4. package/dist/__mocks__/astro-content.d.ts +13 -0
  5. package/dist/__mocks__/astro-content.js +7 -0
  6. package/dist/analytics/analytics.cjs +1 -1
  7. package/dist/analytics/analytics.js +2 -2
  8. package/dist/analytics/log-build.cjs +1 -1
  9. package/dist/analytics/log-build.js +3 -3
  10. package/dist/{chunk-JSONCD7V.js → chunk-2FUEBPD3.js} +1 -1
  11. package/dist/{chunk-3W6JYTHP.js → chunk-HABY2LVH.js} +6 -2
  12. package/dist/{chunk-H4QHE5YZ.js → chunk-KQAMO3R4.js} +1 -1
  13. package/dist/chunk-Q6KRYWPV.js +44 -0
  14. package/dist/{chunk-PQL6O5YA.js → chunk-RRP2B7BL.js} +1 -1
  15. package/dist/constants.cjs +1 -1
  16. package/dist/constants.js +1 -1
  17. package/dist/eventcatalog.cjs +84 -65
  18. package/dist/eventcatalog.config.d.cts +4 -0
  19. package/dist/eventcatalog.config.d.ts +4 -0
  20. package/dist/eventcatalog.js +45 -57
  21. package/dist/generate.cjs +48 -2
  22. package/dist/generate.js +3 -1
  23. package/dist/utils/cli-logger.cjs +82 -0
  24. package/dist/utils/cli-logger.d.cts +10 -0
  25. package/dist/utils/cli-logger.d.ts +10 -0
  26. package/dist/utils/cli-logger.js +7 -0
  27. package/eventcatalog/astro.config.mjs +4 -1
  28. package/eventcatalog/integrations/ecstudio-watcher.mjs +1 -1
  29. package/eventcatalog/integrations/eventcatalog-features.ts +69 -0
  30. package/eventcatalog/public/icons/asyncapi-black.svg +2 -0
  31. package/eventcatalog/public/icons/graphql-black.svg +1 -0
  32. package/eventcatalog/public/icons/openapi-black.svg +1 -0
  33. package/eventcatalog/src/components/ChatPanel/ChatPanel.tsx +821 -0
  34. package/eventcatalog/src/components/ChatPanel/ChatPanelButton.tsx +24 -0
  35. package/eventcatalog/src/components/Grids/DomainGrid.tsx +1 -3
  36. package/eventcatalog/src/components/Grids/MessageGrid.tsx +8 -8
  37. package/eventcatalog/src/components/Header.astro +25 -5
  38. package/eventcatalog/src/components/MDX/NodeGraph/NodeGraph.tsx +14 -3
  39. package/eventcatalog/src/components/Search/Search.astro +2 -2
  40. package/eventcatalog/src/components/Search/SearchModal.tsx +16 -7
  41. package/eventcatalog/src/components/SideNav/NestedSideBar/SearchBar.tsx +9 -2
  42. package/eventcatalog/src/components/SideNav/NestedSideBar/builders/domain.ts +7 -6
  43. package/eventcatalog/src/components/SideNav/NestedSideBar/builders/service.ts +6 -3
  44. package/eventcatalog/src/components/SideNav/NestedSideBar/builders/shared.ts +1 -0
  45. package/eventcatalog/src/components/SideNav/NestedSideBar/index.tsx +23 -8
  46. package/eventcatalog/src/components/SideNav/NestedSideBar/sidebar-builder.ts +57 -11
  47. package/eventcatalog/src/content.config.ts +1 -10
  48. package/eventcatalog/src/enterprise/ai/chat-api.ts +262 -0
  49. package/eventcatalog/src/enterprise/auth/[...auth].ts +3 -0
  50. package/eventcatalog/src/enterprise/auth/login.astro +420 -0
  51. package/eventcatalog/src/enterprise/collections/index.ts +0 -1
  52. package/eventcatalog/src/layouts/Footer.astro +8 -5
  53. package/eventcatalog/src/layouts/VerticalSideBarLayout.astro +30 -19
  54. package/eventcatalog/src/pages/_index.astro +8 -9
  55. package/eventcatalog/src/pages/docs/[type]/[id]/[version]/asyncapi/[filename].astro +19 -3
  56. package/eventcatalog/src/pages/docs/[type]/[id]/[version]/changelog/index.astro +7 -7
  57. package/eventcatalog/src/pages/docs/[type]/[id]/[version]/graphql/[filename].astro +1 -1
  58. package/eventcatalog/src/pages/docs/[type]/[id]/[version]/index.astro +5 -5
  59. package/eventcatalog/src/pages/docs/teams/[id].mdx.ts +36 -0
  60. package/eventcatalog/src/pages/docs/users/[id].mdx.ts +36 -0
  61. package/eventcatalog/src/pages/schemas/explorer/_index.data.ts +178 -0
  62. package/eventcatalog/src/pages/schemas/explorer/index.astro +5 -155
  63. package/eventcatalog/src/remark-plugins/directives.ts +30 -9
  64. package/eventcatalog/src/utils/collections/schemas.ts +31 -7
  65. package/eventcatalog/src/utils/feature.ts +8 -4
  66. package/eventcatalog/src/utils/resource-files.ts +86 -0
  67. package/package.json +12 -15
  68. package/default-files-for-collections/changelogs.md +0 -5
  69. package/default-files-for-collections/channels.md +0 -8
  70. package/default-files-for-collections/commands.md +0 -8
  71. package/default-files-for-collections/domains.md +0 -8
  72. package/default-files-for-collections/events.md +0 -8
  73. package/default-files-for-collections/flows.md +0 -11
  74. package/default-files-for-collections/queries.md +0 -8
  75. package/default-files-for-collections/services.md +0 -8
  76. package/default-files-for-collections/ubiquitousLanguages.md +0 -7
  77. package/eventcatalog/src/enterprise/collections/chat-prompts.ts +0 -32
  78. package/eventcatalog/src/enterprise/eventcatalog-chat/components/Chat.tsx +0 -60
  79. package/eventcatalog/src/enterprise/eventcatalog-chat/components/ChatMessage.tsx +0 -414
  80. package/eventcatalog/src/enterprise/eventcatalog-chat/components/ChatSidebar.tsx +0 -169
  81. package/eventcatalog/src/enterprise/eventcatalog-chat/components/InputModal.tsx +0 -244
  82. package/eventcatalog/src/enterprise/eventcatalog-chat/components/MentionInput.tsx +0 -211
  83. package/eventcatalog/src/enterprise/eventcatalog-chat/components/WelcomePromptArea.tsx +0 -176
  84. package/eventcatalog/src/enterprise/eventcatalog-chat/components/default-prompts.ts +0 -93
  85. package/eventcatalog/src/enterprise/eventcatalog-chat/components/hooks/ChatProvider.tsx +0 -143
  86. package/eventcatalog/src/enterprise/eventcatalog-chat/components/windows/ChatWindow.server.tsx +0 -387
  87. package/eventcatalog/src/enterprise/eventcatalog-chat/pages/api/chat.ts +0 -59
  88. package/eventcatalog/src/enterprise/eventcatalog-chat/pages/chat/index.astro +0 -104
  89. package/eventcatalog/src/enterprise/eventcatalog-chat/providers/ai-provider.ts +0 -140
  90. package/eventcatalog/src/enterprise/eventcatalog-chat/providers/anthropic.ts +0 -28
  91. package/eventcatalog/src/enterprise/eventcatalog-chat/providers/google.ts +0 -41
  92. package/eventcatalog/src/enterprise/eventcatalog-chat/providers/index.ts +0 -26
  93. package/eventcatalog/src/enterprise/eventcatalog-chat/providers/openai.ts +0 -61
  94. package/eventcatalog/src/enterprise/eventcatalog-chat/utils/chat-prompts.ts +0 -50
  95. package/eventcatalog/src/pages/auth/login.astro +0 -280
  96. package/eventcatalog/src/pages/chat/feature.astro +0 -179
  97. package/eventcatalog/src/pages/chat/index.astro +0 -10
  98. package/eventcatalog/src/pages/nav-index.json.ts +0 -30
  99. /package/eventcatalog/src/{pages → enterprise}/auth/error.astro +0 -0
  100. /package/eventcatalog/src/{middleware-auth.ts → enterprise/auth/middleware/middleware-auth.ts} +0 -0
  101. /package/eventcatalog/src/{middleware.ts → enterprise/auth/middleware/middleware.ts} +0 -0
  102. /package/eventcatalog/src/{pages/unauthorized/index.astro → enterprise/auth/unauthorized.astro} +0 -0
  103. /package/eventcatalog/src/{pages → enterprise}/plans/index.astro +0 -0
@@ -1,104 +0,0 @@
1
- ---
2
- import VerticalSideBarLayout from '@layouts/VerticalSideBarLayout.astro';
3
- import Chat from '@enterprise/eventcatalog-chat/components/Chat';
4
- import { getChatPromptsGroupedByCategory } from '@enterprise/eventcatalog-chat/utils/chat-prompts';
5
- import config from '@config';
6
- import { Code } from 'astro-expressive-code/components';
7
- import { getDomains } from '@utils/collections/domains';
8
- import { getEvents } from '@utils/collections/events';
9
- import { getCommands } from '@utils/collections/commands';
10
- import { getServices } from '@utils/collections/services';
11
- import { getQueries } from '@utils/collections/queries';
12
-
13
- const isEnabled = config.chat?.enabled || false;
14
- const chatConfig = config.chat || {};
15
- const output = config.output || 'static';
16
-
17
- // Get all information for the mention input
18
- const [events, commands, queries, services, domains] = await Promise.all([
19
- getEvents({ getAllVersions: false }),
20
- getCommands({ getAllVersions: false }),
21
- getQueries({ getAllVersions: false }),
22
- getServices({ getAllVersions: false }),
23
- getDomains({ getAllVersions: false }),
24
- ]);
25
- const allItems = [...events, ...commands, ...queries, ...services, ...domains];
26
-
27
- const chatPrompts = await getChatPromptsGroupedByCategory();
28
-
29
- const resources = allItems.map((item) => ({ id: item.data.id, type: item.collection, name: item.data.name }));
30
- ---
31
-
32
- <VerticalSideBarLayout title="AI Chat" showNestedSideBar={false}>
33
- <div class="flex h-[calc(100vh-60px)] bg-white">
34
- {
35
- isEnabled ? (
36
- <>
37
- <div id="chatContainer" class="w-full">
38
- <Chat
39
- client:only="react"
40
- chatConfig={{
41
- ...chatConfig,
42
- }}
43
- resources={resources}
44
- chatPrompts={chatPrompts}
45
- output={output as 'static' | 'server'}
46
- />
47
- </div>
48
- </>
49
- ) : (
50
- <div class="flex items-center justify-center w-full p-4 sm:p-8">
51
- <div class="max-w-6xl flex flex-col md:flex-row gap-8 md:gap-12 items-center">
52
- {/* Left side - Illustration */}
53
- <div class="flex-1">
54
- <img
55
- src="/images/ai-placeholder.png"
56
- alt="AI Assistant Illustration"
57
- class="w-full max-w-sm md:max-w-md mx-auto rounded-lg shadow-lg"
58
- />
59
- </div>
60
-
61
- {/* Right side - Content */}
62
- <div class="flex-1">
63
- <h2 class="text-2xl md:text-3xl font-bold text-gray-900 mb-4">EventCatalog AI Assistant</h2>
64
- <p class="text-gray-600 mb-6 text-base md:text-lg">
65
- Chat with your catalog to quickly find information, understand relationships, and get instant answers about your
66
- architecture. Our AI-powered assistant makes exploring your event catalog faster and more intuitive than ever.
67
- </p>
68
-
69
- <div class="bg-gray-700 rounded-lg p-4 md:p-6 mb-4">
70
- <h3 class="text-lg text-white font-semibold mb-3">Quick Setup</h3>
71
- <Code code={`npm install @eventcatalog/generator-ai`} lang="bash" frame="none" />
72
- <a
73
- href="https://www.eventcatalog.dev/features/ai-assistant"
74
- class="inline-flex items-center text-sm text-white mt-4"
75
- >
76
- Learn more about setup →
77
- </a>
78
- </div>
79
- <p class="text-gray-600 mb-6 text-sm">
80
- Your data stays private and secure - all processing happens locally on your machine.
81
- </p>
82
- </div>
83
- </div>
84
- </div>
85
- )
86
- }
87
- </div>
88
- </VerticalSideBarLayout>
89
-
90
- <style>
91
- .loading-status.ready {
92
- background-color: rgb(240 253 244); /* light green bg */
93
- color: rgb(22 163 74); /* green text */
94
- }
95
-
96
- .loading-status.hidden {
97
- display: none;
98
- }
99
-
100
- /* Add smooth scrolling behavior */
101
- .scroll-smooth {
102
- scroll-behavior: smooth;
103
- }
104
- </style>
@@ -1,140 +0,0 @@
1
- import { streamText, tool, type LanguageModel, type UIMessage, stepCountIs, convertToModelMessages } from 'ai';
2
- import { z } from 'astro/zod';
3
- import config from '@config';
4
-
5
- const getBaseURL = () => {
6
- if (import.meta.env.MODE === 'development') {
7
- return `http://localhost:${config.port || 3000}`;
8
- }
9
- return config.homepageLink || 'https://eventcatalog.dev/';
10
- };
11
-
12
- export const getEventCatalogResources = async () => {
13
- const baseUrl = process.env.EVENTCATALOG_URL || getBaseURL();
14
- const url = new URL('/docs/llm/llms.txt', baseUrl);
15
- const response = await fetch(url.toString());
16
- const text = await response.text();
17
- return text;
18
- };
19
-
20
- export const getResourceInformation = async (type: string, id: string, version: string) => {
21
- const baseUrl = process.env.EVENTCATALOG_URL || getBaseURL();
22
- const url = new URL(`/docs/${type}/${id}/${version}.mdx`, baseUrl);
23
- const response = await fetch(url.toString());
24
- const text = await response.text();
25
- return text;
26
- };
27
-
28
- // base class for AI providers
29
- export interface AIProviderOptions {
30
- modelId: string;
31
- model?: LanguageModel;
32
- temperature?: number;
33
- topP?: number | undefined;
34
- topK?: number | undefined;
35
- frequencyPenalty?: number | undefined;
36
- presencePenalty?: number | undefined;
37
- }
38
-
39
- export class AIProvider {
40
- private model?: string | LanguageModel;
41
- private modelId: string;
42
- private temperature: number;
43
- private topP: number | undefined;
44
- private topK: number | undefined;
45
- private frequencyPenalty: number | undefined;
46
- private presencePenalty: number | undefined;
47
- public models: string[];
48
-
49
- constructor({ modelId, model, temperature, topP, topK, frequencyPenalty, presencePenalty }: AIProviderOptions) {
50
- this.modelId = modelId;
51
- this.temperature = temperature ?? 0.2;
52
- this.topP = topP;
53
- this.topK = topK;
54
- this.frequencyPenalty = frequencyPenalty;
55
- this.presencePenalty = presencePenalty;
56
- this.models = [];
57
-
58
- if (model) {
59
- this.model = model;
60
- }
61
- }
62
-
63
- async validateModel(model: string): Promise<{ isValidModel: boolean; listOfModels: string[] }> {
64
- const isValidModel = this.models.includes(model);
65
- return { isValidModel, listOfModels: this.models };
66
- }
67
-
68
- async streamText(system: string, messages: Array<UIMessage> | Array<Omit<UIMessage, 'id'>>) {
69
- if (!this.model) {
70
- throw new Error('Model not set');
71
- }
72
-
73
- return await streamText({
74
- model: this.model,
75
- system: system ?? '',
76
- messages: convertToModelMessages(messages),
77
- stopWhen: stepCountIs(5),
78
- temperature: this.temperature,
79
- ...(this.topP && { topP: this.topP }),
80
- ...(this.topK && { topK: this.topK }),
81
- ...(this.frequencyPenalty && { frequencyPenalty: this.frequencyPenalty }),
82
- ...(this.presencePenalty && { presencePenalty: this.presencePenalty }),
83
- tools: {
84
- findResources: tool({
85
- description: [
86
- 'Find resources that are available in EventCatalog',
87
- '',
88
- 'Use this tool when you need to:',
89
- '- Get a list of resources in EventCatalog including services, domains, events, commands, queries and flows, ubiquitous language terms and entities',
90
- "- Find a resource's id and version to aid other tool requests",
91
- '- Just return the list of matched resources in EventCatalog with a short description of each resource',
92
- "- Don't return bullet points, just return the list of resources in a readable format",
93
- '- Include the resource name, description, and a link to the resource',
94
- '- When you return a link, remove the .mdx from the end of the url',
95
- '- Return a list of messages the resource produces and consumes, these are marked as sends and receives',
96
- '- If the resource has a domain, include it in the response',
97
- '- Ask the user if they would like more information about a specific resource',
98
- '- When you return a message, in brackets let me know if its a query, command or event',
99
- `- The host URL is ${process.env.EVENTCATALOG_URL}`,
100
- ].join('\n'),
101
- inputSchema: z.object({}),
102
- execute: async () => {
103
- const text = await getEventCatalogResources();
104
- return text;
105
- },
106
- }),
107
- findResource: tool({
108
- description: [
109
- 'Get more information about a service, domain, event, command, query or flow in EventCatalog using its id and version',
110
- 'Use this tool when you need to:',
111
- '- Get more details/information about a service, domain, event, command, query, flow or entity in EventCatalog',
112
- '- Use the id to find more information about a service, domain, event, command, query, flow or entity',
113
- '- Return everything you know about this resource',
114
- '- If the resource has a specification return links to the specification file',
115
- '- When you find owners the url would look something like /docs/users/{id} if its a user or /docs/teams/{id} if its a team',
116
- '- When you return the producers and consumers (the messages the service produces and consumes) make sure they include the url to the documentation, the url would look something like /docs/{type}/{id}, e.g /docs/events/MyEvent/1.0.0 or /docs/commands/MyCommand/1.0.0',
117
- '- When you return owners make sure they include the url to the documentation',
118
- '- If the resource has a domain, include it in the response',
119
- '- Ask the user if they would like more information about a specific resource',
120
- '- When you return a message, in brackets let me know if its a query, command or event',
121
- `- If you are returning a flow (state machine) try and return the result in mermaid to the user, visualizing how the business logic flows`,
122
- `- If you return any URLS make sure to include the host URL ${process.env.EVENTCATALOG_URL}`,
123
- '- You will ALWAYS return the visualizer URL in an IFRAME in the given response - example <iframe src="http://localhost:3000/visualiser/{type}/{id}/{version}?embed=true"></iframe>',
124
- ].join('\n'),
125
- inputSchema: z.object({
126
- id: z.string().describe('The id of the resource to find'),
127
- version: z.string().describe('The version of the resource to find'),
128
- type: z
129
- .enum(['services', 'domains', 'events', 'commands', 'queries', 'flows', 'entities'])
130
- .describe('The type of resource to find'),
131
- }),
132
- execute: async ({ id, version, type }) => {
133
- const text = await getResourceInformation(type, id, version);
134
- return text;
135
- },
136
- }),
137
- },
138
- });
139
- }
140
- }
@@ -1,28 +0,0 @@
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
- }
@@ -1,41 +0,0 @@
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
- }
@@ -1,26 +0,0 @@
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
- }
@@ -1,61 +0,0 @@
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,50 +0,0 @@
1
- import { getCollection } from 'astro:content';
2
- import type { CollectionEntry } from 'astro:content';
3
-
4
- export type ChatPrompt = CollectionEntry<'chatPrompts'>;
5
-
6
- // Update cache to store both versions
7
- let cachedChatPrompts: Record<string, ChatPrompt[]> = {
8
- allVersions: [],
9
- currentVersions: [],
10
- };
11
-
12
- export const getChatPrompts = async (): Promise<ChatPrompt[]> => {
13
- const cacheKey = 'allVersions';
14
-
15
- // Check if we have cached domains for this specific getAllVersions value
16
- if (cachedChatPrompts[cacheKey].length > 0) {
17
- return cachedChatPrompts[cacheKey];
18
- }
19
-
20
- const prompts = await getCollection('chatPrompts');
21
-
22
- return prompts;
23
- };
24
-
25
- export type ChatPromptCategoryGroup = {
26
- label: string;
27
- icon?: string;
28
- items: ChatPrompt[];
29
- };
30
-
31
- export const getChatPromptsGroupedByCategory = async (): Promise<ChatPromptCategoryGroup[]> => {
32
- const prompts = await getChatPrompts();
33
-
34
- const grouped = prompts.reduce(
35
- (acc, prompt) => {
36
- const { id, label, icon } = prompt.data.category;
37
-
38
- if (!acc[id]) {
39
- acc[id] = { label, icon, items: [] };
40
- }
41
-
42
- acc[id].items.push(prompt);
43
- return acc;
44
- },
45
- {} as Record<string, { label: string; icon?: string; items: ChatPrompt[] }>
46
- );
47
-
48
- // Convert the grouped object into the desired array format
49
- return Object.values(grouped);
50
- };