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