@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.
- package/README.md +1 -2
- package/dist/components/ChatBot/types.d.ts +3 -1
- package/dist/components/ChatBotInput/ChatBotInput.vue.d.ts +3 -3
- package/dist/components/ChatBotInput/__tests__/ChatBotInput.spec.d.ts +1 -0
- package/dist/components/ChatBotInput/index.d.ts +2 -2
- package/dist/components/ChatBotInput/types.d.ts +4 -4
- package/dist/components/ChatBotMessage/__tests__/ChatBotMessage.spec.d.ts +1 -0
- package/dist/components/ChatBotMessage/__tests__/ChatBotMessageButtons.spec.d.ts +1 -0
- package/dist/components/ChatBotMessage/types.d.ts +3 -2
- package/dist/components/ChatToolBar/__tests__/ChatToolBar.spec.d.ts +1 -0
- package/dist/components/FieldPreview/__tests__/FieldPreview.spec.d.ts +1 -0
- package/dist/components/MarkdownRender/__tests__/MarkdownRender.spec.d.ts +1 -0
- package/dist/components/PulseDots/__tests__/PulseDots.spec.d.ts +1 -0
- package/dist/composables/__tests__/useChatMessages.spec.d.ts +1 -0
- package/dist/composables/__tests__/useSSE.spec.d.ts +1 -0
- package/dist/composables/useChatMessages.d.ts +2 -1
- package/dist/composables/useSSE.d.ts +1 -2
- package/dist/composables/useTexts.d.ts +2 -0
- package/dist/index.js +16 -16
- package/dist/index.mjs +2924 -1770
- package/dist/style.css +1 -1
- package/dist/test/setup.d.ts +1 -0
- package/dist/utils/__tests__/parseFieldValue.spec.d.ts +1 -0
- package/package.json +27 -5
- package/src/assets/styles/preview-file.scss +70 -0
- package/src/assets/styles/styles.scss +190 -222
- package/src/components/ChatBot/ChatBot.vue +345 -368
- package/src/components/ChatBot/types.ts +35 -33
- package/src/components/ChatBotInput/ChatBotInput.vue +188 -190
- package/src/components/ChatBotInput/__tests__/ChatBotInput.spec.ts +279 -0
- package/src/components/ChatBotInput/__tests__/__snapshots__/ChatBotInput.spec.ts.snap +25 -0
- package/src/components/ChatBotInput/index.ts +2 -2
- package/src/components/ChatBotInput/types.ts +25 -25
- package/src/components/ChatBotMessage/ChatBotMessage.vue +159 -134
- package/src/components/ChatBotMessage/ChatBotMessageButtons.vue +179 -164
- package/src/components/ChatBotMessage/__tests__/ChatBotMessage.spec.ts +256 -0
- package/src/components/ChatBotMessage/__tests__/ChatBotMessageButtons.spec.ts +199 -0
- package/src/components/ChatBotMessage/__tests__/__snapshots__/ChatBotMessage.spec.ts.snap +35 -0
- package/src/components/ChatBotMessage/__tests__/__snapshots__/ChatBotMessageButtons.spec.ts.snap +25 -0
- package/src/components/ChatBotMessage/types.ts +54 -53
- package/src/components/ChatToolBar/ChatToolBar.vue +68 -64
- package/src/components/ChatToolBar/__tests__/ChatToolBar.spec.ts +118 -0
- package/src/components/ChatToolBar/__tests__/__snapshots__/ChatToolBar.spec.ts.snap +11 -0
- package/src/components/ChatToolBar/types.ts +12 -12
- package/src/components/FieldPreview/FieldPreview.vue +56 -58
- package/src/components/FieldPreview/__tests__/FieldPreview.spec.ts +72 -0
- package/src/components/FieldPreview/__tests__/__snapshots__/FieldPreview.spec.ts.snap +25 -0
- package/src/components/FieldPreview/field-preview.scss +26 -26
- package/src/components/FieldPreview/types.ts +5 -5
- package/src/components/MarkdownRender/MarkdownRender.vue +15 -15
- package/src/components/MarkdownRender/__tests__/MarkdownRender.spec.ts +68 -0
- package/src/components/MarkdownRender/__tests__/__snapshots__/MarkdownRender.spec.ts.snap +8 -0
- package/src/components/MarkdownRender/markdown-render.scss +19 -20
- package/src/components/MarkdownRender/types.ts +3 -3
- package/src/components/PulseDots/PulseDots.vue +17 -17
- package/src/components/PulseDots/__tests__/PulseDots.spec.ts +35 -0
- package/src/components/PulseDots/__tests__/__snapshots__/PulseDots.spec.ts.snap +7 -0
- package/src/components/PulseDots/__tests__/__snapshots__/pulse-dots.spec.ts.snap +7 -0
- package/src/components/PulseDots/pulse-dots.scss +24 -23
- package/src/composables/__tests__/useChatMessages.spec.ts +51 -0
- package/src/composables/__tests__/useSSE.spec.ts +132 -0
- package/src/composables/useChatApi.ts +128 -134
- package/src/composables/useChatMessages.ts +46 -48
- package/src/composables/useSSE.ts +75 -76
- package/src/composables/useTexts.ts +30 -30
- package/src/test/setup.ts +36 -0
- package/src/utils/__tests__/parseFieldValue.spec.ts +27 -0
- package/src/utils/parseFieldValue.ts +12 -0
- package/src/utils/helper.ts +0 -12
- /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
|
-
-
|
|
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
|
-
|
|
40
|
+
file?: ChatBotFile;
|
|
39
41
|
isWelcomeMessage?: boolean;
|
|
40
42
|
fields?: FieldData[];
|
|
41
43
|
};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { ChatBotInputProps,
|
|
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
|
-
|
|
4
|
+
"send-message": (prompt: string, file?: ChatBotFile | undefined) => void;
|
|
5
5
|
}, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<__VLS_TypePropsToRuntimeProps<ChatBotInputProps>>> & Readonly<{
|
|
6
|
-
|
|
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;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { default as ChatBotInput } from './ChatBotInput.vue';
|
|
2
|
-
import { ChatBotInputProps,
|
|
2
|
+
import { ChatBotInputProps, ChatBotFile } from './types';
|
|
3
3
|
|
|
4
4
|
export { ChatBotInput };
|
|
5
|
-
export type { ChatBotInputProps,
|
|
5
|
+
export type { ChatBotInputProps, ChatBotFile };
|
|
@@ -16,13 +16,13 @@ export type ChatBotInputProps = {
|
|
|
16
16
|
*/
|
|
17
17
|
agentId?: string;
|
|
18
18
|
};
|
|
19
|
-
export type
|
|
19
|
+
export type ChatBotFile = {
|
|
20
20
|
/**
|
|
21
|
-
* The
|
|
21
|
+
* The preview URL for the file (if it's an image)
|
|
22
22
|
*/
|
|
23
|
-
previewUrl
|
|
23
|
+
previewUrl?: string;
|
|
24
24
|
/**
|
|
25
25
|
* The file object
|
|
26
26
|
*/
|
|
27
|
-
|
|
27
|
+
fileData: File;
|
|
28
28
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -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
|
-
*
|
|
14
|
+
* File Preview
|
|
14
15
|
*/
|
|
15
|
-
|
|
16
|
+
file?: ChatBotFile;
|
|
16
17
|
/**
|
|
17
18
|
* Default api endpoint
|
|
18
19
|
*/
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -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,
|
|
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 {};
|