@quidgest/chatbot 0.5.3-dev.0 → 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/dist/components/ChatBot/ChatBot.vue.d.ts +0 -2
- package/dist/components/ChatBot/types.d.ts +4 -3
- package/dist/components/ChatBotInput/ChatBotInput.vue.d.ts +3 -3
- package/dist/components/ChatBotInput/index.d.ts +2 -2
- package/dist/components/ChatBotInput/types.d.ts +4 -4
- package/dist/components/ChatBotMessage/ChatBotMessage.vue.d.ts +1 -3
- package/dist/components/ChatBotMessage/__tests__/ChatBotMessage.spec.d.ts +1 -0
- package/dist/components/ChatBotMessage/types.d.ts +3 -2
- package/dist/components/FieldPreview/FieldPreview.vue.d.ts +0 -2
- package/dist/composables/useChatApi.d.ts +1 -1
- package/dist/composables/useChatMessages.d.ts +2 -2
- package/dist/composables/useTexts.d.ts +1 -4
- package/dist/index.js +25 -25
- package/dist/index.mjs +2308 -1661
- package/dist/style.css +1 -1
- package/package.json +3 -2
- package/src/assets/styles/preview-file.scss +70 -0
- package/src/assets/styles/styles.scss +9 -33
- package/src/components/ChatBot/ChatBot.vue +70 -71
- package/src/components/ChatBot/types.ts +4 -3
- package/src/components/ChatBotInput/ChatBotInput.vue +81 -74
- package/src/components/ChatBotInput/__tests__/ChatBotInput.spec.ts +29 -42
- package/src/components/ChatBotInput/__tests__/__snapshots__/ChatBotInput.spec.ts.snap +5 -5
- package/src/components/ChatBotInput/index.ts +2 -2
- package/src/components/ChatBotInput/types.ts +4 -4
- package/src/components/ChatBotMessage/ChatBotMessage.vue +34 -8
- package/src/components/ChatBotMessage/__tests__/ChatBotMessage.spec.ts +256 -0
- package/src/components/ChatBotMessage/__tests__/ChatBotMessageButtons.spec.ts +4 -4
- package/src/components/ChatBotMessage/__tests__/__snapshots__/ChatBotMessage.spec.ts.snap +35 -0
- package/src/components/ChatBotMessage/types.ts +4 -3
- package/src/components/ChatToolBar/ChatToolBar.vue +1 -2
- package/src/components/ChatToolBar/__tests__/ChatToolBar.spec.ts +18 -38
- package/src/components/FieldPreview/FieldPreview.vue +9 -31
- package/src/components/FieldPreview/__tests__/__snapshots__/FieldPreview.spec.ts.snap +11 -5
- package/src/components/FieldPreview/field-preview.scss +0 -4
- package/src/components/MarkdownRender/MarkdownRender.vue +0 -1
- package/src/composables/__tests__/useChatMessages.spec.ts +1 -14
- package/src/composables/useChatApi.ts +53 -57
- package/src/composables/useChatMessages.ts +4 -8
- package/src/composables/useTexts.ts +2 -5
- package/src/test/setup.ts +0 -5
|
@@ -13,7 +13,6 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
|
|
|
13
13
|
};
|
|
14
14
|
}>>, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
15
15
|
"apply-fields": (fields: AppliedFieldData[]) => void;
|
|
16
|
-
"direct-agent-chat": (agentId: string, prompt: string) => void;
|
|
17
16
|
}, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<ChatBotProps>, {
|
|
18
17
|
apiEndpoint: string;
|
|
19
18
|
userImage: string;
|
|
@@ -27,7 +26,6 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
|
|
|
27
26
|
};
|
|
28
27
|
}>>> & Readonly<{
|
|
29
28
|
"onApply-fields"?: ((fields: AppliedFieldData[]) => any) | undefined;
|
|
30
|
-
"onDirect-agent-chat"?: ((agentId: string, prompt: string) => any) | undefined;
|
|
31
29
|
}>, {
|
|
32
30
|
apiEndpoint: string;
|
|
33
31
|
userImage: string;
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { ChatBotFile } from '../ChatBotInput';
|
|
2
|
+
|
|
1
3
|
export type ChatBotProps = {
|
|
2
4
|
apiEndpoint?: string;
|
|
3
5
|
controllerEndpoint?: string;
|
|
@@ -20,14 +22,13 @@ export type AgentData = {
|
|
|
20
22
|
formId: string;
|
|
21
23
|
};
|
|
22
24
|
export type FieldData = {
|
|
23
|
-
id: string;
|
|
24
25
|
name: string;
|
|
25
26
|
type: string;
|
|
26
27
|
text: string;
|
|
27
28
|
applied?: boolean;
|
|
28
29
|
};
|
|
29
30
|
export type AppliedFieldData = {
|
|
30
|
-
|
|
31
|
+
name: string;
|
|
31
32
|
text: unknown;
|
|
32
33
|
};
|
|
33
34
|
export type ChatMessage = {
|
|
@@ -36,7 +37,7 @@ export type ChatMessage = {
|
|
|
36
37
|
date: Date;
|
|
37
38
|
sender: ChatBotMessageSender;
|
|
38
39
|
sessionID: string;
|
|
39
|
-
|
|
40
|
+
file?: ChatBotFile;
|
|
40
41
|
isWelcomeMessage?: boolean;
|
|
41
42
|
fields?: FieldData[];
|
|
42
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
|
-
"send-message": (prompt: string,
|
|
4
|
+
"send-message": (prompt: string, file?: ChatBotFile | undefined) => void;
|
|
5
5
|
}, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<__VLS_TypePropsToRuntimeProps<ChatBotInputProps>>> & Readonly<{
|
|
6
|
-
"onSend-message"?: ((prompt: string,
|
|
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,
|
|
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
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import { ChatBotMessageProps } from './';
|
|
1
2
|
import { AppliedFieldData, FieldData } from '../ChatBot/types';
|
|
2
|
-
import { ChatBotMessageProps } from './types';
|
|
3
3
|
|
|
4
4
|
declare const _default: import('vue').DefineComponent<import('vue').ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<ChatBotMessageProps>, {
|
|
5
5
|
sender: string;
|
|
@@ -8,14 +8,12 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
|
|
|
8
8
|
fields: () => never[];
|
|
9
9
|
}>>, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
10
10
|
"apply-fields": (fields: AppliedFieldData[]) => void;
|
|
11
|
-
regenerate: (fieldName: string) => void;
|
|
12
11
|
}, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<ChatBotMessageProps>, {
|
|
13
12
|
sender: string;
|
|
14
13
|
userImage: undefined;
|
|
15
14
|
date: () => Date;
|
|
16
15
|
fields: () => never[];
|
|
17
16
|
}>>> & Readonly<{
|
|
18
|
-
onRegenerate?: ((fieldName: string) => any) | undefined;
|
|
19
17
|
"onApply-fields"?: ((fields: AppliedFieldData[]) => any) | undefined;
|
|
20
18
|
}>, {
|
|
21
19
|
date: Date;
|
|
@@ -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
|
*/
|
|
@@ -2,10 +2,8 @@ import { FieldPreviewProps } from './types';
|
|
|
2
2
|
|
|
3
3
|
declare const _default: import('vue').DefineComponent<import('vue').ExtractPropTypes<__VLS_TypePropsToRuntimeProps<FieldPreviewProps>>, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
4
4
|
apply: (text: unknown) => void;
|
|
5
|
-
regenerate: (name: string) => void;
|
|
6
5
|
}, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<__VLS_TypePropsToRuntimeProps<FieldPreviewProps>>> & Readonly<{
|
|
7
6
|
onApply?: ((text: unknown) => any) | undefined;
|
|
8
|
-
onRegenerate?: ((name: string) => any) | undefined;
|
|
9
7
|
}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
|
|
10
8
|
export default _default;
|
|
11
9
|
type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
|
|
@@ -14,7 +14,7 @@ export declare function useChatApi(apiEndpoint: string): {
|
|
|
14
14
|
clearChatData: (username: string, project: string, agentID: string, formId: string) => Promise<RequestResponse<{
|
|
15
15
|
success: boolean;
|
|
16
16
|
}>>;
|
|
17
|
-
|
|
17
|
+
getFieldSuggestionData: (jobId: string, onChunk: (chunk: string) => void, onMetaData: (metadata: Record<string, unknown>) => void) => Promise<void>;
|
|
18
18
|
sendPrompt: (formData: FormData, onChunk: (chunk: string) => void, onError?: (error: Error) => void) => Promise<void>;
|
|
19
19
|
handleFeedback: (feedback: number, comment: string, sessionID: string) => Promise<RequestResponse<{
|
|
20
20
|
success: boolean;
|
|
@@ -1,12 +1,12 @@
|
|
|
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[];
|
|
11
|
-
deleteMessageById: (messageId: number) => void;
|
|
12
12
|
};
|
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* TODO: Implement localization
|
|
3
|
-
*/
|
|
4
1
|
export declare function useTexts(): {
|
|
5
2
|
copy: string;
|
|
6
3
|
apply: string;
|
|
@@ -24,8 +21,8 @@ export declare function useTexts(): {
|
|
|
24
21
|
cancelButton: string;
|
|
25
22
|
senderImage: string;
|
|
26
23
|
imagePreview: string;
|
|
27
|
-
regenerateResponsePrompt: string;
|
|
28
24
|
regenerateResponse: string;
|
|
29
25
|
generatingResponse: string;
|
|
30
26
|
suggestionsForField: string;
|
|
27
|
+
fileUpload: string;
|
|
31
28
|
};
|