@ibiz-template/vue3-components 0.7.41-alpha.42 → 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-B1eGfH7d.js → xlsx-util-8YSXhmdI.js} +1 -1
- package/es/control/toolbar/export-excel/export-excel.mjs +19 -4
- package/es/editor/code/monaco-editor/monaco-editor.mjs +6 -194
- package/es/editor/html/wang-editor/module/ai-module.mjs +1 -1
- package/es/editor/html/wang-editor/wang-editor.mjs +20 -201
- package/es/editor/markdown/ibiz-markdown-editor/custom-menu.mjs +7 -223
- 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 +637 -7
- 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 +5 -1
- package/lib/control/toolbar/export-excel/export-excel.cjs +18 -3
- package/lib/editor/code/monaco-editor/monaco-editor.cjs +6 -194
- package/lib/editor/html/wang-editor/module/ai-module.cjs +1 -1
- package/lib/editor/html/wang-editor/wang-editor.cjs +19 -200
- package/lib/editor/markdown/ibiz-markdown-editor/custom-menu.cjs +7 -223
- 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 +635 -5
- 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.hook.cjs +5 -1
- package/package.json +7 -7
- package/dist/ibiz-markdown-editor-pEdb_gS_.js +0 -1
- package/dist/index-BObZTN7-.js +0 -11
- package/dist/wang-editor-Ck-JCWqK.js +0 -1
|
@@ -5,8 +5,6 @@ var vue3Util = require('@ibiz-template/vue3-util');
|
|
|
5
5
|
var qxUtil = require('qx-util');
|
|
6
6
|
var ElementPlus = require('element-plus');
|
|
7
7
|
require('../../../node_modules/.pnpm/@monaco-editor_loader@1.5.0/node_modules/@monaco-editor/loader/lib/es/index.cjs');
|
|
8
|
-
var runtime = require('@ibiz-template/runtime');
|
|
9
|
-
var core = require('@ibiz-template/core');
|
|
10
8
|
require('./monaco-editor.css');
|
|
11
9
|
var index = require('../../../node_modules/.pnpm/@monaco-editor_loader@1.5.0/node_modules/@monaco-editor/loader/lib/es/loader/index.cjs');
|
|
12
10
|
|
|
@@ -119,20 +117,15 @@ const IBizCode = /* @__PURE__ */ vue.defineComponent({
|
|
|
119
117
|
const openAIChat = async () => {
|
|
120
118
|
if (!c.deACMode || !c.model.appDataEntityId)
|
|
121
119
|
return;
|
|
122
|
-
|
|
123
|
-
const {
|
|
124
|
-
contentToolbarItems,
|
|
125
|
-
footerToolbarItems,
|
|
126
|
-
questionToolbarItems,
|
|
127
|
-
otherToolbarItems
|
|
128
|
-
} = ibiz.aiChatUtil.calcAiToolbarItemsByAc(c.deACMode);
|
|
120
|
+
chatInstance = await ibiz.aiChatUtil.getAIChat();
|
|
129
121
|
const {
|
|
130
122
|
containerOptions,
|
|
131
123
|
chatOptions
|
|
132
|
-
} = ibiz.aiChatUtil.getEditorExAIChatParams(c.editorParams, c.context, c.params, props.data
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
124
|
+
} = await ibiz.aiChatUtil.getEditorExAIChatParams(c.editorParams, c.context, c.params, props.data, c.deACMode, {
|
|
125
|
+
chatInstance,
|
|
126
|
+
view: c.view,
|
|
127
|
+
ctrl: c.ctrl
|
|
128
|
+
});
|
|
136
129
|
chatInstance.create({
|
|
137
130
|
containerOptions: {
|
|
138
131
|
zIndex: zIndex.increment(),
|
|
@@ -148,191 +141,10 @@ const IBizCode = /* @__PURE__ */ vue.defineComponent({
|
|
|
148
141
|
srfactag: c.deACMode.codeName
|
|
149
142
|
},
|
|
150
143
|
appDataEntityId: c.model.appDataEntityId,
|
|
151
|
-
contentToolbarItems,
|
|
152
|
-
footerToolbarItems,
|
|
153
|
-
questionToolbarItems,
|
|
154
|
-
otherToolbarItems,
|
|
155
|
-
aiAgentlist,
|
|
156
144
|
...chatOptions,
|
|
157
|
-
question: async (aiChat, ctx, param, other, arr, sessionid, srfaiagent, srfmode) => {
|
|
158
|
-
id = qxUtil.createUUID();
|
|
159
|
-
abortController = new AbortController();
|
|
160
|
-
const deService = await ibiz.hub.getApp(ctx.srfappid).deService.getService(ctx, other.appDataEntityId);
|
|
161
|
-
try {
|
|
162
|
-
const questionRequestData = {
|
|
163
|
-
messages: arr,
|
|
164
|
-
sessionid
|
|
165
|
-
};
|
|
166
|
-
if (srfaiagent) {
|
|
167
|
-
questionRequestData.srfaiagent = srfaiagent;
|
|
168
|
-
}
|
|
169
|
-
if (srfmode) {
|
|
170
|
-
questionRequestData.mode = srfmode;
|
|
171
|
-
}
|
|
172
|
-
await deService.aiChatSse((msg) => {
|
|
173
|
-
if (msg.actionstate === 20 && msg.actionresult) {
|
|
174
|
-
aiChat.addMessage({
|
|
175
|
-
messageid: id,
|
|
176
|
-
state: msg.actionstate,
|
|
177
|
-
type: "DEFAULT",
|
|
178
|
-
role: "ASSISTANT",
|
|
179
|
-
content: msg.actionresult
|
|
180
|
-
});
|
|
181
|
-
} else if (msg.actionstate === 30 && msg.actionresult) {
|
|
182
|
-
const result = JSON.parse(msg.actionresult);
|
|
183
|
-
const choices = result.choices;
|
|
184
|
-
if (choices && choices.length > 0) {
|
|
185
|
-
aiChat.replaceMessage({
|
|
186
|
-
messageid: id,
|
|
187
|
-
state: msg.actionstate,
|
|
188
|
-
type: "DEFAULT",
|
|
189
|
-
role: "ASSISTANT",
|
|
190
|
-
content: choices[0].content || ""
|
|
191
|
-
});
|
|
192
|
-
}
|
|
193
|
-
} else if (msg.actionstate === 40) {
|
|
194
|
-
aiChat.replaceMessage({
|
|
195
|
-
messageid: id,
|
|
196
|
-
state: msg.actionstate,
|
|
197
|
-
type: "ERROR",
|
|
198
|
-
role: "ASSISTANT",
|
|
199
|
-
content: msg.actionresult
|
|
200
|
-
});
|
|
201
|
-
}
|
|
202
|
-
}, abortController, ctx, param, {
|
|
203
|
-
...questionRequestData
|
|
204
|
-
});
|
|
205
|
-
} catch (error) {
|
|
206
|
-
aiChat.replaceMessage({
|
|
207
|
-
messageid: id,
|
|
208
|
-
state: 40,
|
|
209
|
-
type: "ERROR",
|
|
210
|
-
role: "ASSISTANT",
|
|
211
|
-
content: error.message || ibiz.i18n.t("app.aiError")
|
|
212
|
-
});
|
|
213
|
-
abortController == null ? void 0 : abortController.abort();
|
|
214
|
-
} finally {
|
|
215
|
-
aiChat.completeMessage(id, true);
|
|
216
|
-
return true;
|
|
217
|
-
}
|
|
218
|
-
},
|
|
219
|
-
abortQuestion: async (aiChat) => {
|
|
220
|
-
abortController == null ? void 0 : abortController.abort();
|
|
221
|
-
await aiChat.stopMessage({
|
|
222
|
-
messageid: id,
|
|
223
|
-
state: 30,
|
|
224
|
-
type: "DEFAULT",
|
|
225
|
-
role: "ASSISTANT",
|
|
226
|
-
content: ""
|
|
227
|
-
});
|
|
228
|
-
await aiChat.completeMessage(id, true);
|
|
229
|
-
},
|
|
230
145
|
action: (action, message) => {
|
|
231
146
|
if (action === "backfill")
|
|
232
147
|
emit("change", message.realcontent);
|
|
233
|
-
},
|
|
234
|
-
history: async (ctx, param, other) => {
|
|
235
|
-
const deService = await ibiz.hub.getApp(ctx.srfappid).deService.getService(ctx, other.appDataEntityId);
|
|
236
|
-
const historyRequestData = {};
|
|
237
|
-
if (other.appendCurData) {
|
|
238
|
-
Object.assign(historyRequestData, {
|
|
239
|
-
...other.appendCurData
|
|
240
|
-
});
|
|
241
|
-
}
|
|
242
|
-
if (other.srfaiagent) {
|
|
243
|
-
Object.assign(historyRequestData, {
|
|
244
|
-
srfaiagent: other.srfaiagent
|
|
245
|
-
});
|
|
246
|
-
}
|
|
247
|
-
if (other.srfmode) {
|
|
248
|
-
Object.assign(historyRequestData, {
|
|
249
|
-
mode: other.srfmode
|
|
250
|
-
});
|
|
251
|
-
}
|
|
252
|
-
const result = await deService.aiChatHistory(ctx, param, historyRequestData);
|
|
253
|
-
if (result.data && Array.isArray(result.data)) {
|
|
254
|
-
let preMsg;
|
|
255
|
-
result.data.forEach((item) => {
|
|
256
|
-
if (item.role === "TOOL") {
|
|
257
|
-
if (preMsg && item.content) {
|
|
258
|
-
chatInstance.aiChat.updateRecommendPrompt(preMsg, item.content);
|
|
259
|
-
}
|
|
260
|
-
} else {
|
|
261
|
-
const msg = {
|
|
262
|
-
messageid: qxUtil.createUUID(),
|
|
263
|
-
state: 30,
|
|
264
|
-
type: "DEFAULT",
|
|
265
|
-
role: item.role,
|
|
266
|
-
content: item.content,
|
|
267
|
-
completed: true
|
|
268
|
-
};
|
|
269
|
-
preMsg = msg;
|
|
270
|
-
chatInstance.aiChat.addMessage(msg);
|
|
271
|
-
}
|
|
272
|
-
});
|
|
273
|
-
}
|
|
274
|
-
return true;
|
|
275
|
-
},
|
|
276
|
-
recommendPrompt: async (ctx, param, other) => {
|
|
277
|
-
const deService = await ibiz.hub.getApp(ctx.srfappid).deService.getService(ctx, other.appDataEntityId);
|
|
278
|
-
const result = await deService.aiChatRecommendPrompt(ctx, param, other.message);
|
|
279
|
-
if (result.ok && result.data) {
|
|
280
|
-
const choices = result.data.choices;
|
|
281
|
-
if (choices && choices.length > 0) {
|
|
282
|
-
return choices[0];
|
|
283
|
-
}
|
|
284
|
-
return null;
|
|
285
|
-
}
|
|
286
|
-
return null;
|
|
287
|
-
},
|
|
288
|
-
uploader: {
|
|
289
|
-
onUpload: async (file, reportProgress, options) => {
|
|
290
|
-
const fileMeata = ibiz.util.file.calcFileUpDownUrl((options == null ? void 0 : options.context) || c.context, (options == null ? void 0 : options.params) || c.params, {});
|
|
291
|
-
const uploadHeaders = ibiz.util.file.getUploadHeaders();
|
|
292
|
-
const formData = new FormData();
|
|
293
|
-
formData.append("file", file);
|
|
294
|
-
const res = await ibiz.net.axios({
|
|
295
|
-
url: fileMeata.uploadUrl,
|
|
296
|
-
method: "post",
|
|
297
|
-
headers: uploadHeaders,
|
|
298
|
-
data: formData,
|
|
299
|
-
onUploadProgress: (progressEvent) => {
|
|
300
|
-
const percent = progressEvent.loaded / progressEvent.total * 100;
|
|
301
|
-
reportProgress(percent);
|
|
302
|
-
}
|
|
303
|
-
});
|
|
304
|
-
return res.data;
|
|
305
|
-
}
|
|
306
|
-
},
|
|
307
|
-
extendToolbarClick: async (event, source, context, params, data) => {
|
|
308
|
-
var _a, _b;
|
|
309
|
-
const result = await runtime.UIActionUtil.exec(source.id, {
|
|
310
|
-
view: c.view,
|
|
311
|
-
ctrl: c.ctrl,
|
|
312
|
-
context: core.IBizContext.create(context),
|
|
313
|
-
params,
|
|
314
|
-
data: [data],
|
|
315
|
-
event
|
|
316
|
-
}, source.appId);
|
|
317
|
-
if (result.closeView) {
|
|
318
|
-
c.view.closeView({
|
|
319
|
-
ok: true
|
|
320
|
-
});
|
|
321
|
-
} else if (result.refresh) {
|
|
322
|
-
switch (result.refreshMode) {
|
|
323
|
-
case 1:
|
|
324
|
-
c.view.callUIAction(runtime.SysUIActionTag.REFRESH);
|
|
325
|
-
break;
|
|
326
|
-
case 2:
|
|
327
|
-
(_a = c.view.parentView) == null ? void 0 : _a.callUIAction(runtime.SysUIActionTag.REFRESH);
|
|
328
|
-
break;
|
|
329
|
-
case 3:
|
|
330
|
-
(_b = c.view.getTopView()) == null ? void 0 : _b.callUIAction(runtime.SysUIActionTag.REFRESH);
|
|
331
|
-
break;
|
|
332
|
-
default:
|
|
333
|
-
}
|
|
334
|
-
}
|
|
335
|
-
return result;
|
|
336
148
|
}
|
|
337
149
|
}
|
|
338
150
|
});
|
|
@@ -22,7 +22,7 @@ class AIButtonMenu {
|
|
|
22
22
|
* @type {string}
|
|
23
23
|
* @memberof AIButtonMenu
|
|
24
24
|
*/
|
|
25
|
-
__publicField(this, "iconSvg", '<svg xmlns="http://www.w3.org/2000/svg"
|
|
25
|
+
__publicField(this, "iconSvg", '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="currentColor" height="1em" width="1em" preserveAspectRatio="xMidYMid meet" focusable="false" class="cherry-menu-AIChart"><g id="aae1.Base\u57FA\u7840/1.icon\u56FE\u6807/2.normal/ai-star" stroke-width="1" fill-rule="evenodd"><path d="M5.817 1.53l3.158 8.797h.054v.152l1.443 4.021-1.402.001-1.041-2.982H2.495l-1.03 2.982L0 14.5 4.671 1.533l1.146-.003zm7.86 5.424V14.5h-1.213V6.954h1.212zM5.248 3.549l-2.342 6.778h4.706L5.249 3.55zM13.046 0c.075 0 .147.02.204.071a.318.318 0 01.094.181l.064.273c.097.417.17.727.255.968.084.24.177.4.31.523.134.124.318.218.599.306.281.088.65.166 1.15.265a.358.358 0 01.195.095c.056.057.083.13.083.213a.289.289 0 01-.083.21.362.362 0 01-.197.094c-.528.093-.918.167-1.214.255-.295.088-.485.187-.621.324-.137.138-.23.324-.31.606-.08.283-.145.651-.23 1.147a.329.329 0 01-.093.184.293.293 0 01-.206.075.308.308 0 01-.207-.072.322.322 0 01-.1-.188l-.006-.033c-.085-.486-.149-.845-.228-1.12-.079-.274-.17-.452-.305-.585-.135-.133-.323-.23-.618-.32s-.683-.168-1.21-.273a.353.353 0 01-.2-.096.29.29 0 01-.08-.208c0-.079.023-.153.079-.211a.35.35 0 01.2-.097c.5-.098.869-.176 1.15-.263.282-.087.465-.18.597-.302.132-.12.224-.278.306-.511.082-.236.151-.539.244-.947l.071-.312a.312.312 0 01.102-.183.311.311 0 01.205-.069z" id="aae\u5F62\u72B6\u7ED3\u5408"></path></g></svg>');
|
|
26
26
|
/**
|
|
27
27
|
*
|
|
28
28
|
*
|
|
@@ -4,11 +4,9 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
var vue = require('vue');
|
|
6
6
|
var editorForVue = require('@wangeditor/editor-for-vue');
|
|
7
|
-
var qxUtil = require('qx-util');
|
|
8
7
|
var ramda = require('ramda');
|
|
9
8
|
var vue3Util = require('@ibiz-template/vue3-util');
|
|
10
9
|
var core = require('@ibiz-template/core');
|
|
11
|
-
var runtime = require('@ibiz-template/runtime');
|
|
12
10
|
var ElementPlus = require('element-plus');
|
|
13
11
|
require('./module/index.cjs');
|
|
14
12
|
require('./config/index.cjs');
|
|
@@ -201,24 +199,19 @@ const IBizHtml = /* @__PURE__ */ vue.defineComponent({
|
|
|
201
199
|
const appDataEntityId = c.model.appDataEntityId;
|
|
202
200
|
if (!appDataEntityId || !c.deACMode)
|
|
203
201
|
return;
|
|
204
|
-
const aiAgentlist = await ibiz.aiChatUtil.getAIAgentList(c.context, c.params, c.editorParams);
|
|
205
|
-
const {
|
|
206
|
-
contentToolbarItems,
|
|
207
|
-
footerToolbarItems,
|
|
208
|
-
questionToolbarItems,
|
|
209
|
-
otherToolbarItems
|
|
210
|
-
} = ibiz.aiChatUtil.calcAiToolbarItemsByAc(c.deACMode);
|
|
211
|
-
const {
|
|
212
|
-
containerOptions,
|
|
213
|
-
chatOptions
|
|
214
|
-
} = ibiz.aiChatUtil.getEditorExAIChatParams(c.editorParams, c.context, c.params, props.data);
|
|
215
202
|
const {
|
|
216
203
|
zIndex
|
|
217
204
|
} = vue3Util.useUIStore();
|
|
218
205
|
const containerZIndex = zIndex.increment();
|
|
219
206
|
chatInstance = await ibiz.aiChatUtil.getAIChat();
|
|
220
|
-
|
|
221
|
-
|
|
207
|
+
const {
|
|
208
|
+
containerOptions,
|
|
209
|
+
chatOptions
|
|
210
|
+
} = await ibiz.aiChatUtil.getEditorExAIChatParams(c.editorParams, c.context, c.params, props.data, c.deACMode, {
|
|
211
|
+
chatInstance,
|
|
212
|
+
view: c.view,
|
|
213
|
+
ctrl: c.ctrl
|
|
214
|
+
});
|
|
222
215
|
chatInstance.create({
|
|
223
216
|
containerOptions: {
|
|
224
217
|
zIndex: containerZIndex,
|
|
@@ -234,85 +227,7 @@ const IBizHtml = /* @__PURE__ */ vue.defineComponent({
|
|
|
234
227
|
srfactag: c.deACMode.codeName
|
|
235
228
|
},
|
|
236
229
|
appDataEntityId,
|
|
237
|
-
contentToolbarItems,
|
|
238
|
-
footerToolbarItems,
|
|
239
|
-
questionToolbarItems,
|
|
240
|
-
otherToolbarItems,
|
|
241
|
-
aiAgentlist,
|
|
242
230
|
...chatOptions,
|
|
243
|
-
question: async (aiChat, ctx, param, other, arr, sessionid, srfaiagent, srfmode) => {
|
|
244
|
-
id = qxUtil.createUUID();
|
|
245
|
-
abortController = new AbortController();
|
|
246
|
-
const deService = await ibiz.hub.getApp(ctx.srfappid).deService.getService(ctx, other.appDataEntityId);
|
|
247
|
-
try {
|
|
248
|
-
const questionRequestData = {
|
|
249
|
-
messages: arr,
|
|
250
|
-
sessionid
|
|
251
|
-
};
|
|
252
|
-
if (srfaiagent) {
|
|
253
|
-
questionRequestData.srfaiagent = srfaiagent;
|
|
254
|
-
}
|
|
255
|
-
if (srfmode) {
|
|
256
|
-
questionRequestData.mode = srfmode;
|
|
257
|
-
}
|
|
258
|
-
await deService.aiChatSse((msg) => {
|
|
259
|
-
if (msg.actionstate === 20 && msg.actionresult) {
|
|
260
|
-
aiChat.addMessage({
|
|
261
|
-
messageid: id,
|
|
262
|
-
state: msg.actionstate,
|
|
263
|
-
type: "DEFAULT",
|
|
264
|
-
role: "ASSISTANT",
|
|
265
|
-
content: msg.actionresult
|
|
266
|
-
});
|
|
267
|
-
} else if (msg.actionstate === 30 && msg.actionresult) {
|
|
268
|
-
const result = JSON.parse(msg.actionresult);
|
|
269
|
-
const choices = result.choices;
|
|
270
|
-
if (choices && choices.length > 0) {
|
|
271
|
-
aiChat.replaceMessage({
|
|
272
|
-
messageid: id,
|
|
273
|
-
state: msg.actionstate,
|
|
274
|
-
type: "DEFAULT",
|
|
275
|
-
role: "ASSISTANT",
|
|
276
|
-
content: choices[0].content || ""
|
|
277
|
-
});
|
|
278
|
-
}
|
|
279
|
-
} else if (msg.actionstate === 40) {
|
|
280
|
-
aiChat.replaceMessage({
|
|
281
|
-
messageid: id,
|
|
282
|
-
state: msg.actionstate,
|
|
283
|
-
type: "ERROR",
|
|
284
|
-
role: "ASSISTANT",
|
|
285
|
-
content: msg.actionresult
|
|
286
|
-
});
|
|
287
|
-
}
|
|
288
|
-
}, abortController, ctx, param, {
|
|
289
|
-
...questionRequestData
|
|
290
|
-
});
|
|
291
|
-
} catch (error) {
|
|
292
|
-
aiChat.replaceMessage({
|
|
293
|
-
messageid: id,
|
|
294
|
-
state: 40,
|
|
295
|
-
type: "ERROR",
|
|
296
|
-
role: "ASSISTANT",
|
|
297
|
-
content: error.message || ibiz.i18n.t("app.aiError")
|
|
298
|
-
});
|
|
299
|
-
abortController == null ? void 0 : abortController.abort();
|
|
300
|
-
} finally {
|
|
301
|
-
aiChat.completeMessage(id, true);
|
|
302
|
-
return true;
|
|
303
|
-
}
|
|
304
|
-
},
|
|
305
|
-
abortQuestion: async (aiChat) => {
|
|
306
|
-
abortController == null ? void 0 : abortController.abort();
|
|
307
|
-
await aiChat.stopMessage({
|
|
308
|
-
messageid: id,
|
|
309
|
-
state: 30,
|
|
310
|
-
type: "DEFAULT",
|
|
311
|
-
role: "ASSISTANT",
|
|
312
|
-
content: ""
|
|
313
|
-
});
|
|
314
|
-
await aiChat.completeMessage(id, true);
|
|
315
|
-
},
|
|
316
231
|
action: (action, message) => {
|
|
317
232
|
if (action === "backfill") {
|
|
318
233
|
if (hasEnableEdit.value) {
|
|
@@ -321,109 +236,6 @@ const IBizHtml = /* @__PURE__ */ vue.defineComponent({
|
|
|
321
236
|
emit("change", message.realcontent);
|
|
322
237
|
}
|
|
323
238
|
}
|
|
324
|
-
},
|
|
325
|
-
history: async (ctx, param, other) => {
|
|
326
|
-
const deService = await ibiz.hub.getApp(ctx.srfappid).deService.getService(ctx, other.appDataEntityId);
|
|
327
|
-
const historyRequestData = {};
|
|
328
|
-
if (other.appendCurData) {
|
|
329
|
-
Object.assign(historyRequestData, {
|
|
330
|
-
...other.appendCurData
|
|
331
|
-
});
|
|
332
|
-
}
|
|
333
|
-
if (other.srfaiagent) {
|
|
334
|
-
Object.assign(historyRequestData, {
|
|
335
|
-
srfaiagent: other.srfaiagent
|
|
336
|
-
});
|
|
337
|
-
}
|
|
338
|
-
if (other.srfmode) {
|
|
339
|
-
Object.assign(historyRequestData, {
|
|
340
|
-
mode: other.srfmode
|
|
341
|
-
});
|
|
342
|
-
}
|
|
343
|
-
const result = await deService.aiChatHistory(ctx, param, historyRequestData);
|
|
344
|
-
if (result.data && Array.isArray(result.data)) {
|
|
345
|
-
let preMsg;
|
|
346
|
-
result.data.forEach((item) => {
|
|
347
|
-
if (item.role === "TOOL") {
|
|
348
|
-
if (preMsg && item.content) {
|
|
349
|
-
chatInstance.aiChat.updateRecommendPrompt(preMsg, item.content);
|
|
350
|
-
}
|
|
351
|
-
} else {
|
|
352
|
-
const msg = {
|
|
353
|
-
messageid: qxUtil.createUUID(),
|
|
354
|
-
state: 30,
|
|
355
|
-
type: "DEFAULT",
|
|
356
|
-
role: item.role,
|
|
357
|
-
content: item.content,
|
|
358
|
-
completed: true
|
|
359
|
-
};
|
|
360
|
-
preMsg = msg;
|
|
361
|
-
chatInstance.aiChat.addMessage(msg);
|
|
362
|
-
}
|
|
363
|
-
});
|
|
364
|
-
}
|
|
365
|
-
return true;
|
|
366
|
-
},
|
|
367
|
-
recommendPrompt: async (ctx, param, other) => {
|
|
368
|
-
const deService = await ibiz.hub.getApp(ctx.srfappid).deService.getService(ctx, other.appDataEntityId);
|
|
369
|
-
const result = await deService.aiChatRecommendPrompt(ctx, param, other.message);
|
|
370
|
-
if (result.ok && result.data) {
|
|
371
|
-
const choices = result.data.choices;
|
|
372
|
-
if (choices && choices.length > 0) {
|
|
373
|
-
return choices[0];
|
|
374
|
-
}
|
|
375
|
-
return null;
|
|
376
|
-
}
|
|
377
|
-
return null;
|
|
378
|
-
},
|
|
379
|
-
uploader: {
|
|
380
|
-
onUpload: async (file, reportProgress, options) => {
|
|
381
|
-
const fileMeata = ibiz.util.file.calcFileUpDownUrl((options == null ? void 0 : options.context) || c.context, (options == null ? void 0 : options.params) || c.params, {});
|
|
382
|
-
const fielUploadHeaders = ibiz.util.file.getUploadHeaders();
|
|
383
|
-
const formData = new FormData();
|
|
384
|
-
formData.append("file", file);
|
|
385
|
-
const res = await ibiz.net.axios({
|
|
386
|
-
url: fileMeata.uploadUrl,
|
|
387
|
-
method: "post",
|
|
388
|
-
headers: fielUploadHeaders,
|
|
389
|
-
data: formData,
|
|
390
|
-
onUploadProgress: (progressEvent) => {
|
|
391
|
-
const percent = progressEvent.loaded / progressEvent.total * 100;
|
|
392
|
-
reportProgress(percent);
|
|
393
|
-
}
|
|
394
|
-
});
|
|
395
|
-
return res.data;
|
|
396
|
-
}
|
|
397
|
-
},
|
|
398
|
-
extendToolbarClick: async (event, source, context, params, data) => {
|
|
399
|
-
var _a, _b;
|
|
400
|
-
const result = await runtime.UIActionUtil.exec(source.id, {
|
|
401
|
-
view: c.view,
|
|
402
|
-
ctrl: c.ctrl,
|
|
403
|
-
context: core.IBizContext.create(context),
|
|
404
|
-
params,
|
|
405
|
-
data: [data],
|
|
406
|
-
event
|
|
407
|
-
}, source.appId);
|
|
408
|
-
if (result.closeView) {
|
|
409
|
-
c.view.closeView({
|
|
410
|
-
ok: true
|
|
411
|
-
});
|
|
412
|
-
} else if (result.refresh) {
|
|
413
|
-
switch (result.refreshMode) {
|
|
414
|
-
case 1:
|
|
415
|
-
c.view.callUIAction(runtime.SysUIActionTag.REFRESH);
|
|
416
|
-
break;
|
|
417
|
-
case 2:
|
|
418
|
-
(_a = c.view.parentView) == null ? void 0 : _a.callUIAction(runtime.SysUIActionTag.REFRESH);
|
|
419
|
-
break;
|
|
420
|
-
case 3:
|
|
421
|
-
(_b = c.view.getTopView()) == null ? void 0 : _b.callUIAction(runtime.SysUIActionTag.REFRESH);
|
|
422
|
-
break;
|
|
423
|
-
default:
|
|
424
|
-
}
|
|
425
|
-
}
|
|
426
|
-
return result;
|
|
427
239
|
}
|
|
428
240
|
}
|
|
429
241
|
});
|
|
@@ -436,9 +248,16 @@ const IBizHtml = /* @__PURE__ */ vue.defineComponent({
|
|
|
436
248
|
onClickAI();
|
|
437
249
|
});
|
|
438
250
|
editor.on("lineAiClick", () => {
|
|
439
|
-
const
|
|
440
|
-
|
|
251
|
+
const container = editor.getEditableContainer();
|
|
252
|
+
const hoverToolbar = container.querySelector(".w-e-hover-bar");
|
|
253
|
+
if (!hoverToolbar) {
|
|
441
254
|
return;
|
|
255
|
+
}
|
|
256
|
+
const {
|
|
257
|
+
offsetLeft,
|
|
258
|
+
offsetTop,
|
|
259
|
+
offsetHeight
|
|
260
|
+
} = hoverToolbar;
|
|
442
261
|
const items = ibiz.inLineAIUtil.calcContextMenus(c.deACMode, (tag) => {
|
|
443
262
|
c.doInLineAIUIAction(tag, c.model.appId);
|
|
444
263
|
});
|
|
@@ -451,9 +270,9 @@ const IBizHtml = /* @__PURE__ */ vue.defineComponent({
|
|
|
451
270
|
const popoverZIndex = zIndex.increment();
|
|
452
271
|
ibiz.inLineAIUtil.showContextMenus(
|
|
453
272
|
// 编辑器的左侧距离+选区距离编辑器左侧距离
|
|
454
|
-
editorBoundingClientRect.x +
|
|
273
|
+
editorBoundingClientRect.x + offsetLeft,
|
|
455
274
|
// 编辑器的上方距离+选区距离编辑器上方距离+悬浮工具栏高度
|
|
456
|
-
editorBoundingClientRect.y +
|
|
275
|
+
editorBoundingClientRect.y + offsetTop + offsetHeight,
|
|
457
276
|
items,
|
|
458
277
|
{
|
|
459
278
|
zIndex: popoverZIndex,
|