@n8n/chat 0.9.0 → 0.10.0

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.
@@ -1,27 +1,4 @@
1
- import type { StorybookConfig } from '@storybook/vue3-vite';
1
+ import { sharedConfig } from '@n8n/storybook/main';
2
2
 
3
- import { join, dirname } from 'path';
4
-
5
- /**
6
- * This function is used to resolve the absolute path of a package.
7
- * It is needed in projects that use Yarn PnP or are set up within a monorepo.
8
- */
9
- function getAbsolutePath(value: string): any {
10
- return dirname(require.resolve(join(value, 'package.json')));
11
- }
12
- const config: StorybookConfig = {
13
- stories: ['../src/**/*.mdx', '../src/**/*.stories.@(js|jsx|mjs|ts|tsx)'],
14
- addons: [
15
- getAbsolutePath('@storybook/addon-links'),
16
- getAbsolutePath('@storybook/addon-essentials'),
17
- getAbsolutePath('@storybook/addon-interactions'),
18
- ],
19
- framework: {
20
- name: getAbsolutePath('@storybook/vue3-vite'),
21
- options: {},
22
- },
23
- docs: {
24
- autodocs: 'tag',
25
- },
26
- };
3
+ const config = { ...sharedConfig };
27
4
  export default config;
@@ -3,7 +3,6 @@ import './preview.scss';
3
3
 
4
4
  const preview: Preview = {
5
5
  parameters: {
6
- actions: { argTypesRegex: '^on[A-Z].*' },
7
6
  controls: {
8
7
  matchers: {
9
8
  color: /(background|color)$/i,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@n8n/chat",
3
- "version": "0.9.0",
3
+ "version": "0.10.0",
4
4
  "main": "./chat.umd.js",
5
5
  "module": "./chat.es.js",
6
6
  "types": "./types/index.d.ts",
@@ -45,9 +45,19 @@ export const ChatPlugin: Plugin<ChatOptions> = {
45
45
  options,
46
46
  );
47
47
 
48
+ let textMessage = sendMessageResponse.output ?? sendMessageResponse.text ?? '';
49
+
50
+ if (textMessage === '' && Object.keys(sendMessageResponse).length > 0) {
51
+ try {
52
+ textMessage = JSON.stringify(sendMessageResponse, null, 2);
53
+ } catch (e) {
54
+ // Failed to stringify the object so fallback to empty string
55
+ }
56
+ }
57
+
48
58
  const receivedMessage: ChatMessage = {
49
59
  id: uuidv4(),
50
- text: sendMessageResponse.output,
60
+ text: textMessage,
51
61
  sender: 'bot',
52
62
  createdAt: new Date().toISOString(),
53
63
  };
@@ -13,5 +13,6 @@ export interface LoadPreviousSessionResponse {
13
13
  }
14
14
 
15
15
  export interface SendMessageResponse {
16
- output: string;
16
+ output?: string;
17
+ text?: string;
17
18
  }
package/vite.config.ts CHANGED
@@ -28,6 +28,7 @@ export default defineConfig({
28
28
  alias: {
29
29
  '@': srcPath,
30
30
  '@n8n/chat': srcPath,
31
+ lodash: 'lodash-es',
31
32
  },
32
33
  },
33
34
  define: {