@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 @@
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, UIActionUtil, SysUIActionTag, ConfigService } from '@ibiz-template/runtime';
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,32 @@ 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(context.srfsystemid, "_").concat(context.srfappid, "_").concat(appDataEntityId, "_").concat(appDEACModeId, "_");
225
- topicId += context[appDataEntityName] ? context[appDataEntityName] : createUUID();
226
- const caption = "[".concat(deACMode.logicName, "]").concat((data == null ? void 0 : data.srfmajortext) || "");
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 chatMode = ibiz.aiChatUtil.getAIChatMode("UIACTION", context, params);
226
+ const resourceOptions = await ibiz.aiChatUtil.getAIResourceOptions(
227
+ context,
228
+ params
229
+ );
230
230
  return new Promise((resolve) => {
231
- let id = "";
232
- let abortController;
233
231
  chatInstance.create({
234
- mode: "TOPIC",
232
+ mode: chatMode,
233
+ resourceOptions,
235
234
  containerOptions: {
236
235
  zIndex: containerZIndex,
237
236
  enableBackFill: false,
@@ -240,243 +239,23 @@ class AppUtil {
240
239
  topicOptions: {
241
240
  appid: ibiz.env.appId,
242
241
  id: topicId,
243
- caption,
242
+ caption: topicCaption,
244
243
  url: window.location.hash.substring(1),
245
244
  type: context.srftopicpath || "default",
246
- beforeDelete: async (...args) => {
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
- }
245
+ ...topicOptions
267
246
  },
268
247
  chatOptions: {
269
248
  caption: deACMode.logicName,
270
249
  context: { ...context },
271
250
  params: tempParams,
272
251
  appDataEntityId,
273
- contentToolbarItems,
274
- footerToolbarItems,
275
- questionToolbarItems,
276
- otherToolbarItems,
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
- },
252
+ sessionid,
253
+ // 扩展参数
254
+ ...chatOptions,
255
+ // 关闭回调
355
256
  closed: () => {
356
257
  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
258
+ }
480
259
  }
481
260
  });
482
261
  });
@@ -0,0 +1 @@
1
+ .ibiz-ai-think{width:100%;height:auto;font-size:var(--ibiz-font-size-small);color:var(--ibiz-inline-ai-textarea-container-color-text-1)}.ibiz-ai-think__header{display:flex;gap:var(--ibiz-spacing-extra-tight);align-items:center;margin-bottom:var(--ibiz-spacing-tight);cursor:pointer}.ibiz-ai-think__header:hover{color:var(--ibiz-inline-ai-textarea-container-color-text-hove-1)}.ibiz-ai-think__header--state-icon{display:flex;align-items:center;color:var(--ibiz-color-success)}.ibiz-ai-think__header--state-icon.is-loading{color:var(--ibiz-inline-ai-textarea-container-color-loading)}.ibiz-ai-think__header--collapse-icon{display:flex;align-items:center}.ibiz-ai-think__content{position:relative;padding-left:var(--ibiz-spacing-tight);word-wrap:break-word;white-space:pre-wrap;transition:height .3s cubic-bezier(.4,0,.2,1),opacity .3s cubic-bezier(.4,0,.2,1)}.ibiz-ai-think__content::before{position:absolute;top:0;bottom:0;left:0;width:2px;content:"";background-color:var(--ibiz-inline-ai-textarea-container-color-border)}
@@ -0,0 +1,56 @@
1
+ import { defineComponent, createVNode } from 'vue';
2
+ import { useNamespace } from '@ibiz-template/vue3-util';
3
+ import { LoadingIcon, ThinkSuccessIcon, DownIcon, UpIcon } from '../../icon.mjs';
4
+ import './ai-think.css';
5
+
6
+ "use strict";
7
+ const AIThink = /* @__PURE__ */ defineComponent({
8
+ props: {
9
+ think: {
10
+ type: String
11
+ },
12
+ isLoading: {
13
+ type: Boolean,
14
+ required: true
15
+ },
16
+ isCollapse: {
17
+ type: Boolean,
18
+ required: true
19
+ }
20
+ },
21
+ emits: {
22
+ collapseChange: (_value) => true
23
+ },
24
+ setup(props, {
25
+ emit
26
+ }) {
27
+ const ns = useNamespace("ai-think");
28
+ const onCollapseChange = () => {
29
+ emit("collapseChange", !props.isCollapse);
30
+ };
31
+ return {
32
+ ns,
33
+ onCollapseChange
34
+ };
35
+ },
36
+ render() {
37
+ if (!this.think)
38
+ return;
39
+ return createVNode("div", {
40
+ "class": this.ns.b()
41
+ }, [createVNode("div", {
42
+ "class": this.ns.e("header"),
43
+ "onClick": this.onCollapseChange
44
+ }, [createVNode("div", {
45
+ "class": [this.ns.em("header", "state-icon"), this.ns.is("loading", this.isLoading)]
46
+ }, [this.isLoading ? LoadingIcon : ThinkSuccessIcon]), createVNode("div", {
47
+ "class": this.ns.em("header", "title")
48
+ }, [this.isLoading ? ibiz.i18n.t("util.inlineAiUtil.thinking") : ibiz.i18n.t("util.inlineAiUtil.thinked")]), createVNode("div", {
49
+ "class": this.ns.em("header", "collapse-icon")
50
+ }, [this.isCollapse ? DownIcon : UpIcon])]), !this.isCollapse && createVNode("div", {
51
+ "class": this.ns.e("content")
52
+ }, [this.think])]);
53
+ }
54
+ });
55
+
56
+ export { AIThink };
@@ -0,0 +1 @@
1
+ .ibiz-ai-tool-call{color:var(--ibiz-inline-ai-textarea-container-color-text-0)}.ibiz-ai-tool-call__toggle{display:block;padding:var(--ibiz-spacing-tight) 0;margin-top:var(--ibiz-spacing-tight);text-align:center;cursor:pointer;background-color:var(--ibiz-inline-ai-textarea-container-color-bg-1);border-radius:var(--ibiz-border-radius-small)}.ibiz-ai-tool-call__toggle:hover{background-color:var(--ibiz-inline-ai-textarea-container-color-bg-hover-1)}
@@ -0,0 +1,52 @@
1
+ import { defineComponent, createVNode, ref, computed } from 'vue';
2
+ import { useNamespace } from '@ibiz-template/vue3-util';
3
+ import { AIToolCallItem } from '../ai-tool-call-item/ai-tool-call-item.mjs';
4
+ import './ai-tool-call.css';
5
+
6
+ "use strict";
7
+ const AIToolCall = /* @__PURE__ */ defineComponent({
8
+ props: {
9
+ toolCalls: {
10
+ type: Object,
11
+ required: true
12
+ }
13
+ },
14
+ setup(props) {
15
+ const ns = useNamespace("ai-tool-call");
16
+ const isExpanded = ref(false);
17
+ const showToggle = computed(() => {
18
+ return props.toolCalls.length > 4;
19
+ });
20
+ const items = computed(() => {
21
+ return showToggle.value && !isExpanded.value ? props.toolCalls.slice(0, 4) : props.toolCalls;
22
+ });
23
+ const handleToggle = () => {
24
+ isExpanded.value = !isExpanded.value;
25
+ };
26
+ return {
27
+ ns,
28
+ items,
29
+ showToggle,
30
+ isExpanded,
31
+ handleToggle
32
+ };
33
+ },
34
+ render() {
35
+ if (!this.toolCalls.length)
36
+ return;
37
+ return createVNode("div", {
38
+ "class": this.ns.b()
39
+ }, [this.items.map((item) => {
40
+ return createVNode(AIToolCallItem, {
41
+ "toolCall": item
42
+ }, null);
43
+ }), this.showToggle && createVNode("div", {
44
+ "class": this.ns.e("toggle"),
45
+ "onClick": this.handleToggle
46
+ }, [this.isExpanded ? ibiz.i18n.t("util.inlineAiUtil.collapseToolCall") : ibiz.i18n.t("util.inlineAiUtil.expandToolCall", {
47
+ number: this.toolCalls.length
48
+ })])]);
49
+ }
50
+ });
51
+
52
+ export { AIToolCall };
@@ -0,0 +1 @@
1
+ .ibiz-ai-tool-call-item{--ibiz-ai-tool-call-item-bg-primary:#1e1e1e;--ibiz-ai-tool-call-item-bg-secondary:#2d2d2d;--ibiz-ai-tool-call-item-bg-tertiary:#3c3c3c;--ibiz-ai-tool-call-item-text-primary:#d4d4d4;--ibiz-ai-tool-call-item-text-secondary:#9cdcfe;--ibiz-ai-tool-call-item-text-error:#f44747;--ibiz-ai-tool-call-item-text-string:#ce9178;--ibiz-ai-tool-call-item-text-boolean:#569cd6;--ibiz-ai-tool-call-item-text-property:#9cdcfe;--ibiz-ai-tool-call-item-text-number:#b5cea8;--ibiz-ai-tool-call-item-accent-primary:#0e639c;--ibiz-ai-tool-call-item-accent-error:rgba(244, 71, 71, 0.2);--ibiz-ai-tool-call-item-color-bg:var(--ibiz-inline-ai-textarea-container-color-bg-1);--ibiz-ai-tool-call-item-color-border:var(--ibiz-inline-ai-textarea-container-color-border);margin-bottom:var(--ibiz-spacing-tight);background-color:var(--ibiz-ai-tool-call-item-color-bg);border:1px solid var(--ibiz-ai-tool-call-item-color-border);border-radius:var(--ibiz-border-radius-small)}.ibiz-ai-tool-call-item__header{display:flex;gap:var(--ibiz-spacing-tight);align-items:center;justify-content:space-between;width:100%;padding:var(--ibiz-spacing-tight)}.ibiz-ai-tool-call-item__header-left{display:flex;gap:var(--ibiz-spacing-tight);align-items:center}.ibiz-ai-tool-call-item__header-left--caption{flex-shrink:0}.ibiz-ai-tool-call-item__header-left--desc{flex-grow:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.ibiz-ai-tool-call-item__header-right{display:flex;flex-shrink:0;gap:var(--ibiz-spacing-tight);align-items:center}.ibiz-ai-tool-call-item__header-right--icon{display:flex;align-items:center;cursor:pointer}.ibiz-ai-tool-call-item__header-right--error-text{color:var(--ibiz-color-danger)}.ibiz-ai-tool-call-item__content{padding:var(--ibiz-spacing-tight) 0}.ibiz-ai-tool-call-item__code-line{display:flex;min-height:18px;margin-bottom:var(--ibiz-spacing-base-tight);font-family:Consolas,monospace;font-size:.95rem}.ibiz-ai-tool-call-item__code-line--line-number{min-width:20px;margin-right:15px;color:var(--ibiz-color-success);text-align:right;-webkit-user-select:none;-moz-user-select:none;user-select:none}.ibiz-ai-tool-call-item__property{color:var(--ibiz-ai-tool-call-item-text-property)}.ibiz-ai-tool-call-item__string{overflow:hidden;color:var(--ibiz-ai-tool-call-item-text-string);text-overflow:ellipsis;white-space:nowrap}.ibiz-ai-tool-call-item__boolean{color:var(--ibiz-ai-tool-call-item-text-boolean)}.ibiz-ai-tool-call-item__number{color:var(--ibiz-ai-tool-call-item-text-number)}.ibiz-ai-tool-call-item__null{color:var(--ibiz-ai-tool-call-item-text-boolean)}.ibiz-ai-tool-call-item__error{color:var(--ibiz-ai-tool-call-item-text-error)}