@zeniai/client-epic-state 4.17.10 → 4.17.11
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/entity/accountRecon/accountReconPayload.d.ts +0 -2
- package/lib/entity/accountRecon/accountReconPayload.js +1 -6
- package/lib/entity/accountRecon/accountReconState.d.ts +0 -2
- package/lib/entity/{aiCfo/aiCfoPayload.d.ts → aiController/aiControllerPayload.d.ts} +3 -3
- package/lib/entity/aiController/aiControllerReducer.d.ts +46 -0
- package/lib/entity/{aiCfo/aiCfoReducer.js → aiController/aiControllerReducer.js} +42 -40
- package/lib/entity/aiController/aiControllerSelector.d.ts +14 -0
- package/lib/entity/{aiCfo/aiCfoSelector.js → aiController/aiControllerSelector.js} +6 -6
- package/lib/entity/aiController/aiControllerState.d.ts +88 -0
- package/lib/entity/aiController/aiControllerState.js +49 -0
- package/lib/entity/tenant/clearAllEpic.d.ts +4 -4
- package/lib/entity/tenant/clearAllEpic.js +4 -4
- package/lib/epic.d.ts +7 -7
- package/lib/epic.js +7 -7
- package/lib/index.d.ts +7 -7
- package/lib/index.js +48 -48
- package/lib/reducer.d.ts +6 -6
- package/lib/reducer.js +6 -6
- package/lib/view/{aiCfoView/aiCfoViewPayload.d.ts → aiControllerView/aiControllerViewPayload.d.ts} +2 -2
- package/lib/view/aiControllerView/aiControllerViewReducer.d.ts +73 -0
- package/lib/view/{aiCfoView/aiCfoViewReducer.js → aiControllerView/aiControllerViewReducer.js} +10 -10
- package/lib/view/{aiCfoView/aiCfoViewSelector.d.ts → aiControllerView/aiControllerViewSelector.d.ts} +5 -5
- package/lib/view/{aiCfoView/aiCfoViewSelector.js → aiControllerView/aiControllerViewSelector.js} +6 -6
- package/lib/view/{aiCfoView/aiCfoViewState.d.ts → aiControllerView/aiControllerViewState.d.ts} +3 -3
- package/lib/view/{aiCfoView → aiControllerView}/epics/createSessionAndSubmitEpic.d.ts +2 -2
- package/lib/view/{aiCfoView → aiControllerView}/epics/createSessionAndSubmitEpic.js +9 -9
- package/lib/view/{aiCfoView → aiControllerView}/epics/createSessionEpic.d.ts +2 -2
- package/lib/view/{aiCfoView → aiControllerView}/epics/createSessionEpic.js +8 -8
- package/lib/view/{aiCfoView → aiControllerView}/epics/fetchChatHistoryEpic.d.ts +2 -2
- package/lib/view/{aiCfoView → aiControllerView}/epics/fetchChatHistoryEpic.js +9 -9
- package/lib/view/{aiCfoView → aiControllerView}/epics/fetchChatSessionsForUserEpic.d.ts +2 -2
- package/lib/view/{aiCfoView → aiControllerView}/epics/fetchChatSessionsForUserEpic.js +9 -8
- package/lib/view/{aiCfoView → aiControllerView}/epics/stopSubmitEpic.d.ts +2 -2
- package/lib/view/{aiCfoView → aiControllerView}/epics/stopSubmitEpic.js +11 -11
- package/lib/view/{aiCfoView → aiControllerView}/epics/stopSubmitQuestionEpic.d.ts +2 -2
- package/lib/view/{aiCfoView → aiControllerView}/epics/stopSubmitQuestionEpic.js +8 -8
- package/lib/view/{aiCfoView → aiControllerView}/epics/submitQuestionEpic.d.ts +2 -2
- package/lib/view/{aiCfoView → aiControllerView}/epics/submitQuestionEpic.js +10 -10
- package/lib/view/expenseAutomationView/epics/accountRecon/saveReconciliationReviewEpic.js +0 -2
- package/lib/zeniAPI.d.ts +1 -1
- package/package.json +1 -1
- package/lib/entity/aiCfo/aiCfoReducer.d.ts +0 -45
- package/lib/entity/aiCfo/aiCfoSelector.d.ts +0 -14
- package/lib/entity/aiCfo/aiCfoState.d.ts +0 -88
- package/lib/entity/aiCfo/aiCfoState.js +0 -46
- package/lib/view/aiCfoView/aiCfoViewReducer.d.ts +0 -73
- /package/lib/entity/{aiCfo/aiCfoPayload.js → aiController/aiControllerPayload.js} +0 -0
- /package/lib/view/{aiCfoView/aiCfoViewPayload.js → aiControllerView/aiControllerViewPayload.js} +0 -0
- /package/lib/view/{aiCfoView/aiCfoViewState.js → aiControllerView/aiControllerViewState.js} +0 -0
|
@@ -3,27 +3,27 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.createSessionAndSubmitEpic = void 0;
|
|
4
4
|
const rxjs_1 = require("rxjs");
|
|
5
5
|
const operators_1 = require("rxjs/operators");
|
|
6
|
-
const
|
|
6
|
+
const aiControllerReducer_1 = require("../../../entity/aiController/aiControllerReducer");
|
|
7
7
|
const snackbarReducer_1 = require("../../../entity/snackbar/snackbarReducer");
|
|
8
8
|
const responsePayload_1 = require("../../../responsePayload");
|
|
9
9
|
const zeniDayJS_1 = require("../../../zeniDayJS");
|
|
10
|
-
const
|
|
11
|
-
const createSessionAndSubmitEpic = (actions$, _, zeniAPI) => actions$.pipe((0, operators_1.filter)(
|
|
10
|
+
const aiControllerViewReducer_1 = require("../aiControllerViewReducer");
|
|
11
|
+
const createSessionAndSubmitEpic = (actions$, _, zeniAPI) => actions$.pipe((0, operators_1.filter)(aiControllerViewReducer_1.createSessionAndSubmit.match), (0, operators_1.switchMap)((action) => {
|
|
12
12
|
const { agentId, userId, questionAnswerId, questionId, createdAt, question, } = action.payload;
|
|
13
13
|
const payload = { agent_id: agentId };
|
|
14
14
|
return zeniAPI
|
|
15
|
-
.postAndGetJSON(`${zeniAPI.apiEndPoints.
|
|
15
|
+
.postAndGetJSON(`${zeniAPI.apiEndPoints.aiControllerMicroServiceBaseUrl}/1.0/sessions`, payload)
|
|
16
16
|
.pipe((0, operators_1.mergeMap)((response) => {
|
|
17
17
|
if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
|
|
18
18
|
const sessionId = response.data.chat_session_id;
|
|
19
|
-
return (0, rxjs_1.of)((0,
|
|
19
|
+
return (0, rxjs_1.of)((0, aiControllerReducer_1.setNewSession)({
|
|
20
20
|
chatSessionId: sessionId,
|
|
21
21
|
userId,
|
|
22
22
|
createdAt: (0, zeniDayJS_1.date)(response.data.created_at),
|
|
23
|
-
}), (0,
|
|
23
|
+
}), (0, aiControllerViewReducer_1.createSessionAndSubmitSuccess)({
|
|
24
24
|
agentId,
|
|
25
25
|
sessionId,
|
|
26
|
-
}), (0,
|
|
26
|
+
}), (0, aiControllerViewReducer_1.submitQuestion)(sessionId, questionAnswerId, userId, questionId, createdAt, question), (0, aiControllerReducer_1.addQuestionPayload)({
|
|
27
27
|
chatSessionId: sessionId,
|
|
28
28
|
questionAnswerId: questionAnswerId,
|
|
29
29
|
question: {
|
|
@@ -39,8 +39,8 @@ const createSessionAndSubmitEpic = (actions$, _, zeniAPI) => actions$.pipe((0, o
|
|
|
39
39
|
messageSection: 'ai_cfo_create_session_and_submit',
|
|
40
40
|
messageText: 'failed',
|
|
41
41
|
type: 'error',
|
|
42
|
-
}), (0,
|
|
42
|
+
}), (0, aiControllerViewReducer_1.createSessionAndSubmitFailure)(response.status));
|
|
43
43
|
}
|
|
44
|
-
}), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0,
|
|
44
|
+
}), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0, aiControllerViewReducer_1.createSessionAndSubmitFailure)((0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', `Create and Submit Session REST API call errored out: ${JSON.stringify(error)}`)))));
|
|
45
45
|
}));
|
|
46
46
|
exports.createSessionAndSubmitEpic = createSessionAndSubmitEpic;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { ActionsObservable, StateObservable } from 'redux-observable';
|
|
2
2
|
import { Observable } from 'rxjs';
|
|
3
|
-
import { setNewSession } from '../../../entity/
|
|
3
|
+
import { setNewSession } from '../../../entity/aiController/aiControllerReducer';
|
|
4
4
|
import { RootState } from '../../../reducer';
|
|
5
5
|
import { ZeniAPI } from '../../../zeniAPI';
|
|
6
|
-
import { createSession, createSessionFailure, createSessionSuccess } from '../
|
|
6
|
+
import { createSession, createSessionFailure, createSessionSuccess } from '../aiControllerViewReducer';
|
|
7
7
|
export type ActionType = ReturnType<typeof createSession> | ReturnType<typeof setNewSession> | ReturnType<typeof createSessionSuccess> | ReturnType<typeof createSessionFailure>;
|
|
8
8
|
export declare const createSessionEpic: (actions$: ActionsObservable<ActionType>, _: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
|
|
@@ -3,29 +3,29 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.createSessionEpic = void 0;
|
|
4
4
|
const rxjs_1 = require("rxjs");
|
|
5
5
|
const operators_1 = require("rxjs/operators");
|
|
6
|
-
const
|
|
6
|
+
const aiControllerReducer_1 = require("../../../entity/aiController/aiControllerReducer");
|
|
7
7
|
const responsePayload_1 = require("../../../responsePayload");
|
|
8
8
|
const zeniDayJS_1 = require("../../../zeniDayJS");
|
|
9
|
-
const
|
|
10
|
-
const createSessionEpic = (actions$, _, zeniAPI) => actions$.pipe((0, operators_1.filter)(
|
|
9
|
+
const aiControllerViewReducer_1 = require("../aiControllerViewReducer");
|
|
10
|
+
const createSessionEpic = (actions$, _, zeniAPI) => actions$.pipe((0, operators_1.filter)(aiControllerViewReducer_1.createSession.match), (0, operators_1.switchMap)((action) => {
|
|
11
11
|
const { agentId, userId } = action.payload;
|
|
12
12
|
const payload = { agent_id: agentId };
|
|
13
13
|
return zeniAPI
|
|
14
|
-
.postAndGetJSON(`${zeniAPI.apiEndPoints.
|
|
14
|
+
.postAndGetJSON(`${zeniAPI.apiEndPoints.aiControllerMicroServiceBaseUrl}/1.0/sessions`, payload)
|
|
15
15
|
.pipe((0, operators_1.mergeMap)((response) => {
|
|
16
16
|
if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
|
|
17
|
-
return (0, rxjs_1.of)((0,
|
|
17
|
+
return (0, rxjs_1.of)((0, aiControllerReducer_1.setNewSession)({
|
|
18
18
|
chatSessionId: response.data.chat_session_id,
|
|
19
19
|
userId,
|
|
20
20
|
createdAt: (0, zeniDayJS_1.date)(response.data.created_at),
|
|
21
|
-
}), (0,
|
|
21
|
+
}), (0, aiControllerViewReducer_1.createSessionSuccess)({
|
|
22
22
|
agentId,
|
|
23
23
|
sessionId: response.data.chat_session_id,
|
|
24
24
|
}));
|
|
25
25
|
}
|
|
26
26
|
else {
|
|
27
|
-
return (0, rxjs_1.of)((0,
|
|
27
|
+
return (0, rxjs_1.of)((0, aiControllerViewReducer_1.createSessionFailure)(response.status));
|
|
28
28
|
}
|
|
29
|
-
}), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0,
|
|
29
|
+
}), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0, aiControllerViewReducer_1.createSessionFailure)((0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', `Create Session REST API call errored out: ${JSON.stringify(error)}`)))));
|
|
30
30
|
}));
|
|
31
31
|
exports.createSessionEpic = createSessionEpic;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { ActionsObservable, StateObservable } from 'redux-observable';
|
|
2
2
|
import { Observable } from 'rxjs';
|
|
3
|
-
import { setChatHistory } from '../../../entity/
|
|
3
|
+
import { setChatHistory } from '../../../entity/aiController/aiControllerReducer';
|
|
4
4
|
import { RootState } from '../../../reducer';
|
|
5
5
|
import { ZeniAPI } from '../../../zeniAPI';
|
|
6
|
-
import { fetchChatHistory, fetchChatHistoryFailure, fetchChatHistorySuccess } from '../
|
|
6
|
+
import { fetchChatHistory, fetchChatHistoryFailure, fetchChatHistorySuccess } from '../aiControllerViewReducer';
|
|
7
7
|
export type ActionType = ReturnType<typeof fetchChatHistory> | ReturnType<typeof setChatHistory> | ReturnType<typeof fetchChatHistorySuccess> | ReturnType<typeof fetchChatHistoryFailure>;
|
|
8
8
|
export declare const fetchChatHistoryEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
|
|
@@ -3,14 +3,14 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.fetchChatHistoryEpic = void 0;
|
|
4
4
|
const rxjs_1 = require("rxjs");
|
|
5
5
|
const operators_1 = require("rxjs/operators");
|
|
6
|
-
const
|
|
6
|
+
const aiControllerReducer_1 = require("../../../entity/aiController/aiControllerReducer");
|
|
7
7
|
const responsePayload_1 = require("../../../responsePayload");
|
|
8
|
-
const
|
|
9
|
-
const fetchChatHistoryEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(
|
|
8
|
+
const aiControllerViewReducer_1 = require("../aiControllerViewReducer");
|
|
9
|
+
const fetchChatHistoryEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(aiControllerViewReducer_1.fetchChatHistory.match), (0, operators_1.mergeMap)((action) => {
|
|
10
10
|
var _a, _b;
|
|
11
11
|
const { chatSessionId, userId } = action.payload;
|
|
12
12
|
const state = state$.value;
|
|
13
|
-
const pageToken = (_b = (_a = state.
|
|
13
|
+
const pageToken = (_b = (_a = state.aiControllerViewState.uiState.chatHistoryNextPageToken[chatSessionId]) === null || _a === void 0 ? void 0 : _a.nextPageToken) !== null && _b !== void 0 ? _b : null;
|
|
14
14
|
const queryParams = new URLSearchParams();
|
|
15
15
|
queryParams.append('page_size', '20');
|
|
16
16
|
queryParams.append('chat_session_id', chatSessionId);
|
|
@@ -19,26 +19,26 @@ const fetchChatHistoryEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, op
|
|
|
19
19
|
queryParams.append('page_token', pageToken);
|
|
20
20
|
}
|
|
21
21
|
return zeniAPI
|
|
22
|
-
.getJSON(`${zeniAPI.apiEndPoints.
|
|
22
|
+
.getJSON(`${zeniAPI.apiEndPoints.aiControllerMicroServiceBaseUrl}/1.0/history?${queryParams.toString()}`)
|
|
23
23
|
.pipe((0, operators_1.mergeMap)((response) => {
|
|
24
24
|
if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
|
|
25
25
|
const isPaginationComplete = response.data.next_page_token == null;
|
|
26
|
-
return (0, rxjs_1.of)((0,
|
|
26
|
+
return (0, rxjs_1.of)((0, aiControllerReducer_1.setChatHistory)({
|
|
27
27
|
chatSessionId,
|
|
28
28
|
history: response.data.messages,
|
|
29
29
|
isPaginationComplete,
|
|
30
|
-
}), (0,
|
|
30
|
+
}), (0, aiControllerViewReducer_1.fetchChatHistorySuccess)({
|
|
31
31
|
chatSessionId,
|
|
32
32
|
nextPageToken: response.data.next_page_token,
|
|
33
33
|
}));
|
|
34
34
|
}
|
|
35
35
|
else {
|
|
36
|
-
return (0, rxjs_1.of)((0,
|
|
36
|
+
return (0, rxjs_1.of)((0, aiControllerViewReducer_1.fetchChatHistoryFailure)({
|
|
37
37
|
chatSessionId,
|
|
38
38
|
error: response.status,
|
|
39
39
|
}));
|
|
40
40
|
}
|
|
41
|
-
}), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0,
|
|
41
|
+
}), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0, aiControllerViewReducer_1.fetchChatHistoryFailure)({
|
|
42
42
|
chatSessionId,
|
|
43
43
|
error: (0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Fetch Chat History REST API call errored out' +
|
|
44
44
|
JSON.stringify(error)),
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { ActionsObservable, StateObservable } from 'redux-observable';
|
|
2
2
|
import { Observable } from 'rxjs';
|
|
3
|
-
import { setSessions } from '../../../entity/
|
|
3
|
+
import { setSessions } from '../../../entity/aiController/aiControllerReducer';
|
|
4
4
|
import { RootState } from '../../../reducer';
|
|
5
5
|
import { ZeniAPI } from '../../../zeniAPI';
|
|
6
|
-
import { fetchChatSessionsForUser, fetchChatSessionsForUserFailure, fetchChatSessionsForUserSuccess } from '../
|
|
6
|
+
import { fetchChatSessionsForUser, fetchChatSessionsForUserFailure, fetchChatSessionsForUserSuccess } from '../aiControllerViewReducer';
|
|
7
7
|
export type ActionType = ReturnType<typeof fetchChatSessionsForUser> | ReturnType<typeof setSessions> | ReturnType<typeof fetchChatSessionsForUserSuccess> | ReturnType<typeof fetchChatSessionsForUserFailure>;
|
|
8
8
|
export declare const fetchChatSessionsForUserEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
|
|
@@ -3,33 +3,34 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.fetchChatSessionsForUserEpic = void 0;
|
|
4
4
|
const rxjs_1 = require("rxjs");
|
|
5
5
|
const operators_1 = require("rxjs/operators");
|
|
6
|
-
const
|
|
6
|
+
const aiControllerReducer_1 = require("../../../entity/aiController/aiControllerReducer");
|
|
7
7
|
const responsePayload_1 = require("../../../responsePayload");
|
|
8
|
-
const
|
|
9
|
-
const fetchChatSessionsForUserEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(
|
|
8
|
+
const aiControllerViewReducer_1 = require("../aiControllerViewReducer");
|
|
9
|
+
const fetchChatSessionsForUserEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(aiControllerViewReducer_1.fetchChatSessionsForUser.match), (0, operators_1.switchMap)(() => {
|
|
10
10
|
var _a;
|
|
11
11
|
const state = state$.value;
|
|
12
|
-
const pageToken = (_a = state.
|
|
12
|
+
const pageToken = (_a = state.aiControllerViewState.uiState.chatSessionsNextPageToken
|
|
13
|
+
.nextPageToken) !== null && _a !== void 0 ? _a : null;
|
|
13
14
|
const queryParams = new URLSearchParams();
|
|
14
15
|
queryParams.append('page_size', '50');
|
|
15
16
|
if (pageToken != null) {
|
|
16
17
|
queryParams.append('page_token', pageToken);
|
|
17
18
|
}
|
|
18
19
|
return zeniAPI
|
|
19
|
-
.getJSON(`${zeniAPI.apiEndPoints.
|
|
20
|
+
.getJSON(`${zeniAPI.apiEndPoints.aiControllerMicroServiceBaseUrl}/1.0/sessions?${queryParams.toString()}`)
|
|
20
21
|
.pipe((0, operators_1.mergeMap)((response) => {
|
|
21
22
|
if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
|
|
22
23
|
// Filter out empty sessions that don't have a summary
|
|
23
24
|
const sessions = response.data.sessions.filter((session) => Boolean(session.chat_session_summary) === true);
|
|
24
|
-
return (0, rxjs_1.of)((0,
|
|
25
|
+
return (0, rxjs_1.of)((0, aiControllerReducer_1.setSessions)(sessions), (0, aiControllerViewReducer_1.fetchChatSessionsForUserSuccess)({
|
|
25
26
|
sessions,
|
|
26
27
|
nextPageToken: response.data.next_page_token,
|
|
27
28
|
}));
|
|
28
29
|
}
|
|
29
30
|
else {
|
|
30
|
-
return (0, rxjs_1.of)((0,
|
|
31
|
+
return (0, rxjs_1.of)((0, aiControllerViewReducer_1.fetchChatSessionsForUserFailure)(response.status));
|
|
31
32
|
}
|
|
32
|
-
}), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0,
|
|
33
|
+
}), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0, aiControllerViewReducer_1.fetchChatSessionsForUserFailure)((0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Fetch Chat Sessions for User REST API call errored out' +
|
|
33
34
|
JSON.stringify(error))))));
|
|
34
35
|
}));
|
|
35
36
|
exports.fetchChatSessionsForUserEpic = fetchChatSessionsForUserEpic;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { ActionsObservable, StateObservable } from 'redux-observable';
|
|
2
2
|
import { Observable } from 'rxjs';
|
|
3
|
-
import { deleteQuestion } from '../../../entity/
|
|
3
|
+
import { deleteQuestion } from '../../../entity/aiController/aiControllerReducer';
|
|
4
4
|
import { RootState } from '../../../reducer';
|
|
5
5
|
import { ZeniAPI } from '../../../zeniAPI';
|
|
6
|
-
import { stopSubmit, stopSubmitFailure, stopSubmitSuccess } from '../
|
|
6
|
+
import { stopSubmit, stopSubmitFailure, stopSubmitSuccess } from '../aiControllerViewReducer';
|
|
7
7
|
export type ActionType = ReturnType<typeof stopSubmit> | ReturnType<typeof deleteQuestion> | ReturnType<typeof stopSubmitSuccess> | ReturnType<typeof stopSubmitFailure>;
|
|
8
8
|
export declare const stopSubmitEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
|
|
@@ -3,16 +3,16 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.stopSubmitEpic = void 0;
|
|
4
4
|
const rxjs_1 = require("rxjs");
|
|
5
5
|
const operators_1 = require("rxjs/operators");
|
|
6
|
-
const
|
|
6
|
+
const aiControllerReducer_1 = require("../../../entity/aiController/aiControllerReducer");
|
|
7
7
|
const responsePayload_1 = require("../../../responsePayload");
|
|
8
|
-
const
|
|
9
|
-
const stopSubmitEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(
|
|
8
|
+
const aiControllerViewReducer_1 = require("../aiControllerViewReducer");
|
|
9
|
+
const stopSubmitEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(aiControllerViewReducer_1.stopSubmit.match), (0, operators_1.switchMap)((action) => {
|
|
10
10
|
const { chatSessionId } = action.payload;
|
|
11
11
|
// Find the questionId: last Q/A with no responses
|
|
12
12
|
const state = state$.value;
|
|
13
|
-
const session = state.
|
|
13
|
+
const session = state.aiControllerState.aiControllerByChatSessionId[chatSessionId];
|
|
14
14
|
if (session == null) {
|
|
15
|
-
return (0, rxjs_1.of)((0,
|
|
15
|
+
return (0, rxjs_1.of)((0, aiControllerViewReducer_1.stopSubmitFailure)({
|
|
16
16
|
chatSessionId,
|
|
17
17
|
error: (0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Session not found'),
|
|
18
18
|
}));
|
|
@@ -24,29 +24,29 @@ const stopSubmitEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operator
|
|
|
24
24
|
questionAnswer.responses.answer == null);
|
|
25
25
|
const isOnlyQuestionInSession = session.questionAnswers.length <= 1;
|
|
26
26
|
if (!qa) {
|
|
27
|
-
return (0, rxjs_1.of)((0,
|
|
27
|
+
return (0, rxjs_1.of)((0, aiControllerViewReducer_1.stopSubmitFailure)({
|
|
28
28
|
chatSessionId,
|
|
29
29
|
error: { code: 404, message: 'No pending question found' },
|
|
30
30
|
}));
|
|
31
31
|
}
|
|
32
32
|
const questionId = qa.question.messageId;
|
|
33
33
|
return zeniAPI
|
|
34
|
-
.deleteAndGetJSON(`${zeniAPI.apiEndPoints.
|
|
34
|
+
.deleteAndGetJSON(`${zeniAPI.apiEndPoints.aiControllerMicroServiceBaseUrl}/1.0/messages/${questionId}`)
|
|
35
35
|
.pipe((0, operators_1.mergeMap)((response) => {
|
|
36
36
|
if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
|
|
37
|
-
return (0, rxjs_1.of)((0,
|
|
37
|
+
return (0, rxjs_1.of)((0, aiControllerReducer_1.deleteQuestion)({
|
|
38
38
|
chatSessionId,
|
|
39
39
|
questionAnswerId: qa.questionAnswerId,
|
|
40
|
-
}), (0,
|
|
40
|
+
}), (0, aiControllerViewReducer_1.stopSubmitSuccess)({
|
|
41
41
|
chatSessionId,
|
|
42
42
|
question: qa.question.questionText,
|
|
43
43
|
isOnlyQuestionInSession,
|
|
44
44
|
}));
|
|
45
45
|
}
|
|
46
46
|
else {
|
|
47
|
-
return (0, rxjs_1.of)((0,
|
|
47
|
+
return (0, rxjs_1.of)((0, aiControllerViewReducer_1.stopSubmitFailure)({ chatSessionId, error: response.status }));
|
|
48
48
|
}
|
|
49
|
-
}), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0,
|
|
49
|
+
}), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0, aiControllerViewReducer_1.stopSubmitFailure)({
|
|
50
50
|
chatSessionId,
|
|
51
51
|
error: (0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Stop submit REST API call errored out' +
|
|
52
52
|
JSON.stringify(error)),
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ActionsObservable, StateObservable } from 'redux-observable';
|
|
2
2
|
import { Observable } from 'rxjs';
|
|
3
|
-
import { deleteQuestion } from '../../../entity/
|
|
3
|
+
import { deleteQuestion } from '../../../entity/aiController/aiControllerReducer';
|
|
4
4
|
import { RootState } from '../../../reducer';
|
|
5
|
-
import { stopSubmitQuestion, stopSubmitQuestionFailure, stopSubmitQuestionSuccess } from '../
|
|
5
|
+
import { stopSubmitQuestion, stopSubmitQuestionFailure, stopSubmitQuestionSuccess } from '../aiControllerViewReducer';
|
|
6
6
|
export type ActionType = ReturnType<typeof stopSubmitQuestion> | ReturnType<typeof deleteQuestion> | ReturnType<typeof stopSubmitQuestionSuccess> | ReturnType<typeof stopSubmitQuestionFailure>;
|
|
7
7
|
export declare const stopSubmitQuestionEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>) => Observable<ActionType>;
|
|
@@ -3,16 +3,16 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.stopSubmitQuestionEpic = void 0;
|
|
4
4
|
const rxjs_1 = require("rxjs");
|
|
5
5
|
const operators_1 = require("rxjs/operators");
|
|
6
|
-
const
|
|
6
|
+
const aiControllerReducer_1 = require("../../../entity/aiController/aiControllerReducer");
|
|
7
7
|
const responsePayload_1 = require("../../../responsePayload");
|
|
8
|
-
const
|
|
9
|
-
const stopSubmitQuestionEpic = (actions$, state$) => actions$.pipe((0, operators_1.filter)(
|
|
8
|
+
const aiControllerViewReducer_1 = require("../aiControllerViewReducer");
|
|
9
|
+
const stopSubmitQuestionEpic = (actions$, state$) => actions$.pipe((0, operators_1.filter)(aiControllerViewReducer_1.stopSubmitQuestion.match), (0, operators_1.delay)(500), (0, operators_1.switchMap)((action) => {
|
|
10
10
|
const { chatSessionId } = action.payload;
|
|
11
11
|
// Find the questionId: last Q/A with no responses
|
|
12
12
|
const state = state$.value;
|
|
13
|
-
const session = state.
|
|
13
|
+
const session = state.aiControllerState.aiControllerByChatSessionId[chatSessionId];
|
|
14
14
|
if (session == null) {
|
|
15
|
-
return (0, rxjs_1.of)((0,
|
|
15
|
+
return (0, rxjs_1.of)((0, aiControllerViewReducer_1.stopSubmitQuestionFailure)({
|
|
16
16
|
chatSessionId,
|
|
17
17
|
error: (0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Session not found'),
|
|
18
18
|
}));
|
|
@@ -24,15 +24,15 @@ const stopSubmitQuestionEpic = (actions$, state$) => actions$.pipe((0, operators
|
|
|
24
24
|
questionAnswer.responses.answer == null);
|
|
25
25
|
const isOnlyQuestionInSession = session.questionAnswers.length <= 1;
|
|
26
26
|
if (!qa) {
|
|
27
|
-
return (0, rxjs_1.of)((0,
|
|
27
|
+
return (0, rxjs_1.of)((0, aiControllerViewReducer_1.stopSubmitQuestionFailure)({
|
|
28
28
|
chatSessionId,
|
|
29
29
|
error: { code: 404, message: 'No pending question found' },
|
|
30
30
|
}));
|
|
31
31
|
}
|
|
32
|
-
return (0, rxjs_1.of)((0,
|
|
32
|
+
return (0, rxjs_1.of)((0, aiControllerReducer_1.deleteQuestion)({
|
|
33
33
|
chatSessionId,
|
|
34
34
|
questionAnswerId: qa.questionAnswerId,
|
|
35
|
-
}), (0,
|
|
35
|
+
}), (0, aiControllerViewReducer_1.stopSubmitQuestionSuccess)({
|
|
36
36
|
chatSessionId,
|
|
37
37
|
question: qa.question.questionText,
|
|
38
38
|
isOnlyQuestionInSession,
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { ActionsObservable, StateObservable } from 'redux-observable';
|
|
2
2
|
import { Observable } from 'rxjs';
|
|
3
|
-
import { upsertOrAddQuestionAnswerPayload } from '../../../entity/
|
|
3
|
+
import { upsertOrAddQuestionAnswerPayload } from '../../../entity/aiController/aiControllerReducer';
|
|
4
4
|
import { RootState } from '../../../reducer';
|
|
5
5
|
import { ZeniAPI } from '../../../zeniAPI';
|
|
6
|
-
import { submitQuestion, submitQuestionFailure, submitQuestionSuccess } from '../
|
|
6
|
+
import { submitQuestion, submitQuestionFailure, submitQuestionSuccess } from '../aiControllerViewReducer';
|
|
7
7
|
export type ActionType = ReturnType<typeof submitQuestion> | ReturnType<typeof submitQuestionSuccess> | ReturnType<typeof submitQuestionFailure> | ReturnType<typeof upsertOrAddQuestionAnswerPayload>;
|
|
8
8
|
export declare const submitQuestionEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
|
|
@@ -3,24 +3,24 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.submitQuestionEpic = void 0;
|
|
4
4
|
const rxjs_1 = require("rxjs");
|
|
5
5
|
const operators_1 = require("rxjs/operators");
|
|
6
|
-
const
|
|
6
|
+
const aiControllerReducer_1 = require("../../../entity/aiController/aiControllerReducer");
|
|
7
7
|
const responsePayload_1 = require("../../../responsePayload");
|
|
8
|
-
const
|
|
9
|
-
const submitQuestionEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(
|
|
8
|
+
const aiControllerViewReducer_1 = require("../aiControllerViewReducer");
|
|
9
|
+
const submitQuestionEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(aiControllerViewReducer_1.submitQuestion.match), (0, operators_1.mergeMap)((action) => {
|
|
10
10
|
const { questionAnswerId, userId, sessionId, questionId, createdAt, question, } = action.payload;
|
|
11
|
-
const {
|
|
12
|
-
const { uiState } =
|
|
11
|
+
const { aiControllerViewState } = state$.value;
|
|
12
|
+
const { uiState } = aiControllerViewState;
|
|
13
13
|
const agentId = uiState.agentId;
|
|
14
14
|
const payload = { chat_session_id: sessionId, message: question };
|
|
15
15
|
if (agentId == null || Boolean(question) == false) {
|
|
16
16
|
throw new Error('Invalid State');
|
|
17
17
|
}
|
|
18
18
|
return zeniAPI
|
|
19
|
-
.postAndGetJSON(`${zeniAPI.apiEndPoints.
|
|
19
|
+
.postAndGetJSON(`${zeniAPI.apiEndPoints.aiControllerMicroServiceBaseUrl}/1.0/agents/${agentId}`, payload)
|
|
20
20
|
.pipe((0, operators_1.mergeMap)((response) => {
|
|
21
21
|
if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
|
|
22
22
|
const actions = [];
|
|
23
|
-
actions.push((0,
|
|
23
|
+
actions.push((0, aiControllerReducer_1.upsertOrAddQuestionAnswerPayload)({
|
|
24
24
|
chatSessionId: sessionId,
|
|
25
25
|
questionAnswerId: questionAnswerId,
|
|
26
26
|
question: {
|
|
@@ -31,16 +31,16 @@ const submitQuestionEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, oper
|
|
|
31
31
|
answerPayload: response.data,
|
|
32
32
|
userId,
|
|
33
33
|
insertQuestionAnswer: false, // Don't insert the Q/A here after stopSubmitSuccess
|
|
34
|
-
}), (0,
|
|
34
|
+
}), (0, aiControllerViewReducer_1.submitQuestionSuccess)(sessionId));
|
|
35
35
|
return (0, rxjs_1.of)(...actions);
|
|
36
36
|
}
|
|
37
37
|
else {
|
|
38
|
-
return (0, rxjs_1.of)((0,
|
|
38
|
+
return (0, rxjs_1.of)((0, aiControllerViewReducer_1.submitQuestionFailure)({
|
|
39
39
|
sessionId,
|
|
40
40
|
error: response.status,
|
|
41
41
|
}));
|
|
42
42
|
}
|
|
43
|
-
}), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0,
|
|
43
|
+
}), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0, aiControllerViewReducer_1.submitQuestionFailure)({
|
|
44
44
|
sessionId,
|
|
45
45
|
error: (0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Submit question REST API call errored out' +
|
|
46
46
|
JSON.stringify(error)),
|
|
@@ -62,8 +62,6 @@ const saveReconciliationReviewEpic = (actions$, state$, zeniAPI) => actions$.pip
|
|
|
62
62
|
break;
|
|
63
63
|
}
|
|
64
64
|
}
|
|
65
|
-
payload = Object.assign(Object.assign({}, payload), { is_recommendation_operation_selected: queryParam.review_action ===
|
|
66
|
-
(updatedTransaction === null || updatedTransaction === void 0 ? void 0 : updatedTransaction.recommendedAction.action) });
|
|
67
65
|
const messageSection = getToastMessageSection(updatedTransaction);
|
|
68
66
|
return zeniAPI
|
|
69
67
|
.postAndGetJSON(`${zeniAPI.apiEndPoints.reconciliationMicroServiceBaseUrl}/1.0/reconciliation/review?query=${encodeURIComponent(JSON.stringify(queryParam))}`, payload)
|
package/lib/zeniAPI.d.ts
CHANGED
|
@@ -19,7 +19,7 @@ export interface RESTAPIEndpoints {
|
|
|
19
19
|
readonly taskMicroServiceBaseUrl: string;
|
|
20
20
|
readonly notificationMicroServiceBaseUrl: string;
|
|
21
21
|
readonly reconciliationMicroServiceBaseUrl: string;
|
|
22
|
-
readonly
|
|
22
|
+
readonly aiControllerMicroServiceBaseUrl: string;
|
|
23
23
|
readonly agentPerfBaseUrl: string;
|
|
24
24
|
}
|
|
25
25
|
export interface ZeniAPI<ResponseType = FetchResponse> {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zeniai/client-epic-state",
|
|
3
|
-
"version": "4.17.
|
|
3
|
+
"version": "4.17.11",
|
|
4
4
|
"description": "Shared module between Web & Mobile containing required abstractions for state management, async network communication. ",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "lib/index.d.ts",
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import { ID } from '../../commonStateTypes/common';
|
|
2
|
-
import { ZeniDate } from '../../zeniDayJS';
|
|
3
|
-
import { AiCfoAnswerPayload, AiCfoVisualizationPayload, ChatSessionPayload, MessagePayload } from './aiCfoPayload';
|
|
4
|
-
import { AiCfoState, AiCfoVisualization } from './aiCfoState';
|
|
5
|
-
export declare const initialAiCfoState: AiCfoState;
|
|
6
|
-
export declare const toAiCfoVisualization: (visualization: AiCfoVisualizationPayload) => AiCfoVisualization | undefined;
|
|
7
|
-
export declare const setNewSession: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
8
|
-
chatSessionId: ID;
|
|
9
|
-
userId: ID;
|
|
10
|
-
createdAt: ZeniDate;
|
|
11
|
-
}, "aiCfo/setNewSession">, clearSession: import("@reduxjs/toolkit").ActionCreatorWithPayload<string, "aiCfo/clearSession">, setSessions: import("@reduxjs/toolkit").ActionCreatorWithPayload<ChatSessionPayload[], "aiCfo/setSessions">, setChatHistory: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
12
|
-
chatSessionId: ID;
|
|
13
|
-
history: MessagePayload[];
|
|
14
|
-
isPaginationComplete?: boolean;
|
|
15
|
-
}, "aiCfo/setChatHistory">, upsertAnswerPayload: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
16
|
-
chatSessionId: ID;
|
|
17
|
-
answerPayload: AiCfoAnswerPayload;
|
|
18
|
-
userId: ID;
|
|
19
|
-
questionAnswerId?: ID;
|
|
20
|
-
}, "aiCfo/upsertAnswerPayload">, upsertOrAddQuestionAnswerPayload: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
21
|
-
chatSessionId: ID;
|
|
22
|
-
questionAnswerId: ID;
|
|
23
|
-
question: {
|
|
24
|
-
questionId: ID;
|
|
25
|
-
text: string;
|
|
26
|
-
createdAt: ZeniDate;
|
|
27
|
-
};
|
|
28
|
-
answerPayload: AiCfoAnswerPayload;
|
|
29
|
-
userId: ID;
|
|
30
|
-
insertQuestionAnswer?: boolean;
|
|
31
|
-
}, "aiCfo/upsertOrAddQuestionAnswerPayload">, addQuestionPayload: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
32
|
-
chatSessionId: ID;
|
|
33
|
-
questionAnswerId: ID;
|
|
34
|
-
question: {
|
|
35
|
-
questionId: ID;
|
|
36
|
-
text: string;
|
|
37
|
-
createdAt: ZeniDate;
|
|
38
|
-
};
|
|
39
|
-
userId: ID;
|
|
40
|
-
}, "aiCfo/addQuestionPayload">, clearAiCfo: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"aiCfo/clearAiCfo">, deleteQuestion: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
41
|
-
chatSessionId: ID;
|
|
42
|
-
questionAnswerId: ID;
|
|
43
|
-
}, "aiCfo/deleteQuestion">;
|
|
44
|
-
declare const _default: import("redux").Reducer<AiCfoState>;
|
|
45
|
-
export default _default;
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { ID } from '../../commonStateTypes/common';
|
|
2
|
-
import { AiCfoQuestionWithAnswer, AiCfoState } from './aiCfoState';
|
|
3
|
-
import { ChatSession } from './aiCfoState';
|
|
4
|
-
export declare function getAllQuestionAnswersForChatSession(state: AiCfoState, chatSessionId: ID): AiCfoQuestionWithAnswer[];
|
|
5
|
-
export declare function getQuestionAnswerByIdForChatSession(state: AiCfoState, chatSessionId: ID, questionAnswerId: ID): AiCfoQuestionWithAnswer | undefined;
|
|
6
|
-
export declare function getAllQuestionsForChatSession(state: AiCfoState, chatSessionId: ID): string[];
|
|
7
|
-
export interface AiCfoSelectorView {
|
|
8
|
-
allSessionsWithOrderedQuestionAnswers: ChatSessionWithOrderedQuestionAnswers[];
|
|
9
|
-
}
|
|
10
|
-
export interface ChatSessionWithOrderedQuestionAnswers {
|
|
11
|
-
chatSession: ChatSession;
|
|
12
|
-
questionAnswers: AiCfoQuestionWithAnswer[];
|
|
13
|
-
}
|
|
14
|
-
export declare function getAiCfoSelectorView(state: AiCfoState): AiCfoSelectorView;
|
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
import { ID } from '../../commonStateTypes/common';
|
|
2
|
-
import { ZeniDate } from '../../zeniDayJS';
|
|
3
|
-
export interface AiCfoAnswerParagraph {
|
|
4
|
-
text: string;
|
|
5
|
-
orderedList?: Array<{
|
|
6
|
-
text: string;
|
|
7
|
-
subText?: string;
|
|
8
|
-
unorderedList?: string[];
|
|
9
|
-
}>;
|
|
10
|
-
}
|
|
11
|
-
export declare const ALL_AI_CFO_CHARTS_TYPES: readonly ["bar_chart", "pie_chart", "line_chart"];
|
|
12
|
-
export declare const ALL_AI_CFO_VISUALIZATION_TYPES: readonly ["bar_chart", "pie_chart", "line_chart", "table"];
|
|
13
|
-
export declare const toAiCfoVisualizationType: (v: string) => "bar_chart" | "pie_chart" | "line_chart" | "table";
|
|
14
|
-
export declare const toAiCfoVisualizationTypeStrict: (v: string) => "bar_chart" | "pie_chart" | "line_chart" | "table" | undefined;
|
|
15
|
-
export type AiCfoVisualizationType = ReturnType<typeof toAiCfoVisualizationType>;
|
|
16
|
-
export declare const toAiCfoChartType: (v: string) => "bar_chart" | "pie_chart" | "line_chart";
|
|
17
|
-
export declare const toAiCfoChartTypeStrict: (v: string) => "bar_chart" | "pie_chart" | "line_chart" | undefined;
|
|
18
|
-
export type AiCfoChartType = ReturnType<typeof toAiCfoChartType>;
|
|
19
|
-
export declare const ALL_AI_CFO_ANSWER_STATE_TYPES: readonly ["complete", "partial"];
|
|
20
|
-
export declare const ALL_AI_CFO_ANSWER_RESPONSE_TYPES: readonly ["analysis", "answer", "reasoning", "thought"];
|
|
21
|
-
export declare const toAiCfoAnswerStateType: (v: string) => "complete" | "partial";
|
|
22
|
-
export declare const toAiCfoAnswerResponseType: (v: string) => "analysis" | "answer" | "reasoning" | "thought";
|
|
23
|
-
export declare const toAiCfoAnswerStateTypeStrict: (v: string) => "complete" | "partial" | undefined;
|
|
24
|
-
export declare const toAiCfoAnswerResponseTypeStrict: (v: string) => "analysis" | "answer" | "reasoning" | "thought" | undefined;
|
|
25
|
-
export type AiCfoAnswerStateType = ReturnType<typeof toAiCfoAnswerStateType>;
|
|
26
|
-
export type AiCfoAnswerResponseType = ReturnType<typeof toAiCfoAnswerResponseType>;
|
|
27
|
-
export interface TableVisualization {
|
|
28
|
-
rows: string[][];
|
|
29
|
-
columns: string[];
|
|
30
|
-
}
|
|
31
|
-
export interface ChartVisualization {
|
|
32
|
-
values: Array<Record<string, string | number>>;
|
|
33
|
-
x: string;
|
|
34
|
-
y: string[];
|
|
35
|
-
lines?: string[];
|
|
36
|
-
}
|
|
37
|
-
export interface AiCfoVisualization {
|
|
38
|
-
type: AiCfoVisualizationType;
|
|
39
|
-
data: TableVisualization | ChartVisualization;
|
|
40
|
-
}
|
|
41
|
-
export declare const toMessageSender: (v: string) => "user" | "agent";
|
|
42
|
-
export declare const toMessageType: (v: string) => "plain_text" | "json";
|
|
43
|
-
export declare const toMessageSenderStrict: (v: string) => "user" | "agent" | undefined;
|
|
44
|
-
export declare const toMessageTypeStrict: (v: string) => "plain_text" | "json" | undefined;
|
|
45
|
-
export type MessageSender = ReturnType<typeof toMessageSender>;
|
|
46
|
-
export type MessageType = ReturnType<typeof toMessageType>;
|
|
47
|
-
export interface ResponseBlockBase {
|
|
48
|
-
messageId: ID;
|
|
49
|
-
state: AiCfoAnswerStateType;
|
|
50
|
-
createdAt: ZeniDate;
|
|
51
|
-
chatSessionId: ID;
|
|
52
|
-
userId: ID;
|
|
53
|
-
sender: MessageSender;
|
|
54
|
-
}
|
|
55
|
-
export interface AnswerContentBlockBase {
|
|
56
|
-
text: string;
|
|
57
|
-
followUpQuestions: string[];
|
|
58
|
-
assumptions: string;
|
|
59
|
-
insights: string;
|
|
60
|
-
summarizedTitle?: string;
|
|
61
|
-
visualization?: AiCfoVisualization;
|
|
62
|
-
}
|
|
63
|
-
export interface QuestionContentBlockBase extends ResponseBlockBase {
|
|
64
|
-
questionText: string;
|
|
65
|
-
}
|
|
66
|
-
export interface ResponseBlockType extends ResponseBlockBase {
|
|
67
|
-
content: AnswerContentBlockBase;
|
|
68
|
-
type: AiCfoAnswerResponseType;
|
|
69
|
-
}
|
|
70
|
-
export interface AiCfoQuestionWithAnswer {
|
|
71
|
-
questionAnswerId: ID;
|
|
72
|
-
question: QuestionContentBlockBase;
|
|
73
|
-
responses: Partial<Record<AiCfoAnswerResponseType, ResponseBlockType>>;
|
|
74
|
-
}
|
|
75
|
-
export interface ChatSession {
|
|
76
|
-
chatSessionId: ID;
|
|
77
|
-
userId: ID;
|
|
78
|
-
createdAt: ZeniDate;
|
|
79
|
-
chatSessionSummary?: string;
|
|
80
|
-
}
|
|
81
|
-
export interface ChatSessionWithMessages {
|
|
82
|
-
chatSession: ChatSession;
|
|
83
|
-
questionAnswers: AiCfoQuestionWithAnswer[];
|
|
84
|
-
}
|
|
85
|
-
export interface AiCfoState {
|
|
86
|
-
aiCfoByChatSessionId: Record<ID, ChatSessionWithMessages>;
|
|
87
|
-
partialQuestionAnswers: Record<ID, AiCfoQuestionWithAnswer | undefined>;
|
|
88
|
-
}
|