react-native-chatbot-ai 0.1.53 → 0.1.54
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/lib/module/assets/images/img_empty_data.png +0 -0
- package/lib/module/assets/images/index.js +2 -1
- package/lib/module/assets/images/index.js.map +1 -1
- package/lib/module/components/Drawer/SessionList.js +2 -1
- package/lib/module/components/Drawer/SessionList.js.map +1 -1
- package/lib/module/components/chat/ChatMessageList.js +15 -2
- package/lib/module/components/chat/ChatMessageList.js.map +1 -1
- package/lib/module/components/chat/ChatProductList.js +77 -0
- package/lib/module/components/chat/ChatProductList.js.map +1 -0
- package/lib/module/components/chat/index.js +134 -4
- package/lib/module/components/chat/index.js.map +1 -1
- package/lib/module/components/chat/item/ChatAIAnswerMessageItem.js +0 -2
- package/lib/module/components/chat/item/ChatAIAnswerMessageItem.js.map +1 -1
- package/lib/module/components/chat/item/ChatTable.js +19 -24
- package/lib/module/components/chat/item/ChatTable.js.map +1 -1
- package/lib/module/components/product/Card.js +226 -177
- package/lib/module/components/product/Card.js.map +1 -1
- package/lib/module/components/product/CardHorizontal.js +17 -13
- package/lib/module/components/product/CardHorizontal.js.map +1 -1
- package/lib/module/constants/events.js +2 -1
- package/lib/module/constants/events.js.map +1 -1
- package/lib/module/constants/query.js +2 -1
- package/lib/module/constants/query.js.map +1 -1
- package/lib/module/context/ChatContext.js +13 -3
- package/lib/module/context/ChatContext.js.map +1 -1
- package/lib/module/hooks/message/useMessage.js +7 -1
- package/lib/module/hooks/message/useMessage.js.map +1 -1
- package/lib/module/hooks/message/useSendMessage.js +3 -1
- package/lib/module/hooks/message/useSendMessage.js.map +1 -1
- package/lib/module/hooks/session/useGetExternalSessionInfo.js +17 -0
- package/lib/module/hooks/session/useGetExternalSessionInfo.js.map +1 -0
- package/lib/module/services/endpoints.js +2 -1
- package/lib/module/services/endpoints.js.map +1 -1
- package/lib/module/translation/resources/i18n.js +7 -1
- package/lib/module/translation/resources/i18n.js.map +1 -1
- package/lib/module/types/chat.js.map +1 -1
- package/lib/typescript/src/assets/images/index.d.ts +1 -0
- package/lib/typescript/src/assets/images/index.d.ts.map +1 -1
- package/lib/typescript/src/components/Drawer/SessionList.d.ts.map +1 -1
- package/lib/typescript/src/components/chat/ChatMessageList.d.ts.map +1 -1
- package/lib/typescript/src/components/chat/ChatProductList.d.ts +7 -0
- package/lib/typescript/src/components/chat/ChatProductList.d.ts.map +1 -0
- package/lib/typescript/src/components/chat/index.d.ts.map +1 -1
- package/lib/typescript/src/components/chat/item/ChatAIAnswerMessageItem.d.ts.map +1 -1
- package/lib/typescript/src/components/chat/item/ChatTable.d.ts.map +1 -1
- package/lib/typescript/src/components/product/Card.d.ts +6 -0
- package/lib/typescript/src/components/product/Card.d.ts.map +1 -1
- package/lib/typescript/src/components/product/CardHorizontal.d.ts +1 -0
- package/lib/typescript/src/components/product/CardHorizontal.d.ts.map +1 -1
- package/lib/typescript/src/constants/events.d.ts +1 -0
- package/lib/typescript/src/constants/events.d.ts.map +1 -1
- package/lib/typescript/src/constants/query.d.ts +1 -0
- package/lib/typescript/src/constants/query.d.ts.map +1 -1
- package/lib/typescript/src/context/ChatContext.d.ts.map +1 -1
- package/lib/typescript/src/hooks/message/useMessage.d.ts.map +1 -1
- package/lib/typescript/src/hooks/message/useSendMessage.d.ts.map +1 -1
- package/lib/typescript/src/hooks/session/useGetExternalSessionInfo.d.ts +6 -0
- package/lib/typescript/src/hooks/session/useGetExternalSessionInfo.d.ts.map +1 -0
- package/lib/typescript/src/services/endpoints.d.ts +1 -0
- package/lib/typescript/src/services/endpoints.d.ts.map +1 -1
- package/lib/typescript/src/translation/resources/i18n.d.ts.map +1 -1
- package/lib/typescript/src/types/chat.d.ts +2 -0
- package/lib/typescript/src/types/chat.d.ts.map +1 -1
- package/lib/typescript/src/types/dto.d.ts +10 -0
- package/lib/typescript/src/types/dto.d.ts.map +1 -1
- package/package.json +6 -2
- package/src/assets/images/img_empty_data.png +0 -0
- package/src/assets/images/index.ts +1 -0
- package/src/components/Drawer/SessionList.tsx +4 -2
- package/src/components/chat/ChatMessageList.tsx +20 -2
- package/src/components/chat/ChatProductList.tsx +92 -0
- package/src/components/chat/index.tsx +145 -2
- package/src/components/chat/item/ChatAIAnswerMessageItem.tsx +0 -2
- package/src/components/chat/item/ChatTable.tsx +17 -29
- package/src/components/product/Card.tsx +228 -173
- package/src/components/product/CardHorizontal.tsx +19 -15
- package/src/constants/events.ts +1 -0
- package/src/constants/query.ts +1 -0
- package/src/context/ChatContext.tsx +13 -1
- package/src/hooks/message/useMessage.ts +7 -1
- package/src/hooks/message/useSendMessage.ts +3 -1
- package/src/hooks/session/useGetExternalSessionInfo.ts +23 -0
- package/src/ignore.d.ts +1 -0
- package/src/services/endpoints.ts +2 -0
- package/src/translation/resources/i18n.ts +7 -0
- package/src/types/chat.ts +2 -0
- package/src/types/dto.ts +12 -0
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { useQuery } from '@tanstack/react-query';
|
|
2
|
+
import { QUERY_KEYS } from '../../constants/query';
|
|
3
|
+
import { apiInstance } from '../../services';
|
|
4
|
+
import { BaseResponse, IChatExternalSessionInfoResponse } from '../../types';
|
|
5
|
+
import { ENDPOINTS } from '../../services/endpoints';
|
|
6
|
+
|
|
7
|
+
interface IUseGetExternalSessionInfoProps {
|
|
8
|
+
sessionId: string;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export const useGetExternalSessionInfo = ({
|
|
12
|
+
sessionId,
|
|
13
|
+
}: IUseGetExternalSessionInfoProps) =>
|
|
14
|
+
useQuery({
|
|
15
|
+
queryKey: [QUERY_KEYS.GET_EXTERNAL_SESSION_INFO, sessionId],
|
|
16
|
+
queryFn: async () => {
|
|
17
|
+
const res = await apiInstance?.get<
|
|
18
|
+
BaseResponse<IChatExternalSessionInfoResponse>
|
|
19
|
+
>(ENDPOINTS.assistantService.getExternalSessionInfo(sessionId));
|
|
20
|
+
return res?.data?.data || null;
|
|
21
|
+
},
|
|
22
|
+
enabled: !!sessionId,
|
|
23
|
+
});
|
package/src/ignore.d.ts
CHANGED
|
@@ -17,6 +17,8 @@ export const ENDPOINTS = {
|
|
|
17
17
|
`/assistant-service/v1/app/chat/sessions/${sessionId}/feedback`,
|
|
18
18
|
generateAudio: (sessionId: string, messageId: string) =>
|
|
19
19
|
`/assistant-service/v1/app/chat/sessions/${sessionId}/messages/${messageId}/speech`,
|
|
20
|
+
getExternalSessionInfo: (sessionId: string) =>
|
|
21
|
+
`/assistant-service/v1/app/chat/sessions/${sessionId}/tab-data`,
|
|
20
22
|
},
|
|
21
23
|
uploaderService: {
|
|
22
24
|
upload: '/uploader-service/v1/uploader/permanently',
|
|
@@ -56,6 +56,13 @@ const i18nKey: Record<string, string> = {
|
|
|
56
56
|
//product
|
|
57
57
|
commissions: 'LN: ',
|
|
58
58
|
points: 'Points: ',
|
|
59
|
+
|
|
60
|
+
//tabs
|
|
61
|
+
answer: 'Trả lời',
|
|
62
|
+
source: 'Nguồn',
|
|
63
|
+
product: 'Sản phẩm',
|
|
64
|
+
view_original_message: 'Xem câu trả lời gốc',
|
|
65
|
+
empty_product: 'Không có sản phẩm nào',
|
|
59
66
|
};
|
|
60
67
|
|
|
61
68
|
export default {
|
package/src/types/chat.ts
CHANGED
package/src/types/dto.ts
CHANGED
|
@@ -199,3 +199,15 @@ export interface SendFeedbackResponse {
|
|
|
199
199
|
success: boolean;
|
|
200
200
|
message: string;
|
|
201
201
|
}
|
|
202
|
+
|
|
203
|
+
export interface ISessionProductItem extends IProductItem {
|
|
204
|
+
message_id?: string;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
export interface IChatExternalSessionInfoResponse {
|
|
208
|
+
products: {
|
|
209
|
+
items: ISessionProductItem[];
|
|
210
|
+
count: number;
|
|
211
|
+
};
|
|
212
|
+
source: null;
|
|
213
|
+
}
|