@ibiz-template/mob-vue3-components 0.7.41-alpha.21 → 0.7.41-alpha.22

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 (181) hide show
  1. package/dist/ibiz-markdown-editor-COU_MxNu.js +2 -0
  2. package/dist/ibiz-markdown-editor-COU_MxNu.js.map +1 -0
  3. package/dist/index-Bn7VkqJp.js +76 -0
  4. package/dist/index-Bn7VkqJp.js.map +1 -0
  5. package/dist/{index-BkzKmBm3.js → index-ChdHGLJI.js} +2 -2
  6. package/dist/{index-BkzKmBm3.js.map → index-ChdHGLJI.js.map} +1 -1
  7. package/dist/index-Dd7yiMzY.js +2 -0
  8. package/dist/index-Dd7yiMzY.js.map +1 -0
  9. package/dist/index.es-D0mZvSDS.js +14 -0
  10. package/dist/index.es-D0mZvSDS.js.map +1 -0
  11. package/dist/index.min.css +9 -9
  12. package/dist/index.system.min.js +1 -1
  13. package/dist/{quill-D-355-KZ.js → quill-BOA7ZLOz.js} +2 -2
  14. package/dist/{quill-D-355-KZ.js.map → quill-BOA7ZLOz.js.map} +1 -1
  15. package/dist/{quill-editor-DyVF1l3P.js → quill-editor-DcZd_lqh.js} +2 -2
  16. package/dist/{quill-editor-DyVF1l3P.js.map → quill-editor-DcZd_lqh.js.map} +1 -1
  17. package/dist/quill-editor-preview-DghpeKpg.js +2 -0
  18. package/dist/quill-editor-preview-DghpeKpg.js.map +1 -0
  19. package/dist/{tree-sdPuTW-7.js → tree-BTa0bMPr.js} +2 -2
  20. package/dist/{tree-sdPuTW-7.js.map → tree-BTa0bMPr.js.map} +1 -1
  21. package/dist/xlsx-util-CQaOn5OK.js +105 -0
  22. package/dist/xlsx-util-CQaOn5OK.js.map +1 -0
  23. package/es/_virtual/FileSaver.min.mjs +3 -0
  24. package/es/_virtual/index12.mjs +2 -2
  25. package/es/_virtual/index14.mjs +2 -2
  26. package/es/_virtual/index18.mjs +2 -2
  27. package/es/_virtual/index19.mjs +2 -2
  28. package/es/common/split-trigger/split-trigger.css +1 -1
  29. package/es/common/tab-layout/tab-default-layout/tab-default-layout.mjs +1 -0
  30. package/es/common/tab-layout/tab-sidebar-layout/tab-sidebar-layout.css +1 -1
  31. package/es/common/view-message/view-message.mjs +1 -1
  32. package/es/control/app-menu-icon-view/app-menu-icon-view.css +1 -1
  33. package/es/control/app-menu-icon-view/app-menu-icon-view.mjs +1 -1
  34. package/es/control/app-menu-list-view/app-menu-list-view.css +1 -1
  35. package/es/control/calendar/calendar.css +1 -1
  36. package/es/control/calendar/calendar.mjs +1 -1
  37. package/es/control/caption-bar/caption-bar.css +1 -1
  38. package/es/control/dashboard/custom-dashboard-design/custom-dashboard-design.css +1 -1
  39. package/es/control/dashboard/dashboard.css +1 -1
  40. package/es/control/dashboard/portlet/portlet-layout/portlet-layout.css +1 -1
  41. package/es/control/data-view/data-view.css +1 -1
  42. package/es/control/drbar/drbar.css +1 -1
  43. package/es/control/drtab/drtab.controller.mjs +1 -1
  44. package/es/control/drtab/drtab.css +1 -1
  45. package/es/control/list/md-ctrl/md-ctrl.css +1 -1
  46. package/es/control/search-bar/filter-tree/filter-tree.css +1 -1
  47. package/es/control/search-bar/search-bar.css +1 -1
  48. package/es/control/tab-exp-panel/tab-exp-panel.css +1 -1
  49. package/es/control/toolbar/toolbar-render-util.mjs +4 -0
  50. package/es/control/toolbar/toolbar.css +1 -1
  51. package/es/control/tree/tree.css +1 -1
  52. package/es/control/wizard-panel/wizard-panel.css +1 -1
  53. package/es/editor/array/ibiz-array/ibiz-array.css +1 -1
  54. package/es/editor/data-picker/picker-editor.controller.mjs +1 -1
  55. package/es/editor/html/quill-editor/quill-editor.css +1 -1
  56. package/es/editor/html/quill-editor-preview/quill-editor-preview.css +1 -1
  57. package/es/editor/html/quill-editor-preview/quill-editor-preview.mjs +1 -2
  58. package/es/editor/markdown/ibiz-markdown-editor/ibiz-markdown-editor.mjs +3 -1
  59. package/es/editor/slider/ibiz-slider/ibiz-slider.css +1 -1
  60. package/es/editor/stepper/ibiz-stepper/ibiz-stepper.css +1 -1
  61. package/es/editor/text-box/ibiz-input-number/ibiz-input-number.css +1 -1
  62. package/es/editor/text-box/input/input.mjs +33 -2
  63. package/es/editor/upload/ibiz-file-upload/ibiz-file-upload.css +1 -1
  64. package/es/editor/upload/ibiz-file-upload/ibiz-file-upload.mjs +1 -1
  65. package/es/ibiz-vue3.mjs +1 -0
  66. package/es/index.mjs +3 -0
  67. package/es/locale/en/index.mjs +23 -0
  68. package/es/locale/zh-CN/index.mjs +26 -1
  69. package/es/mob-app/components/modal-router-shell/modal-router-shell.mjs +2 -2
  70. package/es/mob-app/guard/auth-guard/auth-guard.mjs +206 -194
  71. package/es/mob-app/guard/auth-guard/dyna-auth-guard.mjs +65 -0
  72. package/es/mob-app/guard/index.mjs +1 -0
  73. package/es/mob-app/index.mjs +1 -0
  74. package/es/mob-app/main.mjs +14 -1
  75. package/es/mob-app/router/index.mjs +6 -4
  76. package/es/node_modules/.pnpm/@amap_amap-jsapi-loader@1.0.1_patch_hash_73bpcwbs2m5ip4qppmz6a7epsa/node_modules/@amap/amap-jsapi-loader/dist/index.mjs +1 -1
  77. package/es/node_modules/.pnpm/@ibiz-template-plugin_ibiz-mob-ai-chat@0.0.1_cherry-markdown@0.8.58_interactjs@1.10.27_qx-uti_xgmgjpxet4ghyc7txs4jkjxilq/node_modules/@ibiz-template-plugin/ibiz-mob-ai-chat/dist/index.es.mjs +4425 -0
  78. package/es/node_modules/.pnpm/dingtalk-jsapi@3.2.0/node_modules/dingtalk-jsapi/lib/packages/frame-talk-client-pc/index.mjs +1 -1
  79. package/es/node_modules/.pnpm/file-saver@2.0.5/node_modules/file-saver/dist/FileSaver.min.mjs +15 -0
  80. package/es/node_modules/.pnpm/lodash.clonedeep@4.5.0/node_modules/lodash.clonedeep/index.mjs +1 -1
  81. package/es/node_modules/.pnpm/lodash.isequal@4.5.0/node_modules/lodash.isequal/index.mjs +1 -1
  82. package/es/node_modules/.pnpm/xlsx@0.18.5/node_modules/xlsx/xlsx.mjs +24580 -0
  83. package/es/panel-component/view-content-panel-container/view-content-panel-container.css +1 -1
  84. package/es/panel-component/view-content-panel-container/view-content-panel-container.mjs +18 -4
  85. package/es/util/ai-chat-util/ai-chat-util.mjs +932 -0
  86. package/es/util/ai-chat-util/ai-feedback/ai-feedback.css +1 -0
  87. package/es/util/ai-chat-util/ai-feedback/ai-feedback.mjs +140 -0
  88. package/es/util/app-drawer/app-drawer-component.mjs +7 -17
  89. package/es/util/app-modal/app-modal-component.mjs +4 -2
  90. package/es/util/app-util/app-util.mjs +76 -6
  91. package/es/util/index.mjs +2 -0
  92. package/es/util/list-util/list-render-util.mjs +1 -1
  93. package/es/util/user-route-util/user-route-util.mjs +55 -0
  94. package/es/util/xlsx-util/xlsx-util.mjs +163 -0
  95. package/es/view/portal-view/portal-view.mjs +3 -2
  96. package/es/view-engine/mob-calendar-view.engine.mjs +4 -0
  97. package/es/view-engine/mob-pickup-md-view.engine.mjs +1 -0
  98. package/lib/_virtual/FileSaver.min.cjs +5 -0
  99. package/lib/_virtual/index12.cjs +2 -2
  100. package/lib/_virtual/index14.cjs +2 -2
  101. package/lib/_virtual/index18.cjs +2 -2
  102. package/lib/_virtual/index19.cjs +2 -2
  103. package/lib/common/split-trigger/split-trigger.css +1 -1
  104. package/lib/common/tab-layout/tab-default-layout/tab-default-layout.cjs +1 -0
  105. package/lib/common/tab-layout/tab-sidebar-layout/tab-sidebar-layout.css +1 -1
  106. package/lib/common/view-message/view-message.cjs +1 -1
  107. package/lib/control/app-menu-icon-view/app-menu-icon-view.cjs +1 -1
  108. package/lib/control/app-menu-icon-view/app-menu-icon-view.css +1 -1
  109. package/lib/control/app-menu-list-view/app-menu-list-view.css +1 -1
  110. package/lib/control/calendar/calendar.cjs +1 -1
  111. package/lib/control/calendar/calendar.css +1 -1
  112. package/lib/control/caption-bar/caption-bar.css +1 -1
  113. package/lib/control/dashboard/custom-dashboard-design/custom-dashboard-design.css +1 -1
  114. package/lib/control/dashboard/dashboard.css +1 -1
  115. package/lib/control/dashboard/portlet/portlet-layout/portlet-layout.css +1 -1
  116. package/lib/control/data-view/data-view.css +1 -1
  117. package/lib/control/drbar/drbar.css +1 -1
  118. package/lib/control/drtab/drtab.controller.cjs +1 -1
  119. package/lib/control/drtab/drtab.css +1 -1
  120. package/lib/control/list/md-ctrl/md-ctrl.css +1 -1
  121. package/lib/control/search-bar/filter-tree/filter-tree.css +1 -1
  122. package/lib/control/search-bar/search-bar.css +1 -1
  123. package/lib/control/tab-exp-panel/tab-exp-panel.css +1 -1
  124. package/lib/control/toolbar/toolbar-render-util.cjs +4 -0
  125. package/lib/control/toolbar/toolbar.css +1 -1
  126. package/lib/control/tree/tree.css +1 -1
  127. package/lib/control/wizard-panel/wizard-panel.css +1 -1
  128. package/lib/editor/array/ibiz-array/ibiz-array.css +1 -1
  129. package/lib/editor/data-picker/picker-editor.controller.cjs +1 -1
  130. package/lib/editor/html/quill-editor/quill-editor.css +1 -1
  131. package/lib/editor/html/quill-editor-preview/quill-editor-preview.cjs +1 -2
  132. package/lib/editor/html/quill-editor-preview/quill-editor-preview.css +1 -1
  133. package/lib/editor/markdown/ibiz-markdown-editor/ibiz-markdown-editor.cjs +3 -1
  134. package/lib/editor/slider/ibiz-slider/ibiz-slider.css +1 -1
  135. package/lib/editor/stepper/ibiz-stepper/ibiz-stepper.css +1 -1
  136. package/lib/editor/text-box/ibiz-input-number/ibiz-input-number.css +1 -1
  137. package/lib/editor/text-box/input/input.cjs +32 -1
  138. package/lib/editor/upload/ibiz-file-upload/ibiz-file-upload.cjs +1 -1
  139. package/lib/editor/upload/ibiz-file-upload/ibiz-file-upload.css +1 -1
  140. package/lib/ibiz-vue3.cjs +1 -0
  141. package/lib/index.cjs +7 -0
  142. package/lib/locale/en/index.cjs +23 -0
  143. package/lib/locale/zh-CN/index.cjs +26 -1
  144. package/lib/mob-app/components/modal-router-shell/modal-router-shell.cjs +2 -2
  145. package/lib/mob-app/guard/auth-guard/auth-guard.cjs +206 -194
  146. package/lib/mob-app/guard/auth-guard/dyna-auth-guard.cjs +67 -0
  147. package/lib/mob-app/guard/index.cjs +2 -0
  148. package/lib/mob-app/index.cjs +2 -0
  149. package/lib/mob-app/main.cjs +14 -1
  150. package/lib/mob-app/router/index.cjs +6 -4
  151. package/lib/node_modules/.pnpm/@amap_amap-jsapi-loader@1.0.1_patch_hash_73bpcwbs2m5ip4qppmz6a7epsa/node_modules/@amap/amap-jsapi-loader/dist/index.cjs +1 -1
  152. package/lib/node_modules/.pnpm/@ibiz-template-plugin_ibiz-mob-ai-chat@0.0.1_cherry-markdown@0.8.58_interactjs@1.10.27_qx-uti_xgmgjpxet4ghyc7txs4jkjxilq/node_modules/@ibiz-template-plugin/ibiz-mob-ai-chat/dist/index.es.cjs +4427 -0
  153. package/lib/node_modules/.pnpm/dingtalk-jsapi@3.2.0/node_modules/dingtalk-jsapi/lib/packages/frame-talk-client-pc/index.cjs +1 -1
  154. package/lib/node_modules/.pnpm/file-saver@2.0.5/node_modules/file-saver/dist/FileSaver.min.cjs +20 -0
  155. package/lib/node_modules/.pnpm/lodash.clonedeep@4.5.0/node_modules/lodash.clonedeep/index.cjs +1 -1
  156. package/lib/node_modules/.pnpm/lodash.isequal@4.5.0/node_modules/lodash.isequal/index.cjs +1 -1
  157. package/lib/node_modules/.pnpm/xlsx@0.18.5/node_modules/xlsx/xlsx.cjs +24599 -0
  158. package/lib/panel-component/view-content-panel-container/view-content-panel-container.cjs +18 -4
  159. package/lib/panel-component/view-content-panel-container/view-content-panel-container.css +1 -1
  160. package/lib/util/ai-chat-util/ai-chat-util.cjs +934 -0
  161. package/lib/util/ai-chat-util/ai-feedback/ai-feedback.cjs +142 -0
  162. package/lib/util/ai-chat-util/ai-feedback/ai-feedback.css +1 -0
  163. package/lib/util/app-drawer/app-drawer-component.cjs +7 -17
  164. package/lib/util/app-modal/app-modal-component.cjs +4 -2
  165. package/lib/util/app-util/app-util.cjs +75 -5
  166. package/lib/util/index.cjs +5 -0
  167. package/lib/util/list-util/list-render-util.cjs +1 -1
  168. package/lib/util/user-route-util/user-route-util.cjs +58 -0
  169. package/lib/util/xlsx-util/xlsx-util.cjs +166 -0
  170. package/lib/view/portal-view/portal-view.cjs +3 -2
  171. package/lib/view-engine/mob-calendar-view.engine.cjs +4 -0
  172. package/lib/view-engine/mob-pickup-md-view.engine.cjs +1 -0
  173. package/package.json +12 -9
  174. package/dist/ibiz-markdown-editor-DMe7ZdYW.js +0 -2
  175. package/dist/ibiz-markdown-editor-DMe7ZdYW.js.map +0 -1
  176. package/dist/index-CADWRoaa.js +0 -76
  177. package/dist/index-CADWRoaa.js.map +0 -1
  178. package/dist/index-ugd4IDkI.js +0 -2
  179. package/dist/index-ugd4IDkI.js.map +0 -1
  180. package/dist/quill-editor-preview-3eAbHBYz.js +0 -2
  181. package/dist/quill-editor-preview-3eAbHBYz.js.map +0 -1
@@ -0,0 +1,934 @@
1
+ 'use strict';
2
+
3
+ var vue = require('vue');
4
+ var qxUtil = require('qx-util');
5
+ var runtime = require('@ibiz-template/runtime');
6
+ var core = require('@ibiz-template/core');
7
+ var aiFeedback = require('./ai-feedback/ai-feedback.cjs');
8
+
9
+ "use strict";
10
+ var __defProp = Object.defineProperty;
11
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
12
+ var __publicField = (obj, key, value) => {
13
+ __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
14
+ return value;
15
+ };
16
+ class AIChatUtil {
17
+ constructor() {
18
+ __publicField(this, "TOPIC_CHAT_PREFIX", "topic");
19
+ __publicField(this, "INLINE_CHAT_SUFFIX", "inline");
20
+ __publicField(this, "TEMP_CHAT_SUFFIX", "temp");
21
+ __publicField(this, "UNKOWN_CHAT_SUFFIX", "unknow");
22
+ }
23
+ /**
24
+ * 获取AI聊天对象
25
+ */
26
+ async getAIChat() {
27
+ const module = await Promise.resolve().then(function () { return require('../../node_modules/.pnpm/@ibiz-template-plugin_ibiz-mob-ai-chat@0.0.1_cherry-markdown@0.8.58_interactjs@1.10.27_qx-uti_xgmgjpxet4ghyc7txs4jkjxilq/node_modules/@ibiz-template-plugin/ibiz-mob-ai-chat/dist/index.es.cjs'); });
28
+ const chatInstance = module.chat || module.default.chat;
29
+ return chatInstance;
30
+ }
31
+ /**
32
+ * 获取编辑器扩展AI聊天参数
33
+ * @param editorParams
34
+ * @param context
35
+ * @param params
36
+ * @param data
37
+ */
38
+ async getEditorExAIChatParams(editorParams, context, params, data, deACMode, args) {
39
+ const containerOptions = {};
40
+ if (editorParams.autoclose) {
41
+ try {
42
+ containerOptions.autoClose = JSON.parse(editorParams.autoclose);
43
+ } catch (error) {
44
+ ibiz.log.error(error);
45
+ }
46
+ }
47
+ if (editorParams.openmode)
48
+ containerOptions.openMode = editorParams.openmode;
49
+ const topicOptions = {};
50
+ const chatOptions = {};
51
+ if (editorParams.srfaiappendcurdata) {
52
+ chatOptions.appendCurData = editorParams.srfaiappendcurdata === "true" ? data : void 0;
53
+ }
54
+ chatOptions.appendCurContent = editorParams.srfaiappendcurcontent ? core.StringUtil.fill(
55
+ editorParams.srfaiappendcurcontent,
56
+ context,
57
+ params,
58
+ data
59
+ ) : void 0;
60
+ chatOptions.autoQuestion = editorParams.autoquestion !== "false";
61
+ chatOptions.autoFill = editorParams.autofill === "true";
62
+ chatOptions.appendCurResource = editorParams.srfaiappendresource ? core.StringUtil.fill(editorParams.srfaiappendresource, context, params, data) : void 0;
63
+ if (editorParams.srfmode) {
64
+ chatOptions.srfMode = editorParams.srfmode;
65
+ }
66
+ let enableAIAgentChange = ibiz.config.common.enableAIAgentChange;
67
+ if (editorParams.srfenableaiagentchange) {
68
+ enableAIAgentChange = editorParams.srfenableaiagentchange === "true";
69
+ }
70
+ chatOptions.enableAIAgentChange = enableAIAgentChange;
71
+ if (editorParams.srfaiagent) {
72
+ chatOptions.activeAIAgentID = editorParams.srfaiagent;
73
+ }
74
+ const aiAgentlist = await this.getAIAgentList(
75
+ context,
76
+ params,
77
+ editorParams
78
+ );
79
+ chatOptions.aiAgentlist = aiAgentlist;
80
+ if (deACMode) {
81
+ const {
82
+ contentToolbarItems,
83
+ footerToolbarItems,
84
+ questionToolbarItems,
85
+ otherToolbarItems
86
+ } = this.calcAiToolbarItemsByAc(deACMode);
87
+ chatOptions.contentToolbarItems = contentToolbarItems;
88
+ chatOptions.footerToolbarItems = footerToolbarItems;
89
+ chatOptions.questionToolbarItems = questionToolbarItems;
90
+ chatOptions.otherToolbarItems = otherToolbarItems;
91
+ }
92
+ const sessionid = this.getChatSessionId("TEMP");
93
+ chatOptions.sessionid = sessionid;
94
+ let id = "";
95
+ let abortController;
96
+ let asyncacitonid = "";
97
+ const { chatInstance, view, ctrl } = args;
98
+ chatOptions.history = async (ctx, param, other) => {
99
+ const deService = await ibiz.hub.getApp(ctx.srfappid).deService.getService(ctx, other.appDataEntityId);
100
+ const historyRequestData = {};
101
+ if (other.appendCurData) {
102
+ Object.assign(historyRequestData, {
103
+ ...other.appendCurData
104
+ });
105
+ }
106
+ if (other.sessionid) {
107
+ Object.assign(historyRequestData, {
108
+ sessionid: other.sessionid
109
+ });
110
+ }
111
+ if (other.srfaiagent) {
112
+ Object.assign(historyRequestData, {
113
+ srfaiagent: other.srfaiagent
114
+ });
115
+ }
116
+ if (other.srfmode) {
117
+ Object.assign(historyRequestData, {
118
+ mode: other.srfmode
119
+ });
120
+ }
121
+ const result = await deService.aiChatHistory(
122
+ ctx,
123
+ param,
124
+ historyRequestData
125
+ );
126
+ if (result.data && Array.isArray(result.data)) {
127
+ let preMsg;
128
+ result.data.forEach((item) => {
129
+ if (item.role === "TOOL") {
130
+ if (preMsg && item.content) {
131
+ chatInstance.aiChat.updateRecommendPrompt(
132
+ preMsg,
133
+ item.content
134
+ );
135
+ }
136
+ } else {
137
+ const msg = {
138
+ messageid: qxUtil.createUUID(),
139
+ state: 30,
140
+ type: "DEFAULT",
141
+ role: item.role,
142
+ content: item.content,
143
+ completed: true
144
+ };
145
+ preMsg = msg;
146
+ chatInstance.aiChat.addMessage(msg);
147
+ }
148
+ });
149
+ }
150
+ return true;
151
+ };
152
+ chatOptions.question = async (aiChat, ctx, param, other, arr, sessionid2, srfaiagent, srfmode) => {
153
+ id = qxUtil.createUUID();
154
+ abortController = new AbortController();
155
+ const deService = await ibiz.hub.getApp(ctx.srfappid).deService.getService(ctx, other.appDataEntityId);
156
+ try {
157
+ const questionRequestData = {
158
+ messages: arr,
159
+ sessionid: sessionid2
160
+ };
161
+ if (srfaiagent) {
162
+ questionRequestData.srfaiagent = srfaiagent;
163
+ }
164
+ if (srfmode) {
165
+ questionRequestData.mode = srfmode;
166
+ }
167
+ await deService.aiChatSse(
168
+ (msg) => {
169
+ if (msg.actionstate === 20 && msg.actionresult) {
170
+ asyncacitonid = msg.asyncacitonid;
171
+ aiChat.addMessage({
172
+ messageid: id,
173
+ state: msg.actionstate,
174
+ type: "DEFAULT",
175
+ role: "ASSISTANT",
176
+ content: msg.actionresult,
177
+ status: "pending"
178
+ });
179
+ } else if (msg.actionstate === 30 && msg.actionresult) {
180
+ const result = JSON.parse(msg.actionresult);
181
+ const choices = result.choices;
182
+ if (choices && choices.length > 0) {
183
+ aiChat.replaceMessage({
184
+ messageid: id,
185
+ state: msg.actionstate,
186
+ type: "DEFAULT",
187
+ role: "ASSISTANT",
188
+ content: choices[0].content || "",
189
+ realmessageid: choices[0].messageid,
190
+ status: "sent"
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
+ status: "failed"
201
+ });
202
+ }
203
+ },
204
+ abortController,
205
+ ctx,
206
+ param,
207
+ { ...questionRequestData }
208
+ );
209
+ } catch (error) {
210
+ aiChat.replaceMessage({
211
+ messageid: id,
212
+ state: 40,
213
+ type: "ERROR",
214
+ role: "ASSISTANT",
215
+ content: error.message || ibiz.i18n.t("app.aiError"),
216
+ status: "failed"
217
+ });
218
+ abortController == null ? void 0 : abortController.abort();
219
+ } finally {
220
+ aiChat.completeMessage(id, true);
221
+ return true;
222
+ }
223
+ };
224
+ chatOptions.abortQuestion = async (aiChat, ctx, param, other) => {
225
+ abortController == null ? void 0 : abortController.abort();
226
+ if (asyncacitonid) {
227
+ const deService = await ibiz.hub.getApp(ctx.srfappid).deService.getService(ctx, other.appDataEntityId);
228
+ const abortRequestData = { asyncacitonid };
229
+ if (other.sessionid) {
230
+ Object.assign(abortRequestData, {
231
+ sessionid: other.sessionid
232
+ });
233
+ }
234
+ const result = await deService.aiChatCancel(
235
+ ctx,
236
+ param,
237
+ abortRequestData
238
+ );
239
+ asyncacitonid = "";
240
+ }
241
+ await aiChat.stopMessage({
242
+ messageid: id,
243
+ state: 30,
244
+ type: "DEFAULT",
245
+ role: "ASSISTANT",
246
+ content: "",
247
+ status: "canceled"
248
+ });
249
+ await aiChat.completeMessage(id, true);
250
+ };
251
+ chatOptions.recommendPrompt = async (ctx, param, other) => {
252
+ const deService = await ibiz.hub.getApp(ctx.srfappid).deService.getService(ctx, other.appDataEntityId);
253
+ const tempParams = { ...param };
254
+ if (other.srfaiagent) {
255
+ tempParams.srfaiagent = other.srfaiagent;
256
+ }
257
+ const result = await deService.aiChatRecommendPrompt(
258
+ ctx,
259
+ tempParams,
260
+ other.message
261
+ );
262
+ if (result.ok && result.data) {
263
+ const choices = result.data.choices;
264
+ if (choices && choices.length > 0) {
265
+ return choices[0];
266
+ }
267
+ return null;
268
+ }
269
+ return null;
270
+ };
271
+ chatOptions.uploader = {
272
+ onUpload: async (file, reportProgress, options) => {
273
+ const fileMeata = ibiz.util.file.calcFileUpDownUrl(
274
+ (options == null ? void 0 : options.context) || context,
275
+ (options == null ? void 0 : options.params) || params,
276
+ {},
277
+ { enableNoAccess: true }
278
+ );
279
+ const fielUploadHeaders = ibiz.util.file.getUploadHeaders();
280
+ const formData = new FormData();
281
+ formData.append("file", file);
282
+ const res = await ibiz.net.axios({
283
+ url: fileMeata.uploadUrl,
284
+ method: "post",
285
+ headers: fielUploadHeaders,
286
+ data: formData,
287
+ onUploadProgress: (progressEvent) => {
288
+ const percent = progressEvent.loaded / progressEvent.total * 100;
289
+ reportProgress(percent);
290
+ }
291
+ });
292
+ return res.data;
293
+ }
294
+ };
295
+ chatOptions.extendToolbarClick = async (event, source, context2, params2, data2) => {
296
+ var _a, _b, _c;
297
+ const { id: id2, isPluginApp } = source;
298
+ let appId = source.appId;
299
+ const tempContext = core.IBizContext.create(context2);
300
+ if (isPluginApp) {
301
+ const mainApp = ibiz.hub.getApp();
302
+ const targetApp = (_a = mainApp.model.subAppRefs) == null ? void 0 : _a.find(
303
+ (subAppRef) => subAppRef.appId.endsWith(appId)
304
+ );
305
+ if (targetApp) {
306
+ const targetAppId = targetApp.appId;
307
+ tempContext.srfappid = targetAppId;
308
+ appId = targetAppId;
309
+ }
310
+ }
311
+ const result = await runtime.UIActionUtil.exec(
312
+ id2,
313
+ {
314
+ view,
315
+ ctrl,
316
+ context: tempContext,
317
+ params: params2,
318
+ data: [data2],
319
+ event
320
+ },
321
+ appId
322
+ );
323
+ if (result.closeView) {
324
+ view.closeView({ ok: true });
325
+ } else if (result.refresh) {
326
+ switch (result.refreshMode) {
327
+ case 1:
328
+ view.callUIAction(runtime.SysUIActionTag.REFRESH);
329
+ break;
330
+ case 2:
331
+ (_b = view.parentView) == null ? void 0 : _b.callUIAction(runtime.SysUIActionTag.REFRESH);
332
+ break;
333
+ case 3:
334
+ (_c = view.getTopView()) == null ? void 0 : _c.callUIAction(runtime.SysUIActionTag.REFRESH);
335
+ break;
336
+ default:
337
+ }
338
+ }
339
+ return result;
340
+ };
341
+ return { containerOptions, topicOptions, chatOptions };
342
+ }
343
+ /**
344
+ * 获取界面行为扩展AI聊天参数
345
+ * @param context
346
+ * @param params
347
+ * @param data
348
+ * @param deACMode
349
+ * @param args
350
+ * @returns
351
+ */
352
+ async getUIActionExAIChatParams(context, params, data, deACMode, args) {
353
+ const containerOptions = {};
354
+ if (params.hasOwnProperty("autoclose")) {
355
+ try {
356
+ containerOptions.autoClose = JSON.parse(params.autoclose);
357
+ delete params.autoclose;
358
+ } catch (error) {
359
+ ibiz.log.error(error);
360
+ }
361
+ }
362
+ if (params.hasOwnProperty("openmode")) {
363
+ containerOptions.openMode = params.openmode;
364
+ delete params.openmode;
365
+ }
366
+ const topicOptions = {};
367
+ if (params.hasOwnProperty("topiccaptionmode")) {
368
+ topicOptions.captionMode = params.topiccaptionmode;
369
+ delete params.topiccaptionmode;
370
+ } else {
371
+ topicOptions.captionMode = ibiz.config.common.aiChatTopicCaptionMode;
372
+ }
373
+ topicOptions.disableStorage = false;
374
+ if (params.hasOwnProperty("disabletopicstorage")) {
375
+ topicOptions.disableStorage = params.disabletopicstorage === "true";
376
+ delete params.disabletopicstorage;
377
+ }
378
+ topicOptions.beforeDelete = async (...args2) => {
379
+ const isBatchRemove = args2[4];
380
+ const result = await ibiz.confirm.warning({
381
+ title: ibiz.i18n.t(
382
+ `util.appUtil.${isBatchRemove ? "clearTopic" : "aiTitle"}`
383
+ ),
384
+ desc: ibiz.i18n.t(
385
+ `util.appUtil.${isBatchRemove ? "clearTopicDesc" : "aiDesc"}`
386
+ )
387
+ });
388
+ return result;
389
+ };
390
+ topicOptions.action = async (action, context2, params2, data2, event) => {
391
+ if (action === "LINK")
392
+ await ibiz.openView.push(data2.url);
393
+ return true;
394
+ };
395
+ topicOptions.configService = (appid, storageType, subType) => {
396
+ return new runtime.ConfigService(appid, storageType, subType);
397
+ };
398
+ const chatOptions = {};
399
+ if (context.srfaiappendcurdata === "true") {
400
+ chatOptions.appendCurData = data;
401
+ } else if (params.hasOwnProperty("srfaiappendcurdata")) {
402
+ chatOptions.appendCurData = params.srfaiappendcurdata === "true" ? data : void 0;
403
+ delete params.srfaiappendcurdata;
404
+ }
405
+ if (params.hasOwnProperty("srfaiappendcurcontent")) {
406
+ chatOptions.appendCurContent = core.StringUtil.fill(
407
+ params.srfaiappendcurcontent,
408
+ context,
409
+ params,
410
+ data
411
+ );
412
+ delete params.srfaiappendcurcontent;
413
+ }
414
+ if (params.hasOwnProperty("autoquestion")) {
415
+ chatOptions.autoQuestion = params.autoquestion !== "false";
416
+ delete params.autoquestion;
417
+ }
418
+ if (params.hasOwnProperty("srfaiappendresource")) {
419
+ chatOptions.appendCurResource = core.StringUtil.fill(
420
+ params.srfaiappendresource,
421
+ context,
422
+ params,
423
+ data
424
+ );
425
+ delete params.srfaiappendresource;
426
+ }
427
+ if (params.hasOwnProperty("srfmode")) {
428
+ chatOptions.srfMode = params.srfmode;
429
+ delete params.srfmode;
430
+ }
431
+ if (params.hasOwnProperty("srfaiagent")) {
432
+ chatOptions.activeAIAgentID = params.srfaiagent;
433
+ delete params.srfaiagent;
434
+ }
435
+ let enableAIAgentChange = ibiz.config.common.enableAIAgentChange;
436
+ if (params.hasOwnProperty("srfenableaiagentchange")) {
437
+ enableAIAgentChange = params.srfenableaiagentchange === "true";
438
+ delete params.srfenableaiagentchange;
439
+ }
440
+ chatOptions.enableAIAgentChange = enableAIAgentChange;
441
+ const aiAgentlist = await this.getAIAgentList(context, params);
442
+ chatOptions.aiAgentlist = aiAgentlist;
443
+ if (deACMode) {
444
+ const {
445
+ contentToolbarItems,
446
+ footerToolbarItems,
447
+ questionToolbarItems,
448
+ otherToolbarItems
449
+ } = this.calcAiToolbarItemsByAc(deACMode);
450
+ chatOptions.contentToolbarItems = contentToolbarItems;
451
+ chatOptions.footerToolbarItems = footerToolbarItems;
452
+ chatOptions.questionToolbarItems = questionToolbarItems;
453
+ chatOptions.otherToolbarItems = otherToolbarItems;
454
+ }
455
+ let id = "";
456
+ let abortController;
457
+ let asyncacitonid = "";
458
+ const { chatInstance, view, ctrl } = args;
459
+ chatOptions.history = async (ctx, param, other) => {
460
+ const deService = await ibiz.hub.getApp(ctx.srfappid).deService.getService(ctx, other.appDataEntityId);
461
+ const historyRequestData = {};
462
+ if (other.appendCurData) {
463
+ Object.assign(historyRequestData, {
464
+ ...other.appendCurData
465
+ });
466
+ }
467
+ if (other.sessionid) {
468
+ Object.assign(historyRequestData, {
469
+ sessionid: other.sessionid
470
+ });
471
+ }
472
+ if (other.srfaiagent) {
473
+ Object.assign(historyRequestData, {
474
+ srfaiagent: other.srfaiagent
475
+ });
476
+ }
477
+ if (other.srfmode) {
478
+ Object.assign(historyRequestData, {
479
+ mode: other.srfmode
480
+ });
481
+ }
482
+ const result = await deService.aiChatHistory(
483
+ ctx,
484
+ param,
485
+ historyRequestData
486
+ );
487
+ if (result.data && Array.isArray(result.data)) {
488
+ let preMsg;
489
+ result.data.forEach((item) => {
490
+ if (item.role === "TOOL") {
491
+ if (preMsg && item.content) {
492
+ chatInstance.aiChat.updateRecommendPrompt(
493
+ preMsg,
494
+ item.content
495
+ );
496
+ }
497
+ } else {
498
+ const msg = {
499
+ messageid: qxUtil.createUUID(),
500
+ state: 30,
501
+ type: "DEFAULT",
502
+ role: item.role,
503
+ content: item.content,
504
+ completed: true
505
+ };
506
+ preMsg = msg;
507
+ chatInstance.aiChat.addMessage(msg);
508
+ }
509
+ });
510
+ }
511
+ return true;
512
+ };
513
+ chatOptions.question = async (aiChat, ctx, param, other, arr, sessionid, srfaiagent, srfmode) => {
514
+ id = qxUtil.createUUID();
515
+ abortController = new AbortController();
516
+ const deService = await ibiz.hub.getApp(ctx.srfappid).deService.getService(ctx, other.appDataEntityId);
517
+ try {
518
+ const questionRequestData = {
519
+ messages: arr,
520
+ sessionid
521
+ };
522
+ if (srfaiagent) {
523
+ questionRequestData.srfaiagent = srfaiagent;
524
+ }
525
+ if (srfmode) {
526
+ questionRequestData.mode = srfmode;
527
+ }
528
+ await deService.aiChatSse(
529
+ (msg) => {
530
+ if (msg.actionstate === 20 && msg.actionresult) {
531
+ asyncacitonid = msg.asyncacitonid;
532
+ aiChat.addMessage({
533
+ messageid: id,
534
+ state: msg.actionstate,
535
+ type: "DEFAULT",
536
+ role: "ASSISTANT",
537
+ content: msg.actionresult,
538
+ status: "pending"
539
+ });
540
+ } else if (msg.actionstate === 30 && msg.actionresult) {
541
+ const result = JSON.parse(msg.actionresult);
542
+ const choices = result.choices;
543
+ if (choices && choices.length > 0) {
544
+ aiChat.replaceMessage({
545
+ messageid: id,
546
+ state: msg.actionstate,
547
+ type: "DEFAULT",
548
+ role: "ASSISTANT",
549
+ content: choices[0].content || "",
550
+ realmessageid: choices[0].messageid,
551
+ status: "sent"
552
+ });
553
+ }
554
+ } else if (msg.actionstate === 40) {
555
+ aiChat.replaceMessage({
556
+ messageid: id,
557
+ state: msg.actionstate,
558
+ type: "ERROR",
559
+ role: "ASSISTANT",
560
+ content: msg.actionresult,
561
+ status: "failed"
562
+ });
563
+ }
564
+ },
565
+ abortController,
566
+ ctx,
567
+ param,
568
+ { ...questionRequestData }
569
+ );
570
+ } catch (error) {
571
+ aiChat.replaceMessage({
572
+ messageid: id,
573
+ state: 40,
574
+ type: "ERROR",
575
+ role: "ASSISTANT",
576
+ content: error.message || ibiz.i18n.t("app.aiError"),
577
+ status: "failed"
578
+ });
579
+ abortController == null ? void 0 : abortController.abort();
580
+ } finally {
581
+ aiChat.completeMessage(id, true);
582
+ return true;
583
+ }
584
+ };
585
+ chatOptions.abortQuestion = async (aiChat, ctx, param, other) => {
586
+ abortController == null ? void 0 : abortController.abort();
587
+ if (asyncacitonid) {
588
+ const deService = await ibiz.hub.getApp(ctx.srfappid).deService.getService(ctx, other.appDataEntityId);
589
+ const abortRequestData = { asyncacitonid };
590
+ if (other.sessionid) {
591
+ Object.assign(abortRequestData, {
592
+ sessionid: other.sessionid
593
+ });
594
+ }
595
+ const result = await deService.aiChatCancel(
596
+ ctx,
597
+ param,
598
+ abortRequestData
599
+ );
600
+ asyncacitonid = "";
601
+ }
602
+ await aiChat.stopMessage({
603
+ messageid: id,
604
+ state: 30,
605
+ type: "DEFAULT",
606
+ role: "ASSISTANT",
607
+ content: "",
608
+ status: "canceled"
609
+ });
610
+ await aiChat.completeMessage(id, true);
611
+ };
612
+ chatOptions.recommendPrompt = async (ctx, param, other) => {
613
+ const deService = await ibiz.hub.getApp(ctx.srfappid).deService.getService(ctx, other.appDataEntityId);
614
+ const tempParams = { ...param };
615
+ if (other.srfaiagent) {
616
+ tempParams.srfaiagent = other.srfaiagent;
617
+ }
618
+ const result = await deService.aiChatRecommendPrompt(
619
+ ctx,
620
+ tempParams,
621
+ other.message
622
+ );
623
+ if (result.ok && result.data) {
624
+ const choices = result.data.choices;
625
+ if (choices && choices.length > 0) {
626
+ return choices[0];
627
+ }
628
+ return null;
629
+ }
630
+ return null;
631
+ };
632
+ chatOptions.uploader = {
633
+ onUpload: async (file, reportProgress, options) => {
634
+ const { uploadUrl } = ibiz.util.file.calcFileUpDownUrl(
635
+ (options == null ? void 0 : options.context) || context,
636
+ (options == null ? void 0 : options.params) || params,
637
+ {},
638
+ { enableNoAccess: true }
639
+ );
640
+ const headers = ibiz.util.file.getUploadHeaders();
641
+ const formData = new FormData();
642
+ formData.append("file", file);
643
+ const res = await ibiz.net.axios({
644
+ url: uploadUrl,
645
+ method: "post",
646
+ headers,
647
+ data: formData,
648
+ onUploadProgress: (progressEvent) => {
649
+ const percent = progressEvent.loaded / progressEvent.total * 100;
650
+ reportProgress(percent);
651
+ }
652
+ });
653
+ return res.data;
654
+ }
655
+ };
656
+ chatOptions.extendToolbarClick = async (event, source, context2, params2, data2) => {
657
+ var _a, _b, _c;
658
+ const { id: id2, isPluginApp } = source;
659
+ let appId = source.appId;
660
+ const tempContext = core.IBizContext.create(context2);
661
+ if (isPluginApp) {
662
+ const mainApp = ibiz.hub.getApp();
663
+ const targetApp = (_a = mainApp.model.subAppRefs) == null ? void 0 : _a.find(
664
+ (subAppRef) => subAppRef.appId.endsWith(appId)
665
+ );
666
+ if (targetApp) {
667
+ const targetAppId = targetApp.appId;
668
+ tempContext.srfappid = targetAppId;
669
+ appId = targetAppId;
670
+ }
671
+ }
672
+ const result = await runtime.UIActionUtil.exec(
673
+ id2,
674
+ {
675
+ view,
676
+ ctrl,
677
+ context: tempContext,
678
+ params: params2,
679
+ data: [data2],
680
+ event
681
+ },
682
+ appId
683
+ );
684
+ if (result.closeView) {
685
+ view.closeView({ ok: true });
686
+ } else if (result.refresh) {
687
+ switch (result.refreshMode) {
688
+ case 1:
689
+ view.callUIAction(runtime.SysUIActionTag.REFRESH);
690
+ break;
691
+ case 2:
692
+ (_b = view.parentView) == null ? void 0 : _b.callUIAction(runtime.SysUIActionTag.REFRESH);
693
+ break;
694
+ case 3:
695
+ (_c = view.getTopView()) == null ? void 0 : _c.callUIAction(runtime.SysUIActionTag.REFRESH);
696
+ break;
697
+ default:
698
+ }
699
+ }
700
+ return result;
701
+ };
702
+ return { containerOptions, topicOptions, chatOptions };
703
+ }
704
+ /**
705
+ * 计算界面行为扩展AI聊天工具栏项
706
+ * @param deACMode 自填模式
707
+ */
708
+ calcAiToolbarItemsByAc(deACMode) {
709
+ var _a;
710
+ const contentToolbarItems = [];
711
+ const footerToolbarItems = [];
712
+ const questionToolbarItems = [];
713
+ const functionToolbarItems = [];
714
+ const inlineToolbarItems = [];
715
+ const otherToolbarItems = [];
716
+ if (!deACMode || !deACMode.deuiactionGroup) {
717
+ return {
718
+ contentToolbarItems,
719
+ footerToolbarItems,
720
+ questionToolbarItems,
721
+ otherToolbarItems,
722
+ functionToolbarItems,
723
+ inlineToolbarItems
724
+ };
725
+ }
726
+ (_a = deACMode.deuiactionGroup.uiactionGroupDetails) == null ? void 0 : _a.forEach(
727
+ (item) => {
728
+ var _a2, _b, _c, _d, _e, _f, _g, _h;
729
+ const toolbarItem = {
730
+ appId: item.appId,
731
+ id: item.uiactionId,
732
+ label: item.showCaption ? item.caption : "",
733
+ title: item.tooltip,
734
+ icon: {
735
+ showIcon: item.showIcon,
736
+ cssClass: (_a2 = item.sysImage) == null ? void 0 : _a2.cssClass,
737
+ imagePath: (_b = item.sysImage) == null ? void 0 : _b.imagePath
738
+ }
739
+ };
740
+ if (item.sysImage && item.sysImage.imagePath && !item.sysImage.imagePath.startsWith("http")) {
741
+ toolbarItem.icon.imagePath = `${ibiz.env.assetsUrl}/images/${item.sysImage.imagePath}`;
742
+ }
743
+ if ((_c = item.uiactionId) == null ? void 0 : _c.startsWith("mob_msg_content_")) {
744
+ contentToolbarItems.push(toolbarItem);
745
+ } else if ((_d = item.uiactionId) == null ? void 0 : _d.startsWith("mob_msg_footer_")) {
746
+ footerToolbarItems.push(toolbarItem);
747
+ } else if ((_e = item.uiactionId) == null ? void 0 : _e.startsWith("mob_question_")) {
748
+ questionToolbarItems.push(toolbarItem);
749
+ } else if ((_f = item.uiactionId) == null ? void 0 : _f.startsWith("mob_function_")) {
750
+ functionToolbarItems.push(toolbarItem);
751
+ } else if (((_g = item.uiactionId) == null ? void 0 : _g.startsWith("mob_inline")) || item.refUIActionGroup && ((_h = item.refUIActionGroup.id) == null ? void 0 : _h.startsWith("mob_inline"))) {
752
+ inlineToolbarItems.push(toolbarItem);
753
+ } else {
754
+ otherToolbarItems.push(toolbarItem);
755
+ }
756
+ }
757
+ );
758
+ return {
759
+ contentToolbarItems,
760
+ footerToolbarItems,
761
+ questionToolbarItems,
762
+ otherToolbarItems,
763
+ functionToolbarItems,
764
+ inlineToolbarItems
765
+ };
766
+ }
767
+ /**
768
+ * 获取AI代理列表
769
+ * @param context
770
+ * @param params
771
+ */
772
+ async getAIAgentList(context, params, editorParams) {
773
+ const emptyList = [];
774
+ const app = ibiz.hub.getApp(ibiz.env.appId);
775
+ const aiAgentUtil = app.getAppUtil("DYNAMICAIGENT", "CUSTOM");
776
+ if (!aiAgentUtil) {
777
+ return emptyList;
778
+ }
779
+ const utilService = new runtime.UtilService(aiAgentUtil);
780
+ const resultParams = { ...params, page: 0, size: 1e3 };
781
+ if (editorParams && editorParams.srfaiagentscope) {
782
+ Object.assign(resultParams, {
783
+ srfaiagentscope: editorParams.srfaiagentscope
784
+ });
785
+ }
786
+ const data = await utilService.load("", context, resultParams);
787
+ if (!data || data.length === 0) {
788
+ return emptyList;
789
+ }
790
+ return data;
791
+ }
792
+ /**
793
+ * 获取会话标识(TOPIC:适用于多话题场景;INLINE:适用于ai行内会话场景;TEMP:适用于传统ai编辑器会话场景)
794
+ * @param sessionID
795
+ */
796
+ getChatSessionId(type, sessionID) {
797
+ let tempSessionID = "";
798
+ switch (type) {
799
+ case "TOPIC":
800
+ tempSessionID += this.TOPIC_CHAT_PREFIX;
801
+ break;
802
+ case "INLINE":
803
+ tempSessionID += this.INLINE_CHAT_SUFFIX;
804
+ break;
805
+ case "TEMP":
806
+ tempSessionID += this.TEMP_CHAT_SUFFIX;
807
+ break;
808
+ default:
809
+ tempSessionID += this.UNKOWN_CHAT_SUFFIX;
810
+ break;
811
+ }
812
+ tempSessionID += `@${sessionID || qxUtil.createUUID()}@${(/* @__PURE__ */ new Date()).getTime()}`;
813
+ return tempSessionID;
814
+ }
815
+ /**
816
+ * 获取AI会话应用功能
817
+ * @returns
818
+ */
819
+ async getAIResourceUtil() {
820
+ const app = ibiz.hub.getApp(ibiz.env.appId);
821
+ const aiSessionUtil = app.getAppUtil("DYNAMICAISESSION", "CUSTOM");
822
+ return aiSessionUtil;
823
+ }
824
+ /**
825
+ * 获取AI资源参数
826
+ * @returns
827
+ */
828
+ async getAIResourceOptions(context, params) {
829
+ const resourceOptions = {};
830
+ if (ibiz.config.common.aiResourceMode) {
831
+ resourceOptions.resourceMode = ibiz.config.common.aiResourceMode;
832
+ return resourceOptions;
833
+ }
834
+ const aiSessionUtil = await this.getAIResourceUtil();
835
+ resourceOptions.resourceMode = aiSessionUtil ? "REMOTE" : "LOCAL";
836
+ if (!aiSessionUtil) {
837
+ return resourceOptions;
838
+ }
839
+ const utilService = new runtime.AIUtilService(aiSessionUtil);
840
+ resourceOptions.getSessionList = async (args = {}) => {
841
+ const tempParams = { ...params, page: 0, size: 1e3, ...args };
842
+ const result = await utilService.getSessionList(context, tempParams);
843
+ return result;
844
+ };
845
+ resourceOptions.updateSession = async (realID, data) => {
846
+ const result = await utilService.updateSession(
847
+ context,
848
+ params,
849
+ realID,
850
+ data
851
+ );
852
+ return result;
853
+ };
854
+ resourceOptions.deleteSession = async (realID) => {
855
+ const result = await utilService.deleteSession(context, params, realID);
856
+ return result;
857
+ };
858
+ resourceOptions.getMessages = async (args = {}) => {
859
+ const tempParams = { ...params, page: 0, size: 1e3, ...args };
860
+ const result = await utilService.getMessageList(context, tempParams);
861
+ return result;
862
+ };
863
+ resourceOptions.deleteMessage = async (messageID) => {
864
+ const result = await utilService.deleteMessage(
865
+ context,
866
+ params,
867
+ messageID
868
+ );
869
+ return result;
870
+ };
871
+ resourceOptions.likeMessage = async (messageID) => {
872
+ const result = await utilService.likeMessage(context, params, messageID);
873
+ return result;
874
+ };
875
+ resourceOptions.dislikeMessage = async (messageID, feedbackContent) => {
876
+ var _a, _b;
877
+ const overlay = ibiz.overlay.createDrawer(
878
+ (modal) => {
879
+ return vue.h(aiFeedback.AIFeedback, {
880
+ modal,
881
+ content: feedbackContent
882
+ });
883
+ },
884
+ void 0,
885
+ {
886
+ height: "auto",
887
+ placement: "bottom",
888
+ attrs: {
889
+ closeable: false
890
+ }
891
+ }
892
+ );
893
+ overlay.present();
894
+ const result = await overlay.onWillDismiss();
895
+ if (!result.ok)
896
+ return false;
897
+ const content = (_b = (_a = result.data) == null ? void 0 : _a[0]) == null ? void 0 : _b.feedbackContent;
898
+ const _result = await utilService.dislikeMessage(
899
+ context,
900
+ params,
901
+ messageID,
902
+ content
903
+ );
904
+ return _result;
905
+ };
906
+ resourceOptions.cancelFeedback = async (messageID) => {
907
+ const result = await utilService.cancelFeedback(
908
+ context,
909
+ params,
910
+ messageID
911
+ );
912
+ return result;
913
+ };
914
+ resourceOptions.clearAllSession = async (excludeSessionID) => {
915
+ const result = await utilService.clearAllSession(
916
+ context,
917
+ params,
918
+ excludeSessionID
919
+ );
920
+ return result;
921
+ };
922
+ resourceOptions.clearAllMessageBySessionId = async (realID) => {
923
+ const result = await utilService.clearAllMessageBySessionId(
924
+ context,
925
+ params,
926
+ realID
927
+ );
928
+ return result;
929
+ };
930
+ return resourceOptions;
931
+ }
932
+ }
933
+
934
+ exports.AIChatUtil = AIChatUtil;