@blueking/ai-ui-sdk 0.0.15-beta.33 → 0.0.15-beta.35

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.
Files changed (27) hide show
  1. package/dist/component/render-input/index.vue.css +17 -17
  2. package/dist/component/render-input/index.vue.js +1 -1
  3. package/dist/component/render-input/render-drag.vue.css +5 -5
  4. package/dist/component/render-input/render-drag.vue.js +1 -1
  5. package/dist/component/render-knowledge-icon/index.vue.css +1 -1
  6. package/dist/component/render-knowledge-icon/index.vue.js +1 -1
  7. package/dist/component/render-message/openai-message.vue.css +17 -17
  8. package/dist/component/render-message/openai-message.vue.js +1 -1
  9. package/dist/component/render-message/skeleton-message.vue.css +1 -1
  10. package/dist/component/render-message/skeleton-message.vue.js +1 -1
  11. package/dist/component/render-message/system-message.vue.css +2 -2
  12. package/dist/component/render-message/system-message.vue.js +1 -1
  13. package/dist/component/render-message/time-message.vue.css +1 -1
  14. package/dist/component/render-message/time-message.vue.js +1 -1
  15. package/dist/component/render-message/token-expired-message.vue.css +9 -9
  16. package/dist/component/render-message/token-expired-message.vue.js +1 -1
  17. package/dist/component/render-message/user-message.vue.css +15 -15
  18. package/dist/component/render-message/user-message.vue.js +1 -1
  19. package/dist/component/render-stop/index.vue.css +2 -2
  20. package/dist/component/render-stop/index.vue.js +1 -1
  21. package/dist/hooks/use-chat.d.ts +4 -4
  22. package/dist/hooks/use-chat.js +68 -42
  23. package/dist/http/helper/agent.js +4 -1
  24. package/dist/http/helper/session.d.ts +10 -0
  25. package/dist/http/helper/session.js +28 -0
  26. package/dist/types/agent.d.ts +7 -0
  27. package/package.json +1 -1
@@ -1,30 +1,30 @@
1
1
 
2
- .send-prompt-container[data-v-n82ymwbd] {
2
+ .send-prompt-container[data-v-ets338ln] {
3
3
  width: 800px;
4
4
  z-index: 1501;
5
5
  overflow: visible;
6
6
  position: relative;
7
7
  }
8
- .send-prompt-container[data-v-n82ymwbd] .textarea-list {
8
+ .send-prompt-container[data-v-ets338ln] .textarea-list {
9
9
  bottom: var(--textarea-bottom);
10
10
  }
11
- .send-prompt-container:hover .clear-icon[data-v-n82ymwbd] {
11
+ .send-prompt-container:hover .clear-icon[data-v-ets338ln] {
12
12
  display: inline-flex !important;
13
13
  }
14
- .quill-container[data-v-n82ymwbd] {
14
+ .quill-container[data-v-ets338ln] {
15
15
  background: #fff;
16
16
  box-shadow: 0 0 6px 0 #0000001a;
17
17
  border-radius: 4px;
18
18
  box-sizing: border-box !important;
19
19
  border: 1px solid transparent;
20
20
  }
21
- .quill-container.active[data-v-n82ymwbd] {
21
+ .quill-container.active[data-v-ets338ln] {
22
22
  border: 1px solid #3A84FF !important;
23
23
  }
24
- .quill-container[data-v-n82ymwbd]:has(.ql-editor:focus) {
24
+ .quill-container[data-v-ets338ln]:has(.ql-editor:focus) {
25
25
  border: 1px solid #3A84FF !important;
26
26
  }
27
- .send-prompt[data-v-n82ymwbd] {
27
+ .send-prompt[data-v-ets338ln] {
28
28
  width: 800px;
29
29
  border: 1px solid transparent;
30
30
  flex-direction: row;
@@ -34,26 +34,26 @@
34
34
  border-radius: 4px;
35
35
  border: 1px solid transparent !important;
36
36
  }
37
- .send-prompt[data-v-n82ymwbd] .content-input-wrapper {
37
+ .send-prompt[data-v-ets338ln] .content-input-wrapper {
38
38
  padding: 0 !important;
39
39
  height: 100% !important;
40
40
  }
41
- .send-prompt[data-v-n82ymwbd] .auto-textarea-wrapper {
41
+ .send-prompt[data-v-ets338ln] .auto-textarea-wrapper {
42
42
  height: 100% !important;
43
43
  }
44
- .send-prompt[data-v-n82ymwbd] .v-note-panel {
44
+ .send-prompt[data-v-ets338ln] .v-note-panel {
45
45
  border-radius: 4px;
46
46
  }
47
- .send-prompt[data-v-n82ymwbd] .scroll-style {
47
+ .send-prompt[data-v-ets338ln] .scroll-style {
48
48
  overflow-y: hidden !important;
49
49
  }
50
- .send-prompt[data-v-n82ymwbd] .auto-textarea-block {
50
+ .send-prompt[data-v-ets338ln] .auto-textarea-block {
51
51
  display: none;
52
52
  }
53
- .send-prompt[data-v-n82ymwbd]:has(.ql-editor:focus) {
53
+ .send-prompt[data-v-ets338ln]:has(.ql-editor:focus) {
54
54
  height: var(--text-height);
55
55
  }
56
- .ai-ui-sdk-fasong[data-v-n82ymwbd] {
56
+ .ai-ui-sdk-fasong[data-v-ets338ln] {
57
57
  width: 28px;
58
58
  height: 28px;
59
59
  line-height: 28px;
@@ -67,15 +67,15 @@
67
67
  text-align: center;
68
68
  z-index: 1501;
69
69
  }
70
- .ai-ui-sdk-fasong[data-v-n82ymwbd]:hover {
70
+ .ai-ui-sdk-fasong[data-v-ets338ln]:hover {
71
71
  background: #F0F5FF;
72
72
  color: #3a84ff;
73
73
  }
74
- .ai-ui-sdk-fasong.disable[data-v-n82ymwbd] {
74
+ .ai-ui-sdk-fasong.disable[data-v-ets338ln] {
75
75
  color: #dcdee5;
76
76
  cursor: not-allowed;
77
77
  }
78
- .clear-icon[data-v-n82ymwbd] {
78
+ .clear-icon[data-v-ets338ln] {
79
79
  display: none !important;
80
80
  position: absolute;
81
81
  bottom: 42px;
@@ -1,5 +1,5 @@
1
1
  import script from './index.script.vue.js';
2
- script.__scopeId = "data-v-n82ymwbd";
2
+ script.__scopeId = "data-v-ets338ln";
3
3
  script.__file = "./src/component/render-input/index.vue";
4
4
  import './index.vue.css';
5
5
  export default script;
@@ -1,5 +1,5 @@
1
1
 
2
- .send-tool-container[data-v-8y7ryy0d] {
2
+ .send-tool-container[data-v-blqgotpc] {
3
3
  position: absolute;
4
4
  left: 50%;
5
5
  top: 16px;
@@ -12,17 +12,17 @@
12
12
  cursor: row-resize;
13
13
  z-index: 15001;
14
14
  }
15
- .send-tool-container.bottom[data-v-8y7ryy0d] {
15
+ .send-tool-container.bottom[data-v-blqgotpc] {
16
16
  bottom: 0;
17
17
  top: auto;
18
18
  }
19
- .send-tool-container.bottom .ai-ui-sdk-gengduo[data-v-8y7ryy0d] {
19
+ .send-tool-container.bottom .ai-ui-sdk-gengduo[data-v-blqgotpc] {
20
20
  margin-top: -10px;
21
21
  }
22
- .send-tool-container[data-v-8y7ryy0d]:hover, .send-tool-container.is-dragging[data-v-8y7ryy0d] {
22
+ .send-tool-container[data-v-blqgotpc]:hover, .send-tool-container.is-dragging[data-v-blqgotpc] {
23
23
  background: #3A84FF;
24
24
  }
25
- .send-tool-container .ai-ui-sdk-gengduo[data-v-8y7ryy0d] {
25
+ .send-tool-container .ai-ui-sdk-gengduo[data-v-blqgotpc] {
26
26
  margin-top: -2px;
27
27
  color: #63656E;
28
28
  }
@@ -1,5 +1,5 @@
1
1
  import script from './render-drag.script.vue.js';
2
- script.__scopeId = "data-v-8y7ryy0d";
2
+ script.__scopeId = "data-v-blqgotpc";
3
3
  script.__file = "./src/component/render-input/render-drag.vue";
4
4
  import './render-drag.vue.css';
5
5
  export default script;
@@ -1,4 +1,4 @@
1
1
 
2
- .ai-ui-sdk-icon[data-v-wwo11xum] {
2
+ .ai-ui-sdk-icon[data-v-ddovgc9j] {
3
3
  color: #C4C6CC;
4
4
  }
@@ -1,5 +1,5 @@
1
1
  import script from './index.script.vue.js';
2
- script.__scopeId = "data-v-wwo11xum";
2
+ script.__scopeId = "data-v-ddovgc9j";
3
3
  script.__file = "./src/component/render-knowledge-icon/index.vue";
4
4
  import './index.vue.css';
5
5
  export default script;
@@ -1,10 +1,10 @@
1
1
 
2
- .ai-message-home[data-v-uctl72rz] {
2
+ .ai-message-home[data-v-0x5i8c58] {
3
3
  justify-content: center;
4
4
  align-items: flex-start;
5
5
  width: 100%;
6
6
  }
7
- .ai-content[data-v-uctl72rz] {
7
+ .ai-content[data-v-0x5i8c58] {
8
8
  flex: 1;
9
9
  max-width: calc(100% - 104px);
10
10
  background: #FFFFFF;
@@ -17,26 +17,26 @@
17
17
  padding-top: 12px;
18
18
  margin-right: 52px;
19
19
  }
20
- .ai-content .ai-ui-sdk-warning-circle-fill[data-v-uctl72rz] {
20
+ .ai-content .ai-ui-sdk-warning-circle-fill[data-v-0x5i8c58] {
21
21
  color: #EA3636;
22
22
  font-size: 18px;
23
23
  margin-right: 2px;
24
24
  }
25
- .ai-content .ai-ui-sdk-quanquan[data-v-uctl72rz] {
25
+ .ai-content .ai-ui-sdk-quanquan[data-v-0x5i8c58] {
26
26
  display: inline-block;
27
27
  color: #3A84FF;
28
- animation: rotate-uctl72rz 800ms linear infinite;
28
+ animation: rotate-0x5i8c58 800ms linear infinite;
29
29
  position: absolute;
30
30
  left: 7px;
31
31
  top: 23px;
32
32
  z-index: 1501;
33
33
  }
34
- .ai-content .message-check[data-v-uctl72rz] {
34
+ .ai-content .message-check[data-v-0x5i8c58] {
35
35
  position: absolute;
36
36
  top: 0;
37
37
  left: -80px;
38
38
  }
39
- .ai-content[data-v-uctl72rz]::before {
39
+ .ai-content[data-v-0x5i8c58]::before {
40
40
  position: absolute;
41
41
  content: '';
42
42
  width: 15px;
@@ -46,47 +46,47 @@
46
46
  rotate: 45deg;
47
47
  background: #FFFFFF;
48
48
  }
49
- .ai-content.fail[data-v-uctl72rz] {
49
+ .ai-content.fail[data-v-0x5i8c58] {
50
50
  padding: 12px;
51
51
  word-break: break-all;
52
52
  }
53
- .ai-content.loading[data-v-uctl72rz] {
53
+ .ai-content.loading[data-v-0x5i8c58] {
54
54
  padding: 12px 0;
55
55
  word-break: break-all;
56
56
  }
57
- .skeleton-message[data-v-uctl72rz] {
57
+ .skeleton-message[data-v-0x5i8c58] {
58
58
  margin-right: 52px;
59
59
  }
60
- .message-photo[data-v-uctl72rz] {
60
+ .message-photo[data-v-0x5i8c58] {
61
61
  width: 52px;
62
62
  text-align: right;
63
63
  user-select: none;
64
64
  }
65
- .message-photo img[data-v-uctl72rz] {
65
+ .message-photo img[data-v-0x5i8c58] {
66
66
  margin-right: 16px;
67
67
  margin-top: 5px;
68
68
  width: 36px;
69
69
  height: 36px;
70
70
  }
71
- .message-tools[data-v-uctl72rz] {
71
+ .message-tools[data-v-0x5i8c58] {
72
72
  margin: 12px 12px 12px;
73
73
  padding-top: 10px;
74
74
  justify-content: space-between;
75
75
  border-top: 1px solid #EAEBF0;
76
76
  }
77
- .message-tools .rate-tip[data-v-uctl72rz] {
77
+ .message-tools .rate-tip[data-v-0x5i8c58] {
78
78
  font-size: 12px;
79
79
  color: #979BA5;
80
80
  margin-left: 7px;
81
81
  }
82
- .message-tools .tool-icons .ai-ui-sdk-icon[data-v-uctl72rz] {
82
+ .message-tools .tool-icons .ai-ui-sdk-icon[data-v-0x5i8c58] {
83
83
  cursor: pointer;
84
84
  color: #979BA5;
85
85
  }
86
- .message-tools .tool-icons .ai-ui-sdk-icon[data-v-uctl72rz]:hover {
86
+ .message-tools .tool-icons .ai-ui-sdk-icon[data-v-0x5i8c58]:hover {
87
87
  color: #3A84FF;
88
88
  }
89
- @keyframes rotate-uctl72rz {
89
+ @keyframes rotate-0x5i8c58 {
90
90
  0% {
91
91
  transform: rotate(0);
92
92
  }
@@ -1,5 +1,5 @@
1
1
  import script from './openai-message.script.vue.js';
2
- script.__scopeId = "data-v-uctl72rz";
2
+ script.__scopeId = "data-v-0x5i8c58";
3
3
  script.__file = "./src/component/render-message/openai-message.vue";
4
4
  import './openai-message.vue.css';
5
5
  export default script;
@@ -1,5 +1,5 @@
1
1
 
2
- .skeleton-message[data-v-b2ha03wg] {
2
+ .skeleton-message[data-v-xy2w6wna] {
3
3
  height: 50px;
4
4
  flex: 1;
5
5
  background-color: #EBECF3;
@@ -1,6 +1,6 @@
1
1
  import { render } from './skeleton-message.script.vue.js';
2
2
  const script = { render };
3
- script.__scopeId = "data-v-b2ha03wg";
3
+ script.__scopeId = "data-v-xy2w6wna";
4
4
  script.__file = "./src/component/render-message/skeleton-message.vue";
5
5
  import './skeleton-message.vue.css';
6
6
  export default script;
@@ -1,5 +1,5 @@
1
1
 
2
- .system-message[data-v-vw1h5v1k] {
2
+ .system-message[data-v-fb9k5o8k] {
3
3
  position: relative;
4
4
  width: calc(100% - 204px) !important;
5
5
  max-width: 800px !important;
@@ -7,7 +7,7 @@
7
7
  border-bottom: 1px dashed #DCDEE5;
8
8
  margin: 24px 0 40px !important;
9
9
  }
10
- .system-message span[data-v-vw1h5v1k] {
10
+ .system-message span[data-v-fb9k5o8k] {
11
11
  position: absolute;
12
12
  left: 50%;
13
13
  top: 50%;
@@ -1,5 +1,5 @@
1
1
  import script from './system-message.script.vue.js';
2
- script.__scopeId = "data-v-vw1h5v1k";
2
+ script.__scopeId = "data-v-fb9k5o8k";
3
3
  script.__file = "./src/component/render-message/system-message.vue";
4
4
  import './system-message.vue.css';
5
5
  export default script;
@@ -1,5 +1,5 @@
1
1
 
2
- .time-message[data-v-hidcrf0n] {
2
+ .time-message[data-v-fd72go60] {
3
3
  position: relative;
4
4
  padding: 0 8px !important;
5
5
  height: 22px;
@@ -1,5 +1,5 @@
1
1
  import script from './time-message.script.vue.js';
2
- script.__scopeId = "data-v-hidcrf0n";
2
+ script.__scopeId = "data-v-fd72go60";
3
3
  script.__file = "./src/component/render-message/time-message.vue";
4
4
  import './time-message.vue.css';
5
5
  export default script;
@@ -1,10 +1,10 @@
1
1
 
2
- .ai-message-home[data-v-8adzzdeh] {
2
+ .ai-message-home[data-v-l023po5v] {
3
3
  justify-content: center;
4
4
  align-items: flex-start;
5
5
  width: 100%;
6
6
  }
7
- .ai-content[data-v-8adzzdeh] {
7
+ .ai-content[data-v-l023po5v] {
8
8
  flex: 1;
9
9
  background: #FFFFFF;
10
10
  line-height: 22px;
@@ -16,17 +16,17 @@
16
16
  padding-top: 12px;
17
17
  margin-right: 52px;
18
18
  }
19
- .ai-content .ai-ui-sdk-warning-circle-fill[data-v-8adzzdeh] {
19
+ .ai-content .ai-ui-sdk-warning-circle-fill[data-v-l023po5v] {
20
20
  color: #EA3636;
21
21
  font-size: 18px;
22
22
  margin-right: 2px;
23
23
  }
24
- .ai-content .message-check[data-v-8adzzdeh] {
24
+ .ai-content .message-check[data-v-l023po5v] {
25
25
  position: absolute;
26
26
  top: 0;
27
27
  left: -80px;
28
28
  }
29
- .ai-content[data-v-8adzzdeh]::before {
29
+ .ai-content[data-v-l023po5v]::before {
30
30
  position: absolute;
31
31
  content: '';
32
32
  width: 15px;
@@ -36,21 +36,21 @@
36
36
  rotate: 45deg;
37
37
  background: #FFFFFF;
38
38
  }
39
- .ai-content.fail[data-v-8adzzdeh] {
39
+ .ai-content.fail[data-v-l023po5v] {
40
40
  padding: 12px;
41
41
  }
42
- .message-photo[data-v-8adzzdeh] {
42
+ .message-photo[data-v-l023po5v] {
43
43
  width: 52px;
44
44
  text-align: right;
45
45
  user-select: none;
46
46
  }
47
- .message-photo img[data-v-8adzzdeh] {
47
+ .message-photo img[data-v-l023po5v] {
48
48
  margin-right: 16px;
49
49
  margin-top: 5px;
50
50
  width: 36px;
51
51
  height: 36px;
52
52
  }
53
- .clear-message[data-v-8adzzdeh] {
53
+ .clear-message[data-v-l023po5v] {
54
54
  color: #3a84ff;
55
55
  cursor: pointer;
56
56
  }
@@ -1,5 +1,5 @@
1
1
  import script from './token-expired-message.script.vue.js';
2
- script.__scopeId = "data-v-8adzzdeh";
2
+ script.__scopeId = "data-v-l023po5v";
3
3
  script.__file = "./src/component/render-message/token-expired-message.vue";
4
4
  import './token-expired-message.vue.css';
5
5
  export default script;
@@ -1,20 +1,20 @@
1
1
 
2
- .user-message-home[data-v-5979u5t9] {
2
+ .user-message-home[data-v-ce3vm0gu] {
3
3
  align-items: flex-start;
4
4
  justify-content: flex-end;
5
5
  }
6
- .user-message-extra[data-v-5979u5t9] {
6
+ .user-message-extra[data-v-ce3vm0gu] {
7
7
  padding: 0 52px;
8
8
  }
9
- .user-message-extra[data-v-5979u5t9]:after {
9
+ .user-message-extra[data-v-ce3vm0gu]:after {
10
10
  content: '';
11
11
  display: table;
12
12
  clear: both;
13
13
  }
14
- .user-message-extra .ai-ui-sdk-icon[data-v-5979u5t9] {
14
+ .user-message-extra .ai-ui-sdk-icon[data-v-ce3vm0gu] {
15
15
  font-size: 14px;
16
16
  }
17
- .user-content[data-v-5979u5t9] {
17
+ .user-content[data-v-ce3vm0gu] {
18
18
  flex: 1;
19
19
  max-width: calc(100% - 104px);
20
20
  background: #E1ECFF;
@@ -26,7 +26,7 @@
26
26
  position: relative;
27
27
  margin-left: 52px;
28
28
  }
29
- .user-content .ai-ui-sdk-icon[data-v-5979u5t9] {
29
+ .user-content .ai-ui-sdk-icon[data-v-ce3vm0gu] {
30
30
  width: 28px;
31
31
  height: 28px;
32
32
  background: #FFFFFF;
@@ -41,17 +41,17 @@
41
41
  margin-right: 8px;
42
42
  margin-top: 8px;
43
43
  }
44
- .user-content .ai-ui-sdk-icon.hover-show[data-v-5979u5t9] {
44
+ .user-content .ai-ui-sdk-icon.hover-show[data-v-ce3vm0gu] {
45
45
  display: none;
46
46
  }
47
- .user-content .ai-ui-sdk-icon.ai-ui-sdk-yinyong-2[data-v-5979u5t9]:hover, .user-content .ai-ui-sdk-icon.ai-ui-sdk-copy[data-v-5979u5t9]:hover, .user-content .ai-ui-sdk-icon.ai-ui-sdk-baocun[data-v-5979u5t9]:hover, .user-content .ai-ui-sdk-icon.ai-ui-sdk-delete[data-v-5979u5t9]:hover {
47
+ .user-content .ai-ui-sdk-icon.ai-ui-sdk-yinyong-2[data-v-ce3vm0gu]:hover, .user-content .ai-ui-sdk-icon.ai-ui-sdk-copy[data-v-ce3vm0gu]:hover, .user-content .ai-ui-sdk-icon.ai-ui-sdk-baocun[data-v-ce3vm0gu]:hover, .user-content .ai-ui-sdk-icon.ai-ui-sdk-delete[data-v-ce3vm0gu]:hover {
48
48
  color: #3A84FF;
49
49
  border-color: #3A84FF;
50
50
  }
51
- .user-content:hover .hover-show[data-v-5979u5t9] {
51
+ .user-content:hover .hover-show[data-v-ce3vm0gu] {
52
52
  display: flex;
53
53
  }
54
- .user-content[data-v-5979u5t9]::after {
54
+ .user-content[data-v-ce3vm0gu]::after {
55
55
  position: absolute;
56
56
  content: '';
57
57
  width: 15px;
@@ -61,23 +61,23 @@
61
61
  rotate: 45deg;
62
62
  background: #E1ECFF;
63
63
  }
64
- .message-tools[data-v-5979u5t9] {
64
+ .message-tools[data-v-ce3vm0gu] {
65
65
  justify-content: flex-end;
66
66
  position: absolute;
67
67
  width: 150px;
68
68
  left: -150px;
69
69
  top: 2px;
70
70
  }
71
- .message-check[data-v-5979u5t9] {
71
+ .message-check[data-v-ce3vm0gu] {
72
72
  position: absolute;
73
73
  top: 0;
74
74
  left: -80px;
75
75
  }
76
- .message-photo[data-v-5979u5t9] {
76
+ .message-photo[data-v-ce3vm0gu] {
77
77
  width: 52px;
78
78
  user-select: none;
79
79
  }
80
- .message-photo img[data-v-5979u5t9] {
80
+ .message-photo img[data-v-ce3vm0gu] {
81
81
  margin-left: 16px;
82
82
  margin-top: 5px;
83
83
  width: 36px;
@@ -85,6 +85,6 @@
85
85
  border: 1px solid #DCDEE5;
86
86
  border-radius: 100%;
87
87
  }
88
- .skeleton-message[data-v-5979u5t9] {
88
+ .skeleton-message[data-v-ce3vm0gu] {
89
89
  margin-left: 52px;
90
90
  }
@@ -1,5 +1,5 @@
1
1
  import script from './user-message.script.vue.js';
2
- script.__scopeId = "data-v-5979u5t9";
2
+ script.__scopeId = "data-v-ce3vm0gu";
3
3
  script.__file = "./src/component/render-message/user-message.vue";
4
4
  import './user-message.vue.css';
5
5
  export default script;
@@ -1,5 +1,5 @@
1
1
 
2
- .render-stop[data-v-buwe71b5] {
2
+ .render-stop[data-v-it3uxfli] {
3
3
  background: #FFFFFF;
4
4
  border: 1px solid #DCDEE5;
5
5
  border-radius: 2px;
@@ -8,7 +8,7 @@
8
8
  font-size: 12px;
9
9
  cursor: pointer;
10
10
  }
11
- .render-stop .stop-icon[data-v-buwe71b5] {
11
+ .render-stop .stop-icon[data-v-it3uxfli] {
12
12
  width: 8px;
13
13
  height: 8px;
14
14
  background: #FFDDDD;
@@ -1,5 +1,5 @@
1
1
  import script from './index.script.vue.js';
2
- script.__scopeId = "data-v-buwe71b5";
2
+ script.__scopeId = "data-v-it3uxfli";
3
3
  script.__file = "./src/component/render-stop/index.vue";
4
4
  import './index.vue.css';
5
5
  export default script;
@@ -1,4 +1,4 @@
1
- import type { ISessionContent, ISession, ISessionPrompt, ChatCallbacks, BasicChatContent, ShortcutChatContent } from '../types/session';
1
+ import type { ISessionContent, ISession, ISessionPrompt, ChatCallbacks } from '../types/session';
2
2
  import { SessionContentRole, SessionContentStatus } from '../types/enum';
3
3
  type SessionContentsMap = {
4
4
  [key: string]: ISessionContent[];
@@ -829,10 +829,9 @@ export declare const useChat: ({ handleStart, handleText, handleReferenceDoc, ha
829
829
  currentSessionLoading: import("vue").ComputedRef<boolean>;
830
830
  chat: ({ sessionCode, data, headers, }: {
831
831
  sessionCode: string;
832
- data?: Record<string, any>;
832
+ data?: Record<string, unknown>;
833
833
  headers?: Record<string, string>;
834
834
  }) => void;
835
- sendChat: (content: BasicChatContent | ShortcutChatContent, callback?: () => void) => void;
836
835
  stopChat: (sessionCode: string) => void;
837
836
  plusSessionContent: (sessionCode: string, sessionContent: ISessionContent) => Promise<ISessionContent>;
838
837
  updateSessionContent: (sessionContent: ISessionContent) => false | undefined;
@@ -844,7 +843,8 @@ export declare const useChat: ({ handleStart, handleText, handleReferenceDoc, ha
844
843
  deleteSessionContent: (sessionCode: string, contentId: number) => Promise<number>;
845
844
  deleteSessionContents: (sessionCode: string, contentIds: number[]) => Promise<number>;
846
845
  handleStartChat: (sessionCode: string) => Promise<void | undefined>;
847
- handleErrorChat: (sessionCode: string, message: string, code?: string) => Promise<void | undefined>;
846
+ handleErrorChat: (sessionCode: string, message: string, code?: string) => Promise<void>;
847
+ handleCompleteRole: (sessionCode: string, prompts: ISessionPrompt[]) => Promise<void>;
848
848
  reGenerateChat: (sessionCode: string, sessionContent: ISessionContent, sessionIndex: number) => void;
849
849
  reSendChat: (sessionCode: string, sessionContent: ISessionContent, sessionIndex: number) => Promise<void>;
850
850
  deleteChat: (index: number, sessionCode: string) => void;
@@ -55,14 +55,38 @@ 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 { ref, computed } from 'vue';
59
83
  import { HttpErrorCode, SessionContentRole, SessionContentStatus } from '../types/enum.js';
60
84
  import { getHtmlContentFromDocuments, removeReferenceDoc } from './use-reference-doc.js';
61
85
  import { getHtmlContentFromThink, isThinking, removeThink } from './use-think.js';
62
86
  import { useHttp } from './use-http.js';
63
- import { transferSessionContent2SessionPrompt } from '../http/helper/session.js';
87
+ import { transferSessionContent2SessionPrompt, transferSessionPrompt2SessionContent } from '../http/helper/session.js';
64
88
  import { ChatHelper } from '../common/chart-helper.js';
65
- import { processPromptTemplate, throttle } from '../common/util.js';
89
+ import { throttle } from '../common/util.js';
66
90
  // ai 聊天
67
91
  export const useChat = ({ handleStart, handleText, handleReferenceDoc, handleThink, handleEnd, handleError, requestOptions })=>{
68
92
  // 用 ref 存储 requestOptions,使其可更新
@@ -84,6 +108,7 @@ export const useChat = ({ handleStart, handleText, handleReferenceDoc, handleThi
84
108
  const sessionLoadingMap = ref({});
85
109
  const sessionContents = ref([]);
86
110
  const sessionContentsMap = {};
111
+ const sessionWaitingPromptsMap = {};
87
112
  // 通过计算得到的会话列表
88
113
  const calculatedSessionContents = computed(()=>{
89
114
  const calculatedSessionContents = [];
@@ -348,7 +373,7 @@ export const useChat = ({ handleStart, handleText, handleReferenceDoc, handleThi
348
373
  const content = getHtmlContentFromDocuments(documents);
349
374
  sessionContent.content = cover ? content : sessionContent.content + content;
350
375
  yield throttleModifySessionContentApi(sessionContent.id, sessionContent);
351
- return handleReferenceDoc === null || handleReferenceDoc === void 0 ? void 0 : handleReferenceDoc(sessionCode, sessionContent);
376
+ yield handleReferenceDoc === null || handleReferenceDoc === void 0 ? void 0 : handleReferenceDoc(sessionCode, sessionContent);
352
377
  });
353
378
  return _handleReferenceDocChat.apply(this, arguments);
354
379
  }
@@ -364,7 +389,7 @@ export const useChat = ({ handleStart, handleText, handleReferenceDoc, handleThi
364
389
  // 更新 db
365
390
  yield throttleModifySessionContentApi(sessionContent.id, sessionContent);
366
391
  // 调用cb
367
- return handleThink === null || handleThink === void 0 ? void 0 : handleThink(sessionCode, sessionContent);
392
+ yield handleThink === null || handleThink === void 0 ? void 0 : handleThink(sessionCode, sessionContent);
368
393
  });
369
394
  return _handleThinkChat.apply(this, arguments);
370
395
  }
@@ -385,7 +410,7 @@ export const useChat = ({ handleStart, handleText, handleReferenceDoc, handleThi
385
410
  // 更新 db
386
411
  yield throttleModifySessionContentApi(sessionContent.id, sessionContent);
387
412
  // 调用cb
388
- return handleText === null || handleText === void 0 ? void 0 : handleText(sessionCode, sessionContent);
413
+ yield handleText === null || handleText === void 0 ? void 0 : handleText(sessionCode, sessionContent);
389
414
  });
390
415
  return _handleTextChat.apply(this, arguments);
391
416
  }
@@ -413,7 +438,7 @@ export const useChat = ({ handleStart, handleText, handleReferenceDoc, handleThi
413
438
  // 更新 db
414
439
  yield throttleModifySessionContentApi(sessionContent.id, sessionContent);
415
440
  // 调用cb
416
- return handleEnd === null || handleEnd === void 0 ? void 0 : handleEnd(sessionCode, sessionContent);
441
+ yield handleEnd === null || handleEnd === void 0 ? void 0 : handleEnd(sessionCode, sessionContent);
417
442
  }
418
443
  });
419
444
  return _handleEndChat.apply(this, arguments);
@@ -440,10 +465,36 @@ export const useChat = ({ handleStart, handleText, handleReferenceDoc, handleThi
440
465
  // 更新 db
441
466
  yield throttleModifySessionContentApi(sessionContent.id, sessionContent);
442
467
  // 调用cb
443
- return handleError === null || handleError === void 0 ? void 0 : handleError(sessionCode, sessionContent, code);
468
+ yield handleError === null || handleError === void 0 ? void 0 : handleError(sessionCode, sessionContent, code);
444
469
  });
445
470
  return _handleErrorChat.apply(this, arguments);
446
471
  }
472
+ function handleCompleteRole(sessionCode, prompts) {
473
+ return _handleCompleteRole.apply(this, arguments);
474
+ }
475
+ function _handleCompleteRole() {
476
+ _handleCompleteRole = // 完成角色演绎
477
+ _async_to_generator(function*(sessionCode, prompts) {
478
+ let isPaused = false;
479
+ sessionWaitingPromptsMap[sessionCode] = [];
480
+ for (const prompt of prompts){
481
+ if (isPaused) {
482
+ sessionWaitingPromptsMap[sessionCode].push(prompt);
483
+ } else {
484
+ const sessionContent = _object_spread_props(_object_spread({}, transferSessionPrompt2SessionContent(prompt)), {
485
+ sessionCode,
486
+ status: SessionContentStatus.Success
487
+ });
488
+ yield plusSessionContent(sessionCode, sessionContent);
489
+ // 遇到 pause 就暂停
490
+ if (sessionContent.role === SessionContentRole.Pause) {
491
+ isPaused = true;
492
+ }
493
+ }
494
+ }
495
+ });
496
+ return _handleCompleteRole.apply(this, arguments);
497
+ }
447
498
  // 重新生成对话 仅支持重新生成 ai 的回复
448
499
  function reGenerateChat(sessionCode, sessionContent, sessionIndex) {
449
500
  if (sessionContent.role !== SessionContentRole.Ai) {
@@ -459,6 +510,15 @@ export const useChat = ({ handleStart, handleText, handleReferenceDoc, handleThi
459
510
  }
460
511
  // 聊天
461
512
  function chat({ sessionCode, data, headers }) {
513
+ const sessionWaitingPrompts = sessionWaitingPromptsMap[sessionCode];
514
+ if ((sessionWaitingPrompts === null || sessionWaitingPrompts === void 0 ? void 0 : sessionWaitingPrompts.length) > 0) {
515
+ handleCompleteRole(sessionCode, sessionWaitingPrompts);
516
+ } else {
517
+ streamChat(sessionCode, data, headers);
518
+ }
519
+ }
520
+ // stream 聊天
521
+ function streamChat(sessionCode, data, headers) {
462
522
  var _currentRequestOptions_value;
463
523
  const sessionContent = getLastSessionContentBySessionCode(sessionCode);
464
524
  // 发送请求
@@ -503,40 +563,6 @@ export const useChat = ({ handleStart, handleText, handleReferenceDoc, handleThi
503
563
  });
504
564
  return _reSendChat.apply(this, arguments);
505
565
  }
506
- // 发送聊天
507
- function sendChat(content, callback) {
508
- var _currentSession_value, _currentRequestOptions_value, _currentSession_value1, _currentSession_value2, _currentRequestOptions_value1;
509
- 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) {
510
- return;
511
- }
512
- const { message, cite, shortcut } = content;
513
- let input = '';
514
- if (shortcut) {
515
- input = processPromptTemplate(shortcut.prompt, cite);
516
- } else {
517
- input = cite ? `${message}: "${cite}"` : message;
518
- }
519
- sessionContents.value.push({
520
- sessionCode: (_currentSession_value1 = currentSession.value) === null || _currentSession_value1 === void 0 ? void 0 : _currentSession_value1.sessionCode,
521
- content: message,
522
- role: SessionContentRole.User,
523
- status: SessionContentStatus.Success,
524
- cite
525
- });
526
- // 发送请求
527
- chatHelper.stream({
528
- sessionCode: (_currentSession_value2 = currentSession.value) === null || _currentSession_value2 === void 0 ? void 0 : _currentSession_value2.sessionCode,
529
- url: currentRequestOptions.value.url,
530
- headers: (_currentRequestOptions_value1 = currentRequestOptions.value) === null || _currentRequestOptions_value1 === void 0 ? void 0 : _currentRequestOptions_value1.headers,
531
- data: {
532
- inputs: {
533
- chat_history: prompts.value.slice(0, prompts.value.length - 1),
534
- input
535
- }
536
- }
537
- });
538
- callback === null || callback === void 0 ? void 0 : callback();
539
- }
540
566
  /**
541
567
  * 删除聊天内容
542
568
  * @param index 要删除的聊天内容索引
@@ -567,7 +593,6 @@ export const useChat = ({ handleStart, handleText, handleReferenceDoc, handleThi
567
593
  prompts,
568
594
  currentSessionLoading,
569
595
  chat,
570
- sendChat,
571
596
  stopChat,
572
597
  plusSessionContent,
573
598
  updateSessionContent,
@@ -580,6 +605,7 @@ export const useChat = ({ handleStart, handleText, handleReferenceDoc, handleThi
580
605
  deleteSessionContents,
581
606
  handleStartChat,
582
607
  handleErrorChat,
608
+ handleCompleteRole,
583
609
  reGenerateChat,
584
610
  reSendChat,
585
611
  deleteChat,
@@ -3,11 +3,14 @@
3
3
  * @param data IAgentInfoApi
4
4
  * @returns IAgentInfo
5
5
  */ export const transferAgentInfoApi2AgentInfo = (data)=>{
6
- var _data_conversation_settings, _data_conversation_settings1;
6
+ var _data_conversation_settings, _data_conversation_settings1, _data_prompt_setting;
7
7
  return {
8
8
  conversationSettings: {
9
9
  openingRemark: data === null || data === void 0 ? void 0 : (_data_conversation_settings = data.conversation_settings) === null || _data_conversation_settings === void 0 ? void 0 : _data_conversation_settings.opening_remark,
10
10
  predefinedQuestions: data === null || data === void 0 ? void 0 : (_data_conversation_settings1 = data.conversation_settings) === null || _data_conversation_settings1 === void 0 ? void 0 : _data_conversation_settings1.predefined_questions
11
+ },
12
+ promptSetting: {
13
+ content: data === null || data === void 0 ? void 0 : (_data_prompt_setting = data.prompt_setting) === null || _data_prompt_setting === void 0 ? void 0 : _data_prompt_setting.content
11
14
  }
12
15
  };
13
16
  };
@@ -1,10 +1,20 @@
1
1
  import type { ISession, ISessionApi, ISessionContent, ISessionContentApi, ISessionPrompt } from '@/types/session';
2
+ import { SessionContentRole } from '@/types/enum';
2
3
  /**
3
4
  * 将 sessionContent 转换为 sessionPrompt
4
5
  * @param sessionContent sessionContent
5
6
  * @returns sessionPrompt
6
7
  */
7
8
  export declare const transferSessionContent2SessionPrompt: (sessionContent: ISessionContent) => ISessionPrompt;
9
+ /**
10
+ * 将前端使用的 session 提示数据转换为前端使用的 session 内容数据
11
+ * @param prompt 前端使用的 session 提示数据
12
+ * @returns 前端使用的 session 内容数据
13
+ */
14
+ export declare const transferSessionPrompt2SessionContent: (prompt: ISessionPrompt) => {
15
+ role: SessionContentRole;
16
+ content: string;
17
+ };
8
18
  /**
9
19
  * 将 API 返回的 session 数据转换为前端使用的 session 数据
10
20
  * @param data API 返回的 session 数据
@@ -33,6 +33,34 @@ import { SessionContentRole, SessionPromptRole } from '../../types/enum.js';
33
33
  role: sessionRoleMap[sessionContent.role]
34
34
  };
35
35
  };
36
+ /**
37
+ * 将前端使用的 session 提示数据转换为前端使用的 session 内容数据
38
+ * @param prompt 前端使用的 session 提示数据
39
+ * @returns 前端使用的 session 内容数据
40
+ */ export const transferSessionPrompt2SessionContent = (prompt)=>{
41
+ const sessionRoleMap = {
42
+ [SessionPromptRole.Assistant]: SessionContentRole.Ai,
43
+ [SessionPromptRole.User]: SessionContentRole.User,
44
+ [SessionPromptRole.System]: SessionContentRole.Role,
45
+ [SessionPromptRole.Hidden]: SessionContentRole.Hidden,
46
+ [SessionPromptRole.Guide]: SessionContentRole.Guide,
47
+ [SessionPromptRole.HiddenAssistant]: SessionContentRole.HiddenAi,
48
+ [SessionPromptRole.HiddenGuide]: SessionContentRole.HiddenGuide,
49
+ [SessionPromptRole.HiddenSystem]: SessionContentRole.HiddenRole,
50
+ [SessionPromptRole.HiddenUser]: SessionContentRole.HiddenUser,
51
+ [SessionPromptRole.TemplateAssistant]: SessionContentRole.TemplateAi,
52
+ [SessionPromptRole.TemplateGuide]: SessionContentRole.TemplateGuide,
53
+ [SessionPromptRole.TemplateSystem]: SessionContentRole.TemplateRole,
54
+ [SessionPromptRole.TemplateUser]: SessionContentRole.TemplateUser,
55
+ [SessionPromptRole.TemplateHidden]: SessionContentRole.TemplateHidden,
56
+ [SessionPromptRole.Pause]: SessionContentRole.Pause,
57
+ [SessionPromptRole.UserImage]: SessionContentRole.UserImage
58
+ };
59
+ return {
60
+ content: prompt.content,
61
+ role: sessionRoleMap[prompt.role]
62
+ };
63
+ };
36
64
  /**
37
65
  * 将 API 返回的 session 数据转换为前端使用的 session 数据
38
66
  * @param data API 返回的 session 数据
@@ -1,12 +1,19 @@
1
+ import type { ISessionPrompt } from '@/types/session';
1
2
  export interface IAgentInfoApi {
2
3
  conversation_settings?: {
3
4
  opening_remark?: string;
4
5
  predefined_questions?: string[];
5
6
  };
7
+ prompt_setting?: {
8
+ content?: ISessionPrompt[];
9
+ };
6
10
  }
7
11
  export interface IAgentInfo {
8
12
  conversationSettings?: {
9
13
  openingRemark?: string;
10
14
  predefinedQuestions?: string[];
11
15
  };
16
+ promptSetting?: {
17
+ content?: ISessionPrompt[];
18
+ };
12
19
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blueking/ai-ui-sdk",
3
- "version": "0.0.15-beta.33",
3
+ "version": "0.0.15-beta.35",
4
4
  "description": "蓝鲸AI UI SDK",
5
5
  "main": "dist/main.js",
6
6
  "types": "dist/main.d.ts",