@iblai/data-layer 1.12.106 → 1.13.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.
@@ -0,0 +1,41 @@
1
+ import { SERVICES } from '@data-layer/constants';
2
+ export declare const USER_CHAT_HISTORY_REDUCER_PATH = "userChatHistoryApiSlice";
3
+ export declare const USER_CHAT_HISTORY_QUERY_KEYS: {
4
+ GET_USER_CHAT_HISTORY: () => string[];
5
+ GET_USER_CHAT_HISTORY_SESSION: () => string[];
6
+ GET_USER_CHAT_HISTORY_FILTER: () => string[];
7
+ GET_USER_CHAT_HISTORY_REPORTS: () => string[];
8
+ GET_USER_CHAT_HISTORY_REPORT_STATUS: () => string[];
9
+ };
10
+ /**
11
+ * User-scoped chat history endpoints (`my-chat-history*`). Unlike the admin
12
+ * `chat-history` family these require no RBAC permissions — the backend only
13
+ * allows the authenticated user to read their own data, enforced through the
14
+ * `{userId}` path segment.
15
+ */
16
+ export declare const USER_CHAT_HISTORY_ENDPOINTS: {
17
+ GET_USER_CHAT_HISTORY: {
18
+ service: SERVICES;
19
+ path: (org: string, userId: string) => string;
20
+ };
21
+ GET_USER_CHAT_HISTORY_SESSION: {
22
+ service: SERVICES;
23
+ path: (org: string, userId: string, sessionId: string) => string;
24
+ };
25
+ GET_USER_CHAT_HISTORY_FILTER: {
26
+ service: SERVICES;
27
+ path: (org: string, userId: string) => string;
28
+ };
29
+ USER_CHAT_HISTORY_REPORT: {
30
+ service: SERVICES;
31
+ path: (org: string, userId: string) => string;
32
+ };
33
+ USER_CHAT_HISTORY_REPORT_STATUS: {
34
+ service: SERVICES;
35
+ path: (org: string, userId: string, taskId: string) => string;
36
+ };
37
+ USER_CHAT_HISTORY_REPORT_DOWNLOAD: {
38
+ service: SERVICES;
39
+ path: (org: string, userId: string, taskId: string) => string;
40
+ };
41
+ };
@@ -0,0 +1,137 @@
1
+ export type UserChatHistoryTopic = {
2
+ id?: number;
3
+ name: string;
4
+ };
5
+ export type UserChatHistoryDateRange = {
6
+ start_date: string;
7
+ end_date: string;
8
+ };
9
+ export type UserChatHistorySentiment = 'positive' | 'negative' | 'neutral';
10
+ export type UserChatHistoryFilterResponse = {
11
+ topics: UserChatHistoryTopic[];
12
+ date_ranges?: UserChatHistoryDateRange[];
13
+ sentiment?: string[];
14
+ };
15
+ export type UserChatHistoryMessage = {
16
+ human: string;
17
+ ai: string;
18
+ human_message_inserted_at?: string;
19
+ ai_message_inserted_at?: string;
20
+ };
21
+ export type UserChatHistorySession = {
22
+ id: string;
23
+ student?: string;
24
+ email?: string;
25
+ mentor: string;
26
+ mentor_name?: string;
27
+ inserted_at: string;
28
+ topics?: UserChatHistoryTopic[];
29
+ messages?: UserChatHistoryMessage[];
30
+ sentiment?: string;
31
+ rating?: number;
32
+ /** AI-generated title summarizing the conversation. */
33
+ title?: string | null;
34
+ first_user_message?: string | null;
35
+ last_message_at?: string | null;
36
+ message_count_human?: number;
37
+ message_count_ai?: number;
38
+ positive_feedback_count?: number;
39
+ negative_feedback_count?: number;
40
+ };
41
+ export type UserChatHistoryResponse = {
42
+ count: number;
43
+ next: string | null;
44
+ previous: string | null;
45
+ results: UserChatHistorySession[];
46
+ };
47
+ export type UserChatHistoryParams = {
48
+ /** Mentor unique ID. */
49
+ mentor?: string;
50
+ /** `YYYY-MM-DD`. */
51
+ start_date?: string;
52
+ /** `YYYY-MM-DD`. */
53
+ end_date?: string;
54
+ /** Comma-separated topic names. */
55
+ topics?: string;
56
+ sentiment?: UserChatHistorySentiment | string;
57
+ page?: number;
58
+ page_size?: number;
59
+ };
60
+ export type GetUserChatHistoryArgs = {
61
+ org: string;
62
+ userId: string;
63
+ params?: UserChatHistoryParams;
64
+ };
65
+ export type GetUserChatHistorySessionArgs = {
66
+ org: string;
67
+ userId: string;
68
+ sessionId: string;
69
+ };
70
+ export type UserChatHistoryFilterParams = {
71
+ mentor_id?: string;
72
+ /** `true` returns monthly date ranges; otherwise weekly. */
73
+ monthly_range?: boolean;
74
+ start_date?: string;
75
+ end_date?: string;
76
+ };
77
+ export type GetUserChatHistoryFilterArgs = {
78
+ org: string;
79
+ userId: string;
80
+ params?: UserChatHistoryFilterParams;
81
+ };
82
+ export type UserChatHistoryReportState = 'pending' | 'running' | 'accumulating' | 'processing' | 'storing' | 'completed' | 'cancelled' | 'error' | 'expired';
83
+ /** States in which a report task can still reach `completed`. */
84
+ export declare const USER_CHAT_HISTORY_REPORT_ACTIVE_STATES: UserChatHistoryReportState[];
85
+ export type UserChatHistoryReportFilters = {
86
+ mentor_id?: string[];
87
+ topic?: string;
88
+ sentiment?: UserChatHistorySentiment | string;
89
+ };
90
+ export type CreateUserChatHistoryReportBody = {
91
+ start_date?: string;
92
+ end_date?: string;
93
+ format?: 'json' | 'csv';
94
+ /** Force creation of a new report even if a completed one exists. */
95
+ force?: boolean;
96
+ filters?: UserChatHistoryReportFilters;
97
+ };
98
+ export type CreateUserChatHistoryReportArgs = {
99
+ org: string;
100
+ userId: string;
101
+ body?: CreateUserChatHistoryReportBody;
102
+ };
103
+ export type UserChatHistoryReportStatus = {
104
+ report_id?: string;
105
+ report_name?: string;
106
+ state?: UserChatHistoryReportState;
107
+ started_on?: string;
108
+ owner?: string;
109
+ /** When the report download expires (only when completed). */
110
+ expires?: string;
111
+ /** Download link for the report when available. */
112
+ url?: string;
113
+ created_at?: string;
114
+ /** Seconds the client should poll before relying on notifications. */
115
+ poll_timeout?: number;
116
+ };
117
+ /** Envelope returned by the create-report and report-status endpoints. */
118
+ export type UserChatHistoryReportResponse = {
119
+ data: UserChatHistoryReportStatus;
120
+ };
121
+ export type UserChatHistoryReportListItem = UserChatHistoryReportStatus & {
122
+ filters?: UserChatHistoryReportFilters;
123
+ start_date?: string | null;
124
+ end_date?: string | null;
125
+ };
126
+ export type UserChatHistoryReportsResponse = {
127
+ reports: UserChatHistoryReportListItem[];
128
+ };
129
+ export type GetUserChatHistoryReportsArgs = {
130
+ org: string;
131
+ userId: string;
132
+ };
133
+ export type GetUserChatHistoryReportStatusArgs = {
134
+ org: string;
135
+ userId: string;
136
+ taskId: string;
137
+ };
@@ -15,6 +15,7 @@ export * from './features/training-documents/api-slice';
15
15
  export * from './features/platform/api-slice';
16
16
  export * from './features/user/api-slice';
17
17
  export * from './features/user/types';
18
+ export * from './features/user/utils';
18
19
  export * from './features/user/api-slice';
19
20
  export * from './features/core/api-slice';
20
21
  export * from './features/core/constants';
@@ -135,6 +136,9 @@ export * from './features/evaluations/types';
135
136
  export * from './features/watched-groups/api-slice';
136
137
  export * from './features/watched-groups/constants';
137
138
  export * from './features/watched-groups/types';
139
+ export * from './features/user-chat-history/api-slice';
140
+ export * from './features/user-chat-history/constants';
141
+ export * from './features/user-chat-history/types';
138
142
  export * from './reducers';
139
143
  export * from './utils';
140
144
  export type { CustomQueryArgs } from './features/utils';