diff --git a/packages/cli/package.json b/packages/cli/package.json index f1480abc7e8..a559d082d72 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -1,6 +1,6 @@ { "name": "@botpress/cli", - "version": "4.17.17", + "version": "4.17.19", "description": "Botpress CLI", "scripts": { "build": "pnpm run build:types && pnpm run bundle && pnpm run template:gen", diff --git a/packages/cli/src/command-implementations/dev-command.ts b/packages/cli/src/command-implementations/dev-command.ts index 67113e8fdce..505bd99770c 100644 --- a/packages/cli/src/command-implementations/dev-command.ts +++ b/packages/cli/src/command-implementations/dev-command.ts @@ -18,7 +18,7 @@ import { ProjectCommand, ProjectDefinition } from './project-command' const DEFAULT_BOT_PORT = 8075 const DEFAULT_INTEGRATION_PORT = 8076 const TUNNEL_HELLO_INTERVAL = 5000 -const FILEWATCHER_DEBOUNCE_MS = 2000 +const FILEWATCHER_DEBOUNCE_MS = 500 export type DevCommandDefinition = typeof commandDefinitions.dev export class DevCommand extends ProjectCommand { @@ -146,16 +146,21 @@ export class DevCommand extends ProjectCommand { return } - const typescriptEvents = events.filter((e) => pathlib.extname(e.path) === '.ts') - if (typescriptEvents.length === 0) { - return - } + const typescriptEvents = events + .filter((e) => !e.path.startsWith(this.projectPaths.abs.outDir)) + .filter((e) => pathlib.extname(e.path) === '.ts') - this.logger.log('Changes detected, rebuilding') - await this._restart(api, worker, httpTunnelUrl) + const distEvents = events.filter((e) => e.path.startsWith(this.projectPaths.abs.distDir)) + + if (typescriptEvents.length > 0) { + this.logger.log('Changes detected, rebuilding') + await this._restart(api, worker, httpTunnelUrl) + } else if (distEvents.length > 0) { + this.logger.log('Changes detected in output directory, reloading worker') + await worker.reload() + } }, { - ignore: [this.projectPaths.abs.outDir], debounceMs: FILEWATCHER_DEBOUNCE_MS, } ) diff --git a/packages/cognitive/package.json b/packages/cognitive/package.json index b8e96df4aa1..47e6c86ae39 100644 --- a/packages/cognitive/package.json +++ b/packages/cognitive/package.json @@ -1,6 +1,6 @@ { "name": "@botpress/cognitive", - "version": "0.1.41", + "version": "0.1.42", "description": "Wrapper around the Botpress Client to call LLMs", "main": "./dist/index.cjs", "module": "./dist/index.mjs", diff --git a/packages/cognitive/src/cognitive-v2/index.ts b/packages/cognitive/src/cognitive-v2/index.ts index bf373151c2a..3e9bad6384b 100644 --- a/packages/cognitive/src/cognitive-v2/index.ts +++ b/packages/cognitive/src/cognitive-v2/index.ts @@ -62,17 +62,12 @@ export class CognitiveBeta { return data } - public async listModels(input: void, options: RequestOptions = {}) { - const signal = options.signal ?? AbortSignal.timeout(this._timeout) - + public async listModels() { const { data } = await this._withServerRetry(() => - this._axiosClient.post('/v2/cognitive/models', input, { - signal, - timeout: options.timeout ?? this._timeout, - }) + this._axiosClient.get<{ models: Model[] }>('/v2/cognitive/models') ) - return data + return data.models } public async *generateTextStream( diff --git a/packages/cognitive/src/cognitive-v2/types.ts b/packages/cognitive/src/cognitive-v2/types.ts index 6b73840bca6..a0d52c32d67 100644 --- a/packages/cognitive/src/cognitive-v2/types.ts +++ b/packages/cognitive/src/cognitive-v2/types.ts @@ -167,6 +167,10 @@ export type Model = { id: string name: string description: string + /** + * Aliases that are also resolving to this model + */ + aliases?: string[] tags: ( | 'recommended' | 'deprecated' diff --git a/packages/llmz/package.json b/packages/llmz/package.json index c6ebbcabcb3..a489484ce1e 100644 --- a/packages/llmz/package.json +++ b/packages/llmz/package.json @@ -67,7 +67,7 @@ "tsx": "^4.19.2" }, "peerDependencies": { - "@botpress/cognitive": "0.1.41", + "@botpress/cognitive": "0.1.42", "@bpinternal/thicktoken": "^1.0.5", "@bpinternal/zui": "^1.0.1" }, diff --git a/packages/zai/package.json b/packages/zai/package.json index cc294d7d123..4f34e3f69c0 100644 --- a/packages/zai/package.json +++ b/packages/zai/package.json @@ -1,7 +1,7 @@ { "name": "@botpress/zai", "description": "Zui AI (zai) – An LLM utility library written on top of Zui and the Botpress API", - "version": "2.1.11", + "version": "2.1.12", "main": "./dist/index.js", "types": "./dist/index.d.ts", "exports": { @@ -29,7 +29,7 @@ "author": "", "license": "ISC", "dependencies": { - "@botpress/cognitive": "0.1.41", + "@botpress/cognitive": "0.1.42", "json5": "^2.2.3", "jsonrepair": "^3.10.0", "lodash-es": "^4.17.21" diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index af91dede6a7..af174aaba0a 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -2474,7 +2474,7 @@ importers: specifier: 1.25.0 version: link:../client '@botpress/cognitive': - specifier: 0.1.41 + specifier: 0.1.42 version: link:../cognitive '@bpinternal/thicktoken': specifier: ^1.0.5 @@ -2648,7 +2648,7 @@ importers: packages/zai: dependencies: '@botpress/cognitive': - specifier: 0.1.41 + specifier: 0.1.42 version: link:../cognitive '@bpinternal/thicktoken': specifier: ^1.0.0