@ibiz-template/vue3-components 0.7.41-alpha.43 → 0.7.41-alpha.44
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/ibiz-markdown-editor-CUzKkFER.js +1 -0
- package/dist/{index-CG3sQH0b.js → index-DgqTP4Vw.js} +1 -1
- package/dist/{index-kZrZndeH.js → index-Dr0VM8iS.js} +1 -1
- package/dist/index-DtEaU3-5.js +11 -0
- package/dist/index.min.css +1 -1
- package/dist/index.system.min.js +1 -1
- package/dist/wang-editor-CRWSwyXY.js +1 -0
- package/dist/{xlsx-util-8YSXhmdI.js → xlsx-util-CMJON8Uq.js} +1 -1
- package/es/control/grid/grid-column/grid-field-column/attachment-column/attachment-column.mjs +2 -1
- package/es/control/grid/grid-column/grid-field-column/attachment-column/file-util.mjs +22 -11
- package/es/editor/carousel/ibiz-carousel/ibiz-carousel.mjs +5 -2
- package/es/editor/code/monaco-editor/monaco-editor.mjs +2 -0
- package/es/editor/html/wang-editor/wang-editor.mjs +15 -6
- package/es/editor/markdown/ibiz-markdown-editor/custom-menu.mjs +5 -0
- package/es/editor/markdown/ibiz-markdown-editor/ibiz-markdown-editor.css +1 -1
- package/es/editor/markdown/ibiz-markdown-editor/ibiz-markdown-editor.mjs +23 -12
- package/es/editor/text-box/input/input.mjs +2 -0
- package/es/editor/text-box/signature/signature.mjs +28 -15
- package/es/editor/upload/upload-editor.controller.mjs +12 -1
- package/es/editor/upload/use/use-iview-upload.mjs +28 -13
- package/es/locale/en/index.mjs +5 -1
- package/es/locale/zh-CN/index.mjs +5 -1
- package/es/panel-component/coop-pos/coop-pos.controller.mjs +11 -1
- package/es/panel-component/panel-app-title/panel-app-title.controller.mjs +3 -1
- package/es/panel-component/panel-app-title/panel-app-title.mjs +4 -2
- package/es/util/ai-chat-util/ai-chat-util.mjs +70 -35
- package/es/util/app-util/app-util.mjs +2 -1
- package/es/util/inline-ai-util/inline-ai-textarea/common/ai-think/ai-think.css +1 -0
- package/es/util/inline-ai-util/inline-ai-textarea/common/ai-think/ai-think.mjs +56 -0
- package/es/util/inline-ai-util/inline-ai-textarea/common/ai-tool-call/ai-tool-call.css +1 -0
- package/es/util/inline-ai-util/inline-ai-textarea/common/ai-tool-call/ai-tool-call.mjs +52 -0
- package/es/util/inline-ai-util/inline-ai-textarea/common/ai-tool-call-item/ai-tool-call-item.css +1 -0
- package/es/util/inline-ai-util/inline-ai-textarea/common/ai-tool-call-item/ai-tool-call-item.mjs +143 -0
- package/es/util/inline-ai-util/inline-ai-textarea/common/index.mjs +4 -0
- package/es/util/inline-ai-util/inline-ai-textarea/icon.mjs +52 -1
- package/es/util/inline-ai-util/inline-ai-textarea/inline-ai-textarea.css +1 -1
- package/es/util/inline-ai-util/inline-ai-textarea/inline-ai-textarea.hook.mjs +29 -3
- package/es/util/inline-ai-util/inline-ai-textarea/inline-ai-textarea.mjs +32 -25
- package/es/util/inline-ai-util/inline-ai-textarea/interface.mjs +1 -0
- package/lib/control/grid/grid-column/grid-field-column/attachment-column/attachment-column.cjs +2 -1
- package/lib/control/grid/grid-column/grid-field-column/attachment-column/file-util.cjs +22 -11
- package/lib/editor/carousel/ibiz-carousel/ibiz-carousel.cjs +5 -2
- package/lib/editor/code/monaco-editor/monaco-editor.cjs +2 -0
- package/lib/editor/html/wang-editor/wang-editor.cjs +15 -6
- package/lib/editor/markdown/ibiz-markdown-editor/custom-menu.cjs +5 -0
- package/lib/editor/markdown/ibiz-markdown-editor/ibiz-markdown-editor.cjs +23 -12
- package/lib/editor/markdown/ibiz-markdown-editor/ibiz-markdown-editor.css +1 -1
- package/lib/editor/text-box/input/input.cjs +2 -0
- package/lib/editor/text-box/signature/signature.cjs +28 -15
- package/lib/editor/upload/upload-editor.controller.cjs +12 -1
- package/lib/editor/upload/use/use-iview-upload.cjs +28 -13
- package/lib/locale/en/index.cjs +5 -1
- package/lib/locale/zh-CN/index.cjs +5 -1
- package/lib/panel-component/coop-pos/coop-pos.controller.cjs +11 -1
- package/lib/panel-component/panel-app-title/panel-app-title.cjs +4 -2
- package/lib/panel-component/panel-app-title/panel-app-title.controller.cjs +3 -1
- package/lib/util/ai-chat-util/ai-chat-util.cjs +70 -35
- package/lib/util/app-util/app-util.cjs +2 -1
- package/lib/util/inline-ai-util/inline-ai-textarea/common/ai-think/ai-think.cjs +58 -0
- package/lib/util/inline-ai-util/inline-ai-textarea/common/ai-think/ai-think.css +1 -0
- package/lib/util/inline-ai-util/inline-ai-textarea/common/ai-tool-call/ai-tool-call.cjs +54 -0
- package/lib/util/inline-ai-util/inline-ai-textarea/common/ai-tool-call/ai-tool-call.css +1 -0
- package/lib/util/inline-ai-util/inline-ai-textarea/common/ai-tool-call-item/ai-tool-call-item.cjs +145 -0
- package/lib/util/inline-ai-util/inline-ai-textarea/common/ai-tool-call-item/ai-tool-call-item.css +1 -0
- package/lib/util/inline-ai-util/inline-ai-textarea/common/index.cjs +9 -0
- package/lib/util/inline-ai-util/inline-ai-textarea/icon.cjs +54 -0
- package/lib/util/inline-ai-util/inline-ai-textarea/inline-ai-textarea.cjs +31 -24
- package/lib/util/inline-ai-util/inline-ai-textarea/inline-ai-textarea.css +1 -1
- package/lib/util/inline-ai-util/inline-ai-textarea/inline-ai-textarea.hook.cjs +29 -3
- package/lib/util/inline-ai-util/inline-ai-textarea/interface.cjs +3 -0
- package/package.json +5 -5
- package/dist/ibiz-markdown-editor-DJ662N4_.js +0 -1
- package/dist/index-D3x_MFr-.js +0 -11
- package/dist/wang-editor-DDSO3Ha9.js +0 -1
|
@@ -843,7 +843,11 @@ var index = {
|
|
|
843
843
|
warningTitle: "\u786E\u8BA4\u4E2D\u6B62",
|
|
844
844
|
warningDesc: "\u786E\u8BA4\u4E2D\u6B62\u521B\u4F5C\u5417\uFF1F",
|
|
845
845
|
thinking: "\u6DF1\u5EA6\u601D\u8003\u4E2D",
|
|
846
|
-
thinked: "\u5DF2\u6DF1\u5EA6\u601D\u8003"
|
|
846
|
+
thinked: "\u5DF2\u6DF1\u5EA6\u601D\u8003",
|
|
847
|
+
collapseToolCall: "\u6536\u8D77\u5DE5\u5177\u8C03\u7528",
|
|
848
|
+
expandToolCall: "\u5C55\u5F00\u5168\u90E8 {number} \u4E2A\u5DE5\u5177\u8C03\u7528",
|
|
849
|
+
error: "\u53D1\u751F\u9519\u8BEF",
|
|
850
|
+
copy: "\u5DF2\u590D\u5236"
|
|
847
851
|
},
|
|
848
852
|
aiChartUtil: {
|
|
849
853
|
feedback: "\u53CD\u9988",
|
|
@@ -32,6 +32,13 @@ class CoopPosController extends PanelItemController {
|
|
|
32
32
|
* @memberof CoopPosController
|
|
33
33
|
*/
|
|
34
34
|
__publicField(this, "showMode", "default");
|
|
35
|
+
/**
|
|
36
|
+
* 是否启用无权限
|
|
37
|
+
*
|
|
38
|
+
* @type {boolean}
|
|
39
|
+
* @memberof CoopPosController
|
|
40
|
+
*/
|
|
41
|
+
__publicField(this, "enableNoAccess", false);
|
|
35
42
|
/**
|
|
36
43
|
* 消息模式映射
|
|
37
44
|
* - 视图打开数据模式映射消息类型
|
|
@@ -53,6 +60,7 @@ class CoopPosController extends PanelItemController {
|
|
|
53
60
|
await super.onInit();
|
|
54
61
|
this.handleRawItemParams();
|
|
55
62
|
this.showMode = this.rawItemParams.showmode;
|
|
63
|
+
this.enableNoAccess = this.rawItemParams.enablenoaccess === "true";
|
|
56
64
|
await this.getOperator();
|
|
57
65
|
}
|
|
58
66
|
/**
|
|
@@ -152,7 +160,9 @@ class CoopPosController extends PanelItemController {
|
|
|
152
160
|
}
|
|
153
161
|
const { downloadUrl } = ibiz.util.file.calcFileUpDownUrl(
|
|
154
162
|
this.panel.context,
|
|
155
|
-
this.panel.params
|
|
163
|
+
this.panel.params,
|
|
164
|
+
{},
|
|
165
|
+
{ enableNoAccess: this.enableNoAccess }
|
|
156
166
|
);
|
|
157
167
|
return downloadUrl.replace("%fileId%", urlConfig[0].id);
|
|
158
168
|
}
|
|
@@ -56,7 +56,9 @@ class PanelAppTitleController extends PanelItemController {
|
|
|
56
56
|
} else if (indexViewModel.appIconPath) {
|
|
57
57
|
this.state.icon = indexViewModel.appIconPath;
|
|
58
58
|
}
|
|
59
|
-
if (indexViewModel.
|
|
59
|
+
if (indexViewModel.sysImage && indexViewModel.sysImage.rawContent) {
|
|
60
|
+
this.state.icon2 = indexViewModel.sysImage.rawContent;
|
|
61
|
+
} else if (indexViewModel.appIconPath2) {
|
|
60
62
|
this.state.icon2 = indexViewModel.appIconPath2;
|
|
61
63
|
}
|
|
62
64
|
if (indexViewModel.caption) {
|
|
@@ -85,6 +85,7 @@ const PanelAppTitle = /* @__PURE__ */ defineComponent({
|
|
|
85
85
|
render() {
|
|
86
86
|
const {
|
|
87
87
|
icon,
|
|
88
|
+
icon2,
|
|
88
89
|
caption,
|
|
89
90
|
caption2,
|
|
90
91
|
subCaption,
|
|
@@ -100,13 +101,14 @@ const PanelAppTitle = /* @__PURE__ */ defineComponent({
|
|
|
100
101
|
} else {
|
|
101
102
|
if (this.menuAlign === "LEFT") {
|
|
102
103
|
if (this.isCollapse) {
|
|
103
|
-
|
|
104
|
+
const collapseIcon = icon2 || icon;
|
|
105
|
+
if (collapseIcon) {
|
|
104
106
|
iconVNode = createVNode("div", {
|
|
105
107
|
"class": this.ns.e("collpase-icon")
|
|
106
108
|
}, [createVNode(resolveComponent("iBizIcon"), {
|
|
107
109
|
"class": this.ns.e("logo"),
|
|
108
110
|
"icon": {
|
|
109
|
-
rawContent:
|
|
111
|
+
rawContent: collapseIcon
|
|
110
112
|
}
|
|
111
113
|
}, null)]);
|
|
112
114
|
} else {
|
|
@@ -185,7 +185,8 @@ class AIChatUtil {
|
|
|
185
185
|
state: msg.actionstate,
|
|
186
186
|
type: "DEFAULT",
|
|
187
187
|
role: "ASSISTANT",
|
|
188
|
-
content: choices[0].content || ""
|
|
188
|
+
content: choices[0].content || "",
|
|
189
|
+
realmessageid: choices[0].messageid
|
|
189
190
|
});
|
|
190
191
|
}
|
|
191
192
|
} else if (msg.actionstate === 40) {
|
|
@@ -230,9 +231,13 @@ class AIChatUtil {
|
|
|
230
231
|
};
|
|
231
232
|
chatOptions.recommendPrompt = async (ctx, param, other) => {
|
|
232
233
|
const deService = await ibiz.hub.getApp(ctx.srfappid).deService.getService(ctx, other.appDataEntityId);
|
|
234
|
+
const tempParams = { ...param };
|
|
235
|
+
if (other.srfaiagent) {
|
|
236
|
+
tempParams.srfaiagent = other.srfaiagent;
|
|
237
|
+
}
|
|
233
238
|
const result = await deService.aiChatRecommendPrompt(
|
|
234
239
|
ctx,
|
|
235
|
-
|
|
240
|
+
tempParams,
|
|
236
241
|
other.message
|
|
237
242
|
);
|
|
238
243
|
if (result.ok && result.data) {
|
|
@@ -249,7 +254,8 @@ class AIChatUtil {
|
|
|
249
254
|
const fileMeata = ibiz.util.file.calcFileUpDownUrl(
|
|
250
255
|
(options == null ? void 0 : options.context) || context,
|
|
251
256
|
(options == null ? void 0 : options.params) || params,
|
|
252
|
-
{}
|
|
257
|
+
{},
|
|
258
|
+
{ enableNoAccess: true }
|
|
253
259
|
);
|
|
254
260
|
const fielUploadHeaders = ibiz.util.file.getUploadHeaders();
|
|
255
261
|
const formData = new FormData();
|
|
@@ -504,7 +510,8 @@ class AIChatUtil {
|
|
|
504
510
|
state: msg.actionstate,
|
|
505
511
|
type: "DEFAULT",
|
|
506
512
|
role: "ASSISTANT",
|
|
507
|
-
content: choices[0].content || ""
|
|
513
|
+
content: choices[0].content || "",
|
|
514
|
+
realmessageid: choices[0].messageid
|
|
508
515
|
});
|
|
509
516
|
}
|
|
510
517
|
} else if (msg.actionstate === 40) {
|
|
@@ -549,9 +556,13 @@ class AIChatUtil {
|
|
|
549
556
|
};
|
|
550
557
|
chatOptions.recommendPrompt = async (ctx, param, other) => {
|
|
551
558
|
const deService = await ibiz.hub.getApp(ctx.srfappid).deService.getService(ctx, other.appDataEntityId);
|
|
559
|
+
const tempParams = { ...param };
|
|
560
|
+
if (other.srfaiagent) {
|
|
561
|
+
tempParams.srfaiagent = other.srfaiagent;
|
|
562
|
+
}
|
|
552
563
|
const result = await deService.aiChatRecommendPrompt(
|
|
553
564
|
ctx,
|
|
554
|
-
|
|
565
|
+
tempParams,
|
|
555
566
|
other.message
|
|
556
567
|
);
|
|
557
568
|
if (result.ok && result.data) {
|
|
@@ -568,7 +579,8 @@ class AIChatUtil {
|
|
|
568
579
|
const { uploadUrl } = ibiz.util.file.calcFileUpDownUrl(
|
|
569
580
|
(options == null ? void 0 : options.context) || context,
|
|
570
581
|
(options == null ? void 0 : options.params) || params,
|
|
571
|
-
{}
|
|
582
|
+
{},
|
|
583
|
+
{ enableNoAccess: true }
|
|
572
584
|
);
|
|
573
585
|
const headers = ibiz.util.file.getUploadHeaders();
|
|
574
586
|
const formData = new FormData();
|
|
@@ -756,54 +768,42 @@ class AIChatUtil {
|
|
|
756
768
|
return resourceOptions;
|
|
757
769
|
}
|
|
758
770
|
const utilService = new AIUtilService(aiSessionUtil);
|
|
759
|
-
resourceOptions.getSessionList = async () => {
|
|
760
|
-
const
|
|
771
|
+
resourceOptions.getSessionList = async (args = {}) => {
|
|
772
|
+
const tempParams = { ...params, page: 0, size: 1e3, ...args };
|
|
773
|
+
const result = await utilService.getSessionList(context, tempParams);
|
|
761
774
|
return result;
|
|
762
775
|
};
|
|
763
|
-
resourceOptions.updateSession = async (
|
|
776
|
+
resourceOptions.updateSession = async (realID, data) => {
|
|
764
777
|
const result = await utilService.updateSession(
|
|
765
778
|
context,
|
|
766
779
|
params,
|
|
767
|
-
|
|
780
|
+
realID,
|
|
768
781
|
data
|
|
769
782
|
);
|
|
770
783
|
return result;
|
|
771
784
|
};
|
|
772
|
-
resourceOptions.deleteSession = async (
|
|
773
|
-
const result = await utilService.deleteSession(
|
|
774
|
-
context,
|
|
775
|
-
params,
|
|
776
|
-
sessionID
|
|
777
|
-
);
|
|
785
|
+
resourceOptions.deleteSession = async (realID) => {
|
|
786
|
+
const result = await utilService.deleteSession(context, params, realID);
|
|
778
787
|
return result;
|
|
779
788
|
};
|
|
780
|
-
resourceOptions.getMessages = async (
|
|
781
|
-
const
|
|
782
|
-
|
|
783
|
-
params,
|
|
784
|
-
sessionID
|
|
785
|
-
);
|
|
789
|
+
resourceOptions.getMessages = async (args = {}) => {
|
|
790
|
+
const tempParams = { ...params, page: 0, size: 1e3, ...args };
|
|
791
|
+
const result = await utilService.getMessageList(context, tempParams);
|
|
786
792
|
return result;
|
|
787
793
|
};
|
|
788
|
-
resourceOptions.deleteMessage = async (
|
|
794
|
+
resourceOptions.deleteMessage = async (messageID) => {
|
|
789
795
|
const result = await utilService.deleteMessage(
|
|
790
796
|
context,
|
|
791
797
|
params,
|
|
792
|
-
sessionID,
|
|
793
798
|
messageID
|
|
794
799
|
);
|
|
795
800
|
return result;
|
|
796
801
|
};
|
|
797
|
-
resourceOptions.likeMessage = async (
|
|
798
|
-
const result = await utilService.likeMessage(
|
|
799
|
-
context,
|
|
800
|
-
params,
|
|
801
|
-
sessionID,
|
|
802
|
-
messageID
|
|
803
|
-
);
|
|
802
|
+
resourceOptions.likeMessage = async (messageID) => {
|
|
803
|
+
const result = await utilService.likeMessage(context, params, messageID);
|
|
804
804
|
return result;
|
|
805
805
|
};
|
|
806
|
-
resourceOptions.dislikeMessage = async (
|
|
806
|
+
resourceOptions.dislikeMessage = async (messageID, feedbackContent) => {
|
|
807
807
|
var _a, _b;
|
|
808
808
|
const overlay = ibiz.overlay.createModal(
|
|
809
809
|
(modal) => {
|
|
@@ -823,23 +823,58 @@ class AIChatUtil {
|
|
|
823
823
|
const _result = await utilService.dislikeMessage(
|
|
824
824
|
context,
|
|
825
825
|
params,
|
|
826
|
-
sessionID,
|
|
827
826
|
messageID,
|
|
828
827
|
content
|
|
829
828
|
);
|
|
830
829
|
return _result;
|
|
831
830
|
};
|
|
832
|
-
resourceOptions.cancelFeedback = async (
|
|
831
|
+
resourceOptions.cancelFeedback = async (messageID) => {
|
|
833
832
|
const result = await utilService.cancelFeedback(
|
|
834
833
|
context,
|
|
835
834
|
params,
|
|
836
|
-
sessionID,
|
|
837
835
|
messageID
|
|
838
836
|
);
|
|
839
837
|
return result;
|
|
840
838
|
};
|
|
839
|
+
resourceOptions.clearAllSession = async (excludeSessionID) => {
|
|
840
|
+
const result = await utilService.clearAllSession(
|
|
841
|
+
context,
|
|
842
|
+
params,
|
|
843
|
+
excludeSessionID
|
|
844
|
+
);
|
|
845
|
+
return result;
|
|
846
|
+
};
|
|
847
|
+
resourceOptions.clearAllMessageBySessionId = async (realID) => {
|
|
848
|
+
const result = await utilService.clearAllMessageBySessionId(
|
|
849
|
+
context,
|
|
850
|
+
params,
|
|
851
|
+
realID
|
|
852
|
+
);
|
|
853
|
+
return result;
|
|
854
|
+
};
|
|
841
855
|
return resourceOptions;
|
|
842
856
|
}
|
|
857
|
+
/**
|
|
858
|
+
* 获取AI聊天模式
|
|
859
|
+
* @param type 场景类型:UIACTION:界面行为;EDITOR:编辑器
|
|
860
|
+
* @param context
|
|
861
|
+
* @param params
|
|
862
|
+
* @param editorParams
|
|
863
|
+
*/
|
|
864
|
+
getAIChatMode(type, context, params, editorParams) {
|
|
865
|
+
switch (type) {
|
|
866
|
+
case "UIACTION":
|
|
867
|
+
if (params.srfenabletempmode && params.srfenabletempmode === "true") {
|
|
868
|
+
delete params.srfenabletempmode;
|
|
869
|
+
return "DEFAULT";
|
|
870
|
+
}
|
|
871
|
+
return "TOPIC";
|
|
872
|
+
case "EDITOR":
|
|
873
|
+
return "DEFAULT";
|
|
874
|
+
default:
|
|
875
|
+
return "DEFAULT";
|
|
876
|
+
}
|
|
877
|
+
}
|
|
843
878
|
}
|
|
844
879
|
|
|
845
880
|
export { AIChatUtil };
|
|
@@ -222,13 +222,14 @@ class AppUtil {
|
|
|
222
222
|
deACMode,
|
|
223
223
|
{ chatInstance, view, ctrl }
|
|
224
224
|
);
|
|
225
|
+
const chatMode = ibiz.aiChatUtil.getAIChatMode("UIACTION", context, params);
|
|
225
226
|
const resourceOptions = await ibiz.aiChatUtil.getAIResourceOptions(
|
|
226
227
|
context,
|
|
227
228
|
params
|
|
228
229
|
);
|
|
229
230
|
return new Promise((resolve) => {
|
|
230
231
|
chatInstance.create({
|
|
231
|
-
mode:
|
|
232
|
+
mode: chatMode,
|
|
232
233
|
resourceOptions,
|
|
233
234
|
containerOptions: {
|
|
234
235
|
zIndex: containerZIndex,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.ibiz-ai-think{width:100%;height:auto;font-size:var(--ibiz-font-size-small);color:var(--ibiz-inline-ai-textarea-container-color-text-1)}.ibiz-ai-think__header{display:flex;gap:var(--ibiz-spacing-extra-tight);align-items:center;margin-bottom:var(--ibiz-spacing-tight);cursor:pointer}.ibiz-ai-think__header:hover{color:var(--ibiz-inline-ai-textarea-container-color-text-hove-1)}.ibiz-ai-think__header--state-icon{display:flex;align-items:center;color:var(--ibiz-color-success)}.ibiz-ai-think__header--state-icon.is-loading{color:var(--ibiz-inline-ai-textarea-container-color-loading)}.ibiz-ai-think__header--collapse-icon{display:flex;align-items:center}.ibiz-ai-think__content{position:relative;padding-left:var(--ibiz-spacing-tight);word-wrap:break-word;white-space:pre-wrap;transition:height .3s cubic-bezier(.4,0,.2,1),opacity .3s cubic-bezier(.4,0,.2,1)}.ibiz-ai-think__content::before{position:absolute;top:0;bottom:0;left:0;width:2px;content:"";background-color:var(--ibiz-inline-ai-textarea-container-color-border)}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { defineComponent, createVNode } from 'vue';
|
|
2
|
+
import { useNamespace } from '@ibiz-template/vue3-util';
|
|
3
|
+
import { LoadingIcon, ThinkSuccessIcon, DownIcon, UpIcon } from '../../icon.mjs';
|
|
4
|
+
import './ai-think.css';
|
|
5
|
+
|
|
6
|
+
"use strict";
|
|
7
|
+
const AIThink = /* @__PURE__ */ defineComponent({
|
|
8
|
+
props: {
|
|
9
|
+
think: {
|
|
10
|
+
type: String
|
|
11
|
+
},
|
|
12
|
+
isLoading: {
|
|
13
|
+
type: Boolean,
|
|
14
|
+
required: true
|
|
15
|
+
},
|
|
16
|
+
isCollapse: {
|
|
17
|
+
type: Boolean,
|
|
18
|
+
required: true
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
emits: {
|
|
22
|
+
collapseChange: (_value) => true
|
|
23
|
+
},
|
|
24
|
+
setup(props, {
|
|
25
|
+
emit
|
|
26
|
+
}) {
|
|
27
|
+
const ns = useNamespace("ai-think");
|
|
28
|
+
const onCollapseChange = () => {
|
|
29
|
+
emit("collapseChange", !props.isCollapse);
|
|
30
|
+
};
|
|
31
|
+
return {
|
|
32
|
+
ns,
|
|
33
|
+
onCollapseChange
|
|
34
|
+
};
|
|
35
|
+
},
|
|
36
|
+
render() {
|
|
37
|
+
if (!this.think)
|
|
38
|
+
return;
|
|
39
|
+
return createVNode("div", {
|
|
40
|
+
"class": this.ns.b()
|
|
41
|
+
}, [createVNode("div", {
|
|
42
|
+
"class": this.ns.e("header"),
|
|
43
|
+
"onClick": this.onCollapseChange
|
|
44
|
+
}, [createVNode("div", {
|
|
45
|
+
"class": [this.ns.em("header", "state-icon"), this.ns.is("loading", this.isLoading)]
|
|
46
|
+
}, [this.isLoading ? LoadingIcon : ThinkSuccessIcon]), createVNode("div", {
|
|
47
|
+
"class": this.ns.em("header", "title")
|
|
48
|
+
}, [this.isLoading ? ibiz.i18n.t("util.inlineAiUtil.thinking") : ibiz.i18n.t("util.inlineAiUtil.thinked")]), createVNode("div", {
|
|
49
|
+
"class": this.ns.em("header", "collapse-icon")
|
|
50
|
+
}, [this.isCollapse ? DownIcon : UpIcon])]), !this.isCollapse && createVNode("div", {
|
|
51
|
+
"class": this.ns.e("content")
|
|
52
|
+
}, [this.think])]);
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
export { AIThink };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.ibiz-ai-tool-call{color:var(--ibiz-inline-ai-textarea-container-color-text-0)}.ibiz-ai-tool-call__toggle{display:block;padding:var(--ibiz-spacing-tight) 0;margin-top:var(--ibiz-spacing-tight);text-align:center;cursor:pointer;background-color:var(--ibiz-inline-ai-textarea-container-color-bg-1);border-radius:var(--ibiz-border-radius-small)}.ibiz-ai-tool-call__toggle:hover{background-color:var(--ibiz-inline-ai-textarea-container-color-bg-hover-1)}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { defineComponent, createVNode, ref, computed } from 'vue';
|
|
2
|
+
import { useNamespace } from '@ibiz-template/vue3-util';
|
|
3
|
+
import { AIToolCallItem } from '../ai-tool-call-item/ai-tool-call-item.mjs';
|
|
4
|
+
import './ai-tool-call.css';
|
|
5
|
+
|
|
6
|
+
"use strict";
|
|
7
|
+
const AIToolCall = /* @__PURE__ */ defineComponent({
|
|
8
|
+
props: {
|
|
9
|
+
toolCalls: {
|
|
10
|
+
type: Object,
|
|
11
|
+
required: true
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
setup(props) {
|
|
15
|
+
const ns = useNamespace("ai-tool-call");
|
|
16
|
+
const isExpanded = ref(false);
|
|
17
|
+
const showToggle = computed(() => {
|
|
18
|
+
return props.toolCalls.length > 4;
|
|
19
|
+
});
|
|
20
|
+
const items = computed(() => {
|
|
21
|
+
return showToggle.value && !isExpanded.value ? props.toolCalls.slice(0, 4) : props.toolCalls;
|
|
22
|
+
});
|
|
23
|
+
const handleToggle = () => {
|
|
24
|
+
isExpanded.value = !isExpanded.value;
|
|
25
|
+
};
|
|
26
|
+
return {
|
|
27
|
+
ns,
|
|
28
|
+
items,
|
|
29
|
+
showToggle,
|
|
30
|
+
isExpanded,
|
|
31
|
+
handleToggle
|
|
32
|
+
};
|
|
33
|
+
},
|
|
34
|
+
render() {
|
|
35
|
+
if (!this.toolCalls.length)
|
|
36
|
+
return;
|
|
37
|
+
return createVNode("div", {
|
|
38
|
+
"class": this.ns.b()
|
|
39
|
+
}, [this.items.map((item) => {
|
|
40
|
+
return createVNode(AIToolCallItem, {
|
|
41
|
+
"toolCall": item
|
|
42
|
+
}, null);
|
|
43
|
+
}), this.showToggle && createVNode("div", {
|
|
44
|
+
"class": this.ns.e("toggle"),
|
|
45
|
+
"onClick": this.handleToggle
|
|
46
|
+
}, [this.isExpanded ? ibiz.i18n.t("util.inlineAiUtil.collapseToolCall") : ibiz.i18n.t("util.inlineAiUtil.expandToolCall", {
|
|
47
|
+
number: this.toolCalls.length
|
|
48
|
+
})])]);
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
export { AIToolCall };
|
package/es/util/inline-ai-util/inline-ai-textarea/common/ai-tool-call-item/ai-tool-call-item.css
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.ibiz-ai-tool-call-item{--ibiz-ai-tool-call-item-bg-primary:#1e1e1e;--ibiz-ai-tool-call-item-bg-secondary:#2d2d2d;--ibiz-ai-tool-call-item-bg-tertiary:#3c3c3c;--ibiz-ai-tool-call-item-text-primary:#d4d4d4;--ibiz-ai-tool-call-item-text-secondary:#9cdcfe;--ibiz-ai-tool-call-item-text-error:#f44747;--ibiz-ai-tool-call-item-text-string:#ce9178;--ibiz-ai-tool-call-item-text-boolean:#569cd6;--ibiz-ai-tool-call-item-text-property:#9cdcfe;--ibiz-ai-tool-call-item-text-number:#b5cea8;--ibiz-ai-tool-call-item-accent-primary:#0e639c;--ibiz-ai-tool-call-item-accent-error:rgba(244, 71, 71, 0.2);--ibiz-ai-tool-call-item-color-bg:var(--ibiz-inline-ai-textarea-container-color-bg-1);--ibiz-ai-tool-call-item-color-border:var(--ibiz-inline-ai-textarea-container-color-border);margin-bottom:var(--ibiz-spacing-tight);background-color:var(--ibiz-ai-tool-call-item-color-bg);border:1px solid var(--ibiz-ai-tool-call-item-color-border);border-radius:var(--ibiz-border-radius-small)}.ibiz-ai-tool-call-item__header{display:flex;gap:var(--ibiz-spacing-tight);align-items:center;justify-content:space-between;width:100%;padding:var(--ibiz-spacing-tight)}.ibiz-ai-tool-call-item__header-left{display:flex;gap:var(--ibiz-spacing-tight);align-items:center}.ibiz-ai-tool-call-item__header-left--caption{flex-shrink:0}.ibiz-ai-tool-call-item__header-left--desc{flex-grow:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.ibiz-ai-tool-call-item__header-right{display:flex;flex-shrink:0;gap:var(--ibiz-spacing-tight);align-items:center}.ibiz-ai-tool-call-item__header-right--icon{display:flex;align-items:center;cursor:pointer}.ibiz-ai-tool-call-item__header-right--error-text{color:var(--ibiz-color-danger)}.ibiz-ai-tool-call-item__content{padding:var(--ibiz-spacing-tight) 0}.ibiz-ai-tool-call-item__code-line{display:flex;min-height:18px;margin-bottom:var(--ibiz-spacing-base-tight);font-family:Consolas,monospace;font-size:.95rem}.ibiz-ai-tool-call-item__code-line--line-number{min-width:20px;margin-right:15px;color:var(--ibiz-color-success);text-align:right;-webkit-user-select:none;-moz-user-select:none;user-select:none}.ibiz-ai-tool-call-item__property{color:var(--ibiz-ai-tool-call-item-text-property)}.ibiz-ai-tool-call-item__string{overflow:hidden;color:var(--ibiz-ai-tool-call-item-text-string);text-overflow:ellipsis;white-space:nowrap}.ibiz-ai-tool-call-item__boolean{color:var(--ibiz-ai-tool-call-item-text-boolean)}.ibiz-ai-tool-call-item__number{color:var(--ibiz-ai-tool-call-item-text-number)}.ibiz-ai-tool-call-item__null{color:var(--ibiz-ai-tool-call-item-text-boolean)}.ibiz-ai-tool-call-item__error{color:var(--ibiz-ai-tool-call-item-text-error)}
|
package/es/util/inline-ai-util/inline-ai-textarea/common/ai-tool-call-item/ai-tool-call-item.mjs
ADDED
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
import { defineComponent, createVNode, ref, onMounted } from 'vue';
|
|
2
|
+
import { useNamespace } from '@ibiz-template/vue3-util';
|
|
3
|
+
import { ErrorIcon, CopyIcon, DownIcon, RightIcon } from '../../icon.mjs';
|
|
4
|
+
import './ai-tool-call-item.css';
|
|
5
|
+
|
|
6
|
+
"use strict";
|
|
7
|
+
const AIToolCallItem = /* @__PURE__ */ defineComponent({
|
|
8
|
+
props: {
|
|
9
|
+
toolCall: {
|
|
10
|
+
type: Object,
|
|
11
|
+
required: true
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
setup(props) {
|
|
15
|
+
const ns = useNamespace("ai-tool-call-item");
|
|
16
|
+
const isExpanded = ref(false);
|
|
17
|
+
const handleExpandChange = () => {
|
|
18
|
+
isExpanded.value = !isExpanded.value;
|
|
19
|
+
};
|
|
20
|
+
const onCopy = (event) => {
|
|
21
|
+
event.stopPropagation();
|
|
22
|
+
ibiz.util.text.copy(JSON.stringify(props.toolCall, void 0, 2));
|
|
23
|
+
ibiz.message.success(ibiz.i18n.t("util.inlineAiUtil.copy"));
|
|
24
|
+
};
|
|
25
|
+
const formatValue = (value) => {
|
|
26
|
+
if (typeof value === "string") {
|
|
27
|
+
if (value.includes("Failed") || value.includes("Error") || value.includes("ERR_")) {
|
|
28
|
+
return '<span class="'.concat(ns.e("error"), '">"').concat(value, '"</span>');
|
|
29
|
+
}
|
|
30
|
+
return '<span class="'.concat(ns.e("string"), '">"').concat(value, '"</span>');
|
|
31
|
+
}
|
|
32
|
+
if (typeof value === "number") {
|
|
33
|
+
return '<span class="'.concat(ns.e("number"), '">').concat(value, "</span>");
|
|
34
|
+
}
|
|
35
|
+
if (typeof value === "boolean") {
|
|
36
|
+
return '<span class="'.concat(ns.e("boolean"), '">').concat(value, "</span>");
|
|
37
|
+
}
|
|
38
|
+
if (value === null) {
|
|
39
|
+
return '<span class="'.concat(ns.e("null"), '">null</span>');
|
|
40
|
+
}
|
|
41
|
+
return "";
|
|
42
|
+
};
|
|
43
|
+
const formatJSON = (data, indentLevel = 0) => {
|
|
44
|
+
const indent = " ".repeat(indentLevel);
|
|
45
|
+
const lines2 = [];
|
|
46
|
+
if (Array.isArray(data)) {
|
|
47
|
+
if (data.length === 0) {
|
|
48
|
+
return ["".concat(indent, '<span class="').concat(ns.e("array"), '">[]</span>')];
|
|
49
|
+
}
|
|
50
|
+
lines2.push("".concat(indent, '<span class="').concat(ns.e("array"), '">[</span>'));
|
|
51
|
+
data.forEach((item, index) => {
|
|
52
|
+
const itemLines = formatJSON(item, indentLevel + 1);
|
|
53
|
+
const comma = index < data.length - 1 ? "," : "";
|
|
54
|
+
if (typeof item === "object" && item !== null) {
|
|
55
|
+
lines2.push(...itemLines.slice(0, -1));
|
|
56
|
+
lines2.push("".concat(itemLines[itemLines.length - 1]).concat(comma));
|
|
57
|
+
} else {
|
|
58
|
+
lines2.push("".concat(itemLines[0]).concat(comma));
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
lines2.push("".concat(indent, '<span class="').concat(ns.e("array"), '">]</span>'));
|
|
62
|
+
} else if (typeof data === "object" && data !== null) {
|
|
63
|
+
const keys = Object.keys(data);
|
|
64
|
+
if (keys.length === 0) {
|
|
65
|
+
return ["".concat(indent, '<span class="').concat(ns.e("property"), '">{}</span>')];
|
|
66
|
+
}
|
|
67
|
+
lines2.push("".concat(indent, '<span class="').concat(ns.e("property"), '">{</span>'));
|
|
68
|
+
keys.forEach((key, index) => {
|
|
69
|
+
const value = data[key];
|
|
70
|
+
const comma = index < keys.length - 1 ? "," : "";
|
|
71
|
+
const keyElement = '<span class="'.concat(ns.e("json-key"), '">"').concat(key, '":</span>');
|
|
72
|
+
if (typeof value === "object" && value !== null) {
|
|
73
|
+
const valueLines = formatJSON(value, indentLevel + 1);
|
|
74
|
+
lines2.push("".concat(indent, " ").concat(keyElement, " ").concat(valueLines[0].trim()));
|
|
75
|
+
if (valueLines.length > 1) {
|
|
76
|
+
lines2.push(...valueLines.slice(1, -1));
|
|
77
|
+
lines2.push("".concat(valueLines[valueLines.length - 1]).concat(comma));
|
|
78
|
+
}
|
|
79
|
+
} else {
|
|
80
|
+
const valueElement = formatValue(value);
|
|
81
|
+
lines2.push("".concat(indent, " ").concat(keyElement, " ").concat(valueElement).concat(comma));
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
lines2.push("".concat(indent, '<span class="').concat(ns.e("property"), '">}</span>'));
|
|
85
|
+
} else {
|
|
86
|
+
lines2.push("".concat(indent).concat(formatValue(data)));
|
|
87
|
+
}
|
|
88
|
+
return lines2;
|
|
89
|
+
};
|
|
90
|
+
const lines = ref([]);
|
|
91
|
+
const onInit = () => {
|
|
92
|
+
const items = formatJSON(props.toolCall, 0);
|
|
93
|
+
lines.value = items.map((item, index) => '<span class="'.concat(ns.em("code-line", "line-number"), '">').concat(index + 1, "</span>").concat(item));
|
|
94
|
+
};
|
|
95
|
+
onMounted(() => {
|
|
96
|
+
onInit();
|
|
97
|
+
});
|
|
98
|
+
return {
|
|
99
|
+
ns,
|
|
100
|
+
lines,
|
|
101
|
+
isExpanded,
|
|
102
|
+
onCopy,
|
|
103
|
+
handleExpandChange
|
|
104
|
+
};
|
|
105
|
+
},
|
|
106
|
+
render() {
|
|
107
|
+
var _a;
|
|
108
|
+
return createVNode("div", {
|
|
109
|
+
"class": this.ns.b()
|
|
110
|
+
}, [createVNode("div", {
|
|
111
|
+
"class": this.ns.e("header"),
|
|
112
|
+
"onClick": this.handleExpandChange
|
|
113
|
+
}, [createVNode("div", {
|
|
114
|
+
"class": this.ns.e("header-left")
|
|
115
|
+
}, [createVNode("div", {
|
|
116
|
+
"class": this.ns.em("header-left", "caption")
|
|
117
|
+
}, [this.toolCall.name]), createVNode("div", {
|
|
118
|
+
"class": this.ns.em("header-left", "desc")
|
|
119
|
+
}, [(_a = this.toolCall.parameters) == null ? void 0 : _a.desc])]), createVNode("div", {
|
|
120
|
+
"class": this.ns.e("header-right")
|
|
121
|
+
}, [this.toolCall.error && createVNode("div", {
|
|
122
|
+
"class": this.ns.em("header-right", "error")
|
|
123
|
+
}, [createVNode("span", {
|
|
124
|
+
"class": this.ns.em("header-right", "error-text")
|
|
125
|
+
}, [ibiz.i18n.t("util.inlineAiUtil.error")]), createVNode("div", {
|
|
126
|
+
"class": this.ns.em("header-right", "icon")
|
|
127
|
+
}, [ErrorIcon])]), createVNode("div", {
|
|
128
|
+
"onClick": this.onCopy,
|
|
129
|
+
"class": this.ns.em("header-right", "icon")
|
|
130
|
+
}, [CopyIcon]), createVNode("div", {
|
|
131
|
+
"class": this.ns.em("header-right", "icon")
|
|
132
|
+
}, [this.isExpanded ? DownIcon : RightIcon])])]), this.isExpanded && createVNode("div", {
|
|
133
|
+
"class": this.ns.e("content")
|
|
134
|
+
}, [this.lines.map((line) => {
|
|
135
|
+
return createVNode("div", {
|
|
136
|
+
"class": this.ns.e("code-line"),
|
|
137
|
+
"innerHTML": line
|
|
138
|
+
}, null);
|
|
139
|
+
})])]);
|
|
140
|
+
}
|
|
141
|
+
});
|
|
142
|
+
|
|
143
|
+
export { AIToolCallItem };
|
|
@@ -212,5 +212,56 @@ const DownIcon = createVNode("svg", {
|
|
|
212
212
|
"id": "abf\u5F62\u72B6\u7ED3\u5408",
|
|
213
213
|
"transform": "rotate(-90 7.978 8.252)"
|
|
214
214
|
}, null)])]);
|
|
215
|
+
const RightIcon = createVNode("svg", {
|
|
216
|
+
"viewBox": "0 0 1024 1024",
|
|
217
|
+
"version": "1.1",
|
|
218
|
+
"xmlns": "http://www.w3.org/2000/svg",
|
|
219
|
+
"p-id": "4832",
|
|
220
|
+
"width": "16",
|
|
221
|
+
"height": "16",
|
|
222
|
+
"fill": "currentColor"
|
|
223
|
+
}, [createVNode("path", {
|
|
224
|
+
"d": "M707.61856 495.14624l-357.5296-357.5296c-9.30816-9.30688-24.40064-9.30688-33.70752 0-9.30816 9.30816-9.30816 24.40064 0 33.7088L657.056 512 316.38144 852.67456c-9.30816 9.30688-9.30816 24.40064 0 33.7088 4.65408 4.65536 10.75328 6.98112 16.85376 6.98112 6.10048 0 12.19968-2.32576 16.85376-6.98112l357.5296-357.5296C716.92672 519.5456 716.92672 504.4544 707.61856 495.14624z",
|
|
225
|
+
"p-id": "4833"
|
|
226
|
+
}, null)]);
|
|
227
|
+
const ErrorIcon = createVNode("svg", {
|
|
228
|
+
"xmlns": "http://www.w3.org/2000/svg",
|
|
229
|
+
"width": "16",
|
|
230
|
+
"height": "16",
|
|
231
|
+
"viewBox": "0 0 24 24",
|
|
232
|
+
"fill": "none",
|
|
233
|
+
"stroke": "red",
|
|
234
|
+
"stroke-width": "2",
|
|
235
|
+
"stroke-linecap": "round",
|
|
236
|
+
"stroke-linejoin": "round",
|
|
237
|
+
"aria-hidden": "true"
|
|
238
|
+
}, [createVNode("path", {
|
|
239
|
+
"d": "m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3"
|
|
240
|
+
}, null), createVNode("path", {
|
|
241
|
+
"d": "M12 9v4"
|
|
242
|
+
}, null), createVNode("path", {
|
|
243
|
+
"d": "M12 17h.01"
|
|
244
|
+
}, null)]);
|
|
245
|
+
const CopyIcon = createVNode("svg", {
|
|
246
|
+
"xmlns": "http://www.w3.org/2000/svg",
|
|
247
|
+
"width": "16",
|
|
248
|
+
"height": "16",
|
|
249
|
+
"viewBox": "0 0 24 24",
|
|
250
|
+
"fill": "none",
|
|
251
|
+
"stroke": "currentColor",
|
|
252
|
+
"stroke-width": "2",
|
|
253
|
+
"stroke-linecap": "round",
|
|
254
|
+
"stroke-linejoin": "round",
|
|
255
|
+
"aria-hidden": "true"
|
|
256
|
+
}, [createVNode("rect", {
|
|
257
|
+
"width": "14",
|
|
258
|
+
"height": "14",
|
|
259
|
+
"x": "8",
|
|
260
|
+
"y": "8",
|
|
261
|
+
"rx": "2",
|
|
262
|
+
"ry": "2"
|
|
263
|
+
}, null), createVNode("path", {
|
|
264
|
+
"d": "M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"
|
|
265
|
+
}, null)]);
|
|
215
266
|
|
|
216
|
-
export { AIIcon, CancelIcon, CopyTextIcon, DownIcon, LoadingIcon, RegenerateIcon, ReplaceTextIcon, SendIcon, StopIcon, ThinkSuccessIcon, UpIcon, insertTextIcon };
|
|
267
|
+
export { AIIcon, CancelIcon, CopyIcon, CopyTextIcon, DownIcon, ErrorIcon, LoadingIcon, RegenerateIcon, ReplaceTextIcon, RightIcon, SendIcon, StopIcon, ThinkSuccessIcon, UpIcon, insertTextIcon };
|