@wabot-dev/framework 0.9.7 → 0.9.9

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,11 +37,28 @@ import { RepositoryAdapterRegistry } from '../repository/RepositoryAdapterRegist
37
37
  const logger = new Logger('wabot:project-runner');
38
38
  const TEST_FILE_PATTERNS = /\.(test|spec|unit|integration|e2e|multiprocess)\.(ts|js)$/;
39
39
  const DEFAULT_EXCLUDE = ['run.ts', 'cmd.ts'];
40
+ const MODULE_EXT = import.meta.url.endsWith('.ts') ? '.ts' : '.js';
40
41
  const DEFAULT_CHAT_ADAPTERS = [
41
- ['../../addon/chat-bot/openia/OpenaiChatAdapter', 'OpenaiChatAdapter'],
42
- ['../../addon/chat-bot/openrouter/OpenRouterChatAdapter', 'OpenRouterChatAdapter'],
43
- ['../../addon/chat-bot/anthropic/AnthropicChatAdapter', 'AnthropicChatAdapter'],
44
- ['../../addon/chat-bot/google/GoogleChatAdapter', 'GoogleChatAdapter'],
42
+ {
43
+ path: `../../addon/chat-bot/openia/OpenaiChatAdapter${MODULE_EXT}`,
44
+ name: 'OpenaiChatAdapter',
45
+ apiKeyEnv: 'OPENAI_API_KEY',
46
+ },
47
+ {
48
+ path: `../../addon/chat-bot/openrouter/OpenRouterChatAdapter${MODULE_EXT}`,
49
+ name: 'OpenRouterChatAdapter',
50
+ apiKeyEnv: 'OPENROUTER_API_KEY',
51
+ },
52
+ {
53
+ path: `../../addon/chat-bot/anthropic/AnthropicChatAdapter${MODULE_EXT}`,
54
+ name: 'AnthropicChatAdapter',
55
+ apiKeyEnv: 'ANTHROPIC_API_KEY',
56
+ },
57
+ {
58
+ path: `../../addon/chat-bot/google/GoogleChatAdapter${MODULE_EXT}`,
59
+ name: 'GoogleChatAdapter',
60
+ apiKeyEnv: 'GOOGLE_API_KEY',
61
+ },
45
62
  ];
46
63
  class ProjectRunner {
47
64
  directories;
@@ -261,7 +278,11 @@ class ProjectRunner {
261
278
  }
262
279
  }
263
280
  async resolveDefaultChatAdapters() {
264
- const results = await Promise.all(DEFAULT_CHAT_ADAPTERS.map(async ([path, name]) => {
281
+ const results = await Promise.all(DEFAULT_CHAT_ADAPTERS.map(async ({ path, name, apiKeyEnv }) => {
282
+ if (!process.env[apiKeyEnv]) {
283
+ logger.info(`Skipping ${name}: ${apiKeyEnv} is not set`);
284
+ return null;
285
+ }
265
286
  try {
266
287
  const mod = await import(path);
267
288
  const adapter = mod[name];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wabot-dev/framework",
3
- "version": "0.9.7",
3
+ "version": "0.9.9",
4
4
  "description": "Framework for IA Chat Bots",
5
5
  "type": "module",
6
6
  "main": "dist/src/index.js",