@zeniai/client-epic-state 4.17.16 → 4.17.18
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 -10
- package/lib/entity/aiController/aiControllerReducer.d.ts +46 -0
- package/lib/entity/{aiCfo/aiCfoReducer.js → aiController/aiControllerReducer.js} +45 -53
- 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 +8 -10
- package/lib/epic.js +8 -10
- package/lib/index.d.ts +13 -15
- package/lib/index.js +74 -83
- 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/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.js +34 -49
- package/lib/view/spendManagement/chargeCards/cashbackDetail/cashbackDetailPayload.d.ts +0 -7
- package/lib/view/spendManagement/chargeCards/cashbackDetail/cashbackDetailReducer.js +0 -11
- package/lib/view/spendManagement/chargeCards/cashbackDetail/cashbackDetailSelector.d.ts +1 -2
- package/lib/view/spendManagement/chargeCards/cashbackDetail/cashbackDetailSelector.js +0 -1
- package/lib/view/spendManagement/chargeCards/cashbackDetail/cashbackDetailState.d.ts +0 -8
- package/lib/view/spendManagement/chargeCards/cashbackDetail/cashbackDetailState.js +1 -7
- package/lib/view/spendManagement/chargeCards/chargeCardDetail/chargeCardDetail.d.ts +0 -19
- package/lib/view/spendManagement/chargeCards/chargeCardDetail/chargeCardDetail.js +1 -33
- package/lib/view/spendManagement/chargeCards/chargeCardDetail/chargeCardDetailPayload.d.ts +0 -13
- package/lib/view/spendManagement/chargeCards/chargeCardDetail/chargeCardDetailReducer.d.ts +2 -11
- package/lib/view/spendManagement/chargeCards/chargeCardDetail/chargeCardDetailReducer.js +2 -18
- package/lib/view/spendManagement/chargeCards/chargeCardDetail/chargeCardDetailSelector.d.ts +1 -2
- package/lib/view/spendManagement/chargeCards/chargeCardDetail/chargeCardDetailSelector.js +1 -2
- package/lib/view/spendManagement/chargeCards/chargeCardList/chargeCardList.d.ts +0 -13
- package/lib/view/spendManagement/chargeCards/chargeCardList/chargeCardList.js +1 -14
- package/lib/view/spendManagement/chargeCards/chargeCardList/chargeCardListPayload.d.ts +0 -14
- package/lib/view/spendManagement/chargeCards/chargeCardList/chargeCardListReducer.d.ts +2 -2
- package/lib/view/spendManagement/chargeCards/chargeCardList/chargeCardListReducer.js +2 -26
- package/lib/view/spendManagement/chargeCards/chargeCardList/chargeCardListSelector.d.ts +3 -17
- package/lib/view/spendManagement/chargeCards/chargeCardList/chargeCardListSelector.js +4 -34
- package/lib/view/spendManagement/zeniAccounts/transferDetail/transferDetailSelector.js +1 -0
- package/lib/view/transactionDetail/transactionDetailLocalDataHelper.js +36 -40
- 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 -107
- package/lib/entity/aiCfo/aiCfoState.js +0 -81
- package/lib/view/aiCfoView/aiCfoViewReducer.d.ts +0 -73
- package/lib/view/spendManagement/chargeCards/chargeCardDetail/fetchChargeCardTransactionStatisticsEpic.d.ts +0 -7
- package/lib/view/spendManagement/chargeCards/chargeCardDetail/fetchChargeCardTransactionStatisticsEpic.js +0 -39
- package/lib/view/spendManagement/chargeCards/chargeCardList/fetchCreditAccountRepaymentEpic.d.ts +0 -7
- package/lib/view/spendManagement/chargeCards/chargeCardList/fetchCreditAccountRepaymentEpic.js +0 -23
- /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
|
@@ -56,8 +56,6 @@ interface RecommendedActionPayload {
|
|
|
56
56
|
recommended_actions: string;
|
|
57
57
|
recommended_action_description: string;
|
|
58
58
|
recommended_transactions: RecommendedReviewTransactionPayload[];
|
|
59
|
-
plaid_confidence_score?: string | null;
|
|
60
|
-
zeni_confidence_score?: number | null;
|
|
61
59
|
}
|
|
62
60
|
export interface TransactionsToReviewPayload {
|
|
63
61
|
amount: number;
|
|
@@ -7,7 +7,7 @@ const zeniDayJS_1 = require("../../zeniDayJS");
|
|
|
7
7
|
const reconciliationTransaction_1 = require("../transaction/stateTypes/reconciliationTransaction");
|
|
8
8
|
const accountReconState_1 = require("./accountReconState");
|
|
9
9
|
const toTransactionsToReview = (payload, currencyPayload) => {
|
|
10
|
-
var _a, _b
|
|
10
|
+
var _a, _b;
|
|
11
11
|
return {
|
|
12
12
|
transactionId: payload.transaction_id,
|
|
13
13
|
transactionDirection: (0, reconciliationTransaction_1.toTransactionDirectionType)(payload.transaction_direction),
|
|
@@ -26,8 +26,6 @@ const toTransactionsToReview = (payload, currencyPayload) => {
|
|
|
26
26
|
: undefined,
|
|
27
27
|
recommendedAction: {
|
|
28
28
|
action: (0, accountReconState_1.toRecommendedActionCodeType)(payload.recommended_action.recommended_actions),
|
|
29
|
-
plaidConfidenceScore: (_c = payload.recommended_action.plaid_confidence_score) !== null && _c !== void 0 ? _c : null,
|
|
30
|
-
zeniConfidenceScore: (_d = payload.recommended_action.zeni_confidence_score) !== null && _d !== void 0 ? _d : null,
|
|
31
29
|
reason: payload.recommended_action.recommended_action_description,
|
|
32
30
|
recommendedTransactions: payload.recommended_action.recommended_transactions.map((transaction) => (0, exports.toRecommendedReviewTransaction)(transaction, currencyPayload)),
|
|
33
31
|
},
|
|
@@ -35,7 +33,6 @@ const toTransactionsToReview = (payload, currencyPayload) => {
|
|
|
35
33
|
};
|
|
36
34
|
exports.toTransactionsToReview = toTransactionsToReview;
|
|
37
35
|
const toTransactionsToReviewPayload = (payload) => {
|
|
38
|
-
var _a, _b;
|
|
39
36
|
return {
|
|
40
37
|
transaction_id: payload.transactionId,
|
|
41
38
|
transaction_direction: (0, reconciliationTransaction_1.toTransactionDirectionType)(payload.transactionDirection),
|
|
@@ -47,8 +44,6 @@ const toTransactionsToReviewPayload = (payload) => {
|
|
|
47
44
|
recommended_actions: (0, accountReconState_1.toRecommendedActionCodeType)(payload.recommendedAction.action),
|
|
48
45
|
recommended_action_description: payload.recommendedAction.reason,
|
|
49
46
|
recommended_transactions: payload.recommendedAction.recommendedTransactions.map((transaction) => (0, exports.toRecommendedReviewTransactionPayload)(transaction)),
|
|
50
|
-
plaid_confidence_score: (_a = payload.recommendedAction.plaidConfidenceScore) !== null && _a !== void 0 ? _a : null,
|
|
51
|
-
zeni_confidence_score: (_b = payload.recommendedAction.zeniConfidenceScore) !== null && _b !== void 0 ? _b : null,
|
|
52
47
|
},
|
|
53
48
|
};
|
|
54
49
|
};
|
|
@@ -78,8 +78,6 @@ export interface RecommendedAction {
|
|
|
78
78
|
action: RecommendedActionCodeType;
|
|
79
79
|
reason: string;
|
|
80
80
|
recommendedTransactions: RecommendedReviewTransaction[];
|
|
81
|
-
plaidConfidenceScore: string | null;
|
|
82
|
-
zeniConfidenceScore: number | null;
|
|
83
81
|
}
|
|
84
82
|
export interface RecommendedReviewTransaction {
|
|
85
83
|
confidenceScore: number;
|
|
@@ -3,12 +3,6 @@ export interface TableVisualizationPayload {
|
|
|
3
3
|
values: Array<Record<string, string>>;
|
|
4
4
|
columns: string[];
|
|
5
5
|
}
|
|
6
|
-
export interface YFormatPayload {
|
|
7
|
-
type: string;
|
|
8
|
-
unit: string;
|
|
9
|
-
scale: string;
|
|
10
|
-
symbol?: string;
|
|
11
|
-
}
|
|
12
6
|
export interface ChartVisualizationPayload {
|
|
13
7
|
values: Array<Record<string, string | number>>;
|
|
14
8
|
x: string;
|
|
@@ -17,18 +11,17 @@ export interface ChartVisualizationPayload {
|
|
|
17
11
|
* We will normalize it to string[] in state.
|
|
18
12
|
*/
|
|
19
13
|
y: string | string[];
|
|
20
|
-
y_format?: YFormatPayload;
|
|
21
14
|
lines?: string[] | null;
|
|
22
15
|
}
|
|
23
|
-
export interface
|
|
16
|
+
export interface AIControllerVisualizationPayload {
|
|
24
17
|
type: string | null;
|
|
25
18
|
data: TableVisualizationPayload | ChartVisualizationPayload | null;
|
|
26
19
|
}
|
|
27
|
-
export interface
|
|
20
|
+
export interface AIControllerAnswerPayload {
|
|
28
21
|
text: string;
|
|
29
22
|
state: string;
|
|
30
23
|
type: string;
|
|
31
|
-
visualization:
|
|
24
|
+
visualization: AIControllerVisualizationPayload | null;
|
|
32
25
|
metadata: Record<string, string>;
|
|
33
26
|
assumptions: string | null;
|
|
34
27
|
insights: string | null;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { ID } from '../../commonStateTypes/common';
|
|
2
|
+
import { ZeniDate } from '../../zeniDayJS';
|
|
3
|
+
import { AIControllerVisualizationPayload, ChatSessionPayload } from './aiControllerPayload';
|
|
4
|
+
import { AIControllerAnswerPayload, MessagePayload } from './aiControllerPayload';
|
|
5
|
+
import { AIControllerState, AIControllerVisualization } from './aiControllerState';
|
|
6
|
+
export declare const initialAIControllerState: AIControllerState;
|
|
7
|
+
export declare const toAIControllerVisualization: (visualization: AIControllerVisualizationPayload) => AIControllerVisualization | undefined;
|
|
8
|
+
export declare const setNewSession: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
9
|
+
chatSessionId: ID;
|
|
10
|
+
userId: ID;
|
|
11
|
+
createdAt: ZeniDate;
|
|
12
|
+
}, "aiController/setNewSession">, clearSession: import("@reduxjs/toolkit").ActionCreatorWithPayload<string, "aiController/clearSession">, setSessions: import("@reduxjs/toolkit").ActionCreatorWithPayload<ChatSessionPayload[], "aiController/setSessions">, setChatHistory: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
13
|
+
chatSessionId: ID;
|
|
14
|
+
history: MessagePayload[];
|
|
15
|
+
isPaginationComplete?: boolean;
|
|
16
|
+
}, "aiController/setChatHistory">, upsertAnswerPayload: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
17
|
+
chatSessionId: ID;
|
|
18
|
+
answerPayload: AIControllerAnswerPayload;
|
|
19
|
+
userId: ID;
|
|
20
|
+
questionAnswerId?: ID;
|
|
21
|
+
}, "aiController/upsertAnswerPayload">, upsertOrAddQuestionAnswerPayload: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
22
|
+
chatSessionId: ID;
|
|
23
|
+
questionAnswerId: ID;
|
|
24
|
+
question: {
|
|
25
|
+
questionId: ID;
|
|
26
|
+
text: string;
|
|
27
|
+
createdAt: ZeniDate;
|
|
28
|
+
};
|
|
29
|
+
answerPayload: AIControllerAnswerPayload;
|
|
30
|
+
userId: ID;
|
|
31
|
+
insertQuestionAnswer?: boolean;
|
|
32
|
+
}, "aiController/upsertOrAddQuestionAnswerPayload">, addQuestionPayload: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
33
|
+
chatSessionId: ID;
|
|
34
|
+
questionAnswerId: ID;
|
|
35
|
+
question: {
|
|
36
|
+
questionId: ID;
|
|
37
|
+
text: string;
|
|
38
|
+
createdAt: ZeniDate;
|
|
39
|
+
};
|
|
40
|
+
userId: ID;
|
|
41
|
+
}, "aiController/addQuestionPayload">, clearAIController: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"aiController/clearAIController">, deleteQuestion: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
42
|
+
chatSessionId: ID;
|
|
43
|
+
questionAnswerId: ID;
|
|
44
|
+
}, "aiController/deleteQuestion">;
|
|
45
|
+
declare const _default: import("redux").Reducer<AIControllerState>;
|
|
46
|
+
export default _default;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var _a;
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.deleteQuestion = exports.
|
|
4
|
+
exports.deleteQuestion = exports.clearAIController = exports.addQuestionPayload = exports.upsertOrAddQuestionAnswerPayload = exports.upsertAnswerPayload = exports.setChatHistory = exports.setSessions = exports.clearSession = exports.setNewSession = exports.toAIControllerVisualization = exports.initialAIControllerState = void 0;
|
|
5
5
|
const toolkit_1 = require("@reduxjs/toolkit");
|
|
6
6
|
const zeniDayJS_1 = require("../../zeniDayJS");
|
|
7
|
-
const
|
|
8
|
-
exports.
|
|
9
|
-
|
|
7
|
+
const aiControllerState_1 = require("./aiControllerState");
|
|
8
|
+
exports.initialAIControllerState = {
|
|
9
|
+
aiControllerByChatSessionId: {},
|
|
10
10
|
partialQuestionAnswers: {},
|
|
11
11
|
};
|
|
12
12
|
// Utility: Merge two arrays of Q&A pairs, combining responses for the same question
|
|
@@ -32,7 +32,7 @@ function mergeQuestionAnswerPairs(existing, newQAs) {
|
|
|
32
32
|
// Convert back to array and sort by question creation time
|
|
33
33
|
return Array.from(merged.values()).sort((a, b) => a.question.createdAt.valueOf() - b.question.createdAt.valueOf());
|
|
34
34
|
}
|
|
35
|
-
// Utility: Convert chat history (array of MessagePayload) to
|
|
35
|
+
// Utility: Convert chat history (array of MessagePayload) to AIControllerQuestionWithAnswer[]
|
|
36
36
|
function chatHistoryToQA(history) {
|
|
37
37
|
var _a, _b, _c;
|
|
38
38
|
const questionGroups = new Map();
|
|
@@ -58,7 +58,7 @@ function chatHistoryToQA(history) {
|
|
|
58
58
|
group.responses.push(message);
|
|
59
59
|
}
|
|
60
60
|
}
|
|
61
|
-
// Convert groups to
|
|
61
|
+
// Convert groups to AIControllerQuestionWithAnswer
|
|
62
62
|
const questionAnswerPairs = [];
|
|
63
63
|
for (const [messageId, group] of questionGroups.entries()) {
|
|
64
64
|
// Skip groups that don't have a question
|
|
@@ -69,7 +69,7 @@ function chatHistoryToQA(history) {
|
|
|
69
69
|
messageId: group.question.message_id,
|
|
70
70
|
chatSessionId: group.question.chat_session_id,
|
|
71
71
|
userId: group.question.user_id,
|
|
72
|
-
sender: (0,
|
|
72
|
+
sender: (0, aiControllerState_1.toMessageSender)(group.question.sender),
|
|
73
73
|
state: 'complete',
|
|
74
74
|
questionText: group.question.content,
|
|
75
75
|
createdAt: (0, zeniDayJS_1.date)(group.question.created_at),
|
|
@@ -78,7 +78,7 @@ function chatHistoryToQA(history) {
|
|
|
78
78
|
// Process each response for this question
|
|
79
79
|
for (const agentMessage of group.responses) {
|
|
80
80
|
try {
|
|
81
|
-
const parsedAgentMessage = (0,
|
|
81
|
+
const parsedAgentMessage = (0, aiControllerState_1.toMessageType)(agentMessage.message_type) === 'json'
|
|
82
82
|
? JSON.parse(agentMessage.content)
|
|
83
83
|
: {
|
|
84
84
|
text: agentMessage.content,
|
|
@@ -87,21 +87,21 @@ function chatHistoryToQA(history) {
|
|
|
87
87
|
visualization: null,
|
|
88
88
|
follow_up_questions: [],
|
|
89
89
|
};
|
|
90
|
-
const responseType = (0,
|
|
91
|
-
const responseState = (0,
|
|
90
|
+
const responseType = (0, aiControllerState_1.toAIControllerAnswerResponseType)(parsedAgentMessage.type);
|
|
91
|
+
const responseState = (0, aiControllerState_1.toAIControllerAnswerStateType)(parsedAgentMessage.state);
|
|
92
92
|
if (typeof parsedAgentMessage.text === 'string' &&
|
|
93
|
-
|
|
93
|
+
aiControllerState_1.ALL_AI_CONTROLLER_ANSWER_RESPONSE_TYPES.includes(responseType)) {
|
|
94
94
|
responses[responseType] = {
|
|
95
95
|
messageId: agentMessage.message_id,
|
|
96
96
|
chatSessionId: agentMessage.chat_session_id,
|
|
97
97
|
userId: agentMessage.user_id,
|
|
98
|
-
sender: (0,
|
|
98
|
+
sender: (0, aiControllerState_1.toMessageSender)(agentMessage.sender),
|
|
99
99
|
type: responseType,
|
|
100
100
|
state: responseState,
|
|
101
101
|
content: {
|
|
102
102
|
text: parsedAgentMessage.text,
|
|
103
103
|
visualization: parsedAgentMessage.visualization
|
|
104
|
-
? (0, exports.
|
|
104
|
+
? (0, exports.toAIControllerVisualization)(parsedAgentMessage.visualization)
|
|
105
105
|
: undefined,
|
|
106
106
|
followUpQuestions: Array.isArray(parsedAgentMessage.follow_up_questions)
|
|
107
107
|
? parsedAgentMessage.follow_up_questions
|
|
@@ -127,37 +127,27 @@ function chatHistoryToQA(history) {
|
|
|
127
127
|
// Sort by question creation time (oldest first)
|
|
128
128
|
return questionAnswerPairs.sort((a, b) => a.question.createdAt.valueOf() - b.question.createdAt.valueOf());
|
|
129
129
|
}
|
|
130
|
-
const
|
|
130
|
+
const toAIControllerVisualization = (visualization) => {
|
|
131
131
|
var _a;
|
|
132
132
|
if (visualization.type == null || visualization.data == null) {
|
|
133
133
|
return undefined;
|
|
134
134
|
}
|
|
135
135
|
return {
|
|
136
|
-
type: (_a = (0,
|
|
137
|
-
data:
|
|
136
|
+
type: (_a = (0, aiControllerState_1.toAIControllerVisualizationTypeStrict)(visualization.type)) !== null && _a !== void 0 ? _a : 'table',
|
|
137
|
+
data: toAIControllerVisualizationData(visualization.data),
|
|
138
138
|
};
|
|
139
139
|
};
|
|
140
|
-
exports.
|
|
141
|
-
const
|
|
142
|
-
var _a, _b
|
|
140
|
+
exports.toAIControllerVisualization = toAIControllerVisualization;
|
|
141
|
+
const toAIControllerVisualizationData = (data) => {
|
|
142
|
+
var _a, _b;
|
|
143
143
|
if ('x' in data && 'y' in data) {
|
|
144
144
|
// Normalize y to always be an array
|
|
145
145
|
const yArray = Array.isArray(data.y) ? data.y : [data.y];
|
|
146
|
-
// Handle y_format (now required)
|
|
147
|
-
const yFormat = data.y_format != null
|
|
148
|
-
? {
|
|
149
|
-
type: (_a = (0, aiCfoState_1.toYFormatTypeStrict)(data.y_format.type)) !== null && _a !== void 0 ? _a : 'number',
|
|
150
|
-
unit: (0, aiCfoState_1.toYFormatUnitStrict)(data.y_format.unit),
|
|
151
|
-
scale: (_b = (0, aiCfoState_1.toYFormatScaleStrict)(data.y_format.scale)) !== null && _b !== void 0 ? _b : 'raw',
|
|
152
|
-
symbol: (_c = data.y_format.symbol) !== null && _c !== void 0 ? _c : undefined,
|
|
153
|
-
}
|
|
154
|
-
: undefined;
|
|
155
146
|
return {
|
|
156
147
|
values: data.values,
|
|
157
148
|
x: data.x,
|
|
158
149
|
y: yArray,
|
|
159
|
-
lines: (
|
|
160
|
-
yFormat,
|
|
150
|
+
lines: (_a = data.lines) !== null && _a !== void 0 ? _a : [],
|
|
161
151
|
};
|
|
162
152
|
}
|
|
163
153
|
// Table cleaning logic: only strip quotes from column names and cell values
|
|
@@ -170,7 +160,7 @@ const toAiCfoVisualizationData = (data) => {
|
|
|
170
160
|
};
|
|
171
161
|
const columns = (Array.isArray(data.columns)
|
|
172
162
|
? data.columns
|
|
173
|
-
: Object.keys((
|
|
163
|
+
: Object.keys((_b = data.values[0]) !== null && _b !== void 0 ? _b : [])).map(stripQuotes);
|
|
174
164
|
const rows = data.values.map((row) => columns.map((col) => {
|
|
175
165
|
const value = row[col];
|
|
176
166
|
return value == null ? '' : stripQuotes(value);
|
|
@@ -188,11 +178,13 @@ const toResponseBlockType = (answer, userId) => {
|
|
|
188
178
|
chatSessionId: chat_session_id,
|
|
189
179
|
userId,
|
|
190
180
|
sender: 'agent',
|
|
191
|
-
state: (0,
|
|
192
|
-
type: (0,
|
|
181
|
+
state: (0, aiControllerState_1.toAIControllerAnswerStateType)(state),
|
|
182
|
+
type: (0, aiControllerState_1.toAIControllerAnswerResponseType)(type),
|
|
193
183
|
content: {
|
|
194
184
|
text: text,
|
|
195
|
-
visualization: visualization != null
|
|
185
|
+
visualization: visualization != null
|
|
186
|
+
? (0, exports.toAIControllerVisualization)(visualization)
|
|
187
|
+
: undefined,
|
|
196
188
|
followUpQuestions: follow_up_questions !== null && follow_up_questions !== void 0 ? follow_up_questions : [],
|
|
197
189
|
assumptions: assumptions !== null && assumptions !== void 0 ? assumptions : '',
|
|
198
190
|
insights: insights !== null && insights !== void 0 ? insights : '',
|
|
@@ -201,13 +193,13 @@ const toResponseBlockType = (answer, userId) => {
|
|
|
201
193
|
createdAt: (0, zeniDayJS_1.date)(timestamp),
|
|
202
194
|
};
|
|
203
195
|
};
|
|
204
|
-
const
|
|
205
|
-
name: '
|
|
206
|
-
initialState: exports.
|
|
196
|
+
const aiController = (0, toolkit_1.createSlice)({
|
|
197
|
+
name: 'aiController',
|
|
198
|
+
initialState: exports.initialAIControllerState,
|
|
207
199
|
reducers: {
|
|
208
200
|
setNewSession(draft, action) {
|
|
209
201
|
const { chatSessionId, userId, createdAt } = action.payload;
|
|
210
|
-
draft.
|
|
202
|
+
draft.aiControllerByChatSessionId[chatSessionId] = {
|
|
211
203
|
chatSession: {
|
|
212
204
|
chatSessionId,
|
|
213
205
|
userId,
|
|
@@ -223,8 +215,8 @@ const aiCfo = (0, toolkit_1.createSlice)({
|
|
|
223
215
|
action.payload.forEach((chatSessionPayload) => {
|
|
224
216
|
const { chat_session_id } = chatSessionPayload;
|
|
225
217
|
// This is to prevent overwriting the session if it is already in state
|
|
226
|
-
if (draft.
|
|
227
|
-
draft.
|
|
218
|
+
if (draft.aiControllerByChatSessionId[chat_session_id] == null) {
|
|
219
|
+
draft.aiControllerByChatSessionId[chat_session_id] = {
|
|
228
220
|
chatSession: toChatSession(chatSessionPayload),
|
|
229
221
|
questionAnswers: [],
|
|
230
222
|
};
|
|
@@ -235,11 +227,11 @@ const aiCfo = (0, toolkit_1.createSlice)({
|
|
|
235
227
|
},
|
|
236
228
|
setChatHistory(draft, action) {
|
|
237
229
|
const { chatSessionId, history, isPaginationComplete = false, } = action.payload;
|
|
238
|
-
if (draft.
|
|
230
|
+
if (draft.aiControllerByChatSessionId[chatSessionId] == null) {
|
|
239
231
|
console.warn(`session with id ${chatSessionId} not found in setChatHistory`);
|
|
240
232
|
return;
|
|
241
233
|
}
|
|
242
|
-
const session = draft.
|
|
234
|
+
const session = draft.aiControllerByChatSessionId[chatSessionId];
|
|
243
235
|
// Check if we have an existing partial Q&A pair for this session
|
|
244
236
|
const existingPartialQA = draft.partialQuestionAnswers[chatSessionId];
|
|
245
237
|
// Process new messages into Q&A pairs
|
|
@@ -374,13 +366,13 @@ const aiCfo = (0, toolkit_1.createSlice)({
|
|
|
374
366
|
*/
|
|
375
367
|
upsertOrAddQuestionAnswerPayload(draft, action) {
|
|
376
368
|
const { chatSessionId, questionAnswerId, question: { questionId, createdAt, text }, answerPayload, userId, insertQuestionAnswer, } = action.payload;
|
|
377
|
-
const session = draft.
|
|
369
|
+
const session = draft.aiControllerByChatSessionId[chatSessionId];
|
|
378
370
|
if (session == null) {
|
|
379
371
|
console.warn(`session with id ${chatSessionId} not found `);
|
|
380
372
|
return;
|
|
381
373
|
}
|
|
382
374
|
let qa = session.questionAnswers.find((qa) => qa.questionAnswerId === questionAnswerId);
|
|
383
|
-
const responseType = (0,
|
|
375
|
+
const responseType = (0, aiControllerState_1.toAIControllerAnswerResponseTypeStrict)(answerPayload.type);
|
|
384
376
|
if (insertQuestionAnswer === true && qa == null) {
|
|
385
377
|
// Add new Q/A
|
|
386
378
|
qa = {
|
|
@@ -407,7 +399,7 @@ const aiCfo = (0, toolkit_1.createSlice)({
|
|
|
407
399
|
},
|
|
408
400
|
upsertAnswerPayload(draft, action) {
|
|
409
401
|
const { chatSessionId, answerPayload, questionAnswerId, userId } = action.payload;
|
|
410
|
-
const session = draft.
|
|
402
|
+
const session = draft.aiControllerByChatSessionId[chatSessionId];
|
|
411
403
|
if (session == null) {
|
|
412
404
|
console.warn(`session with id ${chatSessionId} not found in upsertAnswerPayload`);
|
|
413
405
|
return;
|
|
@@ -415,7 +407,7 @@ const aiCfo = (0, toolkit_1.createSlice)({
|
|
|
415
407
|
const latestQA = questionAnswerId != null
|
|
416
408
|
? session.questionAnswers.find((questionAnswer) => questionAnswer.questionAnswerId === questionAnswerId)
|
|
417
409
|
: session.questionAnswers.slice(-1)[0];
|
|
418
|
-
const responseType = (0,
|
|
410
|
+
const responseType = (0, aiControllerState_1.toAIControllerAnswerResponseTypeStrict)(answerPayload.type);
|
|
419
411
|
if (latestQA != null && responseType != null) {
|
|
420
412
|
// Directly mutate the responses property
|
|
421
413
|
latestQA.responses[responseType] = toResponseBlockType(answerPayload, userId);
|
|
@@ -423,7 +415,7 @@ const aiCfo = (0, toolkit_1.createSlice)({
|
|
|
423
415
|
},
|
|
424
416
|
addQuestionPayload(draft, action) {
|
|
425
417
|
const { chatSessionId, questionAnswerId, question: { questionId, createdAt, text }, userId, } = action.payload;
|
|
426
|
-
const session = draft.
|
|
418
|
+
const session = draft.aiControllerByChatSessionId[chatSessionId];
|
|
427
419
|
if (session == null) {
|
|
428
420
|
console.warn(`session with id ${chatSessionId} not found in addQuestionPayload`);
|
|
429
421
|
return;
|
|
@@ -450,19 +442,19 @@ const aiCfo = (0, toolkit_1.createSlice)({
|
|
|
450
442
|
clearSession(draft, action) {
|
|
451
443
|
var _a;
|
|
452
444
|
const sessionId = action.payload;
|
|
453
|
-
delete draft.
|
|
445
|
+
delete draft.aiControllerByChatSessionId[sessionId];
|
|
454
446
|
// Clear partial Q&A if it belongs to the cleared session
|
|
455
447
|
if (((_a = draft.partialQuestionAnswers) === null || _a === void 0 ? void 0 : _a[sessionId]) != null) {
|
|
456
448
|
draft.partialQuestionAnswers[sessionId] = undefined;
|
|
457
449
|
}
|
|
458
450
|
},
|
|
459
|
-
|
|
460
|
-
draft.
|
|
451
|
+
clearAIController(draft) {
|
|
452
|
+
draft.aiControllerByChatSessionId = {};
|
|
461
453
|
draft.partialQuestionAnswers = {};
|
|
462
454
|
},
|
|
463
455
|
deleteQuestion(draft, action) {
|
|
464
456
|
const { chatSessionId, questionAnswerId } = action.payload;
|
|
465
|
-
const session = draft.
|
|
457
|
+
const session = draft.aiControllerByChatSessionId[chatSessionId];
|
|
466
458
|
if (session == null) {
|
|
467
459
|
console.warn(`session with id ${chatSessionId} not found in deleteQuestion`);
|
|
468
460
|
return;
|
|
@@ -483,5 +475,5 @@ const toChatSession = (chatSessionPayload) => {
|
|
|
483
475
|
createdAt: (0, zeniDayJS_1.date)(created_at),
|
|
484
476
|
};
|
|
485
477
|
};
|
|
486
|
-
_a =
|
|
487
|
-
exports.default =
|
|
478
|
+
_a = aiController.actions, exports.setNewSession = _a.setNewSession, exports.clearSession = _a.clearSession, exports.setSessions = _a.setSessions, exports.setChatHistory = _a.setChatHistory, exports.upsertAnswerPayload = _a.upsertAnswerPayload, exports.upsertOrAddQuestionAnswerPayload = _a.upsertOrAddQuestionAnswerPayload, exports.addQuestionPayload = _a.addQuestionPayload, exports.clearAIController = _a.clearAIController, exports.deleteQuestion = _a.deleteQuestion;
|
|
479
|
+
exports.default = aiController.reducer;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { ID } from '../../commonStateTypes/common';
|
|
2
|
+
import { AIControllerQuestionWithAnswer, AIControllerState } from './aiControllerState';
|
|
3
|
+
import { ChatSession } from './aiControllerState';
|
|
4
|
+
export declare function getAllQuestionAnswersForChatSession(state: AIControllerState, chatSessionId: ID): AIControllerQuestionWithAnswer[];
|
|
5
|
+
export declare function getQuestionAnswerByIdForChatSession(state: AIControllerState, chatSessionId: ID, questionAnswerId: ID): AIControllerQuestionWithAnswer | undefined;
|
|
6
|
+
export declare function getAllQuestionsForChatSession(state: AIControllerState, chatSessionId: ID): string[];
|
|
7
|
+
export interface AIControllerSelectorView {
|
|
8
|
+
allSessionsWithOrderedQuestionAnswers: ChatSessionWithOrderedQuestionAnswers[];
|
|
9
|
+
}
|
|
10
|
+
export interface ChatSessionWithOrderedQuestionAnswers {
|
|
11
|
+
chatSession: ChatSession;
|
|
12
|
+
questionAnswers: AIControllerQuestionWithAnswer[];
|
|
13
|
+
}
|
|
14
|
+
export declare function getAIControllerSelectorView(state: AIControllerState): AIControllerSelectorView;
|
|
@@ -3,17 +3,17 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.getAllQuestionAnswersForChatSession = getAllQuestionAnswersForChatSession;
|
|
4
4
|
exports.getQuestionAnswerByIdForChatSession = getQuestionAnswerByIdForChatSession;
|
|
5
5
|
exports.getAllQuestionsForChatSession = getAllQuestionsForChatSession;
|
|
6
|
-
exports.
|
|
6
|
+
exports.getAIControllerSelectorView = getAIControllerSelectorView;
|
|
7
7
|
function getAllQuestionAnswersForChatSession(state, chatSessionId) {
|
|
8
8
|
var _a, _b;
|
|
9
|
-
const arr = (_b = (_a = state.
|
|
9
|
+
const arr = (_b = (_a = state.aiControllerByChatSessionId[chatSessionId]) === null || _a === void 0 ? void 0 : _a.questionAnswers) !== null && _b !== void 0 ? _b : [];
|
|
10
10
|
return arr
|
|
11
11
|
.slice()
|
|
12
12
|
.sort((a, b) => a.question.createdAt.valueOf() - b.question.createdAt.valueOf());
|
|
13
13
|
}
|
|
14
14
|
function getQuestionAnswerByIdForChatSession(state, chatSessionId, questionAnswerId) {
|
|
15
15
|
var _a;
|
|
16
|
-
const arr = (_a = state.
|
|
16
|
+
const arr = (_a = state.aiControllerByChatSessionId[chatSessionId]) === null || _a === void 0 ? void 0 : _a.questionAnswers;
|
|
17
17
|
if (arr == null) {
|
|
18
18
|
return undefined;
|
|
19
19
|
}
|
|
@@ -21,7 +21,7 @@ function getQuestionAnswerByIdForChatSession(state, chatSessionId, questionAnswe
|
|
|
21
21
|
}
|
|
22
22
|
function getAllQuestionsForChatSession(state, chatSessionId) {
|
|
23
23
|
var _a;
|
|
24
|
-
const arr = (_a = state.
|
|
24
|
+
const arr = (_a = state.aiControllerByChatSessionId[chatSessionId]) === null || _a === void 0 ? void 0 : _a.questionAnswers;
|
|
25
25
|
if (arr == null) {
|
|
26
26
|
return [];
|
|
27
27
|
}
|
|
@@ -30,8 +30,8 @@ function getAllQuestionsForChatSession(state, chatSessionId) {
|
|
|
30
30
|
.sort((first, second) => first.question.createdAt.valueOf() - second.question.createdAt.valueOf())
|
|
31
31
|
.map((qa) => qa.question.questionText);
|
|
32
32
|
}
|
|
33
|
-
function
|
|
34
|
-
const allSessionsWithOrderedQuestionAnswers = Object.values(state.
|
|
33
|
+
function getAIControllerSelectorView(state) {
|
|
34
|
+
const allSessionsWithOrderedQuestionAnswers = Object.values(state.aiControllerByChatSessionId)
|
|
35
35
|
.map((sessionWithQAs) => (Object.assign(Object.assign({}, sessionWithQAs), { questionAnswers: Array.isArray(sessionWithQAs.questionAnswers)
|
|
36
36
|
? sessionWithQAs.questionAnswers
|
|
37
37
|
.slice()
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { ID } from '../../commonStateTypes/common';
|
|
2
|
+
import { ZeniDate } from '../../zeniDayJS';
|
|
3
|
+
export interface AIControllerAnswerParagraph {
|
|
4
|
+
text: string;
|
|
5
|
+
orderedList?: Array<{
|
|
6
|
+
text: string;
|
|
7
|
+
subText?: string;
|
|
8
|
+
unorderedList?: string[];
|
|
9
|
+
}>;
|
|
10
|
+
}
|
|
11
|
+
export declare const ALL_AI_CONTROLLER_CHARTS_TYPES: readonly ["bar_chart", "pie_chart", "line_chart"];
|
|
12
|
+
export declare const ALL_AI_CONTROLLER_VISUALIZATION_TYPES: readonly ["bar_chart", "pie_chart", "line_chart", "table"];
|
|
13
|
+
export declare const toAIControllerVisualizationType: (v: string) => "bar_chart" | "pie_chart" | "line_chart" | "table";
|
|
14
|
+
export declare const toAIControllerVisualizationTypeStrict: (v: string) => "bar_chart" | "pie_chart" | "line_chart" | "table" | undefined;
|
|
15
|
+
export type AIControllerVisualizationType = ReturnType<typeof toAIControllerVisualizationType>;
|
|
16
|
+
export declare const toAIControllerChartType: (v: string) => "bar_chart" | "pie_chart" | "line_chart";
|
|
17
|
+
export declare const toAIControllerChartTypeStrict: (v: string) => "bar_chart" | "pie_chart" | "line_chart" | undefined;
|
|
18
|
+
export type AIControllerChartType = ReturnType<typeof toAIControllerChartType>;
|
|
19
|
+
export declare const ALL_AI_CONTROLLER_ANSWER_STATE_TYPES: readonly ["complete", "partial"];
|
|
20
|
+
export declare const ALL_AI_CONTROLLER_ANSWER_RESPONSE_TYPES: readonly ["analysis", "answer", "reasoning", "thought"];
|
|
21
|
+
export declare const toAIControllerAnswerStateType: (v: string) => "complete" | "partial";
|
|
22
|
+
export declare const toAIControllerAnswerResponseType: (v: string) => "analysis" | "answer" | "reasoning" | "thought";
|
|
23
|
+
export declare const toAIControllerAnswerStateTypeStrict: (v: string) => "complete" | "partial" | undefined;
|
|
24
|
+
export declare const toAIControllerAnswerResponseTypeStrict: (v: string) => "analysis" | "answer" | "reasoning" | "thought" | undefined;
|
|
25
|
+
export type AIControllerAnswerStateType = ReturnType<typeof toAIControllerAnswerStateType>;
|
|
26
|
+
export type AIControllerAnswerResponseType = ReturnType<typeof toAIControllerAnswerResponseType>;
|
|
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 AIControllerVisualization {
|
|
38
|
+
type: AIControllerVisualizationType;
|
|
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: AIControllerAnswerStateType;
|
|
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?: AIControllerVisualization;
|
|
62
|
+
}
|
|
63
|
+
export interface QuestionContentBlockBase extends ResponseBlockBase {
|
|
64
|
+
questionText: string;
|
|
65
|
+
}
|
|
66
|
+
export interface ResponseBlockType extends ResponseBlockBase {
|
|
67
|
+
content: AnswerContentBlockBase;
|
|
68
|
+
type: AIControllerAnswerResponseType;
|
|
69
|
+
}
|
|
70
|
+
export interface AIControllerQuestionWithAnswer {
|
|
71
|
+
questionAnswerId: ID;
|
|
72
|
+
question: QuestionContentBlockBase;
|
|
73
|
+
responses: Partial<Record<AIControllerAnswerResponseType, 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: AIControllerQuestionWithAnswer[];
|
|
84
|
+
}
|
|
85
|
+
export interface AIControllerState {
|
|
86
|
+
aiControllerByChatSessionId: Record<ID, ChatSessionWithMessages>;
|
|
87
|
+
partialQuestionAnswers: Record<ID, AIControllerQuestionWithAnswer | undefined>;
|
|
88
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.toMessageTypeStrict = exports.toMessageSenderStrict = exports.toMessageType = exports.toMessageSender = exports.toAIControllerAnswerResponseTypeStrict = exports.toAIControllerAnswerStateTypeStrict = exports.toAIControllerAnswerResponseType = exports.toAIControllerAnswerStateType = exports.ALL_AI_CONTROLLER_ANSWER_RESPONSE_TYPES = exports.ALL_AI_CONTROLLER_ANSWER_STATE_TYPES = exports.toAIControllerChartTypeStrict = exports.toAIControllerChartType = exports.toAIControllerVisualizationTypeStrict = exports.toAIControllerVisualizationType = exports.ALL_AI_CONTROLLER_VISUALIZATION_TYPES = exports.ALL_AI_CONTROLLER_CHARTS_TYPES = void 0;
|
|
4
|
+
const stringToUnion_1 = require("../../commonStateTypes/stringToUnion");
|
|
5
|
+
exports.ALL_AI_CONTROLLER_CHARTS_TYPES = [
|
|
6
|
+
'bar_chart',
|
|
7
|
+
'pie_chart',
|
|
8
|
+
'line_chart',
|
|
9
|
+
];
|
|
10
|
+
exports.ALL_AI_CONTROLLER_VISUALIZATION_TYPES = [
|
|
11
|
+
...exports.ALL_AI_CONTROLLER_CHARTS_TYPES,
|
|
12
|
+
'table',
|
|
13
|
+
];
|
|
14
|
+
const toAIControllerVisualizationType = (v) => (0, stringToUnion_1.stringToUnion)(v, exports.ALL_AI_CONTROLLER_VISUALIZATION_TYPES);
|
|
15
|
+
exports.toAIControllerVisualizationType = toAIControllerVisualizationType;
|
|
16
|
+
const toAIControllerVisualizationTypeStrict = (v) => (0, stringToUnion_1.stringToUnionStrict)(v, exports.ALL_AI_CONTROLLER_VISUALIZATION_TYPES);
|
|
17
|
+
exports.toAIControllerVisualizationTypeStrict = toAIControllerVisualizationTypeStrict;
|
|
18
|
+
const toAIControllerChartType = (v) => (0, stringToUnion_1.stringToUnion)(v, exports.ALL_AI_CONTROLLER_CHARTS_TYPES);
|
|
19
|
+
exports.toAIControllerChartType = toAIControllerChartType;
|
|
20
|
+
const toAIControllerChartTypeStrict = (v) => (0, stringToUnion_1.stringToUnionStrict)(v, exports.ALL_AI_CONTROLLER_CHARTS_TYPES);
|
|
21
|
+
exports.toAIControllerChartTypeStrict = toAIControllerChartTypeStrict;
|
|
22
|
+
exports.ALL_AI_CONTROLLER_ANSWER_STATE_TYPES = [
|
|
23
|
+
'complete',
|
|
24
|
+
'partial',
|
|
25
|
+
];
|
|
26
|
+
exports.ALL_AI_CONTROLLER_ANSWER_RESPONSE_TYPES = [
|
|
27
|
+
'analysis',
|
|
28
|
+
'answer',
|
|
29
|
+
'reasoning',
|
|
30
|
+
'thought',
|
|
31
|
+
];
|
|
32
|
+
const toAIControllerAnswerStateType = (v) => (0, stringToUnion_1.stringToUnion)(v, exports.ALL_AI_CONTROLLER_ANSWER_STATE_TYPES);
|
|
33
|
+
exports.toAIControllerAnswerStateType = toAIControllerAnswerStateType;
|
|
34
|
+
const toAIControllerAnswerResponseType = (v) => (0, stringToUnion_1.stringToUnion)(v, exports.ALL_AI_CONTROLLER_ANSWER_RESPONSE_TYPES);
|
|
35
|
+
exports.toAIControllerAnswerResponseType = toAIControllerAnswerResponseType;
|
|
36
|
+
const toAIControllerAnswerStateTypeStrict = (v) => (0, stringToUnion_1.stringToUnionStrict)(v, exports.ALL_AI_CONTROLLER_ANSWER_STATE_TYPES);
|
|
37
|
+
exports.toAIControllerAnswerStateTypeStrict = toAIControllerAnswerStateTypeStrict;
|
|
38
|
+
const toAIControllerAnswerResponseTypeStrict = (v) => (0, stringToUnion_1.stringToUnionStrict)(v, exports.ALL_AI_CONTROLLER_ANSWER_RESPONSE_TYPES);
|
|
39
|
+
exports.toAIControllerAnswerResponseTypeStrict = toAIControllerAnswerResponseTypeStrict;
|
|
40
|
+
const ALL_MESSAGE_SENDERS = ['user', 'agent'];
|
|
41
|
+
const ALL_MESSAGE_TYPES = ['plain_text', 'json'];
|
|
42
|
+
const toMessageSender = (v) => (0, stringToUnion_1.stringToUnion)(v, ALL_MESSAGE_SENDERS);
|
|
43
|
+
exports.toMessageSender = toMessageSender;
|
|
44
|
+
const toMessageType = (v) => (0, stringToUnion_1.stringToUnion)(v, ALL_MESSAGE_TYPES);
|
|
45
|
+
exports.toMessageType = toMessageType;
|
|
46
|
+
const toMessageSenderStrict = (v) => (0, stringToUnion_1.stringToUnionStrict)(v, ALL_MESSAGE_SENDERS);
|
|
47
|
+
exports.toMessageSenderStrict = toMessageSenderStrict;
|
|
48
|
+
const toMessageTypeStrict = (v) => (0, stringToUnion_1.stringToUnionStrict)(v, ALL_MESSAGE_TYPES);
|
|
49
|
+
exports.toMessageTypeStrict = toMessageTypeStrict;
|