@blueking/ai-ui-sdk 0.0.15-beta.21 → 0.0.15-beta.23

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.
@@ -1,37 +1,37 @@
1
1
 
2
2
  .send-prompt-container {
3
- &[data-v-7wcirdvh] {
3
+ &[data-v-qrmlfz26] {
4
4
  width: 800px;
5
5
  z-index: 1501;
6
6
  overflow: visible;
7
7
  position: relative;
8
8
  }
9
- [data-v-7wcirdvh] .textarea-list {
9
+ [data-v-qrmlfz26] .textarea-list {
10
10
  bottom: var(--textarea-bottom);
11
11
  }
12
12
  &:hover {
13
- .clear-icon[data-v-7wcirdvh] {
13
+ .clear-icon[data-v-qrmlfz26] {
14
14
  display: inline-flex !important;
15
15
  }
16
16
  }
17
17
  }
18
18
  .quill-container {
19
- &[data-v-7wcirdvh] {
19
+ &[data-v-qrmlfz26] {
20
20
  background: #fff;
21
21
  box-shadow: 0 0 6px 0 #0000001a;
22
22
  border-radius: 4px;
23
23
  box-sizing: border-box !important;
24
24
  border: 1px solid transparent;
25
25
  }
26
- &.active[data-v-7wcirdvh] {
26
+ &.active[data-v-qrmlfz26] {
27
27
  border: 1px solid #3A84FF !important;
28
28
  }
29
- &[data-v-7wcirdvh]:has(.ql-editor:focus) {
29
+ &[data-v-qrmlfz26]:has(.ql-editor:focus) {
30
30
  border: 1px solid #3A84FF !important;
31
31
  }
32
32
  }
33
33
  .send-prompt {
34
- &[data-v-7wcirdvh] {
34
+ &[data-v-qrmlfz26] {
35
35
  width: 800px;
36
36
  border: 1px solid transparent;
37
37
  flex-direction: row;
@@ -41,28 +41,28 @@
41
41
  border-radius: 4px;
42
42
  border: 1px solid transparent !important;
43
43
  }
44
- [data-v-7wcirdvh] .content-input-wrapper {
44
+ [data-v-qrmlfz26] .content-input-wrapper {
45
45
  padding: 0 !important;
46
46
  height: 100% !important;
47
47
  }
48
- [data-v-7wcirdvh] .auto-textarea-wrapper {
48
+ [data-v-qrmlfz26] .auto-textarea-wrapper {
49
49
  height: 100% !important;
50
50
  }
51
- [data-v-7wcirdvh] .v-note-panel {
51
+ [data-v-qrmlfz26] .v-note-panel {
52
52
  border-radius: 4px;
53
53
  }
54
- [data-v-7wcirdvh] .scroll-style {
54
+ [data-v-qrmlfz26] .scroll-style {
55
55
  overflow-y: hidden !important;
56
56
  }
57
- [data-v-7wcirdvh] .auto-textarea-block {
57
+ [data-v-qrmlfz26] .auto-textarea-block {
58
58
  display: none;
59
59
  }
60
- &[data-v-7wcirdvh]:has(.ql-editor:focus) {
60
+ &[data-v-qrmlfz26]:has(.ql-editor:focus) {
61
61
  height: var(--text-height);
62
62
  }
63
63
  }
64
64
  .ai-ui-sdk-fasong {
65
- &[data-v-7wcirdvh] {
65
+ &[data-v-qrmlfz26] {
66
66
  width: 28px;
67
67
  height: 28px;
68
68
  line-height: 28px;
@@ -76,16 +76,16 @@
76
76
  text-align: center;
77
77
  z-index: 1501;
78
78
  }
79
- &[data-v-7wcirdvh]:hover {
79
+ &[data-v-qrmlfz26]:hover {
80
80
  background: #F0F5FF;
81
81
  color: #3a84ff;
82
82
  }
83
- &.disable[data-v-7wcirdvh] {
83
+ &.disable[data-v-qrmlfz26] {
84
84
  color: #dcdee5;
85
85
  cursor: not-allowed;
86
86
  }
87
87
  }
88
- .clear-icon[data-v-7wcirdvh] {
88
+ .clear-icon[data-v-qrmlfz26] {
89
89
  display: none !important;
90
90
  position: absolute;
91
91
  bottom: 42px;
@@ -1,5 +1,5 @@
1
1
  import script from './index.script.vue.js';
2
- script.__scopeId = "data-v-7wcirdvh";
2
+ script.__scopeId = "data-v-qrmlfz26";
3
3
  script.__file = "./src/component/render-input/index.vue";
4
4
  import './index.vue.css';
5
5
  export default script;
@@ -1,6 +1,6 @@
1
1
 
2
2
  .send-tool-container {
3
- &[data-v-fxy2i13q] {
3
+ &[data-v-15mrllqv] {
4
4
  position: absolute;
5
5
  left: 50%;
6
6
  top: 16px;
@@ -14,18 +14,18 @@
14
14
  z-index: 15001;
15
15
  }
16
16
  &.bottom {
17
- &[data-v-fxy2i13q] {
17
+ &[data-v-15mrllqv] {
18
18
  bottom: 0;
19
19
  top: auto;
20
20
  }
21
- .ai-ui-sdk-gengduo[data-v-fxy2i13q] {
21
+ .ai-ui-sdk-gengduo[data-v-15mrllqv] {
22
22
  margin-top: -10px;
23
23
  }
24
24
  }
25
- &[data-v-fxy2i13q]:hover, &.is-dragging[data-v-fxy2i13q] {
25
+ &[data-v-15mrllqv]:hover, &.is-dragging[data-v-15mrllqv] {
26
26
  background: #3A84FF;
27
27
  }
28
- .ai-ui-sdk-gengduo[data-v-fxy2i13q] {
28
+ .ai-ui-sdk-gengduo[data-v-15mrllqv] {
29
29
  margin-top: -2px;
30
30
  color: #63656E;
31
31
  }
@@ -1,5 +1,5 @@
1
1
  import script from './render-drag.script.vue.js';
2
- script.__scopeId = "data-v-fxy2i13q";
2
+ script.__scopeId = "data-v-15mrllqv";
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-cxuaapzy] {
2
+ .ai-ui-sdk-icon[data-v-ozrx9dwq] {
3
3
  color: #C4C6CC;
4
4
  }
@@ -1,5 +1,5 @@
1
1
  import script from './index.script.vue.js';
2
- script.__scopeId = "data-v-cxuaapzy";
2
+ script.__scopeId = "data-v-ozrx9dwq";
3
3
  script.__file = "./src/component/render-knowledge-icon/index.vue";
4
4
  import './index.vue.css';
5
5
  export default script;
@@ -1,11 +1,11 @@
1
1
 
2
- .ai-message-home[data-v-2ctp5ngk] {
2
+ .ai-message-home[data-v-anlq0wz4] {
3
3
  justify-content: center;
4
4
  align-items: flex-start;
5
5
  width: 100%;
6
6
  }
7
7
  .ai-content {
8
- &[data-v-2ctp5ngk] {
8
+ &[data-v-anlq0wz4] {
9
9
  flex: 1;
10
10
  max-width: calc(100% - 104px);
11
11
  background: #FFFFFF;
@@ -18,12 +18,12 @@
18
18
  padding-top: 12px;
19
19
  margin-right: 52px;
20
20
  }
21
- .ai-ui-sdk-warning-circle-fill[data-v-2ctp5ngk] {
21
+ .ai-ui-sdk-warning-circle-fill[data-v-anlq0wz4] {
22
22
  color: #EA3636;
23
23
  font-size: 18px;
24
24
  margin-right: 2px;
25
25
  }
26
- .ai-ui-sdk-quanquan[data-v-2ctp5ngk] {
26
+ .ai-ui-sdk-quanquan[data-v-anlq0wz4] {
27
27
  display: inline-block;
28
28
  color: #3A84FF;
29
29
  animation: rotate 800ms linear infinite;
@@ -32,12 +32,12 @@
32
32
  top: 23px;
33
33
  z-index: 1501;
34
34
  }
35
- .message-check[data-v-2ctp5ngk] {
35
+ .message-check[data-v-anlq0wz4] {
36
36
  position: absolute;
37
37
  top: 0;
38
38
  left: -80px;
39
39
  }
40
- &[data-v-2ctp5ngk]::before {
40
+ &[data-v-anlq0wz4]::before {
41
41
  position: absolute;
42
42
  content: '';
43
43
  width: 15px;
@@ -47,25 +47,25 @@
47
47
  rotate: 45deg;
48
48
  background: #FFFFFF;
49
49
  }
50
- &.fail[data-v-2ctp5ngk] {
50
+ &.fail[data-v-anlq0wz4] {
51
51
  padding: 12px;
52
52
  word-break: break-all;
53
53
  }
54
- &.loading[data-v-2ctp5ngk] {
54
+ &.loading[data-v-anlq0wz4] {
55
55
  padding: 12px 0;
56
56
  word-break: break-all;
57
57
  }
58
58
  }
59
- .skeleton-message[data-v-2ctp5ngk] {
59
+ .skeleton-message[data-v-anlq0wz4] {
60
60
  margin-right: 52px;
61
61
  }
62
62
  .message-photo {
63
- &[data-v-2ctp5ngk] {
63
+ &[data-v-anlq0wz4] {
64
64
  width: 52px;
65
65
  text-align: right;
66
66
  user-select: none;
67
67
  }
68
- img[data-v-2ctp5ngk] {
68
+ img[data-v-anlq0wz4] {
69
69
  margin-right: 16px;
70
70
  margin-top: 5px;
71
71
  width: 36px;
@@ -73,24 +73,24 @@ img[data-v-2ctp5ngk] {
73
73
  }
74
74
  }
75
75
  .message-tools {
76
- &[data-v-2ctp5ngk] {
76
+ &[data-v-anlq0wz4] {
77
77
  margin: 12px 12px 12px;
78
78
  padding-top: 10px;
79
79
  justify-content: space-between;
80
80
  border-top: 1px solid #EAEBF0;
81
81
  }
82
- .rate-tip[data-v-2ctp5ngk] {
82
+ .rate-tip[data-v-anlq0wz4] {
83
83
  font-size: 12px;
84
84
  color: #979BA5;
85
85
  margin-left: 7px;
86
86
  }
87
87
  .tool-icons {
88
88
  .ai-ui-sdk-icon {
89
- &[data-v-2ctp5ngk] {
89
+ &[data-v-anlq0wz4] {
90
90
  cursor: pointer;
91
91
  color: #979BA5;
92
92
  }
93
- &[data-v-2ctp5ngk]:hover {
93
+ &[data-v-anlq0wz4]:hover {
94
94
  color: #3A84FF;
95
95
  }
96
96
  }
@@ -1,5 +1,5 @@
1
1
  import script from './openai-message.script.vue.js';
2
- script.__scopeId = "data-v-2ctp5ngk";
2
+ script.__scopeId = "data-v-anlq0wz4";
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-pxtnzs1y] {
2
+ .skeleton-message[data-v-zvhby1z7] {
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-pxtnzs1y";
3
+ script.__scopeId = "data-v-zvhby1z7";
4
4
  script.__file = "./src/component/render-message/skeleton-message.vue";
5
5
  import './skeleton-message.vue.css';
6
6
  export default script;
@@ -1,6 +1,6 @@
1
1
 
2
2
  .system-message {
3
- &[data-v-5w1ex3dx] {
3
+ &[data-v-3uxfxwdn] {
4
4
  position: relative;
5
5
  width: calc(100% - 204px) !important;
6
6
  max-width: 800px !important;
@@ -8,7 +8,7 @@
8
8
  border-bottom: 1px dashed #DCDEE5;
9
9
  margin: 24px 0 40px !important;
10
10
  }
11
- span[data-v-5w1ex3dx] {
11
+ span[data-v-3uxfxwdn] {
12
12
  position: absolute;
13
13
  left: 50%;
14
14
  top: 50%;
@@ -1,5 +1,5 @@
1
1
  import script from './system-message.script.vue.js';
2
- script.__scopeId = "data-v-5w1ex3dx";
2
+ script.__scopeId = "data-v-3uxfxwdn";
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-w95lugyl] {
2
+ .time-message[data-v-ymt82p3s] {
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-w95lugyl";
2
+ script.__scopeId = "data-v-ymt82p3s";
3
3
  script.__file = "./src/component/render-message/time-message.vue";
4
4
  import './time-message.vue.css';
5
5
  export default script;
@@ -1,11 +1,11 @@
1
1
 
2
- .ai-message-home[data-v-rvk7xf3h] {
2
+ .ai-message-home[data-v-55t62o2f] {
3
3
  justify-content: center;
4
4
  align-items: flex-start;
5
5
  width: 100%;
6
6
  }
7
7
  .ai-content {
8
- &[data-v-rvk7xf3h] {
8
+ &[data-v-55t62o2f] {
9
9
  flex: 1;
10
10
  background: #FFFFFF;
11
11
  line-height: 22px;
@@ -17,17 +17,17 @@
17
17
  padding-top: 12px;
18
18
  margin-right: 52px;
19
19
  }
20
- .ai-ui-sdk-warning-circle-fill[data-v-rvk7xf3h] {
20
+ .ai-ui-sdk-warning-circle-fill[data-v-55t62o2f] {
21
21
  color: #EA3636;
22
22
  font-size: 18px;
23
23
  margin-right: 2px;
24
24
  }
25
- .message-check[data-v-rvk7xf3h] {
25
+ .message-check[data-v-55t62o2f] {
26
26
  position: absolute;
27
27
  top: 0;
28
28
  left: -80px;
29
29
  }
30
- &[data-v-rvk7xf3h]::before {
30
+ &[data-v-55t62o2f]::before {
31
31
  position: absolute;
32
32
  content: '';
33
33
  width: 15px;
@@ -37,24 +37,24 @@
37
37
  rotate: 45deg;
38
38
  background: #FFFFFF;
39
39
  }
40
- &.fail[data-v-rvk7xf3h] {
40
+ &.fail[data-v-55t62o2f] {
41
41
  padding: 12px;
42
42
  }
43
43
  }
44
44
  .message-photo {
45
- &[data-v-rvk7xf3h] {
45
+ &[data-v-55t62o2f] {
46
46
  width: 52px;
47
47
  text-align: right;
48
48
  user-select: none;
49
49
  }
50
- img[data-v-rvk7xf3h] {
50
+ img[data-v-55t62o2f] {
51
51
  margin-right: 16px;
52
52
  margin-top: 5px;
53
53
  width: 36px;
54
54
  height: 36px;
55
55
  }
56
56
  }
57
- .clear-message[data-v-rvk7xf3h] {
57
+ .clear-message[data-v-55t62o2f] {
58
58
  color: #3a84ff;
59
59
  cursor: pointer;
60
60
  }
@@ -1,5 +1,5 @@
1
1
  import script from './token-expired-message.script.vue.js';
2
- script.__scopeId = "data-v-rvk7xf3h";
2
+ script.__scopeId = "data-v-55t62o2f";
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,23 +1,23 @@
1
1
 
2
- .user-message-home[data-v-ysd8zobk] {
2
+ .user-message-home[data-v-6w1gjrbf] {
3
3
  align-items: flex-start;
4
4
  justify-content: flex-end;
5
5
  }
6
6
  .user-message-extra {
7
- &[data-v-ysd8zobk] {
7
+ &[data-v-6w1gjrbf] {
8
8
  padding: 0 52px;
9
9
  }
10
- &[data-v-ysd8zobk]:after {
10
+ &[data-v-6w1gjrbf]:after {
11
11
  content: '';
12
12
  display: table;
13
13
  clear: both;
14
14
  }
15
- .ai-ui-sdk-icon[data-v-ysd8zobk] {
15
+ .ai-ui-sdk-icon[data-v-6w1gjrbf] {
16
16
  font-size: 14px;
17
17
  }
18
18
  }
19
19
  .user-content {
20
- &[data-v-ysd8zobk] {
20
+ &[data-v-6w1gjrbf] {
21
21
  flex: 1;
22
22
  max-width: calc(100% - 104px);
23
23
  background: #E1ECFF;
@@ -30,7 +30,7 @@
30
30
  margin-left: 52px;
31
31
  }
32
32
  .ai-ui-sdk-icon {
33
- &[data-v-ysd8zobk] {
33
+ &[data-v-6w1gjrbf] {
34
34
  width: 28px;
35
35
  height: 28px;
36
36
  background: #FFFFFF;
@@ -45,20 +45,20 @@
45
45
  margin-right: 8px;
46
46
  margin-top: 8px;
47
47
  }
48
- &.hover-show[data-v-ysd8zobk] {
48
+ &.hover-show[data-v-6w1gjrbf] {
49
49
  display: none;
50
50
  }
51
- &.ai-ui-sdk-yinyong-2[data-v-ysd8zobk]:hover, &.ai-ui-sdk-copy[data-v-ysd8zobk]:hover, &.ai-ui-sdk-baocun[data-v-ysd8zobk]:hover, &.ai-ui-sdk-delete[data-v-ysd8zobk]:hover {
51
+ &.ai-ui-sdk-yinyong-2[data-v-6w1gjrbf]:hover, &.ai-ui-sdk-copy[data-v-6w1gjrbf]:hover, &.ai-ui-sdk-baocun[data-v-6w1gjrbf]:hover, &.ai-ui-sdk-delete[data-v-6w1gjrbf]:hover {
52
52
  color: #3A84FF;
53
53
  border-color: #3A84FF;
54
54
  }
55
55
  }
56
56
  &:hover {
57
- .hover-show[data-v-ysd8zobk] {
57
+ .hover-show[data-v-6w1gjrbf] {
58
58
  display: flex;
59
59
  }
60
60
  }
61
- &[data-v-ysd8zobk]::after {
61
+ &[data-v-6w1gjrbf]::after {
62
62
  position: absolute;
63
63
  content: '';
64
64
  width: 15px;
@@ -69,24 +69,24 @@
69
69
  background: #E1ECFF;
70
70
  }
71
71
  }
72
- .message-tools[data-v-ysd8zobk] {
72
+ .message-tools[data-v-6w1gjrbf] {
73
73
  justify-content: flex-end;
74
74
  position: absolute;
75
75
  width: 150px;
76
76
  left: -150px;
77
77
  top: 2px;
78
78
  }
79
- .message-check[data-v-ysd8zobk] {
79
+ .message-check[data-v-6w1gjrbf] {
80
80
  position: absolute;
81
81
  top: 0;
82
82
  left: -80px;
83
83
  }
84
84
  .message-photo {
85
- &[data-v-ysd8zobk] {
85
+ &[data-v-6w1gjrbf] {
86
86
  width: 52px;
87
87
  user-select: none;
88
88
  }
89
- img[data-v-ysd8zobk] {
89
+ img[data-v-6w1gjrbf] {
90
90
  margin-left: 16px;
91
91
  margin-top: 5px;
92
92
  width: 36px;
@@ -95,6 +95,6 @@ img[data-v-ysd8zobk] {
95
95
  border-radius: 100%;
96
96
  }
97
97
  }
98
- .skeleton-message[data-v-ysd8zobk] {
98
+ .skeleton-message[data-v-6w1gjrbf] {
99
99
  margin-left: 52px;
100
100
  }
@@ -1,5 +1,5 @@
1
1
  import script from './user-message.script.vue.js';
2
- script.__scopeId = "data-v-ysd8zobk";
2
+ script.__scopeId = "data-v-6w1gjrbf";
3
3
  script.__file = "./src/component/render-message/user-message.vue";
4
4
  import './user-message.vue.css';
5
5
  export default script;
@@ -1,6 +1,6 @@
1
1
 
2
2
  .render-stop {
3
- &[data-v-mzvny1l9] {
3
+ &[data-v-fr97f3wv] {
4
4
  background: #FFFFFF;
5
5
  border: 1px solid #DCDEE5;
6
6
  border-radius: 2px;
@@ -9,7 +9,7 @@
9
9
  font-size: 12px;
10
10
  cursor: pointer;
11
11
  }
12
- .stop-icon[data-v-mzvny1l9] {
12
+ .stop-icon[data-v-fr97f3wv] {
13
13
  width: 8px;
14
14
  height: 8px;
15
15
  background: #FFDDDD;
@@ -1,5 +1,5 @@
1
1
  import script from './index.script.vue.js';
2
- script.__scopeId = "data-v-mzvny1l9";
2
+ script.__scopeId = "data-v-fr97f3wv";
3
3
  script.__file = "./src/component/render-stop/index.vue";
4
4
  import './index.vue.css';
5
5
  export default script;
@@ -861,5 +861,6 @@ export declare const useChat: ({ handleStart, handleText, handleReferenceDoc, ha
861
861
  modifySessionContentApi: (data: ISessionContent) => Promise<ISessionContent>;
862
862
  deleteSessionContentApi: (id: number) => Promise<ISessionContent>;
863
863
  batchDeleteSessionContentsApi: (ids: number[]) => Promise<number>;
864
+ updateRequestOptions: (newOptions: Partial<typeof requestOptions>) => void;
864
865
  };
865
866
  export {};
@@ -65,8 +65,19 @@ import { ChatHelper } from '../common/chart-helper.js';
65
65
  import { processPromptTemplate, throttle } from '../common/util.js';
66
66
  // ai 聊天
67
67
  export const useChat = ({ handleStart, handleText, handleReferenceDoc, handleThink, handleEnd, handleError, requestOptions })=>{
68
- // 接口
69
- const { getAgentInfo: getAgentInfoApi, clearSession: clearSessionApi, getSessions: getSessionsApi, plusSession: plusSessionApi, modifySession: modifySessionApi, deleteSession: deleteSessionApi, batchDeleteSessions: batchDeleteSessionsApi, getSession: getSessionApi, getSessionContents: getSessionContentsApi, plusSessionContent: plusSessionContentApi, modifySessionContent: modifySessionContentApi, deleteSessionContent: deleteSessionContentApi, batchDeleteSessionContents: batchDeleteSessionContentsApi } = useHttp(requestOptions.url);
68
+ // 用 ref 存储 requestOptions,使其可更新
69
+ const currentRequestOptions = ref(requestOptions);
70
+ // 创建一个变量保存当前的API实现
71
+ let apiImpl = useHttp(currentRequestOptions.value.url);
72
+ // 更新 requestOptions 的方法
73
+ function updateRequestOptions(newOptions) {
74
+ // 合并新旧配置
75
+ currentRequestOptions.value = _object_spread({}, currentRequestOptions.value, newOptions);
76
+ // 如果 URL 变更,重新获取 API
77
+ if (newOptions.url) {
78
+ apiImpl = useHttp(currentRequestOptions.value.url);
79
+ }
80
+ }
70
81
  const startMessage = '内容正在生成中...';
71
82
  // 聊天上下文
72
83
  const currentSession = ref();
@@ -188,14 +199,14 @@ export const useChat = ({ handleStart, handleText, handleReferenceDoc, handleThi
188
199
  });
189
200
  // 新增 db
190
201
  function plusSessionContent2Db(sessionContent) {
191
- return plusSessionContentApi(sessionContent).then((result)=>{
202
+ return apiImpl.plusSessionContent(sessionContent).then((result)=>{
192
203
  sessionContent.id = result.id;
193
204
  sessionContent.createdAt = result.createdAt;
194
205
  return sessionContent;
195
206
  });
196
207
  }
197
208
  // 防抖更新 db
198
- const throttleModifySessionContentApi = throttle((id, sessionContent)=>modifySessionContentApi(sessionContent), 1000);
209
+ const throttleModifySessionContentApi = throttle((id, sessionContent)=>apiImpl.modifySessionContent(sessionContent), 1000);
199
210
  // 设置 currentSession
200
211
  function setCurrentSession(session) {
201
212
  currentSession.value = session;
@@ -300,12 +311,12 @@ export const useChat = ({ handleStart, handleText, handleReferenceDoc, handleThi
300
311
  const deleteSessionContentIds = getDeleteSessionContents(sessionCode, [
301
312
  contentId
302
313
  ], true);
303
- return batchDeleteSessionContentsApi(deleteSessionContentIds);
314
+ return apiImpl.batchDeleteSessionContents(deleteSessionContentIds);
304
315
  }
305
316
  // 批量删除
306
317
  function deleteSessionContents(sessionCode, contentIds) {
307
318
  const deleteSessionContentIds = getDeleteSessionContents(sessionCode, contentIds, false);
308
- return batchDeleteSessionContentsApi(deleteSessionContentIds);
319
+ return apiImpl.batchDeleteSessionContents(deleteSessionContentIds);
309
320
  }
310
321
  function handleStartChat(sessionCode) {
311
322
  return _handleStartChat.apply(this, arguments);
@@ -448,11 +459,12 @@ export const useChat = ({ handleStart, handleText, handleReferenceDoc, handleThi
448
459
  }
449
460
  // 聊天
450
461
  function chat({ sessionCode, data, headers }) {
462
+ var _currentRequestOptions_value;
451
463
  const sessionContent = getLastSessionContentBySessionCode(sessionCode);
452
464
  // 发送请求
453
465
  chatHelper.stream({
454
466
  sessionCode,
455
- url: `${requestOptions.url}/chat_completion/`,
467
+ url: `${currentRequestOptions.value.url}/chat_completion/`,
456
468
  data: _object_spread({
457
469
  session_content_id: sessionContent === null || sessionContent === void 0 ? void 0 : sessionContent.id,
458
470
  session_code: sessionCode,
@@ -460,7 +472,7 @@ export const useChat = ({ handleStart, handleText, handleReferenceDoc, handleThi
460
472
  stream: true
461
473
  }
462
474
  }, data),
463
- headers: headers || (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers)
475
+ headers: headers || ((_currentRequestOptions_value = currentRequestOptions.value) === null || _currentRequestOptions_value === void 0 ? void 0 : _currentRequestOptions_value.headers)
464
476
  });
465
477
  }
466
478
  function reSendChat(sessionCode, sessionContent, sessionIndex) {
@@ -493,8 +505,8 @@ export const useChat = ({ handleStart, handleText, handleReferenceDoc, handleThi
493
505
  }
494
506
  // 发送聊天
495
507
  function sendChat(content, callback) {
496
- var _currentSession_value, _currentSession_value1, _currentSession_value2;
497
- if (!((_currentSession_value = currentSession.value) === null || _currentSession_value === void 0 ? void 0 : _currentSession_value.sessionCode) || !(requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.url) || currentSessionLoading.value) {
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) {
498
510
  return;
499
511
  }
500
512
  const { message, cite, shortcut } = content;
@@ -514,8 +526,8 @@ export const useChat = ({ handleStart, handleText, handleReferenceDoc, handleThi
514
526
  // 发送请求
515
527
  chatHelper.stream({
516
528
  sessionCode: (_currentSession_value2 = currentSession.value) === null || _currentSession_value2 === void 0 ? void 0 : _currentSession_value2.sessionCode,
517
- url: requestOptions.url,
518
- headers: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers,
529
+ url: currentRequestOptions.value.url,
530
+ headers: (_currentRequestOptions_value1 = currentRequestOptions.value) === null || _currentRequestOptions_value1 === void 0 ? void 0 : _currentRequestOptions_value1.headers,
519
531
  data: {
520
532
  inputs: {
521
533
  chat_history: prompts.value.slice(0, prompts.value.length - 1),
@@ -546,6 +558,7 @@ export const useChat = ({ handleStart, handleText, handleReferenceDoc, handleThi
546
558
  function stopChat(sessionCode) {
547
559
  chatHelper.stop(sessionCode);
548
560
  }
561
+ // 返回包装函数,这些函数会在调用时使用当前的apiImpl
549
562
  return {
550
563
  currentSession,
551
564
  sessionContents,
@@ -570,18 +583,20 @@ export const useChat = ({ handleStart, handleText, handleReferenceDoc, handleThi
570
583
  reGenerateChat,
571
584
  reSendChat,
572
585
  deleteChat,
573
- getAgentInfoApi,
574
- clearSessionApi,
575
- getSessionsApi,
576
- plusSessionApi,
577
- modifySessionApi,
578
- deleteSessionApi,
579
- batchDeleteSessionsApi,
580
- getSessionApi,
581
- getSessionContentsApi,
582
- plusSessionContentApi,
583
- modifySessionContentApi,
584
- deleteSessionContentApi,
585
- batchDeleteSessionContentsApi
586
+ // API 方法包装器,使用正确的类型签名
587
+ getAgentInfoApi: (...args)=>apiImpl.getAgentInfo(...args),
588
+ clearSessionApi: (...args)=>apiImpl.clearSession(...args),
589
+ getSessionsApi: (...args)=>apiImpl.getSessions(...args),
590
+ plusSessionApi: (...args)=>apiImpl.plusSession(...args),
591
+ modifySessionApi: (...args)=>apiImpl.modifySession(...args),
592
+ deleteSessionApi: (...args)=>apiImpl.deleteSession(...args),
593
+ batchDeleteSessionsApi: (...args)=>apiImpl.batchDeleteSessions(...args),
594
+ getSessionApi: (...args)=>apiImpl.getSession(...args),
595
+ getSessionContentsApi: (...args)=>apiImpl.getSessionContents(...args),
596
+ plusSessionContentApi: (...args)=>apiImpl.plusSessionContent(...args),
597
+ modifySessionContentApi: (...args)=>apiImpl.modifySessionContent(...args),
598
+ deleteSessionContentApi: (...args)=>apiImpl.deleteSessionContent(...args),
599
+ batchDeleteSessionContentsApi: (...args)=>apiImpl.batchDeleteSessionContents(...args),
600
+ updateRequestOptions
586
601
  };
587
602
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blueking/ai-ui-sdk",
3
- "version": "0.0.15-beta.21",
3
+ "version": "0.0.15-beta.23",
4
4
  "description": "蓝鲸AI UI SDK",
5
5
  "main": "dist/main.js",
6
6
  "types": "dist/main.d.ts",