@ibiz-template/vue3-components 0.7.41-alpha.41 → 0.7.41-alpha.43
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-DJ662N4_.js +1 -0
- package/dist/{index-CaWTEUU1.js → index-CG3sQH0b.js} +1 -1
- package/dist/index-D3x_MFr-.js +11 -0
- package/dist/{index-CD2XM6M6.js → index-kZrZndeH.js} +1 -1
- package/dist/index.min.css +1 -1
- package/dist/index.system.min.js +1 -1
- package/dist/wang-editor-DDSO3Ha9.js +1 -0
- package/dist/{xlsx-util-Dvg2kWh7.js → xlsx-util-8YSXhmdI.js} +1 -1
- package/es/control/form/form-detail/form-item/composite-form-item-ex/composite-form-item-ex.controller.mjs +16 -6
- package/es/control/toolbar/export-excel/export-excel.mjs +19 -4
- package/es/editor/code/monaco-editor/monaco-editor.mjs +13 -195
- package/es/editor/html/wang-editor/module/ai-module.mjs +1 -1
- package/es/editor/html/wang-editor/wang-editor.mjs +31 -202
- package/es/editor/markdown/ibiz-markdown-editor/custom-menu.mjs +16 -223
- package/es/editor/markdown/ibiz-markdown-editor/ibiz-markdown-editor.css +1 -1
- package/es/editor/markdown/ibiz-markdown-editor/ibiz-markdown-editor.mjs +2 -1
- package/es/editor/text-box/input/input.mjs +9 -197
- package/es/locale/en/index.mjs +24 -1
- package/es/locale/zh-CN/index.mjs +24 -1
- package/es/panel-component/panel-app-title/panel-app-title.mjs +19 -42
- package/es/util/ai-chat-util/ai-chat-util.mjs +644 -15
- package/es/util/ai-chat-util/ai-feedback/ai-feedback.css +1 -0
- package/es/util/ai-chat-util/ai-feedback/ai-feedback.mjs +130 -0
- package/es/util/app-util/app-util.mjs +24 -246
- package/es/util/inline-ai-util/inline-ai-textarea/inline-ai-textarea.hook.mjs +12 -4
- package/es/util/inline-ai-util/inline-ai-textarea/inline-ai-textarea.mjs +3 -1
- package/lib/control/form/form-detail/form-item/composite-form-item-ex/composite-form-item-ex.controller.cjs +16 -6
- package/lib/control/toolbar/export-excel/export-excel.cjs +18 -3
- package/lib/editor/code/monaco-editor/monaco-editor.cjs +13 -195
- package/lib/editor/html/wang-editor/module/ai-module.cjs +1 -1
- package/lib/editor/html/wang-editor/wang-editor.cjs +30 -201
- package/lib/editor/markdown/ibiz-markdown-editor/custom-menu.cjs +16 -223
- package/lib/editor/markdown/ibiz-markdown-editor/ibiz-markdown-editor.cjs +2 -1
- package/lib/editor/markdown/ibiz-markdown-editor/ibiz-markdown-editor.css +1 -1
- package/lib/editor/text-box/input/input.cjs +8 -196
- package/lib/locale/en/index.cjs +24 -1
- package/lib/locale/zh-CN/index.cjs +24 -1
- package/lib/panel-component/panel-app-title/panel-app-title.cjs +18 -41
- package/lib/util/ai-chat-util/ai-chat-util.cjs +642 -13
- package/lib/util/ai-chat-util/ai-feedback/ai-feedback.cjs +132 -0
- package/lib/util/ai-chat-util/ai-feedback/ai-feedback.css +1 -0
- package/lib/util/app-util/app-util.cjs +23 -245
- package/lib/util/inline-ai-util/inline-ai-textarea/inline-ai-textarea.cjs +3 -1
- package/lib/util/inline-ai-util/inline-ai-textarea/inline-ai-textarea.hook.cjs +12 -4
- package/package.json +7 -7
- package/dist/ibiz-markdown-editor-DEV-iSvz.js +0 -1
- package/dist/index-Bv2fgePf.js +0 -11
- package/dist/wang-editor-4cNAgOaJ.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.ibiz-ai-feedback{padding:var(--ibiz-spacing-base)}.ibiz-ai-feedback__header{padding:var(--ibiz-spacing-base-tight) 0;font-size:var(--ibiz-font-size-header-5)}.ibiz-ai-feedback__group--title{padding:var(--ibiz-spacing-tight) 0;font-size:var(--ibiz-font-size-header-6);color:var(--ibiz-color-text-2)}.ibiz-ai-feedback__group--content .el-radio{min-width:130px}.ibiz-ai-feedback__description--title{padding:var(--ibiz-spacing-tight) 0;font-size:var(--ibiz-font-size-header-6)}.ibiz-ai-feedback__footer{display:flex;justify-content:end;margin-top:var(--ibiz-spacing-tight)}
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
import { isVNode, defineComponent, createVNode, resolveComponent, reactive, onMounted } from 'vue';
|
|
2
|
+
import { useNamespace } from '@ibiz-template/vue3-util';
|
|
3
|
+
import './ai-feedback.css';
|
|
4
|
+
|
|
5
|
+
"use strict";
|
|
6
|
+
function _isSlot(s) {
|
|
7
|
+
return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !isVNode(s);
|
|
8
|
+
}
|
|
9
|
+
const AIFeedback = /* @__PURE__ */ defineComponent({
|
|
10
|
+
name: "IBizAIFeedback",
|
|
11
|
+
props: {
|
|
12
|
+
content: {
|
|
13
|
+
type: String
|
|
14
|
+
},
|
|
15
|
+
modal: {
|
|
16
|
+
type: Object,
|
|
17
|
+
required: true
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
setup(props) {
|
|
21
|
+
const ns = useNamespace("ai-feedback");
|
|
22
|
+
const feedback = reactive({
|
|
23
|
+
description: "",
|
|
24
|
+
feedbackItems: []
|
|
25
|
+
});
|
|
26
|
+
const FEEDBACK_CATEGORIES = [{
|
|
27
|
+
title: ibiz.i18n.t("util.aiChartUtil.regardingIssue"),
|
|
28
|
+
children: [ibiz.i18n.t("util.aiChartUtil.understandProblem"), ibiz.i18n.t("util.aiChartUtil.forgotContext"), ibiz.i18n.t("util.aiChartUtil.notFollowingRequire")]
|
|
29
|
+
}, {
|
|
30
|
+
title: ibiz.i18n.t("util.aiChartUtil.regardingResponse"),
|
|
31
|
+
children: [ibiz.i18n.t("util.aiChartUtil.incorrectAswer"), ibiz.i18n.t("util.aiChartUtil.logicalConfusion"), ibiz.i18n.t("util.aiChartUtil.poorTimeliness"), ibiz.i18n.t("util.aiChartUtil.poorReadability"), ibiz.i18n.t("util.aiChartUtil.incompleteAnswer"), ibiz.i18n.t("util.aiChartUtil.unprofessional")]
|
|
32
|
+
}, {
|
|
33
|
+
title: ibiz.i18n.t("util.aiChartUtil.report"),
|
|
34
|
+
children: [ibiz.i18n.t("util.aiChartUtil.pornographicVulgar"), ibiz.i18n.t("util.aiChartUtil.politicallySensitive"), ibiz.i18n.t("util.aiChartUtil.illegalCriminal"), ibiz.i18n.t("util.aiChartUtil.discriminationPrejudice"), ibiz.i18n.t("util.aiChartUtil.violationPrivacy"), ibiz.i18n.t("util.aiChartUtil.contentInfringement")]
|
|
35
|
+
}];
|
|
36
|
+
const onInitFeedback = () => {
|
|
37
|
+
feedback.feedbackItems = FEEDBACK_CATEGORIES.map((category) => ({
|
|
38
|
+
title: category.title,
|
|
39
|
+
value: void 0,
|
|
40
|
+
children: [...category.children]
|
|
41
|
+
}));
|
|
42
|
+
if (props.content) {
|
|
43
|
+
const contentArray = props.content.split(";").filter((item) => item.trim());
|
|
44
|
+
if (contentArray.length > 0) {
|
|
45
|
+
const feedbackValues = contentArray.slice(0, FEEDBACK_CATEGORIES.length);
|
|
46
|
+
feedbackValues.forEach((value, index) => {
|
|
47
|
+
feedback.feedbackItems[index].value = value;
|
|
48
|
+
});
|
|
49
|
+
const descriptionParts = contentArray.slice(FEEDBACK_CATEGORIES.length);
|
|
50
|
+
feedback.description = descriptionParts.join(";");
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
const onCancel = () => {
|
|
55
|
+
props.modal.dismiss();
|
|
56
|
+
};
|
|
57
|
+
const onConfirm = () => {
|
|
58
|
+
const contentArray = feedback.feedbackItems.map((item) => item.value || "").filter((item) => !!item);
|
|
59
|
+
contentArray.push(feedback.description);
|
|
60
|
+
props.modal.dismiss({
|
|
61
|
+
ok: true,
|
|
62
|
+
data: [{
|
|
63
|
+
feedbackContent: contentArray.join(";")
|
|
64
|
+
}]
|
|
65
|
+
});
|
|
66
|
+
};
|
|
67
|
+
onMounted(() => {
|
|
68
|
+
onInitFeedback();
|
|
69
|
+
});
|
|
70
|
+
return {
|
|
71
|
+
ns,
|
|
72
|
+
feedback,
|
|
73
|
+
onCancel,
|
|
74
|
+
onConfirm
|
|
75
|
+
};
|
|
76
|
+
},
|
|
77
|
+
render() {
|
|
78
|
+
let _slot2, _slot3;
|
|
79
|
+
return createVNode("div", {
|
|
80
|
+
"class": this.ns.b()
|
|
81
|
+
}, [createVNode("div", {
|
|
82
|
+
"class": this.ns.e("header")
|
|
83
|
+
}, [ibiz.i18n.t("util.aiChartUtil.feedback")]), createVNode("div", {
|
|
84
|
+
"class": this.ns.e("content")
|
|
85
|
+
}, [this.feedback.feedbackItems.map((item) => {
|
|
86
|
+
let _slot;
|
|
87
|
+
return createVNode("div", {
|
|
88
|
+
"class": this.ns.e("group")
|
|
89
|
+
}, [createVNode("div", {
|
|
90
|
+
"class": this.ns.em("group", "title")
|
|
91
|
+
}, [item.title]), createVNode(resolveComponent("el-radio-group"), {
|
|
92
|
+
"modelValue": item.value,
|
|
93
|
+
"onUpdate:modelValue": ($event) => item.value = $event,
|
|
94
|
+
"class": this.ns.em("group", "content")
|
|
95
|
+
}, _isSlot(_slot = item.children.map((child, index) => {
|
|
96
|
+
return createVNode(resolveComponent("el-radio"), {
|
|
97
|
+
"key": index,
|
|
98
|
+
"label": child
|
|
99
|
+
}, _isSlot(child) ? child : {
|
|
100
|
+
default: () => [child]
|
|
101
|
+
});
|
|
102
|
+
})) ? _slot : {
|
|
103
|
+
default: () => [_slot]
|
|
104
|
+
})]);
|
|
105
|
+
}), createVNode("div", {
|
|
106
|
+
"class": this.ns.e("description")
|
|
107
|
+
}, [createVNode("div", {
|
|
108
|
+
"class": this.ns.em("description", "title")
|
|
109
|
+
}, [ibiz.i18n.t("util.aiChartUtil.description")]), createVNode(resolveComponent("el-input"), {
|
|
110
|
+
"rows": 3,
|
|
111
|
+
"type": "textarea",
|
|
112
|
+
"modelValue": this.feedback.description,
|
|
113
|
+
"onUpdate:modelValue": ($event) => this.feedback.description = $event,
|
|
114
|
+
"placeholder": ibiz.i18n.t("util.aiChartUtil.placeholder")
|
|
115
|
+
}, null)])]), createVNode("div", {
|
|
116
|
+
"class": this.ns.e("footer")
|
|
117
|
+
}, [createVNode(resolveComponent("el-button"), {
|
|
118
|
+
"onClick": this.onCancel
|
|
119
|
+
}, _isSlot(_slot2 = ibiz.i18n.t("app.cancel")) ? _slot2 : {
|
|
120
|
+
default: () => [_slot2]
|
|
121
|
+
}), createVNode(resolveComponent("el-button"), {
|
|
122
|
+
"type": "primary",
|
|
123
|
+
"onClick": this.onConfirm
|
|
124
|
+
}, _isSlot(_slot3 = ibiz.i18n.t("app.confirm")) ? _slot3 : {
|
|
125
|
+
default: () => [_slot3]
|
|
126
|
+
})])]);
|
|
127
|
+
}
|
|
128
|
+
});
|
|
129
|
+
|
|
130
|
+
export { AIFeedback };
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import { getDeACMode, calcDeCodeNameById
|
|
2
|
-
import { createUUID } from 'qx-util';
|
|
3
|
-
import { IBizContext } from '@ibiz-template/core';
|
|
1
|
+
import { getDeACMode, calcDeCodeNameById } from '@ibiz-template/runtime';
|
|
4
2
|
import { route2routePath, useUIStore, routePath2string } from '@ibiz-template/vue3-util';
|
|
5
3
|
|
|
6
4
|
"use strict";
|
|
@@ -200,11 +198,6 @@ class AppUtil {
|
|
|
200
198
|
appDEACModeId,
|
|
201
199
|
appDataEntityId
|
|
202
200
|
} = chartParams;
|
|
203
|
-
const { containerOptions, chatOptions } = ibiz.aiChatUtil.getUIActionExAIChatParams(context, params, data);
|
|
204
|
-
const aiAgentlist = await ibiz.aiChatUtil.getAIAgentList(
|
|
205
|
-
context,
|
|
206
|
-
params
|
|
207
|
-
);
|
|
208
201
|
const deACMode = await getDeACMode(
|
|
209
202
|
appDEACModeId,
|
|
210
203
|
appDataEntityId,
|
|
@@ -212,26 +205,31 @@ class AppUtil {
|
|
|
212
205
|
);
|
|
213
206
|
if (!deACMode)
|
|
214
207
|
return Promise.resolve([]);
|
|
215
|
-
const {
|
|
216
|
-
contentToolbarItems,
|
|
217
|
-
footerToolbarItems,
|
|
218
|
-
questionToolbarItems,
|
|
219
|
-
otherToolbarItems
|
|
220
|
-
} = ibiz.aiChatUtil.calcAiToolbarItemsByAc(deACMode);
|
|
221
208
|
const chatInstance = await ibiz.aiChatUtil.getAIChat();
|
|
222
209
|
const messages = [];
|
|
223
210
|
const appDataEntityName = calcDeCodeNameById(appDataEntityId);
|
|
224
|
-
let topicId = "".concat(
|
|
225
|
-
topicId += context[appDataEntityName] ? context[appDataEntityName] :
|
|
226
|
-
const
|
|
211
|
+
let topicId = "".concat(appDataEntityId, "@").concat(appDEACModeId, "@");
|
|
212
|
+
topicId += context[appDataEntityName] ? context[appDataEntityName] : "default";
|
|
213
|
+
const sessionid = ibiz.aiChatUtil.getChatSessionId("TOPIC", topicId);
|
|
214
|
+
const topicCaption = "[".concat(deACMode.logicName, "]").concat((data == null ? void 0 : data.srfmajortext) || "");
|
|
227
215
|
const tempParams = { ...params, ...{ srfactag: deACMode.codeName } };
|
|
228
216
|
const { zIndex } = useUIStore();
|
|
229
217
|
const containerZIndex = zIndex.increment();
|
|
218
|
+
const { containerOptions, topicOptions, chatOptions } = await ibiz.aiChatUtil.getUIActionExAIChatParams(
|
|
219
|
+
context,
|
|
220
|
+
params,
|
|
221
|
+
data,
|
|
222
|
+
deACMode,
|
|
223
|
+
{ chatInstance, view, ctrl }
|
|
224
|
+
);
|
|
225
|
+
const resourceOptions = await ibiz.aiChatUtil.getAIResourceOptions(
|
|
226
|
+
context,
|
|
227
|
+
params
|
|
228
|
+
);
|
|
230
229
|
return new Promise((resolve) => {
|
|
231
|
-
let id = "";
|
|
232
|
-
let abortController;
|
|
233
230
|
chatInstance.create({
|
|
234
231
|
mode: "TOPIC",
|
|
232
|
+
resourceOptions,
|
|
235
233
|
containerOptions: {
|
|
236
234
|
zIndex: containerZIndex,
|
|
237
235
|
enableBackFill: false,
|
|
@@ -240,243 +238,23 @@ class AppUtil {
|
|
|
240
238
|
topicOptions: {
|
|
241
239
|
appid: ibiz.env.appId,
|
|
242
240
|
id: topicId,
|
|
243
|
-
caption,
|
|
241
|
+
caption: topicCaption,
|
|
244
242
|
url: window.location.hash.substring(1),
|
|
245
243
|
type: context.srftopicpath || "default",
|
|
246
|
-
|
|
247
|
-
const isBatchRemove = args[4];
|
|
248
|
-
const result = await ibiz.confirm.warning({
|
|
249
|
-
title: ibiz.i18n.t(
|
|
250
|
-
"util.appUtil.".concat(isBatchRemove ? "clearTopic" : "aiTitle")
|
|
251
|
-
),
|
|
252
|
-
desc: ibiz.i18n.t(
|
|
253
|
-
"util.appUtil.".concat(isBatchRemove ? "clearTopicDesc" : "aiDesc")
|
|
254
|
-
)
|
|
255
|
-
});
|
|
256
|
-
return result;
|
|
257
|
-
},
|
|
258
|
-
action: async (action, context2, params2, data2, event) => {
|
|
259
|
-
if (action === "LINK") {
|
|
260
|
-
await ibiz.openView.push(data2.url);
|
|
261
|
-
}
|
|
262
|
-
return true;
|
|
263
|
-
},
|
|
264
|
-
configService: (appid, storageType, subType) => {
|
|
265
|
-
return new ConfigService(appid, storageType, subType);
|
|
266
|
-
}
|
|
244
|
+
...topicOptions
|
|
267
245
|
},
|
|
268
246
|
chatOptions: {
|
|
269
247
|
caption: deACMode.logicName,
|
|
270
248
|
context: { ...context },
|
|
271
249
|
params: tempParams,
|
|
272
250
|
appDataEntityId,
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
aiAgentlist,
|
|
278
|
-
question: async (aiChat, ctx, param, other, arr, sessionid, srfaiagent, srfmode) => {
|
|
279
|
-
id = createUUID();
|
|
280
|
-
abortController = new AbortController();
|
|
281
|
-
const deService = await ibiz.hub.getApp(ctx.srfappid).deService.getService(ctx, other.appDataEntityId);
|
|
282
|
-
try {
|
|
283
|
-
const questionRequestData = {
|
|
284
|
-
messages: arr,
|
|
285
|
-
sessionid
|
|
286
|
-
};
|
|
287
|
-
if (srfaiagent) {
|
|
288
|
-
questionRequestData.srfaiagent = srfaiagent;
|
|
289
|
-
}
|
|
290
|
-
if (srfmode) {
|
|
291
|
-
questionRequestData.mode = srfmode;
|
|
292
|
-
}
|
|
293
|
-
await deService.aiChatSse(
|
|
294
|
-
(msg) => {
|
|
295
|
-
if (msg.actionstate === 20 && msg.actionresult) {
|
|
296
|
-
aiChat.addMessage({
|
|
297
|
-
messageid: id,
|
|
298
|
-
state: msg.actionstate,
|
|
299
|
-
type: "DEFAULT",
|
|
300
|
-
role: "ASSISTANT",
|
|
301
|
-
content: msg.actionresult
|
|
302
|
-
});
|
|
303
|
-
} else if (msg.actionstate === 30 && msg.actionresult) {
|
|
304
|
-
const result = JSON.parse(msg.actionresult);
|
|
305
|
-
const choices = result.choices;
|
|
306
|
-
if (choices && choices.length > 0) {
|
|
307
|
-
aiChat.replaceMessage({
|
|
308
|
-
messageid: id,
|
|
309
|
-
state: msg.actionstate,
|
|
310
|
-
type: "DEFAULT",
|
|
311
|
-
role: "ASSISTANT",
|
|
312
|
-
content: choices[0].content || ""
|
|
313
|
-
});
|
|
314
|
-
}
|
|
315
|
-
} else if (msg.actionstate === 40) {
|
|
316
|
-
aiChat.replaceMessage({
|
|
317
|
-
messageid: id,
|
|
318
|
-
state: msg.actionstate,
|
|
319
|
-
type: "ERROR",
|
|
320
|
-
role: "ASSISTANT",
|
|
321
|
-
content: msg.actionresult
|
|
322
|
-
});
|
|
323
|
-
}
|
|
324
|
-
},
|
|
325
|
-
abortController,
|
|
326
|
-
ctx,
|
|
327
|
-
param,
|
|
328
|
-
{ ...questionRequestData }
|
|
329
|
-
);
|
|
330
|
-
} catch (error) {
|
|
331
|
-
aiChat.replaceMessage({
|
|
332
|
-
messageid: id,
|
|
333
|
-
state: 40,
|
|
334
|
-
type: "ERROR",
|
|
335
|
-
role: "ASSISTANT",
|
|
336
|
-
content: error.message || ibiz.i18n.t("app.aiError")
|
|
337
|
-
});
|
|
338
|
-
abortController == null ? void 0 : abortController.abort();
|
|
339
|
-
} finally {
|
|
340
|
-
aiChat.completeMessage(id, true);
|
|
341
|
-
return true;
|
|
342
|
-
}
|
|
343
|
-
},
|
|
344
|
-
abortQuestion: async (aiChat) => {
|
|
345
|
-
abortController == null ? void 0 : abortController.abort();
|
|
346
|
-
await aiChat.stopMessage({
|
|
347
|
-
messageid: id,
|
|
348
|
-
state: 30,
|
|
349
|
-
type: "DEFAULT",
|
|
350
|
-
role: "ASSISTANT",
|
|
351
|
-
content: ""
|
|
352
|
-
});
|
|
353
|
-
await aiChat.completeMessage(id, true);
|
|
354
|
-
},
|
|
251
|
+
sessionid,
|
|
252
|
+
// 扩展参数
|
|
253
|
+
...chatOptions,
|
|
254
|
+
// 关闭回调
|
|
355
255
|
closed: () => {
|
|
356
256
|
resolve(messages);
|
|
357
|
-
}
|
|
358
|
-
history: async (ctx, param, other) => {
|
|
359
|
-
const deService = await ibiz.hub.getApp(ctx.srfappid).deService.getService(ctx, other.appDataEntityId);
|
|
360
|
-
const historyRequestData = {};
|
|
361
|
-
if (other.appendCurData) {
|
|
362
|
-
Object.assign(historyRequestData, {
|
|
363
|
-
...other.appendCurData
|
|
364
|
-
});
|
|
365
|
-
}
|
|
366
|
-
if (other.srfaiagent) {
|
|
367
|
-
Object.assign(historyRequestData, {
|
|
368
|
-
srfaiagent: other.srfaiagent
|
|
369
|
-
});
|
|
370
|
-
}
|
|
371
|
-
if (other.srfmode) {
|
|
372
|
-
Object.assign(historyRequestData, {
|
|
373
|
-
mode: other.srfmode
|
|
374
|
-
});
|
|
375
|
-
}
|
|
376
|
-
const result = await deService.aiChatHistory(
|
|
377
|
-
ctx,
|
|
378
|
-
param,
|
|
379
|
-
historyRequestData
|
|
380
|
-
);
|
|
381
|
-
if (result.data && Array.isArray(result.data)) {
|
|
382
|
-
let preMsg;
|
|
383
|
-
result.data.forEach((item) => {
|
|
384
|
-
if (item.role === "TOOL") {
|
|
385
|
-
if (preMsg && item.content) {
|
|
386
|
-
chatInstance.aiChat.updateRecommendPrompt(
|
|
387
|
-
preMsg,
|
|
388
|
-
item.content
|
|
389
|
-
);
|
|
390
|
-
}
|
|
391
|
-
} else {
|
|
392
|
-
const msg = {
|
|
393
|
-
messageid: createUUID(),
|
|
394
|
-
state: 30,
|
|
395
|
-
type: "DEFAULT",
|
|
396
|
-
role: item.role,
|
|
397
|
-
content: item.content,
|
|
398
|
-
completed: true
|
|
399
|
-
};
|
|
400
|
-
preMsg = msg;
|
|
401
|
-
chatInstance.aiChat.addMessage(msg);
|
|
402
|
-
}
|
|
403
|
-
});
|
|
404
|
-
}
|
|
405
|
-
return true;
|
|
406
|
-
},
|
|
407
|
-
recommendPrompt: async (ctx, param, other) => {
|
|
408
|
-
const deService = await ibiz.hub.getApp(ctx.srfappid).deService.getService(ctx, other.appDataEntityId);
|
|
409
|
-
const result = await deService.aiChatRecommendPrompt(
|
|
410
|
-
ctx,
|
|
411
|
-
param,
|
|
412
|
-
other.message
|
|
413
|
-
);
|
|
414
|
-
if (result.ok && result.data) {
|
|
415
|
-
const choices = result.data.choices;
|
|
416
|
-
if (choices && choices.length > 0) {
|
|
417
|
-
return choices[0];
|
|
418
|
-
}
|
|
419
|
-
return null;
|
|
420
|
-
}
|
|
421
|
-
return null;
|
|
422
|
-
},
|
|
423
|
-
uploader: {
|
|
424
|
-
onUpload: async (file, reportProgress, options) => {
|
|
425
|
-
const { uploadUrl } = ibiz.util.file.calcFileUpDownUrl(
|
|
426
|
-
(options == null ? void 0 : options.context) || context,
|
|
427
|
-
(options == null ? void 0 : options.params) || params,
|
|
428
|
-
{}
|
|
429
|
-
);
|
|
430
|
-
const headers = ibiz.util.file.getUploadHeaders();
|
|
431
|
-
const formData = new FormData();
|
|
432
|
-
formData.append("file", file);
|
|
433
|
-
const res = await ibiz.net.axios({
|
|
434
|
-
url: uploadUrl,
|
|
435
|
-
method: "post",
|
|
436
|
-
headers,
|
|
437
|
-
data: formData,
|
|
438
|
-
onUploadProgress: (progressEvent) => {
|
|
439
|
-
const percent = progressEvent.loaded / progressEvent.total * 100;
|
|
440
|
-
reportProgress(percent);
|
|
441
|
-
}
|
|
442
|
-
});
|
|
443
|
-
return res.data;
|
|
444
|
-
}
|
|
445
|
-
},
|
|
446
|
-
extendToolbarClick: async (event, source, context2, params2, data2) => {
|
|
447
|
-
var _a, _b;
|
|
448
|
-
const result = await UIActionUtil.exec(
|
|
449
|
-
source.id,
|
|
450
|
-
{
|
|
451
|
-
view,
|
|
452
|
-
ctrl,
|
|
453
|
-
context: IBizContext.create(context2),
|
|
454
|
-
params: params2,
|
|
455
|
-
data: [data2],
|
|
456
|
-
event
|
|
457
|
-
},
|
|
458
|
-
source.appId
|
|
459
|
-
);
|
|
460
|
-
if (result.closeView) {
|
|
461
|
-
view.closeView({ ok: true });
|
|
462
|
-
} else if (result.refresh) {
|
|
463
|
-
switch (result.refreshMode) {
|
|
464
|
-
case 1:
|
|
465
|
-
view.callUIAction(SysUIActionTag.REFRESH);
|
|
466
|
-
break;
|
|
467
|
-
case 2:
|
|
468
|
-
(_a = view.parentView) == null ? void 0 : _a.callUIAction(SysUIActionTag.REFRESH);
|
|
469
|
-
break;
|
|
470
|
-
case 3:
|
|
471
|
-
(_b = view.getTopView()) == null ? void 0 : _b.callUIAction(SysUIActionTag.REFRESH);
|
|
472
|
-
break;
|
|
473
|
-
default:
|
|
474
|
-
}
|
|
475
|
-
}
|
|
476
|
-
return result;
|
|
477
|
-
},
|
|
478
|
-
// 扩展参数
|
|
479
|
-
...chatOptions
|
|
257
|
+
}
|
|
480
258
|
}
|
|
481
259
|
});
|
|
482
260
|
});
|
|
@@ -58,6 +58,7 @@ const useAI = (props, opts) => {
|
|
|
58
58
|
const { context, data, deACMode } = props;
|
|
59
59
|
const { srfaiappendcurdata, srfmode, srfaiagent } = opts;
|
|
60
60
|
const params = { srfactag: deACMode.codeName };
|
|
61
|
+
const sessionid = ibiz.aiChatUtil.getChatSessionId("INLINE");
|
|
61
62
|
const app = ibiz.hub.getApp(deACMode.appId);
|
|
62
63
|
let history = [];
|
|
63
64
|
let appDataEntity;
|
|
@@ -75,7 +76,9 @@ const useAI = (props, opts) => {
|
|
|
75
76
|
deACMode.appId
|
|
76
77
|
);
|
|
77
78
|
const path = calcAIPath(true);
|
|
78
|
-
const body = {
|
|
79
|
+
const body = {
|
|
80
|
+
sessionid
|
|
81
|
+
};
|
|
79
82
|
if (srfaiappendcurdata)
|
|
80
83
|
Object.assign(body, data);
|
|
81
84
|
if (srfmode)
|
|
@@ -112,6 +115,7 @@ const useAI = (props, opts) => {
|
|
|
112
115
|
};
|
|
113
116
|
const prepareData = (question, isAsync = false) => {
|
|
114
117
|
const body = {
|
|
118
|
+
sessionid,
|
|
115
119
|
messages: [
|
|
116
120
|
...history,
|
|
117
121
|
{
|
|
@@ -144,8 +148,8 @@ const useAI = (props, opts) => {
|
|
|
144
148
|
}
|
|
145
149
|
return { think, content };
|
|
146
150
|
};
|
|
147
|
-
const asyncAskAI = (question, callBack) => {
|
|
148
|
-
return new Promise((resolve
|
|
151
|
+
const asyncAskAI = (question, callBack, errorBack) => {
|
|
152
|
+
return new Promise((resolve) => {
|
|
149
153
|
abortController.value = new AbortController();
|
|
150
154
|
const { body, url } = prepareData(question, true);
|
|
151
155
|
app.net.sse(url, params, {
|
|
@@ -168,7 +172,11 @@ const useAI = (props, opts) => {
|
|
|
168
172
|
}
|
|
169
173
|
},
|
|
170
174
|
onclose: () => resolve(),
|
|
171
|
-
onerror: () =>
|
|
175
|
+
onerror: (error) => {
|
|
176
|
+
callBack({ state: 40, content: error.message });
|
|
177
|
+
errorBack();
|
|
178
|
+
throw error;
|
|
179
|
+
},
|
|
172
180
|
signal: abortController.value.signal
|
|
173
181
|
});
|
|
174
182
|
});
|
|
@@ -148,7 +148,9 @@ const InlineAITextArea = /* @__PURE__ */ defineComponent({
|
|
|
148
148
|
});
|
|
149
149
|
isCollapse.value = false;
|
|
150
150
|
if (inlinecompletionmode === "async") {
|
|
151
|
-
await asyncAskAI(question, handleAnswer)
|
|
151
|
+
await asyncAskAI(question, handleAnswer, () => {
|
|
152
|
+
isLoading.value = false;
|
|
153
|
+
});
|
|
152
154
|
} else {
|
|
153
155
|
const answer = await syncAskAI(question);
|
|
154
156
|
handleAnswer(answer);
|
|
@@ -26,6 +26,12 @@ class CompositeFormItemExController extends runtime.FormItemController {
|
|
|
26
26
|
* @memberof CompositeFormItemExController
|
|
27
27
|
*/
|
|
28
28
|
__publicField(this, "includesList", ["HTMLEDITOR_DEFAULT", "MARKDOWN_DEFAULT"]);
|
|
29
|
+
/**
|
|
30
|
+
* @description 代码表id
|
|
31
|
+
* @type {string}
|
|
32
|
+
* @memberof CompositeFormItemExController
|
|
33
|
+
*/
|
|
34
|
+
__publicField(this, "codeListId", "");
|
|
29
35
|
/**
|
|
30
36
|
* @description 切换菜单选项
|
|
31
37
|
* @type {{ id: string; name: string; icon?: ISysImage, editor?: IData }[]}
|
|
@@ -44,16 +50,20 @@ class CompositeFormItemExController extends runtime.FormItemController {
|
|
|
44
50
|
return new compositeFormItemEx_state.CompositeFormItemExState((_a = this.parent) == null ? void 0 : _a.state);
|
|
45
51
|
}
|
|
46
52
|
async onInit() {
|
|
47
|
-
var _a, _b, _c;
|
|
53
|
+
var _a, _b, _c, _d;
|
|
48
54
|
await super.onInit();
|
|
49
55
|
const editor = this.model.editor;
|
|
50
56
|
if (!editor) {
|
|
51
57
|
return;
|
|
52
58
|
}
|
|
53
|
-
|
|
59
|
+
this.codeListId = editor.appCodeListId || "";
|
|
60
|
+
if ((_a = editor.editorParams) == null ? void 0 : _a.codelistid) {
|
|
61
|
+
this.codeListId = editor.editorParams.codelistid;
|
|
62
|
+
}
|
|
63
|
+
if (this.codeListId) {
|
|
54
64
|
const app = ibiz.hub.getApp(this.context.srfappid);
|
|
55
65
|
const items = await app.codeList.get(
|
|
56
|
-
|
|
66
|
+
this.codeListId,
|
|
57
67
|
this.context,
|
|
58
68
|
this.params
|
|
59
69
|
);
|
|
@@ -66,13 +76,13 @@ class CompositeFormItemExController extends runtime.FormItemController {
|
|
|
66
76
|
editor: item.data
|
|
67
77
|
};
|
|
68
78
|
});
|
|
69
|
-
this.defaultType = ((
|
|
79
|
+
this.defaultType = ((_b = this.switchOptions[0]) == null ? void 0 : _b.id) || "";
|
|
70
80
|
}
|
|
71
81
|
}
|
|
72
|
-
if ((
|
|
82
|
+
if ((_c = editor.editorParams) == null ? void 0 : _c.defaulttype) {
|
|
73
83
|
this.defaultType = editor.editorParams.defaulttype;
|
|
74
84
|
}
|
|
75
|
-
if ((
|
|
85
|
+
if ((_d = editor.editorParams) == null ? void 0 : _d.includes) {
|
|
76
86
|
this.includesList = JSON.parse(editor.editorParams.includes);
|
|
77
87
|
}
|
|
78
88
|
if (editor.editorItems && editor.editorItems.length) {
|
|
@@ -31,7 +31,8 @@ const IBizExportExcel = /* @__PURE__ */ vue.defineComponent({
|
|
|
31
31
|
required: true
|
|
32
32
|
},
|
|
33
33
|
controller: {
|
|
34
|
-
type: Object
|
|
34
|
+
type: Object,
|
|
35
|
+
required: true
|
|
35
36
|
}
|
|
36
37
|
},
|
|
37
38
|
emits: ["exportExcel"],
|
|
@@ -41,6 +42,15 @@ const IBizExportExcel = /* @__PURE__ */ vue.defineComponent({
|
|
|
41
42
|
const ns = vue3Util.useNamespace("export-excel");
|
|
42
43
|
const startPage = vue.ref(1);
|
|
43
44
|
const endPage = vue.ref(9999);
|
|
45
|
+
const maxRowCount = vue.ref(1e3);
|
|
46
|
+
const xdataControl = props.controller.xdataControl;
|
|
47
|
+
vue.onMounted(() => {
|
|
48
|
+
if (xdataControl)
|
|
49
|
+
xdataControl.evt.on("onMounted", () => {
|
|
50
|
+
var _a;
|
|
51
|
+
maxRowCount.value = ((_a = xdataControl.dataExport) == null ? void 0 : _a.maxRowCount) || 1e3;
|
|
52
|
+
});
|
|
53
|
+
});
|
|
44
54
|
const onCommand = (command, e) => {
|
|
45
55
|
if (!command) {
|
|
46
56
|
return;
|
|
@@ -53,6 +63,7 @@ const IBizExportExcel = /* @__PURE__ */ vue.defineComponent({
|
|
|
53
63
|
};
|
|
54
64
|
return {
|
|
55
65
|
ns,
|
|
66
|
+
maxRowCount,
|
|
56
67
|
endPage,
|
|
57
68
|
startPage,
|
|
58
69
|
onCommand
|
|
@@ -80,7 +91,9 @@ const IBizExportExcel = /* @__PURE__ */ vue.defineComponent({
|
|
|
80
91
|
return [vue.createVNode(vue.resolveComponent("el-menu-item"), {
|
|
81
92
|
"class": this.ns.b("menu-item"),
|
|
82
93
|
"onClick": (e) => this.onCommand("maxRowCount", e)
|
|
83
|
-
}, _isSlot(_slot2 = ibiz.i18n.t("control.toolbar.exportExcel.exportAll"
|
|
94
|
+
}, _isSlot(_slot2 = ibiz.i18n.t("control.toolbar.exportExcel.exportAll", {
|
|
95
|
+
maxRowCount: this.maxRowCount
|
|
96
|
+
})) ? _slot2 : {
|
|
84
97
|
default: () => [_slot2]
|
|
85
98
|
}), vue.createVNode(vue.resolveComponent("el-menu-item"), {
|
|
86
99
|
"class": this.ns.b("menu-item"),
|
|
@@ -156,7 +169,9 @@ const IBizExportExcel = /* @__PURE__ */ vue.defineComponent({
|
|
|
156
169
|
return vue.createVNode(vue.resolveComponent("el-dropdown-menu"), null, {
|
|
157
170
|
default: () => [vue.createVNode(vue.resolveComponent("el-dropdown-item"), {
|
|
158
171
|
"command": "maxRowCount"
|
|
159
|
-
}, _isSlot(_slot7 = ibiz.i18n.t("control.toolbar.exportExcel.exportAll"
|
|
172
|
+
}, _isSlot(_slot7 = ibiz.i18n.t("control.toolbar.exportExcel.exportAll", {
|
|
173
|
+
maxRowCount: this.maxRowCount
|
|
174
|
+
})) ? _slot7 : {
|
|
160
175
|
default: () => [_slot7]
|
|
161
176
|
}), vue.createVNode(vue.resolveComponent("el-dropdown-item"), {
|
|
162
177
|
"command": "activatedPage"
|