@ibiz-template/vue3-components 0.7.41-alpha.42 → 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-CaWTEUU1.js → index-DgqTP4Vw.js} +1 -1
- package/dist/{index-CD2XM6M6.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-B1eGfH7d.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/control/toolbar/export-excel/export-excel.mjs +19 -4
- package/es/editor/carousel/ibiz-carousel/ibiz-carousel.mjs +5 -2
- package/es/editor/code/monaco-editor/monaco-editor.mjs +8 -194
- package/es/editor/html/wang-editor/module/ai-module.mjs +1 -1
- package/es/editor/html/wang-editor/wang-editor.mjs +35 -207
- package/es/editor/markdown/ibiz-markdown-editor/custom-menu.mjs +11 -222
- 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 +11 -197
- 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 +29 -2
- package/es/locale/zh-CN/index.mjs +29 -2
- 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 +22 -43
- package/es/util/ai-chat-util/ai-chat-util.mjs +672 -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 +26 -247
- 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 +34 -4
- 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/control/toolbar/export-excel/export-excel.cjs +18 -3
- package/lib/editor/carousel/ibiz-carousel/ibiz-carousel.cjs +5 -2
- package/lib/editor/code/monaco-editor/monaco-editor.cjs +8 -194
- package/lib/editor/html/wang-editor/module/ai-module.cjs +1 -1
- package/lib/editor/html/wang-editor/wang-editor.cjs +34 -206
- package/lib/editor/markdown/ibiz-markdown-editor/custom-menu.cjs +11 -222
- 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 +10 -196
- 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 +29 -2
- package/lib/locale/zh-CN/index.cjs +29 -2
- package/lib/panel-component/coop-pos/coop-pos.controller.cjs +11 -1
- package/lib/panel-component/panel-app-title/panel-app-title.cjs +21 -42
- package/lib/panel-component/panel-app-title/panel-app-title.controller.cjs +3 -1
- package/lib/util/ai-chat-util/ai-chat-util.cjs +670 -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 +25 -246
- 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 +34 -4
- package/lib/util/inline-ai-util/inline-ai-textarea/interface.cjs +3 -0
- 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,21 +117,18 @@ 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
|
+
});
|
|
129
|
+
const resourceOptions = await ibiz.aiChatUtil.getAIResourceOptions(c.context, c.params);
|
|
136
130
|
chatInstance.create({
|
|
131
|
+
resourceOptions,
|
|
137
132
|
containerOptions: {
|
|
138
133
|
zIndex: zIndex.increment(),
|
|
139
134
|
...containerOptions
|
|
@@ -148,191 +143,10 @@ const IBizCode = /* @__PURE__ */ vue.defineComponent({
|
|
|
148
143
|
srfactag: c.deACMode.codeName
|
|
149
144
|
},
|
|
150
145
|
appDataEntityId: c.model.appDataEntityId,
|
|
151
|
-
contentToolbarItems,
|
|
152
|
-
footerToolbarItems,
|
|
153
|
-
questionToolbarItems,
|
|
154
|
-
otherToolbarItems,
|
|
155
|
-
aiAgentlist,
|
|
156
146
|
...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
147
|
action: (action, message) => {
|
|
231
148
|
if (action === "backfill")
|
|
232
149
|
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
150
|
}
|
|
337
151
|
}
|
|
338
152
|
});
|
|
@@ -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');
|
|
@@ -25,6 +23,7 @@ const IBizHtml = /* @__PURE__ */ vue.defineComponent({
|
|
|
25
23
|
emit,
|
|
26
24
|
slots
|
|
27
25
|
}) {
|
|
26
|
+
var _a;
|
|
28
27
|
const ns = vue3Util.useNamespace("html");
|
|
29
28
|
const c = props.controller;
|
|
30
29
|
const htmlContent = vue.ref();
|
|
@@ -44,6 +43,7 @@ const IBizHtml = /* @__PURE__ */ vue.defineComponent({
|
|
|
44
43
|
const readonlyState = vue.ref(false);
|
|
45
44
|
const enableFullScreen = vue.ref(false);
|
|
46
45
|
const isFullScreen = vue.ref(false);
|
|
46
|
+
let enableNoAccess = false;
|
|
47
47
|
const editorModel = c.model;
|
|
48
48
|
if (editorModel.editorParams) {
|
|
49
49
|
if (editorModel.editorParams.enableEdit) {
|
|
@@ -62,6 +62,9 @@ const IBizHtml = /* @__PURE__ */ vue.defineComponent({
|
|
|
62
62
|
if (editorModel.editorParams.enablefullscreen) {
|
|
63
63
|
enableFullScreen.value = c.toBoolean(editorModel.editorParams.enablefullscreen);
|
|
64
64
|
}
|
|
65
|
+
if (editorModel.editorParams.enablenoaccess) {
|
|
66
|
+
enableNoAccess = ((_a = c == null ? void 0 : c.editorParams) == null ? void 0 : _a.enablenoaccess) === "true";
|
|
67
|
+
}
|
|
65
68
|
}
|
|
66
69
|
if (props.readonly) {
|
|
67
70
|
hasEnableEdit.value = false;
|
|
@@ -69,7 +72,8 @@ const IBizHtml = /* @__PURE__ */ vue.defineComponent({
|
|
|
69
72
|
}
|
|
70
73
|
const getDownloadUrl = (data, file) => {
|
|
71
74
|
const editorParams = {
|
|
72
|
-
...c.editorParams
|
|
75
|
+
...c.editorParams,
|
|
76
|
+
enableNoAccess
|
|
73
77
|
};
|
|
74
78
|
if (editorParams.exportparams) {
|
|
75
79
|
editorParams.exportParams = JSON.parse(editorParams.exportparams);
|
|
@@ -83,7 +87,8 @@ const IBizHtml = /* @__PURE__ */ vue.defineComponent({
|
|
|
83
87
|
vue.watch(() => props.data, (newVal) => {
|
|
84
88
|
if (newVal) {
|
|
85
89
|
const editorParams = {
|
|
86
|
-
...c.editorParams
|
|
90
|
+
...c.editorParams,
|
|
91
|
+
enableNoAccess
|
|
87
92
|
};
|
|
88
93
|
if (editorParams.uploadparams) {
|
|
89
94
|
editorParams.uploadParams = JSON.parse(editorParams.uploadparams);
|
|
@@ -142,7 +147,7 @@ const IBizHtml = /* @__PURE__ */ vue.defineComponent({
|
|
|
142
147
|
},
|
|
143
148
|
// 单个文件上传成功之后
|
|
144
149
|
onSuccess(file, res) {
|
|
145
|
-
if (ibiz.config.common.enableDownloadTicket && res.ticket) {
|
|
150
|
+
if (ibiz.config.common.enableDownloadTicket && !enableNoAccess && res.ticket) {
|
|
146
151
|
ibiz.util.file.setDownloadTicket(res.id, res.ticket);
|
|
147
152
|
}
|
|
148
153
|
console.log("".concat(file.name, " \u4E0A\u4F20\u6210\u529F"), res);
|
|
@@ -160,7 +165,7 @@ const IBizHtml = /* @__PURE__ */ vue.defineComponent({
|
|
|
160
165
|
const downloadUrl = getDownloadUrl(props.data, res);
|
|
161
166
|
let url = downloadUrl.replace("%fileId%", res.id);
|
|
162
167
|
const alt = res.filename;
|
|
163
|
-
if (ibiz.config.common.enableDownloadTicket) {
|
|
168
|
+
if (ibiz.config.common.enableDownloadTicket && !enableNoAccess) {
|
|
164
169
|
const downloadTicket = await ibiz.util.file.getDownloadTicket(c.context, c.params, props.data, {
|
|
165
170
|
fileId: res.id
|
|
166
171
|
}, c.downloadTicketParams);
|
|
@@ -201,25 +206,22 @@ const IBizHtml = /* @__PURE__ */ vue.defineComponent({
|
|
|
201
206
|
const appDataEntityId = c.model.appDataEntityId;
|
|
202
207
|
if (!appDataEntityId || !c.deACMode)
|
|
203
208
|
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
209
|
const {
|
|
216
210
|
zIndex
|
|
217
211
|
} = vue3Util.useUIStore();
|
|
218
212
|
const containerZIndex = zIndex.increment();
|
|
219
213
|
chatInstance = await ibiz.aiChatUtil.getAIChat();
|
|
220
|
-
|
|
221
|
-
|
|
214
|
+
const {
|
|
215
|
+
containerOptions,
|
|
216
|
+
chatOptions
|
|
217
|
+
} = await ibiz.aiChatUtil.getEditorExAIChatParams(c.editorParams, c.context, c.params, props.data, c.deACMode, {
|
|
218
|
+
chatInstance,
|
|
219
|
+
view: c.view,
|
|
220
|
+
ctrl: c.ctrl
|
|
221
|
+
});
|
|
222
|
+
const resourceOptions = await ibiz.aiChatUtil.getAIResourceOptions(c.context, c.params);
|
|
222
223
|
chatInstance.create({
|
|
224
|
+
resourceOptions,
|
|
223
225
|
containerOptions: {
|
|
224
226
|
zIndex: containerZIndex,
|
|
225
227
|
...containerOptions
|
|
@@ -234,85 +236,7 @@ const IBizHtml = /* @__PURE__ */ vue.defineComponent({
|
|
|
234
236
|
srfactag: c.deACMode.codeName
|
|
235
237
|
},
|
|
236
238
|
appDataEntityId,
|
|
237
|
-
contentToolbarItems,
|
|
238
|
-
footerToolbarItems,
|
|
239
|
-
questionToolbarItems,
|
|
240
|
-
otherToolbarItems,
|
|
241
|
-
aiAgentlist,
|
|
242
239
|
...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
240
|
action: (action, message) => {
|
|
317
241
|
if (action === "backfill") {
|
|
318
242
|
if (hasEnableEdit.value) {
|
|
@@ -321,109 +245,6 @@ const IBizHtml = /* @__PURE__ */ vue.defineComponent({
|
|
|
321
245
|
emit("change", message.realcontent);
|
|
322
246
|
}
|
|
323
247
|
}
|
|
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
248
|
}
|
|
428
249
|
}
|
|
429
250
|
});
|
|
@@ -436,9 +257,16 @@ const IBizHtml = /* @__PURE__ */ vue.defineComponent({
|
|
|
436
257
|
onClickAI();
|
|
437
258
|
});
|
|
438
259
|
editor.on("lineAiClick", () => {
|
|
439
|
-
const
|
|
440
|
-
|
|
260
|
+
const container = editor.getEditableContainer();
|
|
261
|
+
const hoverToolbar = container.querySelector(".w-e-hover-bar");
|
|
262
|
+
if (!hoverToolbar) {
|
|
441
263
|
return;
|
|
264
|
+
}
|
|
265
|
+
const {
|
|
266
|
+
offsetLeft,
|
|
267
|
+
offsetTop,
|
|
268
|
+
offsetHeight
|
|
269
|
+
} = hoverToolbar;
|
|
442
270
|
const items = ibiz.inLineAIUtil.calcContextMenus(c.deACMode, (tag) => {
|
|
443
271
|
c.doInLineAIUIAction(tag, c.model.appId);
|
|
444
272
|
});
|
|
@@ -451,9 +279,9 @@ const IBizHtml = /* @__PURE__ */ vue.defineComponent({
|
|
|
451
279
|
const popoverZIndex = zIndex.increment();
|
|
452
280
|
ibiz.inLineAIUtil.showContextMenus(
|
|
453
281
|
// 编辑器的左侧距离+选区距离编辑器左侧距离
|
|
454
|
-
editorBoundingClientRect.x +
|
|
282
|
+
editorBoundingClientRect.x + offsetLeft,
|
|
455
283
|
// 编辑器的上方距离+选区距离编辑器上方距离+悬浮工具栏高度
|
|
456
|
-
editorBoundingClientRect.y +
|
|
284
|
+
editorBoundingClientRect.y + offsetTop + offsetHeight,
|
|
457
285
|
items,
|
|
458
286
|
{
|
|
459
287
|
zIndex: popoverZIndex,
|
|
@@ -560,11 +388,11 @@ const IBizHtml = /* @__PURE__ */ vue.defineComponent({
|
|
|
560
388
|
});
|
|
561
389
|
};
|
|
562
390
|
const moveToLastStr = () => {
|
|
563
|
-
var
|
|
391
|
+
var _a2, _b;
|
|
564
392
|
if (props.value) {
|
|
565
393
|
const index = props.value.indexOf("</p>");
|
|
566
394
|
if (index >= 0) {
|
|
567
|
-
const offset = (
|
|
395
|
+
const offset = (_a2 = editorRef.value.selection.anchor) == null ? void 0 : _a2.offset;
|
|
568
396
|
const path = (_b = editorRef.value.selection.anchor) == null ? void 0 : _b.path;
|
|
569
397
|
if (offset === 0 && path.length > 0 && path[0] === 0) {
|
|
570
398
|
editorRef.value.move(index - 3);
|