@quidgest/chatbot 0.5.1 → 0.5.3-dev.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.
- package/README.md +1 -2
- package/dist/components/ChatBot/ChatBot.vue.d.ts +2 -0
- package/dist/components/ChatBot/types.d.ts +2 -1
- package/dist/components/ChatBotInput/ChatBotInput.vue.d.ts +2 -2
- package/dist/components/ChatBotInput/__tests__/ChatBotInput.spec.d.ts +1 -0
- package/dist/components/ChatBotMessage/ChatBotMessage.vue.d.ts +3 -1
- package/dist/components/ChatBotMessage/__tests__/ChatBotMessageButtons.spec.d.ts +1 -0
- package/dist/components/ChatToolBar/__tests__/ChatToolBar.spec.d.ts +1 -0
- package/dist/components/FieldPreview/FieldPreview.vue.d.ts +2 -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/useChatApi.d.ts +1 -1
- package/dist/composables/useChatMessages.d.ts +2 -1
- package/dist/composables/useSSE.d.ts +1 -2
- package/dist/composables/useTexts.d.ts +5 -0
- package/dist/index.js +25 -25
- package/dist/index.mjs +2319 -1812
- 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 -6
- package/src/assets/styles/styles.scss +212 -220
- package/src/components/ChatBot/ChatBot.vue +346 -368
- package/src/components/ChatBot/types.ts +34 -33
- package/src/components/ChatBotInput/ChatBotInput.vue +181 -190
- package/src/components/ChatBotInput/__tests__/ChatBotInput.spec.ts +292 -0
- package/src/components/ChatBotInput/__tests__/__snapshots__/ChatBotInput.spec.ts.snap +25 -0
- package/src/components/ChatBotInput/types.ts +24 -24
- package/src/components/ChatBotMessage/ChatBotMessage.vue +133 -134
- package/src/components/ChatBotMessage/ChatBotMessageButtons.vue +179 -164
- package/src/components/ChatBotMessage/__tests__/ChatBotMessageButtons.spec.ts +199 -0
- package/src/components/ChatBotMessage/__tests__/__snapshots__/ChatBotMessageButtons.spec.ts.snap +25 -0
- package/src/components/ChatBotMessage/types.ts +52 -52
- package/src/components/ChatToolBar/ChatToolBar.vue +69 -64
- package/src/components/ChatToolBar/__tests__/ChatToolBar.spec.ts +138 -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 +83 -63
- package/src/components/FieldPreview/__tests__/FieldPreview.spec.ts +72 -0
- package/src/components/FieldPreview/__tests__/__snapshots__/FieldPreview.spec.ts.snap +19 -0
- package/src/components/FieldPreview/field-preview.scss +28 -24
- package/src/components/FieldPreview/types.ts +5 -5
- package/src/components/MarkdownRender/MarkdownRender.vue +16 -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 +64 -0
- package/src/composables/__tests__/useSSE.spec.ts +132 -0
- package/src/composables/useChatApi.ts +132 -134
- package/src/composables/useChatMessages.ts +50 -48
- package/src/composables/useSSE.ts +75 -76
- package/src/composables/useTexts.ts +33 -30
- package/src/test/setup.ts +41 -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).
|
|
@@ -13,6 +13,7 @@ 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;
|
|
16
17
|
}, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<ChatBotProps>, {
|
|
17
18
|
apiEndpoint: string;
|
|
18
19
|
userImage: string;
|
|
@@ -26,6 +27,7 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
|
|
|
26
27
|
};
|
|
27
28
|
}>>> & Readonly<{
|
|
28
29
|
"onApply-fields"?: ((fields: AppliedFieldData[]) => any) | undefined;
|
|
30
|
+
"onDirect-agent-chat"?: ((agentId: string, prompt: string) => any) | undefined;
|
|
29
31
|
}>, {
|
|
30
32
|
apiEndpoint: string;
|
|
31
33
|
userImage: string;
|
|
@@ -20,13 +20,14 @@ export type AgentData = {
|
|
|
20
20
|
formId: string;
|
|
21
21
|
};
|
|
22
22
|
export type FieldData = {
|
|
23
|
+
id: string;
|
|
23
24
|
name: string;
|
|
24
25
|
type: string;
|
|
25
26
|
text: string;
|
|
26
27
|
applied?: boolean;
|
|
27
28
|
};
|
|
28
29
|
export type AppliedFieldData = {
|
|
29
|
-
|
|
30
|
+
id: string;
|
|
30
31
|
text: unknown;
|
|
31
32
|
};
|
|
32
33
|
export type ChatMessage = {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { ChatBotInputProps, ChatBotImage } from './types';
|
|
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, image?: ChatBotImage | undefined) => void;
|
|
5
5
|
}, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<__VLS_TypePropsToRuntimeProps<ChatBotInputProps>>> & Readonly<{
|
|
6
|
-
|
|
6
|
+
"onSend-message"?: ((prompt: string, image?: ChatBotImage | 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
|
-
import { ChatBotMessageProps } from './';
|
|
2
1
|
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,12 +8,14 @@ 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;
|
|
11
12
|
}, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<ChatBotMessageProps>, {
|
|
12
13
|
sender: string;
|
|
13
14
|
userImage: undefined;
|
|
14
15
|
date: () => Date;
|
|
15
16
|
fields: () => never[];
|
|
16
17
|
}>>> & Readonly<{
|
|
18
|
+
onRegenerate?: ((fieldName: string) => any) | undefined;
|
|
17
19
|
"onApply-fields"?: ((fields: AppliedFieldData[]) => any) | undefined;
|
|
18
20
|
}>, {
|
|
19
21
|
date: Date;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -2,8 +2,10 @@ 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;
|
|
5
6
|
}, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<__VLS_TypePropsToRuntimeProps<FieldPreviewProps>>> & Readonly<{
|
|
6
7
|
onApply?: ((text: unknown) => any) | undefined;
|
|
8
|
+
onRegenerate?: ((name: string) => any) | undefined;
|
|
7
9
|
}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
|
|
8
10
|
export default _default;
|
|
9
11
|
type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
|
|
@@ -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 {};
|
|
@@ -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
|
+
getJobResultData: (jobId: string, onChunk: (chunk: string) => void, onMetaData: (metadata: Record<string, unknown>) => void, onRequestError?: (error: Error) => 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;
|
|
@@ -4,8 +4,9 @@ import { ChatMessage, ChatBotMessageSender } from '../components/ChatBot/types';
|
|
|
4
4
|
export declare function useChatMessages(): {
|
|
5
5
|
messages: Ref<ChatMessage[], ChatMessage[]>;
|
|
6
6
|
nextMessageId: Ref<number, number>;
|
|
7
|
-
addChatMessage: (message: string, sender?: ChatBotMessageSender, imagePreviewUrl?: string | null, sessionID?: string, isWelcomeMessage?: boolean) =>
|
|
7
|
+
addChatMessage: (message: string, sender?: ChatBotMessageSender, imagePreviewUrl?: string | null, sessionID?: string, isWelcomeMessage?: boolean) => ChatMessage;
|
|
8
8
|
getLastMessage: () => ChatMessage | undefined;
|
|
9
9
|
clearMessages: () => void;
|
|
10
10
|
getMessages: () => ChatMessage[];
|
|
11
|
+
deleteMessageById: (messageId: number) => void;
|
|
11
12
|
};
|
|
@@ -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 {};
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TODO: Implement localization
|
|
3
|
+
*/
|
|
1
4
|
export declare function useTexts(): {
|
|
2
5
|
copy: string;
|
|
3
6
|
apply: string;
|
|
@@ -21,6 +24,8 @@ export declare function useTexts(): {
|
|
|
21
24
|
cancelButton: string;
|
|
22
25
|
senderImage: string;
|
|
23
26
|
imagePreview: string;
|
|
27
|
+
regenerateResponsePrompt: string;
|
|
24
28
|
regenerateResponse: string;
|
|
25
29
|
generatingResponse: string;
|
|
30
|
+
suggestionsForField: string;
|
|
26
31
|
};
|