@clikvn/agent-widget-embedded 0.0.9-dev → 0.0.11-dev

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 (45) hide show
  1. package/dist/commons/constants/variables.d.ts +4 -0
  2. package/dist/commons/constants/variables.d.ts.map +1 -1
  3. package/dist/components/Chat/Chat.d.ts.map +1 -1
  4. package/dist/components/Chat/Icons.d.ts +19 -1
  5. package/dist/components/Chat/Icons.d.ts.map +1 -1
  6. package/dist/components/Chat/Message.d.ts.map +1 -1
  7. package/dist/components/Chat/MultimodalInput.d.ts +3 -1
  8. package/dist/components/Chat/MultimodalInput.d.ts.map +1 -1
  9. package/dist/components/Chat/SuggestedActions.d.ts +12 -0
  10. package/dist/components/Chat/SuggestedActions.d.ts.map +1 -0
  11. package/dist/features/AgentWidget/index.d.ts +8 -2
  12. package/dist/features/AgentWidget/index.d.ts.map +1 -1
  13. package/dist/hooks/useChat.d.ts +2 -0
  14. package/dist/hooks/useChat.d.ts.map +1 -1
  15. package/dist/hooks/useConfiguration.d.ts +8 -1
  16. package/dist/hooks/useConfiguration.d.ts.map +1 -1
  17. package/dist/index.html +12 -51
  18. package/dist/services/apis.d.ts +1 -0
  19. package/dist/services/apis.d.ts.map +1 -1
  20. package/dist/services/chat.service.d.ts +7 -1
  21. package/dist/services/chat.service.d.ts.map +1 -1
  22. package/dist/types/common.type.d.ts +6 -0
  23. package/dist/types/common.type.d.ts.map +1 -1
  24. package/dist/web.js +1 -1
  25. package/package.json +2 -1
  26. package/src/commons/constants/variables.ts +5 -0
  27. package/src/components/Chat/Chat.tsx +2 -0
  28. package/src/components/Chat/Icons.tsx +867 -1
  29. package/src/components/Chat/Message.tsx +42 -16
  30. package/src/components/Chat/MultimodalInput.tsx +140 -107
  31. package/src/components/Chat/SuggestedActions.tsx +99 -0
  32. package/src/features/AgentWidget/index.tsx +8 -2
  33. package/src/hooks/useChat.ts +19 -2
  34. package/src/hooks/useConfiguration.tsx +8 -1
  35. package/src/services/apis.ts +2 -0
  36. package/src/services/chat.service.ts +36 -1
  37. package/src/types/common.type.ts +7 -0
  38. package/dist/components/Chat/AudioRecording.d.ts +0 -9
  39. package/dist/components/Chat/AudioRecording.d.ts.map +0 -1
  40. package/dist/hooks/useConnection.d.ts +0 -15
  41. package/dist/hooks/useConnection.d.ts.map +0 -1
  42. package/dist/services/user.service.d.ts +0 -3
  43. package/dist/services/user.service.d.ts.map +0 -1
  44. package/dist/types/agentType.d.ts +0 -11
  45. package/dist/types/agentType.d.ts.map +0 -1
@@ -8,3 +8,5 @@ export const API_PREDICTION = `${API_CHATS}/prediction`;
8
8
  export const API_CHATBOTS = `${API_VERSION}/bots`;
9
9
 
10
10
  export const API_CREATE_ATTACHMENTS = `${API_CHATS}/attachments`;
11
+
12
+ export const API_SUGGESTIONS = `${API_CHATS}/suggestions`;
@@ -4,10 +4,11 @@ import {
4
4
  API_CHATS,
5
5
  API_CREATE_ATTACHMENTS,
6
6
  API_PREDICTION,
7
+ API_SUGGESTIONS,
7
8
  API_VERSION,
8
9
  } from './apis';
9
10
  import { ChatRequestType, ChatType } from '../types/chat.type';
10
- import { CommonChatType } from '../types/common.type';
11
+ import { CommonChatType, SuggestionType } from '../types/common.type';
11
12
  import {
12
13
  AttachmentUploadResult,
13
14
  ChatMessageType,
@@ -162,3 +163,37 @@ export const getById = async ({
162
163
  method: 'GET',
163
164
  });
164
165
  };
166
+
167
+ export const getSuggestions = async ({
168
+ accessToken,
169
+ id,
170
+ question,
171
+ apiHost
172
+ }: {
173
+ accessToken?: string;
174
+ id: string;
175
+ question?: string;
176
+ apiHost: string;
177
+ }): Promise<SuggestionType[]> => {
178
+ const headers = accessToken
179
+ ? {
180
+ Authorization: `Bearer ${accessToken}`,
181
+ 'Content-Type': 'application/json',
182
+ }
183
+ : {};
184
+ const url = accessToken
185
+ ? `${API_SUGGESTIONS}/${id}`
186
+ : `${API_VERSION}${API_SUGGESTIONS}/${id}`;
187
+ const req = {
188
+ question
189
+ }
190
+ const formData = new FormData();
191
+ formData.append('question', `${question}`);
192
+ return request({
193
+ host: apiHost,
194
+ url,
195
+ headers,
196
+ method: 'POST',
197
+ body: formData,
198
+ });
199
+ };
@@ -15,3 +15,10 @@ export interface SuggestionType {
15
15
  label?: string;
16
16
  action?: string;
17
17
  }
18
+
19
+ export interface ConfigMessageType {
20
+ backgroundColor?: string;
21
+ textColor?: string;
22
+ showAvatar?: boolean;
23
+ avatarSrc?: string;
24
+ }
@@ -1,9 +0,0 @@
1
- import { FC } from 'react';
2
- type Props = {
3
- addRecordingToPreviews: (blob: Blob) => void;
4
- isRecording: boolean;
5
- setIsRecording: (value: boolean) => void;
6
- };
7
- export declare const AudioRecording: FC<Props>;
8
- export {};
9
- //# sourceMappingURL=AudioRecording.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"AudioRecording.d.ts","sourceRoot":"","sources":["../../../src/components/Chat/AudioRecording.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAuB,MAAM,OAAO,CAAC;AAShD,KAAK,KAAK,GAAG;IACX,sBAAsB,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,IAAI,CAAC;IAC7C,WAAW,EAAE,OAAO,CAAC;IACrB,cAAc,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;CAC1C,CAAC;AACF,eAAO,MAAM,cAAc,EAAE,EAAE,CAAC,KAAK,CAiEpC,CAAC"}
@@ -1,15 +0,0 @@
1
- import React from 'react';
2
- type TokenGeneratorData = {
3
- shouldConnect: boolean;
4
- wsUrl: string;
5
- token: string;
6
- disconnect: () => Promise<void>;
7
- connect: () => Promise<void>;
8
- };
9
- export declare const ConnectionProvider: ({ children, livekitURL, }: {
10
- children: React.ReactNode;
11
- livekitURL: string;
12
- }) => import("react/jsx-runtime").JSX.Element;
13
- export declare const useConnection: () => TokenGeneratorData;
14
- export {};
15
- //# sourceMappingURL=useConnection.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useConnection.d.ts","sourceRoot":"","sources":["../../src/hooks/useConnection.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAkC,MAAM,OAAO,CAAC;AAIvD,KAAK,kBAAkB,GAAG;IACxB,aAAa,EAAE,OAAO,CAAC;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAChC,OAAO,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CAC9B,CAAC;AAMF,eAAO,MAAM,kBAAkB,8BAG5B;IACD,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,UAAU,EAAE,MAAM,CAAC;CACpB,4CA6CA,CAAC;AAEF,eAAO,MAAM,aAAa,0BAMzB,CAAC"}
@@ -1,3 +0,0 @@
1
- import { UserType } from '../types/user.type';
2
- export declare const getUserInfo: (accessToken: string) => Promise<UserType>;
3
- //# sourceMappingURL=user.service.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"user.service.d.ts","sourceRoot":"","sources":["../../src/services/user.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAI9C,eAAO,MAAM,WAAW,gBAAuB,MAAM,KAAG,OAAO,CAAC,QAAQ,CAUvE,CAAC"}
@@ -1,11 +0,0 @@
1
- export interface AgentType {
2
- id: string;
3
- created: string;
4
- lastModifiedDate: string;
5
- name: string;
6
- chatflowId: string;
7
- chatflowConfig: any;
8
- hidden: boolean;
9
- avatar: string;
10
- }
11
- //# sourceMappingURL=agentType.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"agentType.d.ts","sourceRoot":"","sources":["../../src/types/agentType.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,SAAS;IACxB,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,MAAM,CAAC;IAChB,gBAAgB,EAAE,MAAM,CAAC;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,CAAC;IACnB,cAAc,EAAE,GAAG,CAAC;IACpB,MAAM,EAAE,OAAO,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;CAChB"}