@iblai/web-utils 1.2.12 → 1.3.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.
- package/dist/data-layer/src/features/audit-logs/types.d.ts +2 -4
- package/dist/index.d.ts +12 -2
- package/dist/index.esm.js +26 -3
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +26 -2
- package/dist/index.js.map +1 -1
- package/dist/package.json +1 -1
- package/dist/web-utils/src/features/chat/slice.d.ts +10 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -750,7 +750,7 @@ const LOCAL_STORAGE_KEYS = {
|
|
|
750
750
|
USER_DATA: "userData",
|
|
751
751
|
USER_TENANTS: "tenants",
|
|
752
752
|
EDX_TOKEN_KEY: "edx_jwt_token",
|
|
753
|
-
DM_TOKEN_KEY: "
|
|
753
|
+
DM_TOKEN_KEY: "dm_token",
|
|
754
754
|
DM_TOKEN_EXPIRES: "dm_token_expires",
|
|
755
755
|
};
|
|
756
756
|
const TOOLS = {
|
|
@@ -3012,9 +3012,9 @@ function useAuthProvider({ middleware = new Map(), onAuthSuccess, onAuthFailure,
|
|
|
3012
3012
|
// Check JWT token expiry and force logout for protected routes
|
|
3013
3013
|
if (isProtectedRoute && storageService) {
|
|
3014
3014
|
const dmTokenInLocalStorage = await storageService.getItem(LOCAL_STORAGE_KEYS.DM_TOKEN_KEY);
|
|
3015
|
+
console.log('[auth-redirect] local storage keys ', LOCAL_STORAGE_KEYS);
|
|
3015
3016
|
const dmTokenExpired = await isDmTokenExpired(storageService);
|
|
3016
3017
|
if (!dmTokenInLocalStorage || dmTokenExpired) {
|
|
3017
|
-
console.log();
|
|
3018
3018
|
if (!!dmTokenInLocalStorage) {
|
|
3019
3019
|
console.log("[auth-redirect] DM token doesn't exists");
|
|
3020
3020
|
}
|
|
@@ -5957,6 +5957,10 @@ const initialState$3 = {
|
|
|
5957
5957
|
// Buffering state initialized
|
|
5958
5958
|
streamingArtifactContentBuffer: "",
|
|
5959
5959
|
lastArtifactContentFlushTime: 0,
|
|
5960
|
+
metadata: {
|
|
5961
|
+
edxCourseId: "",
|
|
5962
|
+
edxUsageId: "",
|
|
5963
|
+
},
|
|
5960
5964
|
};
|
|
5961
5965
|
const chatSlice = createSlice$1({
|
|
5962
5966
|
name: "chatSliceShared",
|
|
@@ -6043,6 +6047,12 @@ const chatSlice = createSlice$1({
|
|
|
6043
6047
|
setIframeContext: (state, action) => {
|
|
6044
6048
|
state.iframeContext = action.payload;
|
|
6045
6049
|
},
|
|
6050
|
+
setMetadata: (state, action) => {
|
|
6051
|
+
state.metadata = {
|
|
6052
|
+
...state.metadata,
|
|
6053
|
+
...action.payload,
|
|
6054
|
+
};
|
|
6055
|
+
},
|
|
6046
6056
|
setDocumentFilter: (state, action) => {
|
|
6047
6057
|
state.documentFilter = action.payload;
|
|
6048
6058
|
},
|
|
@@ -6345,6 +6355,7 @@ const selectActiveTab = (state) => state.chatSliceShared.activeTab;
|
|
|
6345
6355
|
const selectSessionId = (state) => state.chatSliceShared.sessionIds[state.chatSliceShared.activeTab];
|
|
6346
6356
|
const selectSessionIds = (state) => state.chatSliceShared.sessionIds;
|
|
6347
6357
|
const selectIframeContext = (state) => state.chatSliceShared.iframeContext;
|
|
6358
|
+
const selectMetadata = (state) => state.chatSliceShared.metadata;
|
|
6348
6359
|
const selectDocumentFilter = (state) => state.chatSliceShared.documentFilter;
|
|
6349
6360
|
const selectTools = (state) => state.chatSliceShared.tools;
|
|
6350
6361
|
const selectToken = (state) => state.chatSliceShared.token;
|
|
@@ -7104,6 +7115,7 @@ const useChat = ({ wsUrl, wsToken, flowConfig, sessionId, stopGenerationWsUrl, e
|
|
|
7104
7115
|
const connectionAttempts = React.useRef(0);
|
|
7105
7116
|
const { userIsAccessingPublicRoute } = useAuthContext();
|
|
7106
7117
|
const iframeContext = useSelector(selectIframeContext);
|
|
7118
|
+
const chatMetadata = useSelector(selectMetadata);
|
|
7107
7119
|
const documentFilter = useSelector(selectDocumentFilter);
|
|
7108
7120
|
const linkToken = useSelector(selectToken);
|
|
7109
7121
|
// Ollama/offline mode state
|
|
@@ -8093,6 +8105,17 @@ const useChat = ({ wsUrl, wsToken, flowConfig, sessionId, stopGenerationWsUrl, e
|
|
|
8093
8105
|
metadata: iframeContext.metadata,
|
|
8094
8106
|
};
|
|
8095
8107
|
}
|
|
8108
|
+
if (chatMetadata &&
|
|
8109
|
+
(chatMetadata.edxCourseId || chatMetadata.edxUsageId)) {
|
|
8110
|
+
messageData = {
|
|
8111
|
+
...messageData,
|
|
8112
|
+
grading_context: {
|
|
8113
|
+
type: "edx",
|
|
8114
|
+
course_id: chatMetadata.edxCourseId,
|
|
8115
|
+
usage_id: chatMetadata.edxUsageId,
|
|
8116
|
+
},
|
|
8117
|
+
};
|
|
8118
|
+
}
|
|
8096
8119
|
if (documentFilter) {
|
|
8097
8120
|
messageData = {
|
|
8098
8121
|
...messageData,
|
|
@@ -23670,6 +23693,7 @@ exports.selectIsPending = selectIsPending;
|
|
|
23670
23693
|
exports.selectIsStopped = selectIsStopped;
|
|
23671
23694
|
exports.selectIsTyping = selectIsTyping;
|
|
23672
23695
|
exports.selectLastArtifactContentFlushTime = selectLastArtifactContentFlushTime;
|
|
23696
|
+
exports.selectMetadata = selectMetadata;
|
|
23673
23697
|
exports.selectNumberOfActiveChatMessages = selectNumberOfActiveChatMessages;
|
|
23674
23698
|
exports.selectSessionId = selectSessionId;
|
|
23675
23699
|
exports.selectSessionIds = selectSessionIds;
|