@ibiz-template/vue3-components 0.7.41-alpha.151 → 0.7.41-alpha.153

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.
@@ -225,6 +225,11 @@ class AIChatUtil {
225
225
  } else {
226
226
  chatOptions.chatMessagePageSize = ibiz.config.common.aiChatMessagePageSize;
227
227
  }
228
+ if (editorParams.srfaienableworkspace) {
229
+ chatOptions.enableWorkSpace = editorParams.srfaienableworkspace === "true";
230
+ } else {
231
+ chatOptions.enableWorkSpace = ibiz.config.common.aiEnableWorkSpace;
232
+ }
228
233
  chatOptions.fetchAgentList = (args2 = {}) => {
229
234
  const { query, agentid } = args2;
230
235
  return this.getAIAgentList(
@@ -253,7 +258,11 @@ class AIChatUtil {
253
258
  let id = "";
254
259
  let abortController;
255
260
  const { chatInstance, view, ctrl } = args;
256
- const fileSystemOptions = await this.getAIFileSystemOptions();
261
+ let filePreviewMode = ibiz.config.common.aiFilePreviewMode;
262
+ if (editorParams.srfaifilepreviewmode) {
263
+ filePreviewMode = editorParams.srfaifilepreviewmode;
264
+ }
265
+ const fileSystemOptions = await this.getAIFileSystemOptions(filePreviewMode);
257
266
  chatOptions.fileSystemOptions = fileSystemOptions;
258
267
  chatOptions.history = async (ctx, param, other) => {
259
268
  const deService = await ibiz.hub.getApp(ctx.srfappid).deService.getService(ctx, other.appDataEntityId);
@@ -357,9 +366,11 @@ class AIChatUtil {
357
366
  if (extParams && Object.keys(extParams).length > 0) {
358
367
  Object.assign(questionRequestData, { srfextparams: extParams });
359
368
  }
369
+ aiChat.addWaitingMessage(id);
360
370
  await deService.aiChatSse(
361
371
  (msg) => {
362
372
  if (msg.actionstate === 20 && msg.actionresult) {
373
+ aiChat.removeWaitingMessage(id);
363
374
  if (msg.asextparam && localMsgID && updateFlag) {
364
375
  aiChat.updateMsgRealMessageID(localMsgID, msg.asextparam);
365
376
  updateFlag = false;
@@ -430,6 +441,7 @@ class AIChatUtil {
430
441
  }
431
442
  abortController == null ? void 0 : abortController.abort();
432
443
  } finally {
444
+ aiChat.removeWaitingMessage(id);
433
445
  aiChat.completeMessage(id, true);
434
446
  aiChat.setActiveAsyncacitonId("");
435
447
  return true;
@@ -489,9 +501,11 @@ class AIChatUtil {
489
501
  srfproject: other.srfproject
490
502
  });
491
503
  try {
504
+ aiChat.addWaitingMessage(id);
492
505
  await deService.aiResumeSse(
493
506
  (msg) => {
494
507
  if (msg.actionstate === 20 && msg.actionresult) {
508
+ aiChat.removeWaitingMessage(id);
495
509
  aiChat.isLoading.value = true;
496
510
  if (!aiChat.getActiveAsyncacitonId()) {
497
511
  aiChat.setActiveAsyncacitonId(msg.asyncacitonid);
@@ -561,6 +575,7 @@ class AIChatUtil {
561
575
  }
562
576
  abortController == null ? void 0 : abortController.abort();
563
577
  } finally {
578
+ aiChat.removeWaitingMessage(id);
564
579
  aiChat.isLoading.value = false;
565
580
  aiChat.completeMessage(id, true);
566
581
  aiChat.setActiveAsyncacitonId("");
@@ -1024,6 +1039,12 @@ class AIChatUtil {
1024
1039
  } else {
1025
1040
  chatOptions.chatMessagePageSize = ibiz.config.common.aiChatMessagePageSize;
1026
1041
  }
1042
+ if (params.hasOwnProperty("srfaienableworkspace")) {
1043
+ chatOptions.enableWorkSpace = params.srfaienableworkspace === "true";
1044
+ delete params.srfaienableworkspace;
1045
+ } else {
1046
+ chatOptions.enableWorkSpace = ibiz.config.common.aiEnableWorkSpace;
1047
+ }
1027
1048
  chatOptions.fetchAgentList = (args2 = {}) => {
1028
1049
  const { query, agentid } = args2;
1029
1050
  return this.getAIAgentList(context, {
@@ -1050,7 +1071,12 @@ class AIChatUtil {
1050
1071
  let id = "";
1051
1072
  let abortController;
1052
1073
  const { chatInstance, view, ctrl } = args;
1053
- const fileSystemOptions = await this.getAIFileSystemOptions();
1074
+ let filePreviewMode = ibiz.config.common.aiFilePreviewMode;
1075
+ if (params.hasOwnProperty("srfaifilepreviewmode")) {
1076
+ filePreviewMode = params.srfaifilepreviewmode;
1077
+ delete params.srfaifilepreviewmode;
1078
+ }
1079
+ const fileSystemOptions = await this.getAIFileSystemOptions(filePreviewMode);
1054
1080
  chatOptions.fileSystemOptions = fileSystemOptions;
1055
1081
  chatOptions.history = async (ctx, param, other) => {
1056
1082
  const deService = await ibiz.hub.getApp(ctx.srfappid).deService.getService(ctx, other.appDataEntityId);
@@ -1152,9 +1178,11 @@ class AIChatUtil {
1152
1178
  if (extParams && Object.keys(extParams).length > 0) {
1153
1179
  Object.assign(questionRequestData, { srfextparams: extParams });
1154
1180
  }
1181
+ aiChat.addWaitingMessage(id);
1155
1182
  await deService.aiChatSse(
1156
1183
  (msg) => {
1157
1184
  if (msg.actionstate === 20 && msg.actionresult) {
1185
+ aiChat.removeWaitingMessage(id);
1158
1186
  if (msg.asextparam && localMsgID && updateFlag) {
1159
1187
  aiChat.updateMsgRealMessageID(localMsgID, msg.asextparam);
1160
1188
  updateFlag = false;
@@ -1225,6 +1253,7 @@ class AIChatUtil {
1225
1253
  }
1226
1254
  abortController == null ? void 0 : abortController.abort();
1227
1255
  } finally {
1256
+ aiChat.removeWaitingMessage(id);
1228
1257
  aiChat.setActiveAsyncacitonId("");
1229
1258
  aiChat.completeMessage(id, true);
1230
1259
  return true;
@@ -1284,9 +1313,11 @@ class AIChatUtil {
1284
1313
  srfproject: other.srfproject
1285
1314
  });
1286
1315
  try {
1316
+ aiChat.addWaitingMessage(id);
1287
1317
  await deService.aiResumeSse(
1288
1318
  (msg) => {
1289
1319
  if (msg.actionstate === 20 && msg.actionresult) {
1320
+ aiChat.removeWaitingMessage(id);
1290
1321
  aiChat.isLoading.value = true;
1291
1322
  if (!aiChat.getActiveAsyncacitonId()) {
1292
1323
  aiChat.setActiveAsyncacitonId(msg.asyncacitonid);
@@ -1356,6 +1387,7 @@ class AIChatUtil {
1356
1387
  }
1357
1388
  abortController == null ? void 0 : abortController.abort();
1358
1389
  } finally {
1390
+ aiChat.removeWaitingMessage(id);
1359
1391
  aiChat.isLoading.value = false;
1360
1392
  aiChat.completeMessage(id, true);
1361
1393
  aiChat.setActiveAsyncacitonId("");
@@ -1881,8 +1913,34 @@ class AIChatUtil {
1881
1913
  * @returns {*} {Promise<IData>}
1882
1914
  * @memberof AIChatUtil
1883
1915
  */
1884
- async getAIFileSystemOptions() {
1916
+ async getAIFileSystemOptions(filePreviewMode) {
1885
1917
  const fileSystemOptions = {};
1918
+ fileSystemOptions.filePreviewMode = filePreviewMode;
1919
+ fileSystemOptions.getCustomFilePreviewUrl = async (ctx, param, other) => {
1920
+ var _a;
1921
+ const filePreviewAddress = (_a = ibiz.env.customParams) == null ? void 0 : _a.file_preview_address;
1922
+ if (!filePreviewAddress) {
1923
+ ibiz.message.error(
1924
+ ibiz.i18n.t("util.aiChartUtil.noFilePreviewAddress")
1925
+ );
1926
+ return "";
1927
+ }
1928
+ const { id, name, folder } = other;
1929
+ let { downloadUrl } = ibiz.util.file.calcFileUpDownUrl(
1930
+ ctx,
1931
+ param,
1932
+ {},
1933
+ { osscat: folder }
1934
+ );
1935
+ downloadUrl = downloadUrl.replace("%fileId%", id);
1936
+ const { protocol, hostname, port } = window.location;
1937
+ const actualPort = port || (protocol === "https:" ? "443" : "80");
1938
+ const windowInfo = "".concat(protocol, "//").concat(hostname, ":").concat(actualPort);
1939
+ const filedownloadurl = "".concat(windowInfo).concat(downloadUrl, "?fullfilename=").concat(name);
1940
+ const b64Encoded = ibiz.util.base64.encode(filedownloadurl);
1941
+ const previewUrl = "".concat(filePreviewAddress, "/onlinePreview?url=").concat(encodeURIComponent(b64Encoded));
1942
+ return previewUrl;
1943
+ };
1886
1944
  fileSystemOptions.getFileList = async (ctx, param, other) => {
1887
1945
  const deService = await ibiz.hub.getApp(ctx.srfappid).deService.getService(ctx, param.appDataEntityId);
1888
1946
  const response = await deService.aiChatProject(
@@ -1899,12 +1957,57 @@ class AIChatUtil {
1899
1957
  const response = await deService.aiChatProject(
1900
1958
  ctx,
1901
1959
  { srfactag: param.srfactag },
1902
- { ...other, action: "UPLOAD" }
1960
+ { action: "UPLOAD", ...other }
1903
1961
  );
1904
1962
  if (response.ok)
1905
1963
  return response.data;
1906
1964
  return void 0;
1907
1965
  };
1966
+ fileSystemOptions.createFolder = async (ctx, param, other) => {
1967
+ const deService = await ibiz.hub.getApp(ctx.srfappid).deService.getService(ctx, param.appDataEntityId);
1968
+ const response = await deService.aiChatProject(
1969
+ ctx,
1970
+ { srfactag: param.srfactag },
1971
+ { action: "MKDIR", ...other }
1972
+ );
1973
+ return response.data;
1974
+ };
1975
+ fileSystemOptions.createFile = async (ctx, param, other) => {
1976
+ const deService = await ibiz.hub.getApp(ctx.srfappid).deService.getService(ctx, param.appDataEntityId);
1977
+ const response = await deService.aiChatProject(
1978
+ ctx,
1979
+ { srfactag: param.srfactag },
1980
+ { action: "WRITE", ...other }
1981
+ );
1982
+ return response.data;
1983
+ };
1984
+ fileSystemOptions.move = async (ctx, param, other) => {
1985
+ const deService = await ibiz.hub.getApp(ctx.srfappid).deService.getService(ctx, param.appDataEntityId);
1986
+ const response = await deService.aiChatProject(
1987
+ ctx,
1988
+ { srfactag: param.srfactag },
1989
+ { action: "MOVE", ...other }
1990
+ );
1991
+ return response.data;
1992
+ };
1993
+ fileSystemOptions.delete = async (ctx, param, other) => {
1994
+ const deService = await ibiz.hub.getApp(ctx.srfappid).deService.getService(ctx, param.appDataEntityId);
1995
+ const response = await deService.aiChatProject(
1996
+ ctx,
1997
+ { srfactag: param.srfactag },
1998
+ { recursive: true, action: "DELETE", ...other }
1999
+ );
2000
+ return response.data;
2001
+ };
2002
+ fileSystemOptions.readFile = async (ctx, param, other) => {
2003
+ const deService = await ibiz.hub.getApp(ctx.srfappid).deService.getService(ctx, param.appDataEntityId);
2004
+ const response = await deService.aiChatProject(
2005
+ ctx,
2006
+ { srfactag: param.srfactag },
2007
+ { action: "READ", ...other }
2008
+ );
2009
+ return response.data;
2010
+ };
1908
2011
  fileSystemOptions.getContent = async (ctx, param, id, type, cat) => {
1909
2012
  const app = await ibiz.hub.getAppAsync(ctx.appId);
1910
2013
  const requestUrl = "/ibizutil/downloadtxt/".concat(cat ? "".concat(cat, "/") : "").concat(id, "?type=").concat(type);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ibiz-template/vue3-components",
3
- "version": "0.7.41-alpha.151",
3
+ "version": "0.7.41-alpha.153",
4
4
  "description": "web端组件库(vue3)",
5
5
  "main": "lib/index.cjs",
6
6
  "module": "es/index.mjs",
@@ -31,16 +31,16 @@
31
31
  "dependencies": {
32
32
  "@amap/amap-jsapi-loader": "^1.0.1",
33
33
  "@floating-ui/dom": "^1.5.3",
34
- "@ibiz-template-plugin/ai-chat": "^0.0.116",
34
+ "@ibiz-template-plugin/ai-chat": "^0.0.118",
35
35
  "@ibiz-template-plugin/gantt": "0.1.8-alpha.468",
36
36
  "@ibiz-template-plugin/bi-report": "0.0.32",
37
37
  "@ibiz-template-plugin/data-view": "0.0.8",
38
38
  "@ibiz-template/core": "0.7.41-alpha.152",
39
39
  "@ibiz-template/devtool": "0.0.17",
40
- "@ibiz-template/model-helper": "0.7.41-alpha.152",
41
- "@ibiz-template/runtime": "0.7.41-alpha.152",
40
+ "@ibiz-template/model-helper": "0.7.41-alpha.153",
41
+ "@ibiz-template/runtime": "0.7.41-alpha.153",
42
42
  "@ibiz-template/theme": "0.7.39",
43
- "@ibiz-template/vue3-util": "0.7.41-alpha.152",
43
+ "@ibiz-template/vue3-util": "0.7.41-alpha.153",
44
44
  "@ibiz-template/web-theme": "3.16.0",
45
45
  "@ibiz/model-core": "^0.1.89",
46
46
  "@imengyu/vue3-context-menu": "^1.3.5",
@@ -10,6 +10,7 @@ import {
10
10
  IRawItemContainer,
11
11
  } from '@ibiz/model-core';
12
12
  import { isBase64, isBase64Image, isSvg } from '@ibiz-template/core';
13
+ import { isObject } from 'lodash-es';
13
14
  import { IControlController, IViewController } from '@ibiz-template/runtime';
14
15
  import { parseHtml } from '../../util';
15
16
  import './rawitem.scss';
@@ -119,8 +120,9 @@ export const IBizRawItem = defineComponent({
119
120
  }
120
121
  } else if (['INFO', 'WARNING', 'ERROR'].includes(contentType!)) {
121
122
  rawItemContent.value = (rawItem as IUnkownItem).rawContent!;
122
- } else if (['VIDEO', 'DIVIDER'].includes(contentType!)) {
123
- // 暂不处理
123
+ // 分割线内容解析,视频模型缺少,暂不处理(有rawItemParams则为面板直接内容)
124
+ } else if (contentType === 'DIVIDER' && !rawItem!.rawItemParams) {
125
+ rawItemContent.value = (rawItem as IUnkownItem).rawContent!;
124
126
  } else if (contentType === 'IMAGE' && sysImage) {
125
127
  rawItemContent.value = sysImage;
126
128
  }
@@ -179,6 +181,21 @@ export const IBizRawItem = defineComponent({
179
181
  // 文本类型显示值
180
182
  const rawItemText: Ref<string | number | IData> = ref('');
181
183
 
184
+ // 获取面板项直接内容项参数
185
+ const getRawItemParams = () => {
186
+ const tempParams: IData = {};
187
+ if (
188
+ rawItem &&
189
+ rawItem.rawItemParams &&
190
+ rawItem.rawItemParams.length > 0
191
+ ) {
192
+ rawItem.rawItemParams.forEach((item: IData) => {
193
+ tempParams[item.key] = item.value;
194
+ });
195
+ }
196
+ return tempParams;
197
+ };
198
+
182
199
  // 转换各类值操作
183
200
  const convertValue = () => {
184
201
  // 图片类型
@@ -243,25 +260,43 @@ export const IBizRawItem = defineComponent({
243
260
  )
244
261
  ) {
245
262
  if (rawItemContent.value) {
246
- let rawConfig = {};
263
+ let rawConfig: IData | string = {};
247
264
  try {
265
+ // 兼容json字符串格式与字符串文本模式
248
266
  if (typeof rawItemContent.value === 'string') {
249
- // eslint-disable-next-line no-new-func
250
- const func = new Function(`return (${rawItemContent.value});`);
251
- rawConfig = func();
267
+ // 以 { 或 [ 开头的使用脚本解析,不是则做为文本字符串
268
+ if (/^[[{]/.test(rawItemContent.value)) {
269
+ // eslint-disable-next-line no-new-func
270
+ const func = new Function(`return (${rawItemContent.value});`);
271
+ rawConfig = func();
272
+ } else {
273
+ rawConfig = rawItemContent.value;
274
+ }
252
275
  switch (rawItemType.value) {
253
276
  case 'VIDEO':
254
- Object.assign(playerParams.value, rawConfig);
277
+ if (isObject(rawConfig)) {
278
+ Object.assign(playerParams.value, rawConfig);
279
+ } else {
280
+ playerParams.value.path = rawConfig;
281
+ }
255
282
  break;
256
283
  case 'DIVIDER':
257
- Object.assign(dividerParams.value, rawConfig);
284
+ if (isObject(rawConfig)) {
285
+ Object.assign(dividerParams.value, rawConfig);
286
+ } else {
287
+ dividerParams.value.html = rawConfig;
288
+ }
258
289
  break;
259
290
  case 'INFO':
260
291
  case 'WARNING':
261
292
  case 'ERROR':
262
293
  alertParams.value.type =
263
294
  rawItemType.value.toLocaleLowerCase();
264
- Object.assign(alertParams.value, rawConfig);
295
+ if (isObject(rawConfig)) {
296
+ Object.assign(alertParams.value, rawConfig);
297
+ } else {
298
+ alertParams.value.title = rawConfig;
299
+ }
265
300
  break;
266
301
  default:
267
302
  break;
@@ -274,17 +309,13 @@ export const IBizRawItem = defineComponent({
274
309
  }),
275
310
  );
276
311
  }
277
- } else if (rawItemType.value === 'VIDEO') {
278
- if (
279
- rawItem &&
280
- rawItem.rawItemParams &&
281
- rawItem.rawItemParams.length > 0
282
- ) {
283
- const tempParams: IData = {};
284
- rawItem.rawItemParams.forEach((item: IData) => {
285
- tempParams[item.key] = item.value;
286
- });
312
+ // 面板中分割线、视频支持直接内容项参数
313
+ } else if (['DIVIDER', 'VIDEO'].includes(rawItemType.value)) {
314
+ const tempParams = getRawItemParams();
315
+ if (rawItemType.value === 'VIDEO') {
287
316
  Object.assign(playerParams.value, tempParams);
317
+ } else {
318
+ Object.assign(dividerParams.value, tempParams);
288
319
  }
289
320
  }
290
321
  }
@@ -697,12 +697,14 @@ export const CalendarControl = defineComponent({
697
697
  ? item.text
698
698
  : ''
699
699
  : item.text;
700
+ // htmlCode 有值时才传 v-html,否则传 children
701
+ const vHtmlProps = htmlCode ? { 'v-html': htmlCode } : {};
700
702
  return (
701
703
  <div
702
704
  class={itemClass}
703
705
  style={style}
704
706
  key={item.deData.srfkey}
705
- v-html={htmlCode}
707
+ {...vHtmlProps}
706
708
  title={showTitle(item.tips || item.text)}
707
709
  onClick={(): Promise<void> => this.c.onRowClick(item)}
708
710
  onDblclick={(): Promise<void> => this.c.onDbRowClick(item)}
@@ -130,6 +130,9 @@ export const IBizEmbedAIChat = defineComponent({
130
130
  container: aiChatElementRef.value,
131
131
  compWrapperId: editorParams.compwrapperid || 'DEFAULT',
132
132
  enableBackFill: false,
133
+ isEmbedAiHeaderHidden: editorParams.isembedaiheaderhidden
134
+ ? editorParams.isembedaiheaderhidden === 'true'
135
+ : ibiz.config.common.isEmbedAiHeaderHidden,
133
136
  },
134
137
  topicOptions: {
135
138
  appid: ibiz.env.appId,
@@ -979,6 +979,8 @@ export default {
979
979
  violationPrivacy: 'Violation of Privacy',
980
980
  contentInfringement: 'Content infringement',
981
981
  placeholder: 'Please enter',
982
+ noFilePreviewAddress:
983
+ 'No attachment preview service. Please contact the administrator to add it!',
982
984
  },
983
985
  screenShotUtil: {
984
986
  prepareCanvas: 'Prepare the canvas...',
@@ -922,6 +922,7 @@ export default {
922
922
  violationPrivacy: '侵犯隐私',
923
923
  contentInfringement: '内容侵权',
924
924
  placeholder: '请输入',
925
+ noFilePreviewAddress: '无附件预览服务,请联系管理员添加!',
925
926
  },
926
927
  screenShotUtil: {
927
928
  prepareCanvas: '准备画布中...',