@iblai/web-utils 1.1.2 → 1.1.3
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/core/index.d.ts +7 -1
- package/dist/data-layer/src/features/analytics/constants.d.ts +6 -6
- package/dist/data-layer/src/features/analytics/types.d.ts +9 -0
- package/dist/data-layer/src/features/api-keys/api-slice.d.ts +72 -24
- package/dist/data-layer/src/features/apps/api-slice.d.ts +72 -24
- package/dist/data-layer/src/features/artifacts/api-slice.d.ts +1798 -0
- package/dist/data-layer/src/features/artifacts/constants.d.ts +42 -0
- package/dist/data-layer/src/features/artifacts/types.d.ts +37 -0
- package/dist/data-layer/src/features/auth/types.d.ts +1 -1
- package/dist/data-layer/src/features/billing/api-slice.d.ts +15 -5
- package/dist/data-layer/src/features/billing/constants.d.ts +16 -0
- package/dist/data-layer/src/features/billing/custom-api-slice.d.ts +634 -0
- package/dist/data-layer/src/features/billing/types.d.ts +35 -0
- package/dist/data-layer/src/features/career/api-slice.d.ts +342 -114
- package/dist/data-layer/src/features/catalog/api-slice.d.ts +1050 -317
- package/dist/data-layer/src/features/chat/api-slice.d.ts +204 -68
- package/dist/data-layer/src/features/chat-history/api-slice.d.ts +202 -60
- package/dist/data-layer/src/features/core/api-slice.d.ts +1143 -134
- package/dist/data-layer/src/features/core/custom-public-image-asset-api-slice.d.ts +60 -20
- package/dist/data-layer/src/features/credentials/api-slice.d.ts +3706 -146
- package/dist/data-layer/src/features/credentials/constants.d.ts +9 -1
- package/dist/data-layer/src/features/credentials/custom-api-slice.d.ts +535 -2
- package/dist/data-layer/src/features/credentials/types.d.ts +14 -0
- package/dist/data-layer/src/features/datasets/api-slice.d.ts +60 -197
- package/dist/data-layer/src/features/llms/api-slice.d.ts +60 -20
- package/dist/data-layer/src/features/mcp/api-slice.d.ts +2613 -0
- package/dist/data-layer/src/features/mcp/constants.d.ts +57 -0
- package/dist/data-layer/src/features/mcp/types.d.ts +176 -0
- package/dist/data-layer/src/features/memory/types.d.ts +1 -0
- package/dist/data-layer/src/features/mentor/api-slice.d.ts +1789 -473
- package/dist/data-layer/src/features/mentor/constants.d.ts +7 -1
- package/dist/data-layer/src/features/mentor/custom-api-slice.d.ts +162 -1
- package/dist/data-layer/src/features/mentor/types.d.ts +7 -1
- package/dist/data-layer/src/features/mentor-categories/api-slice.d.ts +117 -39
- package/dist/data-layer/src/features/moderation-logs/api-slice.d.ts +705 -0
- package/dist/data-layer/src/features/notifications/api-slice.d.ts +214 -86
- package/dist/data-layer/src/features/per-learner/api-slice.d.ts +174 -58
- package/dist/data-layer/src/features/platform/api-slice.d.ts +1568 -293
- package/dist/data-layer/src/features/platform/types.d.ts +13 -0
- package/dist/data-layer/src/features/prompts/api-slice.d.ts +249 -83
- package/dist/data-layer/src/features/reports/api-slice.d.ts +145 -41
- package/dist/data-layer/src/features/search/ai-search-api-slice.d.ts +399 -1
- package/dist/data-layer/src/features/search/api-slice.d.ts +117 -39
- package/dist/data-layer/src/features/search/constants.d.ts +10 -0
- package/dist/data-layer/src/features/search/types.d.ts +72 -0
- package/dist/data-layer/src/features/sessions/api-slice.d.ts +440 -46
- package/dist/data-layer/src/features/skills/api-slice.d.ts +231 -77
- package/dist/data-layer/src/features/tenant/api-slice.d.ts +123 -41
- package/dist/data-layer/src/features/tools/api-slice.d.ts +60 -20
- package/dist/data-layer/src/features/training-documents/api-slice.d.ts +141 -47
- package/dist/data-layer/src/features/user-invitations/api-slice.d.ts +66 -22
- package/dist/data-layer/src/index.d.ts +6 -0
- package/dist/index.d.ts +367 -33
- package/dist/index.esm.js +7619 -3934
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +7644 -3931
- package/dist/index.js.map +1 -1
- package/dist/package.json +22 -12
- package/dist/web-utils/src/__tests__/index.mobile.test.d.ts +7 -0
- package/dist/web-utils/src/__tests__/index.web.test.d.ts +8 -0
- package/dist/web-utils/src/constants/__tests__/chat.test.d.ts +1 -0
- package/dist/web-utils/src/constants/chat.d.ts +1 -1
- package/dist/web-utils/src/features/chat/__tests__/slice.test.d.ts +1 -0
- package/dist/web-utils/src/features/chat/slice.d.ts +37 -2
- package/dist/web-utils/src/features/csv/combine-csv.d.ts +35 -0
- package/dist/web-utils/src/features/csv/index.d.ts +1 -0
- package/dist/web-utils/src/features/files/__tests__/filesSlice.test.d.ts +1 -0
- package/dist/web-utils/src/features/index.d.ts +1 -0
- package/dist/web-utils/src/hoc/index.d.ts +2 -0
- package/dist/web-utils/src/hoc/with-permissions.d.ts +44 -0
- package/dist/web-utils/src/hooks/__tests__/use-mentor-settings.test.d.ts +1 -0
- package/dist/web-utils/src/hooks/chat/ollama-client.d.ts +57 -0
- package/dist/web-utils/src/hooks/chat/use-advanced-chat.d.ts +10 -4
- package/dist/web-utils/src/hooks/chat/use-advanced-chat.test.d.ts +1 -0
- package/dist/web-utils/src/hooks/chat/use-chat-v2.d.ts +59 -2
- package/dist/web-utils/src/hooks/chat/use-chat-v2.test.d.ts +1 -0
- package/dist/web-utils/src/hooks/chat/use-chat.d.ts +1 -0
- package/dist/web-utils/src/hooks/chat/use-get-chat-details.test.d.ts +1 -0
- package/dist/web-utils/src/hooks/chat/use-mentor-tools.d.ts +2 -0
- package/dist/web-utils/src/hooks/chat/use-mentor-tools.test.d.ts +1 -0
- package/dist/web-utils/src/hooks/index.d.ts +1 -0
- package/dist/web-utils/src/hooks/subscription-v2/constants.d.ts +5 -0
- package/dist/web-utils/src/hooks/subscription-v2/use-subscription-handler.d.ts +56 -1
- package/dist/web-utils/src/hooks/tenant-metadata/__tests__/config-loader.test.d.ts +10 -0
- package/dist/web-utils/src/hooks/tenant-metadata/__tests__/use-tenant-metadata.test.d.ts +1 -0
- package/dist/web-utils/src/hooks/tenant-metadata/use-tenant-metadata.d.ts +2 -1
- package/dist/web-utils/src/index.d.ts +1 -0
- package/dist/web-utils/src/index.mobile.d.ts +130 -10
- package/dist/web-utils/src/index.web.d.ts +174 -12
- package/dist/web-utils/src/providers/__tests__/mentor-provider.test.d.ts +1 -0
- package/dist/web-utils/src/providers/__tests__/tenant-provider.test.d.ts +1 -0
- package/dist/web-utils/src/providers/auth-provider.d.ts +5 -2
- package/dist/web-utils/src/providers/mentor-provider.d.ts +2 -1
- package/dist/web-utils/src/providers/tenant-provider.d.ts +7 -2
- package/dist/web-utils/src/types/index.d.ts +1 -0
- package/dist/web-utils/src/types/subscription.d.ts +21 -0
- package/dist/web-utils/src/utils/__tests__/auth.test.d.ts +1 -0
- package/dist/web-utils/src/utils/__tests__/constants.test.d.ts +1 -0
- package/dist/web-utils/src/utils/__tests__/helpers.test.d.ts +1 -0
- package/dist/web-utils/src/utils/__tests__/platform.test.d.ts +1 -0
- package/dist/web-utils/src/utils/constants.d.ts +1 -0
- package/dist/web-utils/src/utils/data/__tests__/advanced-tab.test.d.ts +1 -0
- package/dist/web-utils/src/utils/helpers.d.ts +6 -0
- package/dist/web-utils/src/utils/index.d.ts +1 -0
- package/dist/web-utils/src/utils/platform.d.ts +1 -0
- package/dist/web-utils/tests/hooks/chat/use-mentor-tools.test.d.ts +1 -0
- package/dist/web-utils/tests/hooks/subscription-v2/use-subscription-handler.test.d.ts +1 -0
- package/dist/web-utils/tests/hooks/use-mentor-settings.test.d.ts +1 -0
- package/dist/web-utils/tests/providers/mentor-provider.test.d.ts +1 -0
- package/dist/web-utils/tests/providers/tenant-provider.test.d.ts +1 -0
- package/dist/web-utils/tests/utils/helpers.test.d.ts +1 -0
- package/dist/web-utils/tsconfig.tsbuildinfo +1 -1
- package/package.json +22 -12
package/dist/package.json
CHANGED
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@iblai/web-utils",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.3",
|
|
4
4
|
"main": "./dist/index.js",
|
|
5
5
|
"module": "./dist/index.esm.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
7
7
|
"files": [
|
|
8
8
|
"dist"
|
|
9
9
|
],
|
|
10
|
+
"engines": {
|
|
11
|
+
"node": "25.3.0"
|
|
12
|
+
},
|
|
10
13
|
"scripts": {
|
|
11
14
|
"build": "rollup -c",
|
|
12
15
|
"watch": "rollup -c -w",
|
|
@@ -21,27 +24,29 @@
|
|
|
21
24
|
"license": "ISC",
|
|
22
25
|
"description": "IBL Web Utils",
|
|
23
26
|
"devDependencies": {
|
|
24
|
-
"@eslint/js": "^9.39.
|
|
27
|
+
"@eslint/js": "^9.39.2",
|
|
25
28
|
"@rollup/plugin-commonjs": "^28.0.9",
|
|
26
29
|
"@rollup/plugin-json": "^6.1.0",
|
|
27
30
|
"@rollup/plugin-node-resolve": "^16.0.3",
|
|
28
31
|
"@rollup/plugin-typescript": "^12.3.0",
|
|
32
|
+
"@tauri-apps/api": "^2.9.1",
|
|
29
33
|
"@testing-library/jest-dom": "6.6.3",
|
|
30
34
|
"@testing-library/react": "16.3.0",
|
|
31
35
|
"@types/jest": "29.5.14",
|
|
32
|
-
"@types/node": "^22.19.
|
|
36
|
+
"@types/node": "^22.19.6",
|
|
33
37
|
"@types/react": "19.1.17",
|
|
34
|
-
"@typescript-eslint/eslint-plugin": "^8.
|
|
35
|
-
"@typescript-eslint/parser": "^8.
|
|
38
|
+
"@typescript-eslint/eslint-plugin": "^8.53.0",
|
|
39
|
+
"@typescript-eslint/parser": "^8.53.0",
|
|
40
|
+
"@vitest/coverage-istanbul": "^3.2.4",
|
|
36
41
|
"@vitest/coverage-v8": "^3.2.4",
|
|
37
|
-
"autoprefixer": "^10.4.
|
|
38
|
-
"eslint": "^9.39.
|
|
42
|
+
"autoprefixer": "^10.4.23",
|
|
43
|
+
"eslint": "^9.39.2",
|
|
39
44
|
"eslint-config-prettier": "10.1.2",
|
|
40
45
|
"globals": "^16.5.0",
|
|
41
46
|
"jest": "29.7.0",
|
|
42
47
|
"jest-environment-jsdom": "29.7.0",
|
|
43
48
|
"jsdom": "^25.0.1",
|
|
44
|
-
"rollup-plugin-dts": "^6.
|
|
49
|
+
"rollup-plugin-dts": "^6.3.0",
|
|
45
50
|
"rollup-plugin-peer-deps-external": "^2.2.4",
|
|
46
51
|
"rollup-plugin-strip-code": "^0.2.8",
|
|
47
52
|
"rollup-plugin-typescript2": "^0.36.0",
|
|
@@ -50,20 +55,25 @@
|
|
|
50
55
|
"vitest": "^3.2.4"
|
|
51
56
|
},
|
|
52
57
|
"dependencies": {
|
|
53
|
-
"@reduxjs/toolkit": "^2.
|
|
54
|
-
"axios": "^1.13.
|
|
58
|
+
"@reduxjs/toolkit": "^2.11.2",
|
|
59
|
+
"axios": "^1.13.2",
|
|
55
60
|
"dayjs": "^1.11.19",
|
|
56
61
|
"jwt-decode": "^4.0.0",
|
|
57
62
|
"react-redux": "^9.2.0",
|
|
58
|
-
"rollup": "^4.
|
|
63
|
+
"rollup": "^4.55.1",
|
|
59
64
|
"rollup-plugin-copy": "^3.5.0",
|
|
60
65
|
"zod": "3.24.2"
|
|
61
66
|
},
|
|
62
67
|
"peerDependencies": {
|
|
63
68
|
"@iblai/data-layer": "^1.1.2",
|
|
64
|
-
"@iblai/iblai-api": "4.
|
|
69
|
+
"@iblai/iblai-api": "4.166.0-ai",
|
|
65
70
|
"react": "19.1.0"
|
|
66
71
|
},
|
|
72
|
+
"peerDependenciesMeta": {
|
|
73
|
+
"@tauri-apps/api": {
|
|
74
|
+
"optional": true
|
|
75
|
+
}
|
|
76
|
+
},
|
|
67
77
|
"packageManager": "pnpm@10.11.0",
|
|
68
78
|
"publishConfig": {
|
|
69
79
|
"access": "public",
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tests for packages/web-utils/src/index.web.ts
|
|
3
|
+
*
|
|
4
|
+
* This file tests the web-specific entry point for @iblai/web-utils.
|
|
5
|
+
* It verifies all exports are properly exposed and functional,
|
|
6
|
+
* including web-specific features like Next.js navigation hooks.
|
|
7
|
+
*/
|
|
8
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,12 +1,28 @@
|
|
|
1
1
|
import type { AdvancedTab } from "../../utils";
|
|
2
2
|
import type { Message } from "../../hooks/chat/use-chat-v2";
|
|
3
3
|
export type ChatState = Record<AdvancedTab, Message[]>;
|
|
4
|
-
export
|
|
5
|
-
}
|
|
4
|
+
export type SessionIds = Record<AdvancedTab, string>;
|
|
6
5
|
export type StreamingMessage = {
|
|
7
6
|
id: string;
|
|
8
7
|
content: string;
|
|
9
8
|
};
|
|
9
|
+
export type StreamingArtifact = {
|
|
10
|
+
id?: number;
|
|
11
|
+
title: string;
|
|
12
|
+
fileExtension: string;
|
|
13
|
+
content: string;
|
|
14
|
+
isUpdate: boolean;
|
|
15
|
+
isPartial: boolean;
|
|
16
|
+
startIndex?: number;
|
|
17
|
+
endIndex?: number;
|
|
18
|
+
org?: string;
|
|
19
|
+
userId?: string;
|
|
20
|
+
sessionId?: string;
|
|
21
|
+
versionNumber?: number;
|
|
22
|
+
metadata?: Record<string, unknown>;
|
|
23
|
+
};
|
|
24
|
+
export declare const STREAMING_CONTENT_BUFFER_THRESHOLD = 300;
|
|
25
|
+
export declare const STREAMING_CONTENT_FLUSH_INTERVAL = 300;
|
|
10
26
|
export declare const defaultSessionIds: SessionIds;
|
|
11
27
|
export type ChatStatus = "idle" | "pending" | "streaming" | "stopped" | "error";
|
|
12
28
|
type ChatSliceState = {
|
|
@@ -14,6 +30,7 @@ type ChatSliceState = {
|
|
|
14
30
|
isTyping: boolean;
|
|
15
31
|
streaming: boolean;
|
|
16
32
|
currentStreamingMessage: StreamingMessage;
|
|
33
|
+
currentStreamingArtifact: StreamingArtifact | null;
|
|
17
34
|
activeTab: AdvancedTab;
|
|
18
35
|
sessionId: string;
|
|
19
36
|
sessionIds: SessionIds;
|
|
@@ -31,6 +48,9 @@ type ChatSliceState = {
|
|
|
31
48
|
documentFilter: Record<string, unknown> | null;
|
|
32
49
|
shouldStartNewChat: boolean;
|
|
33
50
|
showingSharedChat: boolean;
|
|
51
|
+
artifactsEnabled: boolean;
|
|
52
|
+
streamingArtifactContentBuffer: string;
|
|
53
|
+
lastArtifactContentFlushTime: number;
|
|
34
54
|
};
|
|
35
55
|
export declare const chatActions: import("@reduxjs/toolkit").CaseReducerActions<import("@reduxjs/toolkit").SliceCaseReducers<ChatSliceState>, string>;
|
|
36
56
|
export declare const chatSliceReducerShared: import("@reduxjs/toolkit").Reducer<ChatSliceState>;
|
|
@@ -100,4 +120,19 @@ export declare const selectShouldStartNewChat: (state: {
|
|
|
100
120
|
export declare const selectShowingSharedChat: (state: {
|
|
101
121
|
chatSliceShared: ChatSliceState;
|
|
102
122
|
}) => boolean;
|
|
123
|
+
export declare const selectArtifactsEnabled: (state: {
|
|
124
|
+
chatSliceShared: ChatSliceState;
|
|
125
|
+
}) => boolean;
|
|
126
|
+
export declare const selectCurrentStreamingArtifact: (state: {
|
|
127
|
+
chatSliceShared: ChatSliceState;
|
|
128
|
+
}) => StreamingArtifact | null;
|
|
129
|
+
export declare const selectStreamingArtifactContentBuffer: (state: {
|
|
130
|
+
chatSliceShared: ChatSliceState;
|
|
131
|
+
}) => string;
|
|
132
|
+
export declare const selectLastArtifactContentFlushTime: (state: {
|
|
133
|
+
chatSliceShared: ChatSliceState;
|
|
134
|
+
}) => number;
|
|
135
|
+
export declare const selectStreamingArtifactFullContent: (state: {
|
|
136
|
+
chatSliceShared: ChatSliceState;
|
|
137
|
+
}) => string | null;
|
|
103
138
|
export {};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Combines multiple CSV data objects by merging rows based on a common column.
|
|
3
|
+
* Duplicate columns across CSVs are included only once.
|
|
4
|
+
*
|
|
5
|
+
* @param csvDataArray - Array of CSV data objects with headers and rows
|
|
6
|
+
* @param joinColumn - Column name to use for joining (default: 'email')
|
|
7
|
+
* @returns Combined CSV data with merged headers and rows
|
|
8
|
+
*/
|
|
9
|
+
export declare function combineCSVData(csvDataArray: Array<{
|
|
10
|
+
headers: string[];
|
|
11
|
+
rows: string[][];
|
|
12
|
+
}>, joinColumn?: string): {
|
|
13
|
+
headers: string[];
|
|
14
|
+
rows: string[][];
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* Parses CSV text into headers and rows
|
|
18
|
+
*
|
|
19
|
+
* @param csvText - Raw CSV text content
|
|
20
|
+
* @returns Object with headers and rows arrays
|
|
21
|
+
*/
|
|
22
|
+
export declare function parseCSV(csvText: string): {
|
|
23
|
+
headers: string[];
|
|
24
|
+
rows: string[][];
|
|
25
|
+
};
|
|
26
|
+
/**
|
|
27
|
+
* Converts CSV data back to CSV text format
|
|
28
|
+
*
|
|
29
|
+
* @param data - Object with headers and rows
|
|
30
|
+
* @returns CSV text content
|
|
31
|
+
*/
|
|
32
|
+
export declare function csvDataToText(data: {
|
|
33
|
+
headers: string[];
|
|
34
|
+
rows: string[][];
|
|
35
|
+
}): string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./combine-csv";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
type WithFormPermissionsProps = {
|
|
3
|
+
name: string | string[];
|
|
4
|
+
permissions: Record<string, {
|
|
5
|
+
read?: boolean;
|
|
6
|
+
write: boolean;
|
|
7
|
+
delete?: boolean;
|
|
8
|
+
}>;
|
|
9
|
+
children: (props: {
|
|
10
|
+
disabled: boolean;
|
|
11
|
+
canDelete?: boolean;
|
|
12
|
+
}) => React.ReactNode;
|
|
13
|
+
enableRBAC?: boolean;
|
|
14
|
+
};
|
|
15
|
+
declare const WithFormPermissions: React.FC<WithFormPermissionsProps>;
|
|
16
|
+
export default WithFormPermissions;
|
|
17
|
+
/**
|
|
18
|
+
* Check if the user has the permissions to access the component
|
|
19
|
+
* @param rbacResource - The resource in the permission rbac slice to check for. Supports:
|
|
20
|
+
* - Single resource: "mentors#read"
|
|
21
|
+
* - OR operator (|): "apitokens#create|apitokens#list" - returns true if ANY permission exists
|
|
22
|
+
* - AND operator (&): "apitokens#create&apitokens#list" - returns true if ALL permissions exist
|
|
23
|
+
* @param rbacPermissions - The RBAC permissions object from the store.
|
|
24
|
+
* @param children - The component to render if the user has the permissions.
|
|
25
|
+
*/
|
|
26
|
+
type WithPermissionsProps = {
|
|
27
|
+
rbacResource: string;
|
|
28
|
+
rbacPermissions: object;
|
|
29
|
+
children: (props: {
|
|
30
|
+
hasPermission: boolean;
|
|
31
|
+
}) => React.ReactNode;
|
|
32
|
+
};
|
|
33
|
+
export declare const WithPermissions: ({ rbacResource, rbacPermissions, children, }: WithPermissionsProps) => import("react/jsx-runtime").JSX.Element;
|
|
34
|
+
/**
|
|
35
|
+
* Check RBAC permissions for a resource string that may contain operators
|
|
36
|
+
* @param rbacPermissions - The RBAC permissions object
|
|
37
|
+
* @param rbacResource - The resource path to check. Supports:
|
|
38
|
+
* - Single resource: "mentors#read"
|
|
39
|
+
* - OR operator (|): "apitokens#create|apitokens#list" - returns true if ANY permission exists
|
|
40
|
+
* - AND operator (&): "apitokens#create&apitokens#list" - returns true if ALL permissions exist
|
|
41
|
+
* @param enableRBAC - Whether RBAC is enabled (if false, always returns true)
|
|
42
|
+
* @returns boolean indicating if permission exists
|
|
43
|
+
*/
|
|
44
|
+
export declare const checkRbacPermission: (rbacPermissions: object, rbacResource: string, enableRBAC?: boolean) => boolean;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
export interface OllamaMessage {
|
|
2
|
+
role: "user" | "assistant" | "system";
|
|
3
|
+
content: string;
|
|
4
|
+
}
|
|
5
|
+
export interface OllamaChatRequest {
|
|
6
|
+
model: string;
|
|
7
|
+
messages: OllamaMessage[];
|
|
8
|
+
stream?: boolean;
|
|
9
|
+
}
|
|
10
|
+
export interface OllamaChatStreamResponse {
|
|
11
|
+
model: string;
|
|
12
|
+
created_at: string;
|
|
13
|
+
message: {
|
|
14
|
+
role: "assistant";
|
|
15
|
+
content: string;
|
|
16
|
+
};
|
|
17
|
+
done: boolean;
|
|
18
|
+
total_duration?: number;
|
|
19
|
+
load_duration?: number;
|
|
20
|
+
prompt_eval_count?: number;
|
|
21
|
+
prompt_eval_duration?: number;
|
|
22
|
+
eval_count?: number;
|
|
23
|
+
eval_duration?: number;
|
|
24
|
+
}
|
|
25
|
+
export interface OllamaStreamCallbacks {
|
|
26
|
+
onStart: (generationId: string) => void;
|
|
27
|
+
onToken: (token: string, fullContent: string) => void;
|
|
28
|
+
onEnd: (fullContent: string) => void;
|
|
29
|
+
onError: (error: string) => void;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Check if Ollama is running and accessible
|
|
33
|
+
*/
|
|
34
|
+
export declare function checkOllamaHealth(): Promise<boolean>;
|
|
35
|
+
/**
|
|
36
|
+
* Check if a specific model is available in Ollama
|
|
37
|
+
*/
|
|
38
|
+
export declare function checkModelAvailable(model?: string): Promise<boolean>;
|
|
39
|
+
/**
|
|
40
|
+
* Send a chat message to Ollama with streaming response
|
|
41
|
+
* This mimics the WebSocket behavior of the main chat
|
|
42
|
+
*
|
|
43
|
+
* When running in Tauri, uses Tauri commands to proxy the request
|
|
44
|
+
* to avoid mixed content (HTTPS -> HTTP) browser blocking.
|
|
45
|
+
*/
|
|
46
|
+
export declare function streamOllamaChat(messages: OllamaMessage[], callbacks: OllamaStreamCallbacks, abortController?: AbortController): Promise<void>;
|
|
47
|
+
/**
|
|
48
|
+
* Convert chat history to Ollama format
|
|
49
|
+
*/
|
|
50
|
+
export declare function convertToOllamaMessages(messages: Array<{
|
|
51
|
+
role: "user" | "assistant" | "system";
|
|
52
|
+
content: string;
|
|
53
|
+
}>): OllamaMessage[];
|
|
54
|
+
/**
|
|
55
|
+
* Get system prompt for the local LLM
|
|
56
|
+
*/
|
|
57
|
+
export declare function getLocalLLMSystemPrompt(): OllamaMessage;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import type { ChatMode } from "../../types";
|
|
2
|
+
import type { ChatMode, Error402MessageData } from "../../types";
|
|
3
3
|
import { type AdvancedTab } from "../../utils";
|
|
4
|
-
import { Message } from "./use-chat-v2";
|
|
4
|
+
import { Message, type OAuthRequiredData, type OAuthResolvedData } from "./use-chat-v2";
|
|
5
5
|
import { ChatStatus } from "../../features/chat/slice";
|
|
6
6
|
type Props = {
|
|
7
7
|
mode?: ChatMode;
|
|
@@ -16,11 +16,15 @@ type Props = {
|
|
|
16
16
|
errorHandler?: (message: string, error?: any) => void;
|
|
17
17
|
isPreviewMode?: boolean;
|
|
18
18
|
mentorShareableToken?: string | null;
|
|
19
|
-
on402Error?: (message:
|
|
19
|
+
on402Error?: (message: Error402MessageData) => void;
|
|
20
20
|
cachedSessionId?: Record<string, string>;
|
|
21
21
|
onStartNewChat?: (sessionId: string) => void;
|
|
22
|
+
onOAuthRequired?: (data: OAuthRequiredData) => void;
|
|
23
|
+
onOAuthResolved?: (data: OAuthResolvedData) => void;
|
|
24
|
+
isOffline?: boolean;
|
|
25
|
+
onOfflineWithoutLocalLLM?: () => void;
|
|
22
26
|
};
|
|
23
|
-
export declare function useAdvancedChat({ tenantKey, mentorId, username, token, wsUrl, stopGenerationWsUrl, redirectToAuthSpa, errorHandler, sendMessageToParentWebsite, isPreviewMode, mentorShareableToken, on402Error, cachedSessionId, onStartNewChat, }: Props): {
|
|
27
|
+
export declare function useAdvancedChat({ tenantKey, mentorId, username, token, wsUrl, stopGenerationWsUrl, redirectToAuthSpa, errorHandler, sendMessageToParentWebsite, isPreviewMode, mentorShareableToken, on402Error, cachedSessionId, onStartNewChat, onOAuthRequired, onOAuthResolved, isOffline, onOfflineWithoutLocalLLM, }: Props): {
|
|
24
28
|
messages: Message[];
|
|
25
29
|
isStreaming: boolean;
|
|
26
30
|
status: ChatStatus;
|
|
@@ -46,5 +50,7 @@ export declare function useAdvancedChat({ tenantKey, mentorId, username, token,
|
|
|
46
50
|
sessionIds: import("../../features").SessionIds;
|
|
47
51
|
enableSafetyDisclaimer: boolean;
|
|
48
52
|
resetConnection: () => void;
|
|
53
|
+
isLoadingChats: boolean;
|
|
54
|
+
refetchChats: () => Promise<void>;
|
|
49
55
|
};
|
|
50
56
|
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
import React from "react";
|
|
1
2
|
import type { AdvancedTab } from "../../utils/data/advanced-tab";
|
|
2
3
|
import { ChatStatus } from "@web-utils/features";
|
|
3
4
|
import { FileReference } from "../../types/file-upload";
|
|
5
|
+
import { Error402MessageData } from "@web-utils/types";
|
|
4
6
|
type MessageActionTypes = "redirectToAuthSpaJoinTenant";
|
|
5
7
|
export interface MessageAction {
|
|
6
8
|
text: string;
|
|
@@ -14,6 +16,36 @@ export interface FileAttachment {
|
|
|
14
16
|
uploadUrl?: string;
|
|
15
17
|
fileId?: string;
|
|
16
18
|
}
|
|
19
|
+
export interface ArtifactData {
|
|
20
|
+
id: number;
|
|
21
|
+
title: string;
|
|
22
|
+
content: string;
|
|
23
|
+
file_extension: string;
|
|
24
|
+
llm_name?: string;
|
|
25
|
+
llm_provider?: string;
|
|
26
|
+
date_created: string;
|
|
27
|
+
date_updated: string;
|
|
28
|
+
metadata?: Record<string, unknown>;
|
|
29
|
+
username?: string;
|
|
30
|
+
session_id?: string;
|
|
31
|
+
current_version_number?: number;
|
|
32
|
+
version_count?: number;
|
|
33
|
+
}
|
|
34
|
+
export interface ArtifactVersion {
|
|
35
|
+
id: number;
|
|
36
|
+
artifact: ArtifactData;
|
|
37
|
+
title: string;
|
|
38
|
+
content: string;
|
|
39
|
+
session_id?: string;
|
|
40
|
+
content_length?: number;
|
|
41
|
+
is_current: boolean;
|
|
42
|
+
is_partial?: boolean;
|
|
43
|
+
chat_message?: number;
|
|
44
|
+
version_number: number;
|
|
45
|
+
date_created: string;
|
|
46
|
+
created_by?: string;
|
|
47
|
+
change_summary?: string;
|
|
48
|
+
}
|
|
17
49
|
export interface Message {
|
|
18
50
|
id: string;
|
|
19
51
|
role: "user" | "assistant" | "system";
|
|
@@ -25,11 +57,32 @@ export interface Message {
|
|
|
25
57
|
visible: boolean;
|
|
26
58
|
actions?: MessageAction[];
|
|
27
59
|
fileAttachments?: FileAttachment[];
|
|
60
|
+
artifactVersions?: ArtifactVersion[];
|
|
28
61
|
}
|
|
62
|
+
export type ArtifactPayload = {
|
|
63
|
+
title: string;
|
|
64
|
+
file_extension: string;
|
|
65
|
+
id: string;
|
|
66
|
+
is_partial?: boolean;
|
|
67
|
+
snippet_start?: number;
|
|
68
|
+
snippet_end?: number;
|
|
69
|
+
};
|
|
29
70
|
export type SendMessageOptions = {
|
|
30
71
|
visible?: boolean;
|
|
31
72
|
fileReferences?: FileReference[];
|
|
73
|
+
artifact?: ArtifactPayload;
|
|
32
74
|
} | undefined;
|
|
75
|
+
export interface OAuthRequiredData {
|
|
76
|
+
serverName: string;
|
|
77
|
+
serverId: number;
|
|
78
|
+
authUrl: string;
|
|
79
|
+
message: string;
|
|
80
|
+
}
|
|
81
|
+
export interface OAuthResolvedData {
|
|
82
|
+
serverName: string;
|
|
83
|
+
serverId: number;
|
|
84
|
+
message: string;
|
|
85
|
+
}
|
|
33
86
|
export interface UseChatProps {
|
|
34
87
|
wsUrl: string;
|
|
35
88
|
wsToken: string;
|
|
@@ -60,7 +113,11 @@ export interface UseChatProps {
|
|
|
60
113
|
}) => void;
|
|
61
114
|
onAddUserMessage?: (activeTab: AdvancedTab, message: Message) => void;
|
|
62
115
|
sendMessageToParentWebsite?: (payload: unknown) => void;
|
|
63
|
-
on402Error?: (message:
|
|
116
|
+
on402Error?: (message: Error402MessageData) => void;
|
|
117
|
+
onOAuthRequired?: (data: OAuthRequiredData) => void;
|
|
118
|
+
onOAuthResolved?: (data: OAuthResolvedData) => void;
|
|
119
|
+
onOfflineWithoutLocalLLM?: () => void;
|
|
120
|
+
isOffline?: boolean;
|
|
64
121
|
}
|
|
65
122
|
export interface UseChatReturn {
|
|
66
123
|
sendMessage: (tab: AdvancedTab, text: string, options?: SendMessageOptions) => Promise<void>;
|
|
@@ -70,5 +127,5 @@ export interface UseChatReturn {
|
|
|
70
127
|
stopGenerating: () => void;
|
|
71
128
|
resetConnection: () => void;
|
|
72
129
|
}
|
|
73
|
-
export declare const useChat: ({ wsUrl, wsToken, flowConfig, sessionId, stopGenerationWsUrl, enableHaptics, hapticFeedback, store, errorHandler, onStatusChange, onStreamingChange, onStreamingMessageUpdate, WebSocketImpl, redirectToAuthSpa, sendMessageToParentWebsite, on402Error, }: UseChatProps) => UseChatReturn;
|
|
130
|
+
export declare const useChat: ({ wsUrl, wsToken, flowConfig, sessionId, stopGenerationWsUrl, enableHaptics, hapticFeedback, store, errorHandler, onStatusChange, onStreamingChange, onStreamingMessageUpdate, WebSocketImpl, redirectToAuthSpa, sendMessageToParentWebsite, on402Error, onOAuthRequired, onOAuthResolved, onOfflineWithoutLocalLLM, isOffline, }: UseChatProps) => UseChatReturn;
|
|
74
131
|
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -12,10 +12,12 @@ export declare function useMentorTools({ tenantKey, mentorId, username, errorHan
|
|
|
12
12
|
enableWebBrowsing: boolean;
|
|
13
13
|
screenSharing: boolean;
|
|
14
14
|
deepResearch: boolean;
|
|
15
|
+
studyMode: boolean;
|
|
15
16
|
imageGeneration: boolean;
|
|
16
17
|
codeInterpreter: boolean;
|
|
17
18
|
promptsIsEnabled: boolean;
|
|
18
19
|
googleSlidesIsEnabled: boolean;
|
|
19
20
|
googleDocumentIsEnabled: boolean;
|
|
21
|
+
artifactsEnabled: boolean;
|
|
20
22
|
};
|
|
21
23
|
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -11,6 +11,7 @@ export * from "./chat/use-mentor-tools";
|
|
|
11
11
|
export * from "./profile/use-user-profile-update";
|
|
12
12
|
export * from "./profile/use-profile-image-upload";
|
|
13
13
|
export * from "./chat/use-chat-v2";
|
|
14
|
+
export * from "./chat/ollama-client";
|
|
14
15
|
export * from "./tenant-metadata/use-tenant-metadata";
|
|
15
16
|
export * from "./tenant-metadata/constants";
|
|
16
17
|
export * from "./use-mentor-settings";
|
|
@@ -49,3 +49,8 @@ export declare const SUBSCRIPTION_PACKAGES: {
|
|
|
49
49
|
STARTER_PACKAGE: (productName: string) => string;
|
|
50
50
|
PRO_PACKAGE: (productName: string) => string;
|
|
51
51
|
};
|
|
52
|
+
export declare const SUBSCRIPTION_PACKAGES_V2: {
|
|
53
|
+
FREE_PACKAGE: string;
|
|
54
|
+
STARTER_PACKAGE: string;
|
|
55
|
+
PRO_PACKAGE: string;
|
|
56
|
+
};
|
|
@@ -7,10 +7,65 @@ export declare const useSubscriptionHandlerV2: (subscriptionFlow: SubscriptionFl
|
|
|
7
7
|
handleSubscriptionCheck: () => Promise<void>;
|
|
8
8
|
bannerButtonTriggerCallback: (trigger: string) => ((returnURL?: string) => Promise<void>) | (() => void);
|
|
9
9
|
CREDIT_INTERVAL_CHECK_COUNTER: number;
|
|
10
|
-
getBillingURL: ({ returnURL, includeSubscriptionIdIfNeeded, }: {
|
|
10
|
+
getBillingURL: ({ returnURL, includeSubscriptionIdIfNeeded, additionalPayload, }: {
|
|
11
11
|
returnURL: string;
|
|
12
12
|
includeSubscriptionIdIfNeeded?: boolean;
|
|
13
|
+
additionalPayload?: Record<string, any>;
|
|
13
14
|
}) => Promise<string | null | undefined>;
|
|
14
15
|
getTopUpURL: (obtainBillingPageURLIfNeeded?: boolean) => Promise<string | null | undefined>;
|
|
15
16
|
getUserSubscriptionPackage: () => Promise<string | null>;
|
|
17
|
+
getUserActiveApp: (platformKey?: string, useCache?: boolean) => Promise<{
|
|
18
|
+
id: null;
|
|
19
|
+
app: {
|
|
20
|
+
name: string;
|
|
21
|
+
url: string;
|
|
22
|
+
type: string;
|
|
23
|
+
metadata: null;
|
|
24
|
+
onboarding_required: boolean;
|
|
25
|
+
};
|
|
26
|
+
platform: {
|
|
27
|
+
key: any;
|
|
28
|
+
name: any;
|
|
29
|
+
org: any;
|
|
30
|
+
lms_url: null;
|
|
31
|
+
cms_url: null;
|
|
32
|
+
portal_url: null;
|
|
33
|
+
is_advertising: boolean;
|
|
34
|
+
is_enterprise: boolean;
|
|
35
|
+
};
|
|
36
|
+
subscription: {
|
|
37
|
+
identifier: any;
|
|
38
|
+
product: null;
|
|
39
|
+
active: boolean;
|
|
40
|
+
subscription_ends: null;
|
|
41
|
+
subscription_starts: null;
|
|
42
|
+
created_on: null;
|
|
43
|
+
last_updated: null;
|
|
44
|
+
owner: {
|
|
45
|
+
email: null;
|
|
46
|
+
username: null;
|
|
47
|
+
};
|
|
48
|
+
trial_ends: null;
|
|
49
|
+
entitlements: {
|
|
50
|
+
has_credits: any;
|
|
51
|
+
account_id: any;
|
|
52
|
+
available_credits: any;
|
|
53
|
+
};
|
|
54
|
+
uuid: any;
|
|
55
|
+
stripe_mode: null;
|
|
56
|
+
status: string;
|
|
57
|
+
subscription_id: null;
|
|
58
|
+
product_sku: any;
|
|
59
|
+
};
|
|
60
|
+
provider: string;
|
|
61
|
+
is_admin: boolean;
|
|
62
|
+
is_active: boolean;
|
|
63
|
+
metadata: null;
|
|
64
|
+
onboarding_completed: boolean;
|
|
65
|
+
free_trial_started: any;
|
|
66
|
+
free_trial_expired: boolean;
|
|
67
|
+
has_active_subscription: boolean;
|
|
68
|
+
pricing_table: any;
|
|
69
|
+
} | null>;
|
|
70
|
+
getUserActiveAppLegacy: (platformKey?: string, useCache?: boolean) => Promise<import("@iblai/iblai-api").UserApp | undefined>;
|
|
16
71
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|