@blueking/ai-ui-sdk 0.1.1 → 0.1.2-beta.10
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/components/render-aside/index.vue.css +9 -9
- package/dist/components/render-aside/index.vue.js +1 -1
- package/dist/components/render-auth/auth-dialog-fn.d.ts +2 -0
- package/dist/components/render-auth/auth-dialog-fn.ts.js +14 -0
- package/dist/components/render-auth/auth-dialog.script.vue.js.js +110 -0
- package/dist/components/render-auth/auth-dialog.vue.css +4 -0
- package/dist/components/render-auth/auth-dialog.vue.d.ts +5 -0
- package/dist/components/render-auth/auth-dialog.vue.js +4 -0
- package/dist/components/render-auto-height-textarea/index.vue.css +11 -11
- package/dist/components/render-auto-height-textarea/index.vue.d.ts +2 -2
- package/dist/components/render-auto-height-textarea/index.vue.js +1 -1
- package/dist/components/render-choose-tag/index.script.vue.js.js +242 -0
- package/dist/components/render-choose-tag/index.vue.css +39 -0
- package/dist/components/render-choose-tag/index.vue.d.ts +12 -0
- package/dist/components/render-choose-tag/index.vue.js +5 -0
- package/dist/components/render-collapse/index.vue.css +2 -2
- package/dist/components/render-collapse/index.vue.js +1 -1
- package/dist/components/render-dataset/components/edit-dataset-data/index.script.vue.js.js +4 -3
- package/dist/components/render-dataset/components/edit-dataset-data/index.vue.css +3 -3
- package/dist/components/render-dataset/components/edit-dataset-data/index.vue.d.ts +1 -0
- package/dist/components/render-dataset/components/edit-dataset-data/index.vue.js +1 -1
- package/dist/components/render-dataset/components/operation-record/index.script.vue.js.js +8 -5
- package/dist/components/render-dataset/components/operation-record/index.vue.css +4 -4
- package/dist/components/render-dataset/components/operation-record/index.vue.d.ts +1 -0
- package/dist/components/render-dataset/components/operation-record/index.vue.js +1 -1
- package/dist/components/render-dataset/components/operation-record/table/index.script.vue.js.js +4 -3
- package/dist/components/render-dataset/components/operation-record/table/index.vue.css +1 -1
- package/dist/components/render-dataset/components/operation-record/table/index.vue.d.ts +1 -0
- package/dist/components/render-dataset/components/operation-record/table/index.vue.js +1 -1
- package/dist/components/render-dataset/components/operation-record/view-op-result/index.vue.css +2 -2
- package/dist/components/render-dataset/components/operation-record/view-op-result/index.vue.js +1 -1
- package/dist/components/render-dataset/components/plus-dataset/dataset-footer.script.vue.js.js +6 -4
- package/dist/components/render-dataset/components/plus-dataset/dataset-footer.vue.d.ts +4 -2
- package/dist/components/render-dataset/components/plus-dataset/dataset-form.script.vue.js +89 -26
- package/dist/components/render-dataset/components/plus-dataset/dataset-form.vue.d.ts +3 -0
- package/dist/components/render-dataset/components/plus-dataset/index.script.vue.js.js +73 -22
- package/dist/components/render-dataset/components/plus-dataset/index.vue.css +2 -2
- package/dist/components/render-dataset/components/plus-dataset/index.vue.d.ts +3 -0
- package/dist/components/render-dataset/components/plus-dataset/index.vue.js +1 -1
- package/dist/components/render-dataset/components/plus-dataset-data/form/dataset.script.vue.js.js +4 -3
- package/dist/components/render-dataset/components/plus-dataset-data/form/dataset.vue.d.ts +1 -0
- package/dist/components/render-dataset/components/plus-dataset-data/form/file.script.vue.js.js +4 -3
- package/dist/components/render-dataset/components/plus-dataset-data/form/file.vue.d.ts +1 -0
- package/dist/components/render-dataset/components/plus-dataset-data/form/footer.script.vue.js.js +4 -3
- package/dist/components/render-dataset/components/plus-dataset-data/form/footer.vue.css +1 -1
- package/dist/components/render-dataset/components/plus-dataset-data/form/footer.vue.d.ts +1 -0
- package/dist/components/render-dataset/components/plus-dataset-data/form/footer.vue.js +1 -1
- package/dist/components/render-dataset/components/plus-dataset-data/form/index.script.vue.js.js +13 -4
- package/dist/components/render-dataset/components/plus-dataset-data/form/index.vue.css +2 -2
- package/dist/components/render-dataset/components/plus-dataset-data/form/index.vue.d.ts +1 -0
- package/dist/components/render-dataset/components/plus-dataset-data/form/index.vue.js +1 -1
- package/dist/components/render-dataset/components/plus-dataset-data/form/manual.script.vue.js +4 -3
- package/dist/components/render-dataset/components/plus-dataset-data/form/manual.vue.d.ts +1 -0
- package/dist/components/render-dataset/components/plus-dataset-data/index.script.vue.js.js +4 -1
- package/dist/components/render-dataset/components/plus-dataset-data/index.vue.d.ts +1 -0
- package/dist/components/render-dataset/components/search-dataset/index.script.vue.js.js +21 -6
- package/dist/components/render-dataset/components/search-dataset/index.vue.d.ts +2 -0
- package/dist/components/render-dataset/components/source-type-icon/index.vue.css +3 -3
- package/dist/components/render-dataset/components/source-type-icon/index.vue.js +1 -1
- package/dist/components/render-dataset/index.script.vue.js.js +7 -4
- package/dist/components/render-dataset/index.vue.css +1 -1
- package/dist/components/render-dataset/index.vue.d.ts +1 -0
- package/dist/components/render-dataset/index.vue.js +1 -1
- package/dist/components/render-dataset-detail/components/header.script.vue.js.js +4 -3
- package/dist/components/render-dataset-detail/components/header.vue.d.ts +1 -0
- package/dist/components/render-dataset-detail/index.script.vue.js.js +6 -3
- package/dist/components/render-dataset-detail/index.vue.d.ts +1 -0
- package/dist/components/render-dataset-detail-origin-data/components/batch-operation/index.script.vue.js.js +4 -3
- package/dist/components/render-dataset-detail-origin-data/components/batch-operation/index.vue.d.ts +1 -0
- package/dist/components/render-dataset-detail-origin-data/components/table/index.script.vue.js +13 -8
- package/dist/components/render-dataset-detail-origin-data/components/table/index.vue.css +1 -1
- package/dist/components/render-dataset-detail-origin-data/components/table/index.vue.d.ts +1 -0
- package/dist/components/render-dataset-detail-origin-data/components/table/index.vue.js +1 -1
- package/dist/components/render-dataset-detail-origin-data/index.script.vue.js.js +12 -5
- package/dist/components/render-dataset-detail-origin-data/index.vue.css +3 -3
- package/dist/components/render-dataset-detail-origin-data/index.vue.d.ts +1 -0
- package/dist/components/render-dataset-detail-origin-data/index.vue.js +1 -1
- package/dist/components/render-dataset-list/components/main.script.vue.js.js +23 -5
- package/dist/components/render-dataset-list/components/main.vue.css +3 -3
- package/dist/components/render-dataset-list/components/main.vue.d.ts +2 -0
- package/dist/components/render-dataset-list/components/main.vue.js +1 -1
- package/dist/components/render-dataset-list/components/table.script.vue.js.js +199 -33
- package/dist/components/render-dataset-list/components/table.vue.d.ts +2 -0
- package/dist/components/render-dataset-list/index.script.vue.js.js +10 -2
- package/dist/components/render-dataset-list/index.vue.d.ts +2 -0
- package/dist/components/render-expand-collapse/index.vue.css +3 -3
- package/dist/components/render-expand-collapse/index.vue.js +1 -1
- package/dist/components/render-file-card/index.vue.css +11 -11
- package/dist/components/render-file-card/index.vue.js +1 -1
- package/dist/components/render-file-type-icon/index.vue.css +5 -5
- package/dist/components/render-file-type-icon/index.vue.js +1 -1
- package/dist/components/render-header/index.vue.css +5 -5
- package/dist/components/render-header/index.vue.js +1 -1
- package/dist/components/render-router-tab/index.vue.css +3 -3
- package/dist/components/render-router-tab/index.vue.js +1 -1
- package/dist/{component.d.ts → components.d.ts} +3 -1
- package/dist/{component.ts.js → components.ts.js} +3 -1
- package/dist/enums.d.ts +1 -0
- package/dist/enums.ts.js +1 -0
- package/dist/events.d.ts +1 -0
- package/dist/events.ts.js +1 -0
- package/dist/hooks/use-chat.d.ts +4 -3
- package/dist/hooks/use-chat.ts.js +84 -57
- package/dist/hooks/use-dataset-http.d.ts +2 -1
- package/dist/hooks/use-dataset-http.ts.js +102 -19
- package/dist/hooks/use-form-rule.d.ts +29 -0
- package/dist/hooks/use-form-rule.ts.js +101 -0
- package/dist/hooks/use-meta-http.d.ts +16 -0
- package/dist/hooks/use-meta-http.ts.js +83 -0
- package/dist/hooks/use-permission-http.d.ts +7 -0
- package/dist/hooks/use-permission-http.ts.js +26 -0
- package/dist/hooks/use-permission.d.ts +9 -0
- package/dist/hooks/use-permission.ts.js +100 -0
- package/dist/hooks/use-session-http.d.ts +1 -1
- package/dist/hooks/use-session-http.ts.js +37 -11
- package/dist/hooks.d.ts +7 -0
- package/dist/hooks.ts.js +7 -0
- package/dist/http/fetch/index.ts.js +59 -6
- package/dist/http/helper/agent.ts.js +4 -1
- package/dist/http/helper/dataset.ts.js +13 -9
- package/dist/http/helper/permission.d.ts +7 -1
- package/dist/http/helper/permission.ts.js +8 -0
- package/dist/http/helper/session.d.ts +10 -0
- package/dist/http/helper/session.ts.js +33 -3
- package/dist/https.d.ts +2 -0
- package/dist/https.ts.js +2 -0
- package/dist/transforms.d.ts +4 -0
- package/dist/transforms.ts.js +4 -0
- package/dist/types/agent.d.ts +7 -0
- package/dist/types/dataset.d.ts +12 -0
- package/dist/types/enum.d.ts +42 -0
- package/dist/types/enum.ts.js +45 -0
- package/dist/types/meta.d.ts +3 -0
- package/dist/types/permission.d.ts +40 -0
- package/dist/types.d.ts +6 -0
- package/dist/types.ts.js +6 -0
- package/package.json +31 -10
- package/dist/main.d.ts +0 -22
- package/dist/main.ts.js +0 -28
@@ -1,21 +1,21 @@
|
|
1
1
|
|
2
|
-
.upload-file-home[data-v-
|
2
|
+
.upload-file-home[data-v-ggb0r5j6] {
|
3
3
|
position: relative;
|
4
4
|
background: #FFFFFF;
|
5
5
|
border: 1px solid #DCDEE5;
|
6
6
|
border-radius: 4px;
|
7
7
|
padding: 12px 12px 10px 12px;
|
8
8
|
}
|
9
|
-
.upload-file-home[data-v-
|
9
|
+
.upload-file-home[data-v-ggb0r5j6]:hover {
|
10
10
|
border: 1px solid #3A84FF;
|
11
11
|
}
|
12
|
-
.upload-file-home:hover .file-icons[data-v-
|
12
|
+
.upload-file-home:hover .file-icons[data-v-ggb0r5j6] {
|
13
13
|
display: flex;
|
14
14
|
}
|
15
|
-
.upload-file-home .file-icon[data-v-
|
15
|
+
.upload-file-home .file-icon[data-v-ggb0r5j6] {
|
16
16
|
font-size: 32px;
|
17
17
|
}
|
18
|
-
.upload-file-home .file-content[data-v-
|
18
|
+
.upload-file-home .file-content[data-v-ggb0r5j6] {
|
19
19
|
font-size: 12px;
|
20
20
|
flex: 1;
|
21
21
|
align-items: flex-start;
|
@@ -23,28 +23,28 @@
|
|
23
23
|
font-weight: normal;
|
24
24
|
width: 0;
|
25
25
|
}
|
26
|
-
.upload-file-home .file-content .file-name[data-v-
|
26
|
+
.upload-file-home .file-content .file-name[data-v-ggb0r5j6] {
|
27
27
|
width: 100%;
|
28
28
|
font-size: 14px;
|
29
29
|
line-height: 20px;
|
30
30
|
}
|
31
|
-
.upload-file-home .file-content .file-size[data-v-
|
31
|
+
.upload-file-home .file-content .file-size[data-v-ggb0r5j6] {
|
32
32
|
font-size: 12px;
|
33
33
|
color: #979BA5;
|
34
34
|
line-height: 20px;
|
35
35
|
}
|
36
|
-
.upload-file-home .file-icons[data-v-
|
36
|
+
.upload-file-home .file-icons[data-v-ggb0r5j6] {
|
37
37
|
display: none;
|
38
38
|
color: #979BA5;
|
39
39
|
}
|
40
|
-
.upload-file-home .file-icons .bkaidev-icon[data-v-
|
40
|
+
.upload-file-home .file-icons .bkaidev-icon[data-v-ggb0r5j6] {
|
41
41
|
cursor: pointer;
|
42
42
|
margin-right: 15px;
|
43
43
|
font-size: 16px;
|
44
44
|
}
|
45
|
-
.upload-file-home .file-icons .bkaidev-icon[data-v-
|
45
|
+
.upload-file-home .file-icons .bkaidev-icon[data-v-ggb0r5j6]:hover {
|
46
46
|
color: #3A84FF;
|
47
47
|
}
|
48
|
-
.upload-file-home .file-icons .bkaidev-delete[data-v-
|
48
|
+
.upload-file-home .file-icons .bkaidev-delete[data-v-ggb0r5j6] {
|
49
49
|
margin: 0;
|
50
50
|
}
|
@@ -1,16 +1,16 @@
|
|
1
1
|
|
2
|
-
.ai-ui-sdk-icon.ai-ui-sdk-pdf[data-v-
|
2
|
+
.ai-ui-sdk-icon.ai-ui-sdk-pdf[data-v-lq1m5cmu] {
|
3
3
|
color: #EA3636;
|
4
4
|
}
|
5
|
-
.ai-ui-sdk-icon.ai-ui-sdk-doc-2[data-v-
|
5
|
+
.ai-ui-sdk-icon.ai-ui-sdk-doc-2[data-v-lq1m5cmu], .ai-ui-sdk-icon.ai-ui-sdk-ppt-2[data-v-lq1m5cmu], .ai-ui-sdk-icon.ai-ui-sdk-markdown[data-v-lq1m5cmu] {
|
6
6
|
color: #3A84FF;
|
7
7
|
}
|
8
|
-
.ai-ui-sdk-icon.ai-ui-sdk-folder-fill[data-v-
|
8
|
+
.ai-ui-sdk-icon.ai-ui-sdk-folder-fill[data-v-lq1m5cmu] {
|
9
9
|
color: #C4C6CC;
|
10
10
|
}
|
11
|
-
.ai-ui-sdk-icon.ai-ui-sdk-excel[data-v-
|
11
|
+
.ai-ui-sdk-icon.ai-ui-sdk-excel[data-v-lq1m5cmu] {
|
12
12
|
color: #2DCB56;
|
13
13
|
}
|
14
|
-
.ai-ui-sdk-icon.ai-ui-sdk-wangye[data-v-
|
14
|
+
.ai-ui-sdk-icon.ai-ui-sdk-wangye[data-v-lq1m5cmu] {
|
15
15
|
color: #14A568;
|
16
16
|
}
|
@@ -1,5 +1,5 @@
|
|
1
1
|
|
2
|
-
.header-home[data-v-
|
2
|
+
.header-home[data-v-05p8dnux] {
|
3
3
|
width: 100%;
|
4
4
|
height: 52px;
|
5
5
|
background: #FFFFFF;
|
@@ -7,14 +7,14 @@
|
|
7
7
|
position: relative;
|
8
8
|
z-index: 2;
|
9
9
|
}
|
10
|
-
.header-title[data-v-
|
10
|
+
.header-title[data-v-05p8dnux] {
|
11
11
|
position: absolute;
|
12
12
|
left: 24px;
|
13
13
|
top: 14px;
|
14
14
|
font-size: 16px;
|
15
15
|
color: #313238;
|
16
16
|
}
|
17
|
-
.header-main[data-v-
|
17
|
+
.header-main[data-v-05p8dnux] {
|
18
18
|
display: flex;
|
19
19
|
align-items: center;
|
20
20
|
justify-content: flex-end;
|
@@ -22,13 +22,13 @@
|
|
22
22
|
height: 100%;
|
23
23
|
margin: 0 auto;
|
24
24
|
}
|
25
|
-
.header-select[data-v-
|
25
|
+
.header-select[data-v-05p8dnux] {
|
26
26
|
width: 300px;
|
27
27
|
margin-right: 8px;
|
28
28
|
z-index: 9;
|
29
29
|
font-size: 12px;
|
30
30
|
}
|
31
|
-
.header-input[data-v-
|
31
|
+
.header-input[data-v-05p8dnux] {
|
32
32
|
width: 300px;
|
33
33
|
font-size: 12px;
|
34
34
|
}
|
@@ -1,12 +1,12 @@
|
|
1
1
|
|
2
|
-
.router-tab[data-v-
|
2
|
+
.router-tab[data-v-piqv65gr] {
|
3
3
|
margin-top: 2px;
|
4
4
|
height: 42px;
|
5
5
|
background: #FFFFFF;
|
6
6
|
box-shadow: 0 2px 4px 0 #1919290d;
|
7
7
|
padding: 0 45px;
|
8
8
|
}
|
9
|
-
.router-tab a[data-v-
|
9
|
+
.router-tab a[data-v-piqv65gr] {
|
10
10
|
padding: 0 8px;
|
11
11
|
margin-right: 24px;
|
12
12
|
font-size: 14px;
|
@@ -15,7 +15,7 @@
|
|
15
15
|
color: #4D4F56;
|
16
16
|
box-sizing: border-box;
|
17
17
|
}
|
18
|
-
.router-tab a.router-link-exact-active[data-v-
|
18
|
+
.router-tab a.router-link-exact-active[data-v-piqv65gr] {
|
19
19
|
color: #3A84FF;
|
20
20
|
border-bottom: 2px solid #3A84FF;
|
21
21
|
}
|
@@ -1,6 +1,8 @@
|
|
1
|
+
import { renderAuthDialog } from './components/render-auth/auth-dialog-fn';
|
1
2
|
import RenderAutoHeightTextarea from './components/render-auto-height-textarea/index.vue';
|
3
|
+
import RenderChooseTag from './components/render-choose-tag/index.vue';
|
2
4
|
import RenderDataset from './components/render-dataset/index.vue';
|
3
5
|
import RenderDatasetDetail from './components/render-dataset-detail/index.vue';
|
4
6
|
import RenderDatasetDetailOriginData from './components/render-dataset-detail-origin-data/index.vue';
|
5
7
|
import RenderDatasetList from './components/render-dataset-list/index.vue';
|
6
|
-
export { RenderDataset, RenderDatasetDetail, RenderDatasetList, RenderAutoHeightTextarea, RenderDatasetDetailOriginData, };
|
8
|
+
export { renderAuthDialog, RenderDataset, RenderDatasetDetail, RenderDatasetList, RenderAutoHeightTextarea, RenderDatasetDetailOriginData, RenderChooseTag, };
|
@@ -1,7 +1,9 @@
|
|
1
1
|
// components
|
2
|
+
import { renderAuthDialog } from './components/render-auth/auth-dialog-fn.ts.js';
|
2
3
|
import RenderAutoHeightTextarea from './components/render-auto-height-textarea/index.vue.js';
|
4
|
+
import RenderChooseTag from './components/render-choose-tag/index.vue.js';
|
3
5
|
import RenderDataset from './components/render-dataset/index.vue.js';
|
4
6
|
import RenderDatasetDetail from './components/render-dataset-detail/index.vue.js';
|
5
7
|
import RenderDatasetDetailOriginData from './components/render-dataset-detail-origin-data/index.vue.js';
|
6
8
|
import RenderDatasetList from './components/render-dataset-list/index.vue.js';
|
7
|
-
export { RenderDataset, RenderDatasetDetail, RenderDatasetList, RenderAutoHeightTextarea, RenderDatasetDetailOriginData };
|
9
|
+
export { renderAuthDialog, RenderDataset, RenderDatasetDetail, RenderDatasetList, RenderAutoHeightTextarea, RenderDatasetDetailOriginData, RenderChooseTag };
|
package/dist/enums.d.ts
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
export * from './types/enum';
|
package/dist/enums.ts.js
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
export * from './types/enum.ts.js';
|
package/dist/events.d.ts
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
export * from './event';
|
@@ -0,0 +1 @@
|
|
1
|
+
export * from './event/index.ts.js';
|
package/dist/hooks/use-chat.d.ts
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
import { SessionContentRole, SessionContentStatus } from '../types/enum';
|
2
|
-
import type {
|
2
|
+
import type { ChatCallbacks, ISession, ISessionContent, ISessionPrompt } from '../types/session';
|
3
3
|
type SessionContentsMap = {
|
4
4
|
[key: string]: ISessionContent[];
|
5
5
|
};
|
@@ -827,12 +827,12 @@ export declare const useChat: ({ handleStart, handleText, handleReferenceDoc, ha
|
|
827
827
|
sessionLoadingMap: import("vue").Ref<SessionLoadingMap, SessionLoadingMap>;
|
828
828
|
prompts: import("vue").ComputedRef<ISessionPrompt[]>;
|
829
829
|
currentSessionLoading: import("vue").ComputedRef<boolean>;
|
830
|
-
chat: ({ sessionCode, data, headers, }: {
|
830
|
+
chat: ({ sessionCode, url, data, headers, }: {
|
831
831
|
sessionCode: string;
|
832
|
+
url?: string;
|
832
833
|
data?: Record<string, any>;
|
833
834
|
headers?: Record<string, string>;
|
834
835
|
}) => void;
|
835
|
-
sendChat: (content: BasicChatContent | ShortcutChatContent, callback?: () => void) => void;
|
836
836
|
stopChat: (sessionCode: string) => void;
|
837
837
|
plusSessionContent: (sessionCode: string, sessionContent: ISessionContent) => Promise<ISessionContent>;
|
838
838
|
updateSessionContent: (sessionContent: ISessionContent) => boolean;
|
@@ -845,6 +845,7 @@ export declare const useChat: ({ handleStart, handleText, handleReferenceDoc, ha
|
|
845
845
|
deleteSessionContents: (sessionCode: string, contentIds: number[]) => Promise<number>;
|
846
846
|
handleStartChat: (sessionCode: string) => Promise<void>;
|
847
847
|
handleErrorChat: (sessionCode: string, message: string, code?: string) => Promise<void>;
|
848
|
+
handleCompleteRole: (sessionCode: string, prompts: ISessionPrompt[]) => Promise<void>;
|
848
849
|
reGenerateChat: (sessionCode: string, sessionContent: ISessionContent, sessionIndex: number) => void;
|
849
850
|
reSendChat: (sessionCode: string, sessionContent: ISessionContent, sessionIndex: number) => Promise<void>;
|
850
851
|
deleteChat: (index: number, sessionCode: string) => void;
|
@@ -55,35 +55,52 @@ function _object_spread(target) {
|
|
55
55
|
}
|
56
56
|
return target;
|
57
57
|
}
|
58
|
+
function ownKeys(object, enumerableOnly) {
|
59
|
+
var keys = Object.keys(object);
|
60
|
+
if (Object.getOwnPropertySymbols) {
|
61
|
+
var symbols = Object.getOwnPropertySymbols(object);
|
62
|
+
if (enumerableOnly) {
|
63
|
+
symbols = symbols.filter(function(sym) {
|
64
|
+
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
65
|
+
});
|
66
|
+
}
|
67
|
+
keys.push.apply(keys, symbols);
|
68
|
+
}
|
69
|
+
return keys;
|
70
|
+
}
|
71
|
+
function _object_spread_props(target, source) {
|
72
|
+
source = source != null ? source : {};
|
73
|
+
if (Object.getOwnPropertyDescriptors) {
|
74
|
+
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
75
|
+
} else {
|
76
|
+
ownKeys(Object(source)).forEach(function(key) {
|
77
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
78
|
+
});
|
79
|
+
}
|
80
|
+
return target;
|
81
|
+
}
|
58
82
|
import { computed, ref } from 'vue';
|
59
83
|
import { ChatHelper } from '../common/chart-helper.ts.js';
|
60
|
-
import {
|
84
|
+
import { throttle } from '../common/util.ts.js';
|
61
85
|
import { getHtmlContentFromDocuments, removeReferenceDoc } from './use-reference-doc.ts.js';
|
62
86
|
import { useSessionHttp } from './use-session-http.ts.js';
|
63
87
|
import { getHtmlContentFromThink, isThinking, removeThink } from './use-think.ts.js';
|
64
|
-
import { transferSessionContent2SessionPrompt } from '../http/helper/session.ts.js';
|
88
|
+
import { transferSessionContent2SessionPrompt, transferSessionPrompt2SessionContent } from '../http/helper/session.ts.js';
|
65
89
|
import { HttpErrorCode, SessionContentRole, SessionContentStatus } from '../types/enum.ts.js';
|
66
90
|
// ai 聊天
|
67
91
|
export const useChat = ({ handleStart, handleText, handleReferenceDoc, handleThink, handleEnd, handleError, requestOptions })=>{
|
68
|
-
// 用 ref 存储 requestOptions,使其可更新
|
69
|
-
const currentRequestOptions = ref(requestOptions);
|
70
92
|
// 创建一个变量保存当前的API实现
|
71
|
-
let apiImpl = useSessionHttp(
|
72
|
-
//
|
73
|
-
function updateRequestOptions(newOptions) {
|
74
|
-
// 合并新旧配置
|
75
|
-
currentRequestOptions.value = _object_spread({}, currentRequestOptions.value, newOptions);
|
76
|
-
// 如果 URL 变更,重新获取 API
|
77
|
-
if (newOptions.url) {
|
78
|
-
apiImpl = useSessionHttp(currentRequestOptions.value.url);
|
79
|
-
}
|
80
|
-
}
|
93
|
+
let apiImpl = useSessionHttp(requestOptions.url, requestOptions.headers);
|
94
|
+
// start message
|
81
95
|
const startMessage = '内容正在生成中...';
|
96
|
+
// 用 ref 存储 requestOptions,使其可更新
|
97
|
+
const currentRequestOptions = ref(requestOptions);
|
82
98
|
// 聊天上下文
|
83
99
|
const currentSession = ref();
|
84
100
|
const sessionLoadingMap = ref({});
|
85
101
|
const sessionContents = ref([]);
|
86
102
|
const sessionContentsMap = {};
|
103
|
+
const sessionWaitingPromptsMap = {};
|
87
104
|
// 通过计算得到的会话列表
|
88
105
|
const calculatedSessionContents = computed(()=>{
|
89
106
|
const calculatedSessionContents = [];
|
@@ -197,6 +214,15 @@ export const useChat = ({ handleStart, handleText, handleReferenceDoc, handleThi
|
|
197
214
|
handleEnd: handleEndChat,
|
198
215
|
handleError: handleErrorChat
|
199
216
|
});
|
217
|
+
// 更新 requestOptions 的方法
|
218
|
+
function updateRequestOptions(newOptions) {
|
219
|
+
// 合并新旧配置
|
220
|
+
currentRequestOptions.value = _object_spread({}, currentRequestOptions.value, newOptions);
|
221
|
+
// 如果 URL 变更,重新获取 API
|
222
|
+
if (newOptions.url) {
|
223
|
+
apiImpl = useSessionHttp(currentRequestOptions.value.url, currentRequestOptions.value.headers);
|
224
|
+
}
|
225
|
+
}
|
200
226
|
// 新增 db
|
201
227
|
function plusSessionContent2Db(sessionContent) {
|
202
228
|
return apiImpl.plusSessionContent(sessionContent).then((result)=>{
|
@@ -348,7 +374,7 @@ export const useChat = ({ handleStart, handleText, handleReferenceDoc, handleThi
|
|
348
374
|
const content = getHtmlContentFromDocuments(documents);
|
349
375
|
sessionContent.content = cover ? content : sessionContent.content + content;
|
350
376
|
yield throttleModifySessionContentApi(sessionContent.id, sessionContent);
|
351
|
-
|
377
|
+
yield handleReferenceDoc === null || handleReferenceDoc === void 0 ? void 0 : handleReferenceDoc(sessionCode, sessionContent);
|
352
378
|
});
|
353
379
|
return _handleReferenceDocChat.apply(this, arguments);
|
354
380
|
}
|
@@ -364,7 +390,7 @@ export const useChat = ({ handleStart, handleText, handleReferenceDoc, handleThi
|
|
364
390
|
// 更新 db
|
365
391
|
yield throttleModifySessionContentApi(sessionContent.id, sessionContent);
|
366
392
|
// 调用cb
|
367
|
-
|
393
|
+
yield handleThink === null || handleThink === void 0 ? void 0 : handleThink(sessionCode, sessionContent);
|
368
394
|
});
|
369
395
|
return _handleThinkChat.apply(this, arguments);
|
370
396
|
}
|
@@ -385,7 +411,7 @@ export const useChat = ({ handleStart, handleText, handleReferenceDoc, handleThi
|
|
385
411
|
// 更新 db
|
386
412
|
yield throttleModifySessionContentApi(sessionContent.id, sessionContent);
|
387
413
|
// 调用cb
|
388
|
-
|
414
|
+
yield handleText === null || handleText === void 0 ? void 0 : handleText(sessionCode, sessionContent);
|
389
415
|
});
|
390
416
|
return _handleTextChat.apply(this, arguments);
|
391
417
|
}
|
@@ -413,7 +439,7 @@ export const useChat = ({ handleStart, handleText, handleReferenceDoc, handleThi
|
|
413
439
|
// 更新 db
|
414
440
|
yield throttleModifySessionContentApi(sessionContent.id, sessionContent);
|
415
441
|
// 调用cb
|
416
|
-
|
442
|
+
yield handleEnd === null || handleEnd === void 0 ? void 0 : handleEnd(sessionCode, sessionContent);
|
417
443
|
}
|
418
444
|
});
|
419
445
|
return _handleEndChat.apply(this, arguments);
|
@@ -435,7 +461,7 @@ export const useChat = ({ handleStart, handleText, handleReferenceDoc, handleThi
|
|
435
461
|
sessionContent.role = SessionContentRole.TokenExpired;
|
436
462
|
if ((_currentSession_value = currentSession.value) === null || _currentSession_value === void 0 ? void 0 : (_currentSession_value_sessionProperty = _currentSession_value.sessionProperty) === null || _currentSession_value_sessionProperty === void 0 ? void 0 : _currentSession_value_sessionProperty.isAutoClear) {
|
437
463
|
var _currentSession_value1;
|
438
|
-
yield
|
464
|
+
yield plusSessionContent(sessionCode, {
|
439
465
|
sessionCode,
|
440
466
|
role: SessionContentRole.System,
|
441
467
|
content: '由于Token超限,已自动清理会话,后续会话不会携带先前的会话信息'
|
@@ -450,10 +476,36 @@ export const useChat = ({ handleStart, handleText, handleReferenceDoc, handleThi
|
|
450
476
|
// 更新 db
|
451
477
|
yield throttleModifySessionContentApi(sessionContent.id, sessionContent);
|
452
478
|
// 调用cb
|
453
|
-
|
479
|
+
yield handleError === null || handleError === void 0 ? void 0 : handleError(sessionCode, sessionContent, code);
|
454
480
|
});
|
455
481
|
return _handleErrorChat.apply(this, arguments);
|
456
482
|
}
|
483
|
+
function handleCompleteRole(sessionCode, prompts) {
|
484
|
+
return _handleCompleteRole.apply(this, arguments);
|
485
|
+
}
|
486
|
+
function _handleCompleteRole() {
|
487
|
+
_handleCompleteRole = // 完成角色演绎
|
488
|
+
_async_to_generator(function*(sessionCode, prompts) {
|
489
|
+
let isPaused = false;
|
490
|
+
sessionWaitingPromptsMap[sessionCode] = [];
|
491
|
+
for (const prompt of prompts){
|
492
|
+
if (isPaused) {
|
493
|
+
sessionWaitingPromptsMap[sessionCode].push(prompt);
|
494
|
+
} else {
|
495
|
+
const sessionContent = _object_spread_props(_object_spread({}, transferSessionPrompt2SessionContent(prompt)), {
|
496
|
+
sessionCode,
|
497
|
+
status: SessionContentStatus.Success
|
498
|
+
});
|
499
|
+
yield plusSessionContent(sessionCode, sessionContent);
|
500
|
+
// 遇到 pause 就暂停
|
501
|
+
if (sessionContent.role === SessionContentRole.Pause) {
|
502
|
+
isPaused = true;
|
503
|
+
}
|
504
|
+
}
|
505
|
+
}
|
506
|
+
});
|
507
|
+
return _handleCompleteRole.apply(this, arguments);
|
508
|
+
}
|
457
509
|
// 重新生成对话 仅支持重新生成 ai 的回复
|
458
510
|
function reGenerateChat(sessionCode, sessionContent, sessionIndex) {
|
459
511
|
if (sessionContent.role !== SessionContentRole.Ai) {
|
@@ -468,13 +520,22 @@ export const useChat = ({ handleStart, handleText, handleReferenceDoc, handleThi
|
|
468
520
|
userSessionContent && chat(userSessionContent);
|
469
521
|
}
|
470
522
|
// 聊天
|
471
|
-
function chat({ sessionCode, data, headers }) {
|
523
|
+
function chat({ sessionCode, url, data, headers }) {
|
524
|
+
const sessionWaitingPrompts = sessionWaitingPromptsMap[sessionCode];
|
525
|
+
if ((sessionWaitingPrompts === null || sessionWaitingPrompts === void 0 ? void 0 : sessionWaitingPrompts.length) > 0) {
|
526
|
+
handleCompleteRole(sessionCode, sessionWaitingPrompts);
|
527
|
+
} else {
|
528
|
+
streamChat(sessionCode, data, url, headers);
|
529
|
+
}
|
530
|
+
}
|
531
|
+
// stream 聊天
|
532
|
+
function streamChat(sessionCode, data, url, headers) {
|
472
533
|
var _currentRequestOptions_value;
|
473
534
|
const sessionContent = getLastSessionContentBySessionCode(sessionCode);
|
474
535
|
// 发送请求
|
475
536
|
chatHelper.stream({
|
476
537
|
sessionCode,
|
477
|
-
url: `${currentRequestOptions.value.url}/chat_completion/`,
|
538
|
+
url: url || `${currentRequestOptions.value.url}/chat_completion/`,
|
478
539
|
data: _object_spread({
|
479
540
|
session_content_id: sessionContent === null || sessionContent === void 0 ? void 0 : sessionContent.id,
|
480
541
|
session_code: sessionCode,
|
@@ -513,40 +574,6 @@ export const useChat = ({ handleStart, handleText, handleReferenceDoc, handleThi
|
|
513
574
|
});
|
514
575
|
return _reSendChat.apply(this, arguments);
|
515
576
|
}
|
516
|
-
// 发送聊天
|
517
|
-
function sendChat(content, callback) {
|
518
|
-
var _currentSession_value, _currentRequestOptions_value, _currentSession_value1, _currentSession_value2, _currentRequestOptions_value1;
|
519
|
-
if (!((_currentSession_value = currentSession.value) === null || _currentSession_value === void 0 ? void 0 : _currentSession_value.sessionCode) || !((_currentRequestOptions_value = currentRequestOptions.value) === null || _currentRequestOptions_value === void 0 ? void 0 : _currentRequestOptions_value.url) || currentSessionLoading.value) {
|
520
|
-
return;
|
521
|
-
}
|
522
|
-
const { message, cite, shortcut } = content;
|
523
|
-
let input = '';
|
524
|
-
if (shortcut) {
|
525
|
-
input = processPromptTemplate(shortcut.prompt, cite);
|
526
|
-
} else {
|
527
|
-
input = cite ? `${message}: "${cite}"` : message;
|
528
|
-
}
|
529
|
-
sessionContents.value.push({
|
530
|
-
sessionCode: (_currentSession_value1 = currentSession.value) === null || _currentSession_value1 === void 0 ? void 0 : _currentSession_value1.sessionCode,
|
531
|
-
content: message,
|
532
|
-
role: SessionContentRole.User,
|
533
|
-
status: SessionContentStatus.Success,
|
534
|
-
cite
|
535
|
-
});
|
536
|
-
// 发送请求
|
537
|
-
chatHelper.stream({
|
538
|
-
sessionCode: (_currentSession_value2 = currentSession.value) === null || _currentSession_value2 === void 0 ? void 0 : _currentSession_value2.sessionCode,
|
539
|
-
url: currentRequestOptions.value.url,
|
540
|
-
headers: (_currentRequestOptions_value1 = currentRequestOptions.value) === null || _currentRequestOptions_value1 === void 0 ? void 0 : _currentRequestOptions_value1.headers,
|
541
|
-
data: {
|
542
|
-
inputs: {
|
543
|
-
chat_history: prompts.value.slice(0, prompts.value.length - 1),
|
544
|
-
input
|
545
|
-
}
|
546
|
-
}
|
547
|
-
});
|
548
|
-
callback === null || callback === void 0 ? void 0 : callback();
|
549
|
-
}
|
550
577
|
/**
|
551
578
|
* 删除聊天内容
|
552
579
|
* @param index 要删除的聊天内容索引
|
@@ -577,7 +604,6 @@ export const useChat = ({ handleStart, handleText, handleReferenceDoc, handleThi
|
|
577
604
|
prompts,
|
578
605
|
currentSessionLoading,
|
579
606
|
chat,
|
580
|
-
sendChat,
|
581
607
|
stopChat,
|
582
608
|
plusSessionContent,
|
583
609
|
updateSessionContent,
|
@@ -590,6 +616,7 @@ export const useChat = ({ handleStart, handleText, handleReferenceDoc, handleThi
|
|
590
616
|
deleteSessionContents,
|
591
617
|
handleStartChat,
|
592
618
|
handleErrorChat,
|
619
|
+
handleCompleteRole,
|
593
620
|
reGenerateChat,
|
594
621
|
reSendChat,
|
595
622
|
deleteChat,
|
@@ -1,5 +1,6 @@
|
|
1
|
+
import { type Ref } from 'vue';
|
1
2
|
import type { IComponent, IDatasetApi, IDatasetDataApi, IDatasetDataForm, IDatasetDataParam, IDatasetForm, IDatasetInfo, IDatasetListParam, IOperatRecordParam, ISchema, IUserInfoForm } from '@/types/dataset';
|
2
|
-
export declare const useDatasetHttp: (apiPrefix?: string) => {
|
3
|
+
export declare const useDatasetHttp: (apiPrefix?: string, spaceId?: Ref<string>) => {
|
3
4
|
getCompanyList: () => Promise<import("@/types/dataset").ICompany[]>;
|
4
5
|
getDatasetMineInfo: () => Promise<IDatasetInfo>;
|
5
6
|
getComponentList: () => Promise<IComponent[]>;
|