@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.
- package/dist/commons/constants/variables.d.ts +4 -0
- package/dist/commons/constants/variables.d.ts.map +1 -1
- package/dist/components/Chat/Chat.d.ts.map +1 -1
- package/dist/components/Chat/Icons.d.ts +19 -1
- package/dist/components/Chat/Icons.d.ts.map +1 -1
- package/dist/components/Chat/Message.d.ts.map +1 -1
- package/dist/components/Chat/MultimodalInput.d.ts +3 -1
- package/dist/components/Chat/MultimodalInput.d.ts.map +1 -1
- package/dist/components/Chat/SuggestedActions.d.ts +12 -0
- package/dist/components/Chat/SuggestedActions.d.ts.map +1 -0
- package/dist/features/AgentWidget/index.d.ts +8 -2
- package/dist/features/AgentWidget/index.d.ts.map +1 -1
- package/dist/hooks/useChat.d.ts +2 -0
- package/dist/hooks/useChat.d.ts.map +1 -1
- package/dist/hooks/useConfiguration.d.ts +8 -1
- package/dist/hooks/useConfiguration.d.ts.map +1 -1
- package/dist/index.html +12 -51
- package/dist/services/apis.d.ts +1 -0
- package/dist/services/apis.d.ts.map +1 -1
- package/dist/services/chat.service.d.ts +7 -1
- package/dist/services/chat.service.d.ts.map +1 -1
- package/dist/types/common.type.d.ts +6 -0
- package/dist/types/common.type.d.ts.map +1 -1
- package/dist/web.js +1 -1
- package/package.json +2 -1
- package/src/commons/constants/variables.ts +5 -0
- package/src/components/Chat/Chat.tsx +2 -0
- package/src/components/Chat/Icons.tsx +867 -1
- package/src/components/Chat/Message.tsx +42 -16
- package/src/components/Chat/MultimodalInput.tsx +140 -107
- package/src/components/Chat/SuggestedActions.tsx +99 -0
- package/src/features/AgentWidget/index.tsx +8 -2
- package/src/hooks/useChat.ts +19 -2
- package/src/hooks/useConfiguration.tsx +8 -1
- package/src/services/apis.ts +2 -0
- package/src/services/chat.service.ts +36 -1
- package/src/types/common.type.ts +7 -0
- package/dist/components/Chat/AudioRecording.d.ts +0 -9
- package/dist/components/Chat/AudioRecording.d.ts.map +0 -1
- package/dist/hooks/useConnection.d.ts +0 -15
- package/dist/hooks/useConnection.d.ts.map +0 -1
- package/dist/services/user.service.d.ts +0 -3
- package/dist/services/user.service.d.ts.map +0 -1
- package/dist/types/agentType.d.ts +0 -11
- package/dist/types/agentType.d.ts.map +0 -1
package/src/services/apis.ts
CHANGED
|
@@ -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
|
+
};
|
package/src/types/common.type.ts
CHANGED
|
@@ -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 +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 +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"}
|