@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.
Files changed (82) hide show
  1. package/dist/ibiz-markdown-editor-CUzKkFER.js +1 -0
  2. package/dist/{index-CaWTEUU1.js → index-DgqTP4Vw.js} +1 -1
  3. package/dist/{index-CD2XM6M6.js → index-Dr0VM8iS.js} +1 -1
  4. package/dist/index-DtEaU3-5.js +11 -0
  5. package/dist/index.min.css +1 -1
  6. package/dist/index.system.min.js +1 -1
  7. package/dist/wang-editor-CRWSwyXY.js +1 -0
  8. package/dist/{xlsx-util-B1eGfH7d.js → xlsx-util-CMJON8Uq.js} +1 -1
  9. package/es/control/grid/grid-column/grid-field-column/attachment-column/attachment-column.mjs +2 -1
  10. package/es/control/grid/grid-column/grid-field-column/attachment-column/file-util.mjs +22 -11
  11. package/es/control/toolbar/export-excel/export-excel.mjs +19 -4
  12. package/es/editor/carousel/ibiz-carousel/ibiz-carousel.mjs +5 -2
  13. package/es/editor/code/monaco-editor/monaco-editor.mjs +8 -194
  14. package/es/editor/html/wang-editor/module/ai-module.mjs +1 -1
  15. package/es/editor/html/wang-editor/wang-editor.mjs +35 -207
  16. package/es/editor/markdown/ibiz-markdown-editor/custom-menu.mjs +11 -222
  17. package/es/editor/markdown/ibiz-markdown-editor/ibiz-markdown-editor.css +1 -1
  18. package/es/editor/markdown/ibiz-markdown-editor/ibiz-markdown-editor.mjs +23 -12
  19. package/es/editor/text-box/input/input.mjs +11 -197
  20. package/es/editor/text-box/signature/signature.mjs +28 -15
  21. package/es/editor/upload/upload-editor.controller.mjs +12 -1
  22. package/es/editor/upload/use/use-iview-upload.mjs +28 -13
  23. package/es/locale/en/index.mjs +29 -2
  24. package/es/locale/zh-CN/index.mjs +29 -2
  25. package/es/panel-component/coop-pos/coop-pos.controller.mjs +11 -1
  26. package/es/panel-component/panel-app-title/panel-app-title.controller.mjs +3 -1
  27. package/es/panel-component/panel-app-title/panel-app-title.mjs +22 -43
  28. package/es/util/ai-chat-util/ai-chat-util.mjs +672 -7
  29. package/es/util/ai-chat-util/ai-feedback/ai-feedback.css +1 -0
  30. package/es/util/ai-chat-util/ai-feedback/ai-feedback.mjs +130 -0
  31. package/es/util/app-util/app-util.mjs +26 -247
  32. package/es/util/inline-ai-util/inline-ai-textarea/common/ai-think/ai-think.css +1 -0
  33. package/es/util/inline-ai-util/inline-ai-textarea/common/ai-think/ai-think.mjs +56 -0
  34. package/es/util/inline-ai-util/inline-ai-textarea/common/ai-tool-call/ai-tool-call.css +1 -0
  35. package/es/util/inline-ai-util/inline-ai-textarea/common/ai-tool-call/ai-tool-call.mjs +52 -0
  36. package/es/util/inline-ai-util/inline-ai-textarea/common/ai-tool-call-item/ai-tool-call-item.css +1 -0
  37. package/es/util/inline-ai-util/inline-ai-textarea/common/ai-tool-call-item/ai-tool-call-item.mjs +143 -0
  38. package/es/util/inline-ai-util/inline-ai-textarea/common/index.mjs +4 -0
  39. package/es/util/inline-ai-util/inline-ai-textarea/icon.mjs +52 -1
  40. package/es/util/inline-ai-util/inline-ai-textarea/inline-ai-textarea.css +1 -1
  41. package/es/util/inline-ai-util/inline-ai-textarea/inline-ai-textarea.hook.mjs +34 -4
  42. package/es/util/inline-ai-util/inline-ai-textarea/inline-ai-textarea.mjs +32 -25
  43. package/es/util/inline-ai-util/inline-ai-textarea/interface.mjs +1 -0
  44. package/lib/control/grid/grid-column/grid-field-column/attachment-column/attachment-column.cjs +2 -1
  45. package/lib/control/grid/grid-column/grid-field-column/attachment-column/file-util.cjs +22 -11
  46. package/lib/control/toolbar/export-excel/export-excel.cjs +18 -3
  47. package/lib/editor/carousel/ibiz-carousel/ibiz-carousel.cjs +5 -2
  48. package/lib/editor/code/monaco-editor/monaco-editor.cjs +8 -194
  49. package/lib/editor/html/wang-editor/module/ai-module.cjs +1 -1
  50. package/lib/editor/html/wang-editor/wang-editor.cjs +34 -206
  51. package/lib/editor/markdown/ibiz-markdown-editor/custom-menu.cjs +11 -222
  52. package/lib/editor/markdown/ibiz-markdown-editor/ibiz-markdown-editor.cjs +23 -12
  53. package/lib/editor/markdown/ibiz-markdown-editor/ibiz-markdown-editor.css +1 -1
  54. package/lib/editor/text-box/input/input.cjs +10 -196
  55. package/lib/editor/text-box/signature/signature.cjs +28 -15
  56. package/lib/editor/upload/upload-editor.controller.cjs +12 -1
  57. package/lib/editor/upload/use/use-iview-upload.cjs +28 -13
  58. package/lib/locale/en/index.cjs +29 -2
  59. package/lib/locale/zh-CN/index.cjs +29 -2
  60. package/lib/panel-component/coop-pos/coop-pos.controller.cjs +11 -1
  61. package/lib/panel-component/panel-app-title/panel-app-title.cjs +21 -42
  62. package/lib/panel-component/panel-app-title/panel-app-title.controller.cjs +3 -1
  63. package/lib/util/ai-chat-util/ai-chat-util.cjs +670 -5
  64. package/lib/util/ai-chat-util/ai-feedback/ai-feedback.cjs +132 -0
  65. package/lib/util/ai-chat-util/ai-feedback/ai-feedback.css +1 -0
  66. package/lib/util/app-util/app-util.cjs +25 -246
  67. package/lib/util/inline-ai-util/inline-ai-textarea/common/ai-think/ai-think.cjs +58 -0
  68. package/lib/util/inline-ai-util/inline-ai-textarea/common/ai-think/ai-think.css +1 -0
  69. package/lib/util/inline-ai-util/inline-ai-textarea/common/ai-tool-call/ai-tool-call.cjs +54 -0
  70. package/lib/util/inline-ai-util/inline-ai-textarea/common/ai-tool-call/ai-tool-call.css +1 -0
  71. package/lib/util/inline-ai-util/inline-ai-textarea/common/ai-tool-call-item/ai-tool-call-item.cjs +145 -0
  72. package/lib/util/inline-ai-util/inline-ai-textarea/common/ai-tool-call-item/ai-tool-call-item.css +1 -0
  73. package/lib/util/inline-ai-util/inline-ai-textarea/common/index.cjs +9 -0
  74. package/lib/util/inline-ai-util/inline-ai-textarea/icon.cjs +54 -0
  75. package/lib/util/inline-ai-util/inline-ai-textarea/inline-ai-textarea.cjs +31 -24
  76. package/lib/util/inline-ai-util/inline-ai-textarea/inline-ai-textarea.css +1 -1
  77. package/lib/util/inline-ai-util/inline-ai-textarea/inline-ai-textarea.hook.cjs +34 -4
  78. package/lib/util/inline-ai-util/inline-ai-textarea/interface.cjs +3 -0
  79. package/package.json +7 -7
  80. package/dist/ibiz-markdown-editor-pEdb_gS_.js +0 -1
  81. package/dist/index-BObZTN7-.js +0 -11
  82. package/dist/wang-editor-Ck-JCWqK.js +0 -1
@@ -0,0 +1,132 @@
1
+ 'use strict';
2
+
3
+ var vue = require('vue');
4
+ var vue3Util = require('@ibiz-template/vue3-util');
5
+ require('./ai-feedback.css');
6
+
7
+ "use strict";
8
+ function _isSlot(s) {
9
+ return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !vue.isVNode(s);
10
+ }
11
+ const AIFeedback = /* @__PURE__ */ vue.defineComponent({
12
+ name: "IBizAIFeedback",
13
+ props: {
14
+ content: {
15
+ type: String
16
+ },
17
+ modal: {
18
+ type: Object,
19
+ required: true
20
+ }
21
+ },
22
+ setup(props) {
23
+ const ns = vue3Util.useNamespace("ai-feedback");
24
+ const feedback = vue.reactive({
25
+ description: "",
26
+ feedbackItems: []
27
+ });
28
+ const FEEDBACK_CATEGORIES = [{
29
+ title: ibiz.i18n.t("util.aiChartUtil.regardingIssue"),
30
+ children: [ibiz.i18n.t("util.aiChartUtil.understandProblem"), ibiz.i18n.t("util.aiChartUtil.forgotContext"), ibiz.i18n.t("util.aiChartUtil.notFollowingRequire")]
31
+ }, {
32
+ title: ibiz.i18n.t("util.aiChartUtil.regardingResponse"),
33
+ 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")]
34
+ }, {
35
+ title: ibiz.i18n.t("util.aiChartUtil.report"),
36
+ 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")]
37
+ }];
38
+ const onInitFeedback = () => {
39
+ feedback.feedbackItems = FEEDBACK_CATEGORIES.map((category) => ({
40
+ title: category.title,
41
+ value: void 0,
42
+ children: [...category.children]
43
+ }));
44
+ if (props.content) {
45
+ const contentArray = props.content.split(";").filter((item) => item.trim());
46
+ if (contentArray.length > 0) {
47
+ const feedbackValues = contentArray.slice(0, FEEDBACK_CATEGORIES.length);
48
+ feedbackValues.forEach((value, index) => {
49
+ feedback.feedbackItems[index].value = value;
50
+ });
51
+ const descriptionParts = contentArray.slice(FEEDBACK_CATEGORIES.length);
52
+ feedback.description = descriptionParts.join(";");
53
+ }
54
+ }
55
+ };
56
+ const onCancel = () => {
57
+ props.modal.dismiss();
58
+ };
59
+ const onConfirm = () => {
60
+ const contentArray = feedback.feedbackItems.map((item) => item.value || "").filter((item) => !!item);
61
+ contentArray.push(feedback.description);
62
+ props.modal.dismiss({
63
+ ok: true,
64
+ data: [{
65
+ feedbackContent: contentArray.join(";")
66
+ }]
67
+ });
68
+ };
69
+ vue.onMounted(() => {
70
+ onInitFeedback();
71
+ });
72
+ return {
73
+ ns,
74
+ feedback,
75
+ onCancel,
76
+ onConfirm
77
+ };
78
+ },
79
+ render() {
80
+ let _slot2, _slot3;
81
+ return vue.createVNode("div", {
82
+ "class": this.ns.b()
83
+ }, [vue.createVNode("div", {
84
+ "class": this.ns.e("header")
85
+ }, [ibiz.i18n.t("util.aiChartUtil.feedback")]), vue.createVNode("div", {
86
+ "class": this.ns.e("content")
87
+ }, [this.feedback.feedbackItems.map((item) => {
88
+ let _slot;
89
+ return vue.createVNode("div", {
90
+ "class": this.ns.e("group")
91
+ }, [vue.createVNode("div", {
92
+ "class": this.ns.em("group", "title")
93
+ }, [item.title]), vue.createVNode(vue.resolveComponent("el-radio-group"), {
94
+ "modelValue": item.value,
95
+ "onUpdate:modelValue": ($event) => item.value = $event,
96
+ "class": this.ns.em("group", "content")
97
+ }, _isSlot(_slot = item.children.map((child, index) => {
98
+ return vue.createVNode(vue.resolveComponent("el-radio"), {
99
+ "key": index,
100
+ "label": child
101
+ }, _isSlot(child) ? child : {
102
+ default: () => [child]
103
+ });
104
+ })) ? _slot : {
105
+ default: () => [_slot]
106
+ })]);
107
+ }), vue.createVNode("div", {
108
+ "class": this.ns.e("description")
109
+ }, [vue.createVNode("div", {
110
+ "class": this.ns.em("description", "title")
111
+ }, [ibiz.i18n.t("util.aiChartUtil.description")]), vue.createVNode(vue.resolveComponent("el-input"), {
112
+ "rows": 3,
113
+ "type": "textarea",
114
+ "modelValue": this.feedback.description,
115
+ "onUpdate:modelValue": ($event) => this.feedback.description = $event,
116
+ "placeholder": ibiz.i18n.t("util.aiChartUtil.placeholder")
117
+ }, null)])]), vue.createVNode("div", {
118
+ "class": this.ns.e("footer")
119
+ }, [vue.createVNode(vue.resolveComponent("el-button"), {
120
+ "onClick": this.onCancel
121
+ }, _isSlot(_slot2 = ibiz.i18n.t("app.cancel")) ? _slot2 : {
122
+ default: () => [_slot2]
123
+ }), vue.createVNode(vue.resolveComponent("el-button"), {
124
+ "type": "primary",
125
+ "onClick": this.onConfirm
126
+ }, _isSlot(_slot3 = ibiz.i18n.t("app.confirm")) ? _slot3 : {
127
+ default: () => [_slot3]
128
+ })])]);
129
+ }
130
+ });
131
+
132
+ exports.AIFeedback = AIFeedback;
@@ -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)}
@@ -1,8 +1,6 @@
1
1
  'use strict';
2
2
 
3
3
  var runtime = require('@ibiz-template/runtime');
4
- var qxUtil = require('qx-util');
5
- var core = require('@ibiz-template/core');
6
4
  var vue3Util = require('@ibiz-template/vue3-util');
7
5
 
8
6
  "use strict";
@@ -202,11 +200,6 @@ class AppUtil {
202
200
  appDEACModeId,
203
201
  appDataEntityId
204
202
  } = chartParams;
205
- const { containerOptions, chatOptions } = ibiz.aiChatUtil.getUIActionExAIChatParams(context, params, data);
206
- const aiAgentlist = await ibiz.aiChatUtil.getAIAgentList(
207
- context,
208
- params
209
- );
210
203
  const deACMode = await runtime.getDeACMode(
211
204
  appDEACModeId,
212
205
  appDataEntityId,
@@ -214,26 +207,32 @@ class AppUtil {
214
207
  );
215
208
  if (!deACMode)
216
209
  return Promise.resolve([]);
217
- const {
218
- contentToolbarItems,
219
- footerToolbarItems,
220
- questionToolbarItems,
221
- otherToolbarItems
222
- } = ibiz.aiChatUtil.calcAiToolbarItemsByAc(deACMode);
223
210
  const chatInstance = await ibiz.aiChatUtil.getAIChat();
224
211
  const messages = [];
225
212
  const appDataEntityName = runtime.calcDeCodeNameById(appDataEntityId);
226
- let topicId = "".concat(context.srfsystemid, "_").concat(context.srfappid, "_").concat(appDataEntityId, "_").concat(appDEACModeId, "_");
227
- topicId += context[appDataEntityName] ? context[appDataEntityName] : qxUtil.createUUID();
228
- const caption = "[".concat(deACMode.logicName, "]").concat((data == null ? void 0 : data.srfmajortext) || "");
213
+ let topicId = "".concat(appDataEntityId, "@").concat(appDEACModeId, "@");
214
+ topicId += context[appDataEntityName] ? context[appDataEntityName] : "default";
215
+ const sessionid = ibiz.aiChatUtil.getChatSessionId("TOPIC", topicId);
216
+ const topicCaption = "[".concat(deACMode.logicName, "]").concat((data == null ? void 0 : data.srfmajortext) || "");
229
217
  const tempParams = { ...params, ...{ srfactag: deACMode.codeName } };
230
218
  const { zIndex } = vue3Util.useUIStore();
231
219
  const containerZIndex = zIndex.increment();
220
+ const { containerOptions, topicOptions, chatOptions } = await ibiz.aiChatUtil.getUIActionExAIChatParams(
221
+ context,
222
+ params,
223
+ data,
224
+ deACMode,
225
+ { chatInstance, view, ctrl }
226
+ );
227
+ const chatMode = ibiz.aiChatUtil.getAIChatMode("UIACTION", context, params);
228
+ const resourceOptions = await ibiz.aiChatUtil.getAIResourceOptions(
229
+ context,
230
+ params
231
+ );
232
232
  return new Promise((resolve) => {
233
- let id = "";
234
- let abortController;
235
233
  chatInstance.create({
236
- mode: "TOPIC",
234
+ mode: chatMode,
235
+ resourceOptions,
237
236
  containerOptions: {
238
237
  zIndex: containerZIndex,
239
238
  enableBackFill: false,
@@ -242,243 +241,23 @@ class AppUtil {
242
241
  topicOptions: {
243
242
  appid: ibiz.env.appId,
244
243
  id: topicId,
245
- caption,
244
+ caption: topicCaption,
246
245
  url: window.location.hash.substring(1),
247
246
  type: context.srftopicpath || "default",
248
- beforeDelete: async (...args) => {
249
- const isBatchRemove = args[4];
250
- const result = await ibiz.confirm.warning({
251
- title: ibiz.i18n.t(
252
- "util.appUtil.".concat(isBatchRemove ? "clearTopic" : "aiTitle")
253
- ),
254
- desc: ibiz.i18n.t(
255
- "util.appUtil.".concat(isBatchRemove ? "clearTopicDesc" : "aiDesc")
256
- )
257
- });
258
- return result;
259
- },
260
- action: async (action, context2, params2, data2, event) => {
261
- if (action === "LINK") {
262
- await ibiz.openView.push(data2.url);
263
- }
264
- return true;
265
- },
266
- configService: (appid, storageType, subType) => {
267
- return new runtime.ConfigService(appid, storageType, subType);
268
- }
247
+ ...topicOptions
269
248
  },
270
249
  chatOptions: {
271
250
  caption: deACMode.logicName,
272
251
  context: { ...context },
273
252
  params: tempParams,
274
253
  appDataEntityId,
275
- contentToolbarItems,
276
- footerToolbarItems,
277
- questionToolbarItems,
278
- otherToolbarItems,
279
- aiAgentlist,
280
- question: async (aiChat, ctx, param, other, arr, sessionid, srfaiagent, srfmode) => {
281
- id = qxUtil.createUUID();
282
- abortController = new AbortController();
283
- const deService = await ibiz.hub.getApp(ctx.srfappid).deService.getService(ctx, other.appDataEntityId);
284
- try {
285
- const questionRequestData = {
286
- messages: arr,
287
- sessionid
288
- };
289
- if (srfaiagent) {
290
- questionRequestData.srfaiagent = srfaiagent;
291
- }
292
- if (srfmode) {
293
- questionRequestData.mode = srfmode;
294
- }
295
- await deService.aiChatSse(
296
- (msg) => {
297
- if (msg.actionstate === 20 && msg.actionresult) {
298
- aiChat.addMessage({
299
- messageid: id,
300
- state: msg.actionstate,
301
- type: "DEFAULT",
302
- role: "ASSISTANT",
303
- content: msg.actionresult
304
- });
305
- } else if (msg.actionstate === 30 && msg.actionresult) {
306
- const result = JSON.parse(msg.actionresult);
307
- const choices = result.choices;
308
- if (choices && choices.length > 0) {
309
- aiChat.replaceMessage({
310
- messageid: id,
311
- state: msg.actionstate,
312
- type: "DEFAULT",
313
- role: "ASSISTANT",
314
- content: choices[0].content || ""
315
- });
316
- }
317
- } else if (msg.actionstate === 40) {
318
- aiChat.replaceMessage({
319
- messageid: id,
320
- state: msg.actionstate,
321
- type: "ERROR",
322
- role: "ASSISTANT",
323
- content: msg.actionresult
324
- });
325
- }
326
- },
327
- abortController,
328
- ctx,
329
- param,
330
- { ...questionRequestData }
331
- );
332
- } catch (error) {
333
- aiChat.replaceMessage({
334
- messageid: id,
335
- state: 40,
336
- type: "ERROR",
337
- role: "ASSISTANT",
338
- content: error.message || ibiz.i18n.t("app.aiError")
339
- });
340
- abortController == null ? void 0 : abortController.abort();
341
- } finally {
342
- aiChat.completeMessage(id, true);
343
- return true;
344
- }
345
- },
346
- abortQuestion: async (aiChat) => {
347
- abortController == null ? void 0 : abortController.abort();
348
- await aiChat.stopMessage({
349
- messageid: id,
350
- state: 30,
351
- type: "DEFAULT",
352
- role: "ASSISTANT",
353
- content: ""
354
- });
355
- await aiChat.completeMessage(id, true);
356
- },
254
+ sessionid,
255
+ // 扩展参数
256
+ ...chatOptions,
257
+ // 关闭回调
357
258
  closed: () => {
358
259
  resolve(messages);
359
- },
360
- history: async (ctx, param, other) => {
361
- const deService = await ibiz.hub.getApp(ctx.srfappid).deService.getService(ctx, other.appDataEntityId);
362
- const historyRequestData = {};
363
- if (other.appendCurData) {
364
- Object.assign(historyRequestData, {
365
- ...other.appendCurData
366
- });
367
- }
368
- if (other.srfaiagent) {
369
- Object.assign(historyRequestData, {
370
- srfaiagent: other.srfaiagent
371
- });
372
- }
373
- if (other.srfmode) {
374
- Object.assign(historyRequestData, {
375
- mode: other.srfmode
376
- });
377
- }
378
- const result = await deService.aiChatHistory(
379
- ctx,
380
- param,
381
- historyRequestData
382
- );
383
- if (result.data && Array.isArray(result.data)) {
384
- let preMsg;
385
- result.data.forEach((item) => {
386
- if (item.role === "TOOL") {
387
- if (preMsg && item.content) {
388
- chatInstance.aiChat.updateRecommendPrompt(
389
- preMsg,
390
- item.content
391
- );
392
- }
393
- } else {
394
- const msg = {
395
- messageid: qxUtil.createUUID(),
396
- state: 30,
397
- type: "DEFAULT",
398
- role: item.role,
399
- content: item.content,
400
- completed: true
401
- };
402
- preMsg = msg;
403
- chatInstance.aiChat.addMessage(msg);
404
- }
405
- });
406
- }
407
- return true;
408
- },
409
- recommendPrompt: async (ctx, param, other) => {
410
- const deService = await ibiz.hub.getApp(ctx.srfappid).deService.getService(ctx, other.appDataEntityId);
411
- const result = await deService.aiChatRecommendPrompt(
412
- ctx,
413
- param,
414
- other.message
415
- );
416
- if (result.ok && result.data) {
417
- const choices = result.data.choices;
418
- if (choices && choices.length > 0) {
419
- return choices[0];
420
- }
421
- return null;
422
- }
423
- return null;
424
- },
425
- uploader: {
426
- onUpload: async (file, reportProgress, options) => {
427
- const { uploadUrl } = ibiz.util.file.calcFileUpDownUrl(
428
- (options == null ? void 0 : options.context) || context,
429
- (options == null ? void 0 : options.params) || params,
430
- {}
431
- );
432
- const headers = ibiz.util.file.getUploadHeaders();
433
- const formData = new FormData();
434
- formData.append("file", file);
435
- const res = await ibiz.net.axios({
436
- url: uploadUrl,
437
- method: "post",
438
- headers,
439
- data: formData,
440
- onUploadProgress: (progressEvent) => {
441
- const percent = progressEvent.loaded / progressEvent.total * 100;
442
- reportProgress(percent);
443
- }
444
- });
445
- return res.data;
446
- }
447
- },
448
- extendToolbarClick: async (event, source, context2, params2, data2) => {
449
- var _a, _b;
450
- const result = await runtime.UIActionUtil.exec(
451
- source.id,
452
- {
453
- view,
454
- ctrl,
455
- context: core.IBizContext.create(context2),
456
- params: params2,
457
- data: [data2],
458
- event
459
- },
460
- source.appId
461
- );
462
- if (result.closeView) {
463
- view.closeView({ ok: true });
464
- } else if (result.refresh) {
465
- switch (result.refreshMode) {
466
- case 1:
467
- view.callUIAction(runtime.SysUIActionTag.REFRESH);
468
- break;
469
- case 2:
470
- (_a = view.parentView) == null ? void 0 : _a.callUIAction(runtime.SysUIActionTag.REFRESH);
471
- break;
472
- case 3:
473
- (_b = view.getTopView()) == null ? void 0 : _b.callUIAction(runtime.SysUIActionTag.REFRESH);
474
- break;
475
- default:
476
- }
477
- }
478
- return result;
479
- },
480
- // 扩展参数
481
- ...chatOptions
260
+ }
482
261
  }
483
262
  });
484
263
  });
@@ -0,0 +1,58 @@
1
+ 'use strict';
2
+
3
+ var vue = require('vue');
4
+ var vue3Util = require('@ibiz-template/vue3-util');
5
+ var icon = require('../../icon.cjs');
6
+ require('./ai-think.css');
7
+
8
+ "use strict";
9
+ const AIThink = /* @__PURE__ */ vue.defineComponent({
10
+ props: {
11
+ think: {
12
+ type: String
13
+ },
14
+ isLoading: {
15
+ type: Boolean,
16
+ required: true
17
+ },
18
+ isCollapse: {
19
+ type: Boolean,
20
+ required: true
21
+ }
22
+ },
23
+ emits: {
24
+ collapseChange: (_value) => true
25
+ },
26
+ setup(props, {
27
+ emit
28
+ }) {
29
+ const ns = vue3Util.useNamespace("ai-think");
30
+ const onCollapseChange = () => {
31
+ emit("collapseChange", !props.isCollapse);
32
+ };
33
+ return {
34
+ ns,
35
+ onCollapseChange
36
+ };
37
+ },
38
+ render() {
39
+ if (!this.think)
40
+ return;
41
+ return vue.createVNode("div", {
42
+ "class": this.ns.b()
43
+ }, [vue.createVNode("div", {
44
+ "class": this.ns.e("header"),
45
+ "onClick": this.onCollapseChange
46
+ }, [vue.createVNode("div", {
47
+ "class": [this.ns.em("header", "state-icon"), this.ns.is("loading", this.isLoading)]
48
+ }, [this.isLoading ? icon.LoadingIcon : icon.ThinkSuccessIcon]), vue.createVNode("div", {
49
+ "class": this.ns.em("header", "title")
50
+ }, [this.isLoading ? ibiz.i18n.t("util.inlineAiUtil.thinking") : ibiz.i18n.t("util.inlineAiUtil.thinked")]), vue.createVNode("div", {
51
+ "class": this.ns.em("header", "collapse-icon")
52
+ }, [this.isCollapse ? icon.DownIcon : icon.UpIcon])]), !this.isCollapse && vue.createVNode("div", {
53
+ "class": this.ns.e("content")
54
+ }, [this.think])]);
55
+ }
56
+ });
57
+
58
+ exports.AIThink = AIThink;
@@ -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,54 @@
1
+ 'use strict';
2
+
3
+ var vue = require('vue');
4
+ var vue3Util = require('@ibiz-template/vue3-util');
5
+ var aiToolCallItem = require('../ai-tool-call-item/ai-tool-call-item.cjs');
6
+ require('./ai-tool-call.css');
7
+
8
+ "use strict";
9
+ const AIToolCall = /* @__PURE__ */ vue.defineComponent({
10
+ props: {
11
+ toolCalls: {
12
+ type: Object,
13
+ required: true
14
+ }
15
+ },
16
+ setup(props) {
17
+ const ns = vue3Util.useNamespace("ai-tool-call");
18
+ const isExpanded = vue.ref(false);
19
+ const showToggle = vue.computed(() => {
20
+ return props.toolCalls.length > 4;
21
+ });
22
+ const items = vue.computed(() => {
23
+ return showToggle.value && !isExpanded.value ? props.toolCalls.slice(0, 4) : props.toolCalls;
24
+ });
25
+ const handleToggle = () => {
26
+ isExpanded.value = !isExpanded.value;
27
+ };
28
+ return {
29
+ ns,
30
+ items,
31
+ showToggle,
32
+ isExpanded,
33
+ handleToggle
34
+ };
35
+ },
36
+ render() {
37
+ if (!this.toolCalls.length)
38
+ return;
39
+ return vue.createVNode("div", {
40
+ "class": this.ns.b()
41
+ }, [this.items.map((item) => {
42
+ return vue.createVNode(aiToolCallItem.AIToolCallItem, {
43
+ "toolCall": item
44
+ }, null);
45
+ }), this.showToggle && vue.createVNode("div", {
46
+ "class": this.ns.e("toggle"),
47
+ "onClick": this.handleToggle
48
+ }, [this.isExpanded ? ibiz.i18n.t("util.inlineAiUtil.collapseToolCall") : ibiz.i18n.t("util.inlineAiUtil.expandToolCall", {
49
+ number: this.toolCalls.length
50
+ })])]);
51
+ }
52
+ });
53
+
54
+ exports.AIToolCall = AIToolCall;
@@ -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)}