@quidgest/chatbot 0.5.1 → 0.5.3

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 (70) hide show
  1. package/README.md +1 -2
  2. package/dist/components/ChatBot/types.d.ts +3 -1
  3. package/dist/components/ChatBotInput/ChatBotInput.vue.d.ts +3 -3
  4. package/dist/components/ChatBotInput/__tests__/ChatBotInput.spec.d.ts +1 -0
  5. package/dist/components/ChatBotInput/index.d.ts +2 -2
  6. package/dist/components/ChatBotInput/types.d.ts +4 -4
  7. package/dist/components/ChatBotMessage/__tests__/ChatBotMessage.spec.d.ts +1 -0
  8. package/dist/components/ChatBotMessage/__tests__/ChatBotMessageButtons.spec.d.ts +1 -0
  9. package/dist/components/ChatBotMessage/types.d.ts +3 -2
  10. package/dist/components/ChatToolBar/__tests__/ChatToolBar.spec.d.ts +1 -0
  11. package/dist/components/FieldPreview/__tests__/FieldPreview.spec.d.ts +1 -0
  12. package/dist/components/MarkdownRender/__tests__/MarkdownRender.spec.d.ts +1 -0
  13. package/dist/components/PulseDots/__tests__/PulseDots.spec.d.ts +1 -0
  14. package/dist/composables/__tests__/useChatMessages.spec.d.ts +1 -0
  15. package/dist/composables/__tests__/useSSE.spec.d.ts +1 -0
  16. package/dist/composables/useChatMessages.d.ts +2 -1
  17. package/dist/composables/useSSE.d.ts +1 -2
  18. package/dist/composables/useTexts.d.ts +2 -0
  19. package/dist/index.js +16 -16
  20. package/dist/index.mjs +2924 -1770
  21. package/dist/style.css +1 -1
  22. package/dist/test/setup.d.ts +1 -0
  23. package/dist/utils/__tests__/parseFieldValue.spec.d.ts +1 -0
  24. package/package.json +27 -5
  25. package/src/assets/styles/preview-file.scss +70 -0
  26. package/src/assets/styles/styles.scss +190 -222
  27. package/src/components/ChatBot/ChatBot.vue +345 -368
  28. package/src/components/ChatBot/types.ts +35 -33
  29. package/src/components/ChatBotInput/ChatBotInput.vue +188 -190
  30. package/src/components/ChatBotInput/__tests__/ChatBotInput.spec.ts +279 -0
  31. package/src/components/ChatBotInput/__tests__/__snapshots__/ChatBotInput.spec.ts.snap +25 -0
  32. package/src/components/ChatBotInput/index.ts +2 -2
  33. package/src/components/ChatBotInput/types.ts +25 -25
  34. package/src/components/ChatBotMessage/ChatBotMessage.vue +159 -134
  35. package/src/components/ChatBotMessage/ChatBotMessageButtons.vue +179 -164
  36. package/src/components/ChatBotMessage/__tests__/ChatBotMessage.spec.ts +256 -0
  37. package/src/components/ChatBotMessage/__tests__/ChatBotMessageButtons.spec.ts +199 -0
  38. package/src/components/ChatBotMessage/__tests__/__snapshots__/ChatBotMessage.spec.ts.snap +35 -0
  39. package/src/components/ChatBotMessage/__tests__/__snapshots__/ChatBotMessageButtons.spec.ts.snap +25 -0
  40. package/src/components/ChatBotMessage/types.ts +54 -53
  41. package/src/components/ChatToolBar/ChatToolBar.vue +68 -64
  42. package/src/components/ChatToolBar/__tests__/ChatToolBar.spec.ts +118 -0
  43. package/src/components/ChatToolBar/__tests__/__snapshots__/ChatToolBar.spec.ts.snap +11 -0
  44. package/src/components/ChatToolBar/types.ts +12 -12
  45. package/src/components/FieldPreview/FieldPreview.vue +56 -58
  46. package/src/components/FieldPreview/__tests__/FieldPreview.spec.ts +72 -0
  47. package/src/components/FieldPreview/__tests__/__snapshots__/FieldPreview.spec.ts.snap +25 -0
  48. package/src/components/FieldPreview/field-preview.scss +26 -26
  49. package/src/components/FieldPreview/types.ts +5 -5
  50. package/src/components/MarkdownRender/MarkdownRender.vue +15 -15
  51. package/src/components/MarkdownRender/__tests__/MarkdownRender.spec.ts +68 -0
  52. package/src/components/MarkdownRender/__tests__/__snapshots__/MarkdownRender.spec.ts.snap +8 -0
  53. package/src/components/MarkdownRender/markdown-render.scss +19 -20
  54. package/src/components/MarkdownRender/types.ts +3 -3
  55. package/src/components/PulseDots/PulseDots.vue +17 -17
  56. package/src/components/PulseDots/__tests__/PulseDots.spec.ts +35 -0
  57. package/src/components/PulseDots/__tests__/__snapshots__/PulseDots.spec.ts.snap +7 -0
  58. package/src/components/PulseDots/__tests__/__snapshots__/pulse-dots.spec.ts.snap +7 -0
  59. package/src/components/PulseDots/pulse-dots.scss +24 -23
  60. package/src/composables/__tests__/useChatMessages.spec.ts +51 -0
  61. package/src/composables/__tests__/useSSE.spec.ts +132 -0
  62. package/src/composables/useChatApi.ts +128 -134
  63. package/src/composables/useChatMessages.ts +46 -48
  64. package/src/composables/useSSE.ts +75 -76
  65. package/src/composables/useTexts.ts +30 -30
  66. package/src/test/setup.ts +36 -0
  67. package/src/utils/__tests__/parseFieldValue.spec.ts +27 -0
  68. package/src/utils/parseFieldValue.ts +12 -0
  69. package/src/utils/helper.ts +0 -12
  70. /package/dist/utils/{helper.d.ts → parseFieldValue.d.ts} +0 -0
package/README.md CHANGED
@@ -4,5 +4,4 @@ This template should help get you started developing with Vue 3 in Vite. The tem
4
4
 
5
5
  ## Recommended IDE Setup
6
6
 
7
- - [VS Code](https://code.visualstudio.com/) + [Volar](https://marketplace.visualstudio.com/items?itemName=Vue.volar) (and disable Vetur) + [TypeScript Vue Plugin (Volar)](https://marketplace.visualstudio.com/items?itemName=Vue.vscode-typescript-vue-plugin).
8
-
7
+ - [VS Code](https://code.visualstudio.com/) + [Volar](https://marketplace.visualstudio.com/items?itemName=Vue.volar) (and disable Vetur) + [TypeScript Vue Plugin (Volar)](https://marketplace.visualstudio.com/items?itemName=Vue.vscode-typescript-vue-plugin).
@@ -1,3 +1,5 @@
1
+ import { ChatBotFile } from '../ChatBotInput';
2
+
1
3
  export type ChatBotProps = {
2
4
  apiEndpoint?: string;
3
5
  controllerEndpoint?: string;
@@ -35,7 +37,7 @@ export type ChatMessage = {
35
37
  date: Date;
36
38
  sender: ChatBotMessageSender;
37
39
  sessionID: string;
38
- imagePreviewUrl?: string;
40
+ file?: ChatBotFile;
39
41
  isWelcomeMessage?: boolean;
40
42
  fields?: FieldData[];
41
43
  };
@@ -1,9 +1,9 @@
1
- import { ChatBotInputProps, ChatBotImage } from './types';
1
+ import { ChatBotInputProps, ChatBotFile } from './';
2
2
 
3
3
  declare const _default: import('vue').DefineComponent<import('vue').ExtractPropTypes<__VLS_TypePropsToRuntimeProps<ChatBotInputProps>>, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
4
- sendMessage: (prompt: string, image?: ChatBotImage | undefined) => void;
4
+ "send-message": (prompt: string, file?: ChatBotFile | undefined) => void;
5
5
  }, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<__VLS_TypePropsToRuntimeProps<ChatBotInputProps>>> & Readonly<{
6
- onSendMessage?: ((prompt: string, image?: ChatBotImage | undefined) => any) | undefined;
6
+ "onSend-message"?: ((prompt: string, file?: ChatBotFile | undefined) => any) | undefined;
7
7
  }>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
8
8
  export default _default;
9
9
  type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
@@ -1,5 +1,5 @@
1
1
  import { default as ChatBotInput } from './ChatBotInput.vue';
2
- import { ChatBotInputProps, ChatBotImage } from './types';
2
+ import { ChatBotInputProps, ChatBotFile } from './types';
3
3
 
4
4
  export { ChatBotInput };
5
- export type { ChatBotInputProps, ChatBotImage };
5
+ export type { ChatBotInputProps, ChatBotFile };
@@ -16,13 +16,13 @@ export type ChatBotInputProps = {
16
16
  */
17
17
  agentId?: string;
18
18
  };
19
- export type ChatBotImage = {
19
+ export type ChatBotFile = {
20
20
  /**
21
- * The image URL
21
+ * The preview URL for the file (if it's an image)
22
22
  */
23
- previewUrl: string;
23
+ previewUrl?: string;
24
24
  /**
25
25
  * The file object
26
26
  */
27
- file: File;
27
+ fileData: File;
28
28
  };
@@ -1,4 +1,5 @@
1
1
  import { ChatBotMessageSender, FieldData } from '../ChatBot/types';
2
+ import { ChatBotFile } from '../ChatBotInput';
2
3
 
3
4
  export type ChatBotMessageProps = {
4
5
  sender?: ChatBotMessageSender;
@@ -10,9 +11,9 @@ export type ChatBotMessageProps = {
10
11
  */
11
12
  dateFormat: string;
12
13
  /**
13
- * Image preview URL
14
+ * File Preview
14
15
  */
15
- imagePreviewUrl?: string;
16
+ file?: ChatBotFile;
16
17
  /**
17
18
  * Default api endpoint
18
19
  */
@@ -0,0 +1 @@
1
+ export {};
@@ -1,10 +1,11 @@
1
1
  import { Ref } from 'vue';
2
2
  import { ChatMessage, ChatBotMessageSender } from '../components/ChatBot/types';
3
+ import { ChatBotFile } from '../components/ChatBotInput';
3
4
 
4
5
  export declare function useChatMessages(): {
5
6
  messages: Ref<ChatMessage[], ChatMessage[]>;
6
7
  nextMessageId: Ref<number, number>;
7
- addChatMessage: (message: string, sender?: ChatBotMessageSender, imagePreviewUrl?: string | null, sessionID?: string, isWelcomeMessage?: boolean) => void;
8
+ addChatMessage: (message: string, sender?: ChatBotMessageSender, file?: ChatBotFile, sessionID?: string, isWelcomeMessage?: boolean) => ChatMessage;
8
9
  getLastMessage: () => ChatMessage | undefined;
9
10
  clearMessages: () => void;
10
11
  getMessages: () => ChatMessage[];
@@ -1,10 +1,9 @@
1
1
  import { AxiosRequestConfig } from 'axios';
2
2
 
3
- type SSEvents = {
3
+ export type SSEvents = {
4
4
  onMessage?: (message: string) => void;
5
5
  onError?: (error: Error) => void;
6
6
  onFieldMetadata?: (metadata: Record<string, unknown>) => void;
7
7
  onDone?: () => void;
8
8
  };
9
9
  export declare function useSSE(config: AxiosRequestConfig, handlers: SSEvents): Promise<void>;
10
- export {};
@@ -23,4 +23,6 @@ export declare function useTexts(): {
23
23
  imagePreview: string;
24
24
  regenerateResponse: string;
25
25
  generatingResponse: string;
26
+ suggestionsForField: string;
27
+ fileUpload: string;
26
28
  };