@tencentcloud/roomkit-electron-vue3 2.7.0 → 2.7.2

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 (134) hide show
  1. package/es/components/AITools/AISubtitles.vue.mjs +1 -1
  2. package/es/components/AITools/AISubtitles.vue2.mjs +18 -19
  3. package/es/components/AITools/AITranscription.vue.mjs +1 -1
  4. package/es/components/AITools/AITranscription.vue2.mjs +65 -76
  5. package/es/components/Chat/ChatEditor/index.vue2.mjs +1 -1
  6. package/es/components/Chat/ChatKit/components/TUIChat/chat-header/index.vue2.mjs +1 -1
  7. package/es/components/Chat/ChatKit/components/TUIChat/emoji-config/default-emoji.mjs +4 -4
  8. package/es/components/Chat/ChatKit/components/TUIChat/emoji-config/index.mjs +1 -1
  9. package/es/components/Chat/ChatKit/components/TUIChat/index.vue2.mjs +1 -1
  10. package/es/components/Chat/ChatKit/components/TUIChat/message-input/message-input-quote/index.vue2.mjs +1 -1
  11. package/es/components/Chat/ChatKit/components/TUIChat/message-input-toolbar/emoji-picker/emoji-picker-dialog.vue2.mjs +1 -1
  12. package/es/components/Chat/ChatKit/components/TUIChat/message-input-toolbar/image-upload/index.vue2.mjs +1 -1
  13. package/es/components/Chat/ChatKit/components/TUIChat/message-input-toolbar/video-upload/index.vue2.mjs +1 -1
  14. package/es/components/Chat/ChatKit/components/TUIChat/message-list/index.vue2.mjs +2 -2
  15. package/es/components/Chat/ChatKit/components/TUIChat/message-list/message-elements/message-audio.vue2.mjs +1 -1
  16. package/es/components/Chat/ChatKit/components/TUIChat/message-list/message-elements/message-record/index.vue2.mjs +1 -1
  17. package/es/components/Chat/ChatKit/components/TUIChat/message-list/message-group-application/index.vue2.mjs +2 -2
  18. package/es/components/Chat/ChatKit/components/TUIChat/offlinePushInfoManager/offlinePushInfoManager.mjs +1 -1
  19. package/es/components/Chat/ChatKit/components/TUIChat/utils/sendMessage.mjs +1 -1
  20. package/es/components/Chat/ChatKit/components/common/BottomPopup/index.vue2.mjs +1 -1
  21. package/es/components/Chat/ChatKit/components/common/Dialog/index.vue2.mjs +1 -1
  22. package/es/components/Chat/ChatKit/components/common/Drawer/index.vue2.mjs +1 -1
  23. package/es/components/Chat/ChatKit/components/common/Icon.vue2.mjs +1 -1
  24. package/es/components/Chat/ChatKit/components/common/Overlay/index.vue2.mjs +1 -1
  25. package/es/components/Chat/ChatKit/components/common/Toast/index.mjs +1 -1
  26. package/es/components/Chat/ChatKit/components/common/Toast/index.vue2.mjs +1 -1
  27. package/es/components/Chat/ChatKit/components/common/Transfer/index.vue2.mjs +1 -1
  28. package/es/components/Chat/ChatKit/locales/index.mjs +4 -4
  29. package/es/components/Chat/ChatKit/plugins/plugin-components/message-plugin.vue2.mjs +1 -1
  30. package/es/components/ManageMember/MemberControl/index.vue.mjs +1 -1
  31. package/es/components/ManageMember/MemberControl/index.vue2.mjs +6 -4
  32. package/es/components/ManageMember/MemberControl/useMemberControlHooks.mjs +1 -1
  33. package/es/components/ManageMember/MemberItemCommon/MemberInfo.vue.mjs +1 -1
  34. package/es/components/ManageMember/index.vue2.mjs +1 -1
  35. package/es/components/PreRoom/PasswordDialog.vue2.mjs +1 -1
  36. package/es/components/RoomContent/StreamRegion/StreamPlay/index.vue2.mjs +1 -1
  37. package/es/components/RoomFooter/ApplyControl/MasterApplyControl/index.vue2.mjs +1 -1
  38. package/es/components/RoomFooter/ApplyControl/MemberApplyControl.vue2.mjs +1 -1
  39. package/es/components/RoomFooter/AudioControl.vue2.mjs +1 -1
  40. package/es/components/RoomFooter/BasicBeauty.vue.mjs +1 -1
  41. package/es/components/RoomFooter/BasicBeauty.vue2.mjs +5 -3
  42. package/es/components/RoomFooter/ChatControl.vue.mjs +2 -0
  43. package/es/components/RoomFooter/EndControl/index.vue2.mjs +1 -1
  44. package/es/components/RoomFooter/ScreenShareControl/Index.vue2.mjs +1 -1
  45. package/es/components/RoomFooter/ScreenShareControl/ScreenWindowSelectDialog.vue2.mjs +1 -1
  46. package/es/components/RoomFooter/VideoControl.vue2.mjs +2 -2
  47. package/es/components/RoomFooter/VirtualBackground.vue2.mjs +1 -1
  48. package/es/components/RoomFooter/WhiteboardControl.vue.mjs +1 -1
  49. package/es/components/RoomHeader/UserInfo/index.vue.mjs +1 -1
  50. package/es/components/RoomHeader/UserInfo/index.vue2.mjs +2 -1
  51. package/es/components/RoomHeader/index/LayoutControl.vue2.mjs +1 -1
  52. package/es/components/RoomHome/RoomControl/index.vue2.mjs +2 -2
  53. package/es/components/RoomInvite/InvitationNotification.vue2.mjs +1 -1
  54. package/es/components/RoomInvite/index.vue2.mjs +1 -1
  55. package/es/components/RoomSetting/index.vue2.mjs +1 -1
  56. package/es/components/ScheduleConference/Contacts.vue2.mjs +1 -1
  57. package/es/components/ScheduleConference/ScheduleConferencePanel/index.vue2.mjs +2 -2
  58. package/es/components/ScheduleConference/ScheduleRoomControl.vue2.mjs +2 -2
  59. package/es/components/ScheduleConference/ScheduleRoomList.vue2.mjs +1 -1
  60. package/es/components/ScheduleConference/ShareLink.vue2.mjs +1 -1
  61. package/es/components/common/VideoProfile.vue2.mjs +1 -1
  62. package/es/components/common/VideoSettingTab.vue2.mjs +2 -2
  63. package/es/components/common/base/Button.vue2.mjs +1 -1
  64. package/es/components/common/base/Dialog/index.vue2.mjs +1 -1
  65. package/es/components/common/base/Input/index.vue2.mjs +1 -1
  66. package/es/components/common/base/Message/Message.vue2.mjs +1 -1
  67. package/es/components/common/base/MessageBox/index.vue2.mjs +1 -1
  68. package/es/components/common/base/SvgIcon.vue2.mjs +1 -1
  69. package/es/constants/room.mjs +1 -3
  70. package/es/extension/RoomMessageCard/RoomMessageCard.vue2.mjs +1 -1
  71. package/es/extension/chatExtension.mjs +3 -6
  72. package/es/hooks/useDeviceManager.mjs +1 -1
  73. package/es/index.mjs +134 -126
  74. package/es/services/function/aiTask.d.ts +13 -17
  75. package/es/services/function/aiTask.mjs +63 -100
  76. package/es/services/manager/MediaManager.mjs +1 -1
  77. package/es/services/manager/dataReportManager.d.ts +4 -1
  78. package/es/services/manager/dataReportManager.mjs +3 -0
  79. package/es/services/manager/roomActionManager.mjs +1 -1
  80. package/es/services/roomService.mjs +1 -1
  81. package/es/stores/basic.mjs +1 -1
  82. package/es/stores/room.mjs +1 -4
  83. package/es/utils/common/logger/index.mjs +1 -1
  84. package/es/utils/utils.d.ts +2 -0
  85. package/es/utils/utils.mjs +33 -0
  86. package/lib/components/AITools/AISubtitles.vue.js +1 -1
  87. package/lib/components/AITools/AISubtitles.vue2.js +17 -18
  88. package/lib/components/AITools/AITranscription.vue.js +1 -1
  89. package/lib/components/AITools/AITranscription.vue2.js +64 -75
  90. package/lib/components/Chat/ChatKit/components/TUIChat/message-input/index.vue2.js +6 -6
  91. package/lib/components/Chat/ChatKit/components/TUIChat/message-list/index.vue2.js +8 -8
  92. package/lib/components/Chat/ChatKit/components/TUIChat/message-list/message-elements/message-quote/index.vue2.js +4 -4
  93. package/lib/components/Chat/ChatKit/components/TUIChat/message-list/message-tool/index.vue2.js +10 -10
  94. package/lib/components/Chat/ChatKit/locales/index.js +4 -4
  95. package/lib/components/ManageMember/MemberControl/index.vue.js +1 -1
  96. package/lib/components/ManageMember/MemberControl/index.vue2.js +5 -3
  97. package/lib/components/ManageMember/MemberItemCommon/MemberInfo.vue.js +1 -1
  98. package/lib/components/RoomContent/StreamContainer/index.vue2.js +6 -6
  99. package/lib/components/RoomFooter/AudioControl.vue2.js +4 -4
  100. package/lib/components/RoomFooter/BasicBeauty.vue.js +1 -1
  101. package/lib/components/RoomFooter/BasicBeauty.vue2.js +3 -1
  102. package/lib/components/RoomFooter/ChatControl.vue.js +2 -0
  103. package/lib/components/RoomFooter/ScreenShareControl/Index.vue2.js +5 -5
  104. package/lib/components/RoomFooter/VideoControl.vue2.js +4 -4
  105. package/lib/components/RoomHeader/UserInfo/index.vue.js +1 -1
  106. package/lib/components/RoomHeader/UserInfo/index.vue2.js +2 -1
  107. package/lib/components/ScheduleConference/ScheduleConferencePanel/index.vue2.js +1 -1
  108. package/lib/components/ScheduleConference/ScheduleRoomControl.vue2.js +1 -1
  109. package/lib/components/ScheduleConference/ScheduleRoomList.vue2.js +1 -1
  110. package/lib/conference.vue2.js +12 -12
  111. package/lib/constants/room.js +1 -3
  112. package/lib/extension/chatExtension.js +1 -4
  113. package/lib/hooks/useMasterApplyControl.js +9 -9
  114. package/lib/index.js +134 -126
  115. package/lib/preConference.vue2.js +7 -7
  116. package/lib/services/function/aiTask.d.ts +13 -17
  117. package/lib/services/function/aiTask.js +63 -100
  118. package/lib/services/manager/dataReportManager.d.ts +4 -1
  119. package/lib/services/manager/dataReportManager.js +3 -0
  120. package/lib/stores/room.js +0 -3
  121. package/lib/utils/utils.d.ts +2 -0
  122. package/lib/utils/utils.js +33 -0
  123. package/package.json +2 -2
  124. package/src/TUIRoom/components/AITools/AISubtitles.vue +26 -23
  125. package/src/TUIRoom/components/AITools/AITranscription.vue +106 -101
  126. package/src/TUIRoom/components/ManageMember/MemberControl/index.vue +8 -3
  127. package/src/TUIRoom/components/ManageMember/MemberItemCommon/MemberInfo.vue +1 -1
  128. package/src/TUIRoom/components/RoomFooter/BasicBeauty.vue +2 -1
  129. package/src/TUIRoom/components/RoomFooter/ChatControl.vue +2 -1
  130. package/src/TUIRoom/components/RoomHeader/UserInfo/index.vue +2 -5
  131. package/src/TUIRoom/services/function/aiTask.ts +79 -113
  132. package/src/TUIRoom/services/manager/dataReportManager.ts +3 -0
  133. package/src/TUIRoom/stores/room.ts +0 -3
  134. package/src/TUIRoom/utils/utils.ts +47 -0
@@ -3,18 +3,20 @@ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { en
3
3
  var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
4
4
  import mitt from "mitt";
5
5
  import { isElectron, isMobile } from "../../utils/environment.mjs";
6
+ import { findLastIndex } from "../../utils/utils.mjs";
6
7
  var AI_TASK = /* @__PURE__ */ ((AI_TASK2) => {
7
8
  AI_TASK2["TRANSCRIPTION_TASK"] = "transcription";
8
9
  return AI_TASK2;
9
10
  })(AI_TASK || {});
11
+ const ASR_EVENT_CODE = 1e4;
10
12
  class AITask {
11
13
  constructor(service) {
12
14
  __publicField(this, "emitter", mitt());
13
15
  __publicField(this, "trtc");
14
16
  __publicField(this, "service");
15
- __publicField(this, "subtitleMsg", []);
16
- __publicField(this, "subtitleText", { value: "" });
17
- __publicField(this, "transcriptionText", { value: "" });
17
+ __publicField(this, "subtitleMessages", {});
18
+ __publicField(this, "transcribedMessageList", []);
19
+ __publicField(this, "subtitleTimeout", {});
18
20
  this.service = service;
19
21
  if (isElectron || isMobile) return;
20
22
  this.bindCtx();
@@ -43,126 +45,87 @@ class AITask {
43
45
  if (typeof ((_a = this.service.roomEngine.instance) == null ? void 0 : _a.getTRTCCloud) === "undefined" || typeof ((_c = (_b = this.service.roomEngine.instance) == null ? void 0 : _b.getTRTCCloud()) == null ? void 0 : _c._trtc) === "undefined") {
44
46
  return;
45
47
  }
46
- const trtc = (_d = this.service.roomEngine.instance) == null ? void 0 : _d.getTRTCCloud()._trtc;
47
- this.trtc = trtc;
48
- trtc.on("custom-message", this.handleAIMessage);
48
+ this.trtc = (_d = this.service.roomEngine.instance) == null ? void 0 : _d.getTRTCCloud()._trtc;
49
+ this.trtc.on("custom-message", this.handleAIMessage);
49
50
  }
50
51
  handleUnmount() {
51
52
  var _a;
52
- this.subtitleMsg = [];
53
- this.subtitleText.value = "";
54
- this.transcriptionText.value = "";
53
+ this.subtitleMessages = {};
54
+ this.transcribedMessageList = [];
55
55
  (_a = this.trtc) == null ? void 0 : _a.off("custom-message", this.handleAIMessage);
56
56
  }
57
57
  bindEvent() {
58
58
  this.service.lifeCycleManager.on("mount", this.handleMount);
59
59
  this.service.lifeCycleManager.on("unmount", this.handleUnmount);
60
60
  }
61
- // todo trtc defines this type as any
61
+ resetSubtitleTimeout(id, fn) {
62
+ if (this.subtitleTimeout[id]) {
63
+ clearTimeout(this.subtitleTimeout[id]);
64
+ }
65
+ this.subtitleTimeout[id] = setTimeout(fn, 3e3);
66
+ }
62
67
  handleAIMessage(event) {
63
68
  if (event.cmdId !== 1) return;
64
69
  const data = new TextDecoder().decode(event.data);
65
70
  const jsonData = JSON.parse(data);
66
71
  this.handleMessage(jsonData);
67
72
  this.emit("transcription", {
68
- subtitleText: this.subtitleText,
69
- transcriptionText: this.transcriptionText,
70
- subtitleMsg: this.subtitleMsg
73
+ subtitleMessages: this.subtitleMessages,
74
+ transcribedMessageList: this.transcribedMessageList
71
75
  });
72
76
  }
73
77
  handleMessage(data) {
74
- const refreshSubtitle = () => {
75
- let displayText = "";
76
- for (let i = 0; i < this.subtitleMsg.length; i++) {
77
- displayText += `${this.service.roomStore.getDisplayName(this.subtitleMsg[i].userid)}: ${this.subtitleMsg[i].text}
78
- `;
79
- if (this.subtitleMsg[i].translation_text !== "") {
80
- displayText += `${this.service.roomStore.getDisplayName(this.subtitleMsg[i].userid)}: ${this.subtitleMsg[i].translation_text}
81
- `;
82
- }
83
- }
84
- this.subtitleText.value = displayText;
78
+ if (data.type !== ASR_EVENT_CODE) return;
79
+ const { sender, payload } = data;
80
+ const { end } = payload;
81
+ const createSubtitleMsg = () => {
82
+ return {
83
+ sender,
84
+ text: payload.text,
85
+ translationText: payload.translation_text,
86
+ startMsTs: data.start_ms_ts,
87
+ end
88
+ };
85
89
  };
86
- if (data.type === 1e4 && data.payload.end === false) {
87
- let exist = false;
88
- for (let i = 0; i < this.subtitleMsg.length; i++) {
89
- if (data.sender === this.subtitleMsg[i].userid) {
90
- this.subtitleMsg[i].text = data.payload.text;
91
- this.subtitleMsg[i].translation_text = data.payload.translation_text;
92
- exist = true;
93
- break;
94
- }
95
- }
96
- if (!exist) {
97
- this.subtitleMsg.push({
98
- userid: data.sender,
99
- text: data.payload.text,
100
- translation_text: data.payload.translation_text
101
- });
102
- }
103
- refreshSubtitle();
104
- } else if (data.type === 1e4 && data.payload.end === true) {
105
- for (let i = 0; i < this.subtitleMsg.length; i++) {
106
- if (data.sender === this.subtitleMsg[i].userid) {
107
- this.subtitleMsg[i].text = data.payload.text;
108
- this.subtitleMsg[i].translation_text = data.payload.translation_text;
109
- break;
110
- }
111
- }
112
- refreshSubtitle();
113
- let content = `${data.payload.start_time}->${data.payload.end_time} ${data.sender}: ${data.payload.text}
114
- `;
115
- if (data.payload.translation_text !== "") {
116
- content += `${data.payload.start_time}->${data.payload.end_time} ${data.sender}: ${data.payload.translation_text}
117
- `;
90
+ const updateMsg = (msg) => {
91
+ msg.text = payload.text;
92
+ msg.translationText = payload.translation_text;
93
+ msg.end = end;
94
+ };
95
+ const appendMsg = (msg, target) => {
96
+ if (Array.isArray(target)) {
97
+ target.push(msg);
98
+ } else if (typeof target === "object") {
99
+ const recordTarget = target;
100
+ recordTarget[msg.sender] = msg;
101
+ } else {
102
+ throw new Error("Invalid target type");
118
103
  }
119
- this.transcriptionText.value += content;
104
+ };
105
+ const existingSubtitle = this.subtitleMessages[sender];
106
+ if (existingSubtitle) {
107
+ updateMsg(existingSubtitle);
108
+ } else {
109
+ appendMsg(createSubtitleMsg(), this.subtitleMessages);
120
110
  }
121
- if (data.type === "subtitle") {
122
- let exist = false;
123
- for (let i = 0; i < this.subtitleMsg.length; i++) {
124
- if (data.userid === this.subtitleMsg[i].userid) {
125
- this.subtitleMsg[i].text = data.text;
126
- this.subtitleMsg[i].translation_text = data.translation_text;
127
- exist = true;
128
- break;
129
- }
130
- }
131
- if (!exist) {
132
- this.subtitleMsg.push({
133
- userid: data.userid,
134
- text: data.text,
135
- translation_text: data.translation_text
136
- });
137
- }
138
- refreshSubtitle();
139
- } else if (data.type === "transcription") {
140
- for (let i = 0; i < this.subtitleMsg.length; i++) {
141
- if (data.userid === this.subtitleMsg[i].userid) {
142
- this.subtitleMsg[i].text = data.text;
143
- this.subtitleMsg[i].translation_text = data.translation_text;
144
- break;
145
- }
146
- }
147
- refreshSubtitle();
148
- let content = `${formatTimestampToTime(data.start_ms_ts)}->${formatTimestampToTime(data.end_ms_ts)} ${this.service.roomStore.getDisplayName(data.userid)}: ${data.text}
149
- `;
150
- if (data.translation_text !== "") {
151
- content += `${formatTimestampToTime(data.start_ms_ts)}->${formatTimestampToTime(data.end_ms_ts)} ${this.service.roomStore.getDisplayName(data.userid)}: ${data.translation_text}
152
- `;
153
- }
154
- this.transcriptionText.value += content;
111
+ const transcriptionIndex = findLastIndex(
112
+ this.transcribedMessageList,
113
+ (msg) => msg.sender === sender && !msg.end
114
+ );
115
+ if (transcriptionIndex !== -1) {
116
+ updateMsg(this.transcribedMessageList[transcriptionIndex]);
117
+ } else {
118
+ appendMsg(createSubtitleMsg(), this.transcribedMessageList);
155
119
  }
120
+ this.resetSubtitleTimeout(sender, () => {
121
+ if (!end) return;
122
+ delete this.subtitleMessages[sender];
123
+ this.emit("transcription", {
124
+ subtitleMessages: this.subtitleMessages,
125
+ transcribedMessageList: this.transcribedMessageList
126
+ });
127
+ });
156
128
  }
157
- StartAITranscription() {
158
- }
159
- }
160
- function formatTimestampToTime(timestamp) {
161
- const date = new Date(timestamp);
162
- const hours = date.getHours().toString().padStart(2, "0");
163
- const minutes = date.getMinutes().toString().padStart(2, "0");
164
- const seconds = date.getSeconds().toString().padStart(2, "0");
165
- return `${hours}:${minutes}:${seconds}`;
166
129
  }
167
130
  export {
168
131
  AITask,
@@ -1,7 +1,7 @@
1
1
  var __defProp = Object.defineProperty;
2
2
  var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3
3
  var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
4
- import TUIRoomEngine__default, { TUIVideoStreamType, TRTCVideoStreamType, TRTCVideoFillMode, TRTCVideoMirrorType, TRTCVideoRotation, TUIChangeReason, TUIRoomEvents } from "@tencentcloud/tuiroom-engine-electron";
4
+ import TUIRoomEngine__default, { TUIVideoStreamType, TRTCVideoStreamType, TRTCVideoFillMode, TRTCVideoRotation, TRTCVideoMirrorType, TUIChangeReason, TUIRoomEvents } from "@tencentcloud/tuiroom-engine-electron";
5
5
  import { EventType } from "../types.mjs";
6
6
  import { isMobile } from "../../utils/environment.mjs";
7
7
  import { MESSAGE_DURATION } from "../../constants/message.mjs";
@@ -10,7 +10,10 @@ export declare enum MetricsKey {
10
10
  disableScreenSharing = 106053,
11
11
  enableWatermark = 106054,
12
12
  enableVirtualBackground = 106055,
13
- hideFeatureButton = 106056
13
+ hideFeatureButton = 106056,
14
+ openChat = 106057,
15
+ setBasicBeauty = 106058,
16
+ aiTask = 106059
14
17
  }
15
18
  export declare class DataReportManager {
16
19
  private taskQueue;
@@ -16,6 +16,9 @@ var MetricsKey = /* @__PURE__ */ ((MetricsKey2) => {
16
16
  MetricsKey2[MetricsKey2["enableWatermark"] = 106054] = "enableWatermark";
17
17
  MetricsKey2[MetricsKey2["enableVirtualBackground"] = 106055] = "enableVirtualBackground";
18
18
  MetricsKey2[MetricsKey2["hideFeatureButton"] = 106056] = "hideFeatureButton";
19
+ MetricsKey2[MetricsKey2["openChat"] = 106057] = "openChat";
20
+ MetricsKey2[MetricsKey2["setBasicBeauty"] = 106058] = "setBasicBeauty";
21
+ MetricsKey2[MetricsKey2["aiTask"] = 106059] = "aiTask";
19
22
  return MetricsKey2;
20
23
  })(MetricsKey || {});
21
24
  class DataReportManager {
@@ -1,7 +1,7 @@
1
1
  var __defProp = Object.defineProperty;
2
2
  var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3
3
  var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
4
- import { TRTCVideoEncParam, TRTCVideoResolution, TUIRoomType, TUISeatMode, TUIMediaDeviceType, TUIVideoStreamType } from "@tencentcloud/tuiroom-engine-electron";
4
+ import { TUISeatMode, TUIRoomType, TUIMediaDeviceType, TRTCVideoEncParam, TUIVideoStreamType, TRTCVideoResolution } from "@tencentcloud/tuiroom-engine-electron";
5
5
  import { EventType } from "../types.mjs";
6
6
  import { isWeChat, isMobile } from "../../utils/environment.mjs";
7
7
  import logger from "../../utils/common/logger/index.mjs";
@@ -4,7 +4,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
4
4
  import mitt from "mitt";
5
5
  import useGetRoomEngine from "../hooks/useRoomEngine.mjs";
6
6
  import { EventType } from "./types.mjs";
7
- import TUIRoomEngine__default, { TUIRoomEvents, TUIKickedOutOfRoomReason, TUIRole, TRTCVideoMirrorType, TRTCVideoRotation, TRTCVideoFillMode } from "@tencentcloud/tuiroom-engine-electron";
7
+ import TUIRoomEngine__default, { TUIRoomEvents, TUIKickedOutOfRoomReason, TUIRole, TRTCVideoMirrorType, TRTCVideoFillMode, TRTCVideoRotation } from "@tencentcloud/tuiroom-engine-electron";
8
8
  import { useBasicStore } from "../stores/basic.mjs";
9
9
  import { useRoomStore } from "../stores/room.mjs";
10
10
  import { useChatStore } from "../stores/chat.mjs";
@@ -2,7 +2,7 @@ import { defineStore } from "pinia";
2
2
  import { getLanguage } from "../utils/common.mjs";
3
3
  import { LAYOUT } from "../constants/render.mjs";
4
4
  import { isUndefined } from "../utils/utils.mjs";
5
- import { isElectron, isWeChat, isMobile } from "../utils/environment.mjs";
5
+ import { isMobile, isWeChat, isElectron } from "../utils/environment.mjs";
6
6
  function getDefaultLayout() {
7
7
  if (isMobile) {
8
8
  return isWeChat ? LAYOUT.SIX_EQUAL_POINTS : LAYOUT.LARGE_SMALL_WINDOW;
@@ -1,5 +1,5 @@
1
1
  import { defineStore } from "pinia";
2
- import { TUIVideoQuality, TUISeatMode, TUIVideoStreamType, TUIRole, TUIMediaDeviceType, TUIInvitationStatus } from "@tencentcloud/tuiroom-engine-electron";
2
+ import { TUIVideoQuality, TUISeatMode, TUIInvitationStatus, TUIRole, TUIMediaDeviceType, TUIVideoStreamType } from "@tencentcloud/tuiroom-engine-electron";
3
3
  import { useBasicStore } from "./basic.mjs";
4
4
  import { set, del } from "../utils/vue.mjs";
5
5
  import { isMobile } from "../utils/environment.mjs";
@@ -410,9 +410,6 @@ const useRoomStore = defineStore("room", {
410
410
  updateVideoQuality(quality) {
411
411
  this.localVideoQuality = quality;
412
412
  },
413
- setLocalUser(obj) {
414
- Object.assign(this.localUser, obj);
415
- },
416
413
  setDeviceList(type, deviceList) {
417
414
  switch (type) {
418
415
  case TUIMediaDeviceType.kMediaDeviceTypeVideoCamera:
@@ -1,5 +1,5 @@
1
1
  import { EUserEventNames } from "./logger-constants.mjs";
2
- import { getLogPrefix, LogContext, LogLevelType } from "./logger-utils.mjs";
2
+ import { LogLevelType, getLogPrefix, LogContext } from "./logger-utils.mjs";
3
3
  let currentLogLevel = LogLevelType.LOG_LEVEL_DEBUG;
4
4
  const logger = {
5
5
  debug(...args) {
@@ -60,3 +60,5 @@ export declare function convertSecondsToHMS(seconds: number): {
60
60
  seconds: number;
61
61
  };
62
62
  export declare function getNanoId(size?: number): string;
63
+ export declare function findLastIndex<T>(array: T[], predicate: (value: T, index: number, obj: T[]) => boolean, thisArg?: any): number;
64
+ export declare function formatTimestampToTime(timestamp: number, format?: string): string;
@@ -145,6 +145,37 @@ function getNanoId(size = 21) {
145
145
  }
146
146
  return id;
147
147
  }
148
+ function findLastIndex(array, predicate, thisArg) {
149
+ const len = array.length >>> 0;
150
+ let k = len - 1;
151
+ while (k >= 0) {
152
+ const kValue = array[k];
153
+ if (predicate.call(thisArg, kValue, k, array)) {
154
+ return k;
155
+ }
156
+ k = k - 1;
157
+ }
158
+ return -1;
159
+ }
160
+ function formatTimestampToTime(timestamp, format = "MM-DD HH:mm") {
161
+ const date = new Date(timestamp);
162
+ const padStart = (value, length = 2) => value.toString().padStart(length, "0");
163
+ const replacements = {
164
+ YYYY: date.getFullYear().toString(),
165
+ YY: (date.getFullYear() % 100).toString().padStart(2, "0"),
166
+ MM: padStart(date.getMonth() + 1),
167
+ DD: padStart(date.getDate()),
168
+ HH: padStart(date.getHours()),
169
+ hh: padStart(date.getHours() % 12),
170
+ mm: padStart(date.getMinutes()),
171
+ ss: padStart(date.getSeconds()),
172
+ A: date.getHours() >= 12 ? "PM" : "AM"
173
+ };
174
+ return format.replace(
175
+ /YYYY|YY|MM|DD|HH|hh|mm|ss|A/g,
176
+ (match) => replacements[match]
177
+ );
178
+ }
148
179
  export {
149
180
  addSuffix,
150
181
  calculateByteLength,
@@ -152,6 +183,8 @@ export {
152
183
  debounce,
153
184
  deepClone,
154
185
  exitFullScreen,
186
+ findLastIndex,
187
+ formatTimestampToTime,
155
188
  getNanoId,
156
189
  getUrlParam,
157
190
  getUrlWithRoomId,
@@ -3,5 +3,5 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
3
3
  const AISubtitles_vue_vue_type_script_setup_true_lang = require("./AISubtitles.vue2.js");
4
4
  ;/* empty css */
5
5
  const _pluginVue_exportHelper = require("../../_virtual/_plugin-vue_export-helper.js");
6
- const AISubtitlesOverlay = /* @__PURE__ */ _pluginVue_exportHelper.default(AISubtitles_vue_vue_type_script_setup_true_lang.default, [["__scopeId", "data-v-720279c8"]]);
6
+ const AISubtitlesOverlay = /* @__PURE__ */ _pluginVue_exportHelper.default(AISubtitles_vue_vue_type_script_setup_true_lang.default, [["__scopeId", "data-v-cacf47e3"]]);
7
7
  exports.default = AISubtitlesOverlay;
@@ -8,6 +8,7 @@ require("@tencentcloud/tuiroom-engine-electron");
8
8
  require("mitt");
9
9
  require("../../services/manager/roomActionManager.js");
10
10
  require("@tencentcloud/tui-core");
11
+ const dataReportManager = require("../../services/manager/dataReportManager.js");
11
12
  const aiTask = require("../../services/function/aiTask.js");
12
13
  const _hoisted_1 = {
13
14
  key: 0,
@@ -16,32 +17,30 @@ const _hoisted_1 = {
16
17
  const _sfc_main = /* @__PURE__ */ Vue.defineComponent({
17
18
  __name: "AISubtitles",
18
19
  setup(__props) {
19
- const rawSubtitleText = Vue.ref("");
20
- const subtitleLines = Vue.computed(
21
- () => rawSubtitleText.value.split("\n").filter((item) => item)
22
- );
23
- let subtitleTimeout = null;
24
- const resetSubtitleTimeout = () => {
25
- if (subtitleTimeout) {
26
- clearTimeout(subtitleTimeout);
27
- }
28
- subtitleTimeout = setTimeout(() => {
29
- rawSubtitleText.value = "";
30
- }, 3e3);
31
- };
20
+ const subtitleMessages = Vue.ref({});
21
+ const subtitleLines = Vue.computed(() => {
22
+ const arr = Object.keys(subtitleMessages.value).map((userId) => {
23
+ return subtitleMessages.value[userId];
24
+ });
25
+ return arr.sort((a, b) => a.startMsTs - b.startMsTs);
26
+ });
32
27
  const handleAISubtitles = (data) => {
33
28
  if (!data) return;
34
- rawSubtitleText.value = data.subtitleText.value;
35
- resetSubtitleTimeout();
29
+ subtitleMessages.value = Object.assign({}, data.subtitleMessages);
36
30
  };
37
- roomService.roomService.aiTask.on(aiTask.AI_TASK.TRANSCRIPTION_TASK, handleAISubtitles);
31
+ Vue.onMounted(() => {
32
+ roomService.roomService.dataReportManager.reportCount(dataReportManager.MetricsKey.aiTask);
33
+ roomService.roomService.aiTask.on(aiTask.AI_TASK.TRANSCRIPTION_TASK, handleAISubtitles);
34
+ });
38
35
  Vue.onUnmounted(() => {
39
36
  roomService.roomService.aiTask.off(aiTask.AI_TASK.TRANSCRIPTION_TASK, handleAISubtitles);
40
37
  });
41
38
  return (_ctx, _cache) => {
42
39
  return subtitleLines.value.length ? (Vue.openBlock(), Vue.createElementBlock("div", _hoisted_1, [
43
- (Vue.openBlock(true), Vue.createElementBlock(Vue.Fragment, null, Vue.renderList(subtitleLines.value, (line, index) => {
44
- return Vue.openBlock(), Vue.createElementBlock("div", { key: index }, Vue.toDisplayString(line), 1);
40
+ (Vue.openBlock(true), Vue.createElementBlock(Vue.Fragment, null, Vue.renderList(subtitleLines.value, (line) => {
41
+ return Vue.openBlock(), Vue.createElementBlock("div", {
42
+ key: line.sender
43
+ }, Vue.toDisplayString(`${Vue.unref(roomService.roomService).roomStore.getDisplayName(line.sender)}: ${line == null ? void 0 : line.text}`), 1);
45
44
  }), 128))
46
45
  ])) : Vue.createCommentVNode("", true);
47
46
  };
@@ -3,5 +3,5 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
3
3
  const AITranscription_vue_vue_type_script_setup_true_lang = require("./AITranscription.vue2.js");
4
4
  ;/* empty css */
5
5
  const _pluginVue_exportHelper = require("../../_virtual/_plugin-vue_export-helper.js");
6
- const AITranscription = /* @__PURE__ */ _pluginVue_exportHelper.default(AITranscription_vue_vue_type_script_setup_true_lang.default, [["__scopeId", "data-v-ef9f284c"]]);
6
+ const AITranscription = /* @__PURE__ */ _pluginVue_exportHelper.default(AITranscription_vue_vue_type_script_setup_true_lang.default, [["__scopeId", "data-v-35b9944f"]]);
7
7
  exports.default = AITranscription;
@@ -8,108 +8,97 @@ require("@tencentcloud/tuiroom-engine-electron");
8
8
  require("mitt");
9
9
  require("../../services/manager/roomActionManager.js");
10
10
  require("@tencentcloud/tui-core");
11
+ const dataReportManager = require("../../services/manager/dataReportManager.js");
11
12
  const aiTask = require("../../services/function/aiTask.js");
13
+ const utils = require("../../utils/utils.js");
12
14
  const _hoisted_1 = { class: "title" };
13
15
  const _hoisted_2 = { class: "speaker" };
14
16
  const _hoisted_3 = { class: "timestamp" };
15
- const _hoisted_4 = { class: "content" };
17
+ const timeInterval = 60 * 1e3;
16
18
  const _sfc_main = /* @__PURE__ */ Vue.defineComponent({
17
19
  __name: "AITranscription",
18
20
  setup(__props) {
19
- const conversationContainer = Vue.ref(null);
20
- Vue.onMounted(() => scrollToBottom());
21
- const processedConversations = Vue.ref(processConversation(roomService.roomService.aiTask.transcriptionText.value));
21
+ const conversationContainerRef = Vue.ref();
22
+ const isUserScrolling = Vue.ref(false);
23
+ const rawTranscribedMessageList = Vue.ref(
24
+ roomService.roomService.aiTask.transcribedMessageList
25
+ );
26
+ Vue.onMounted(() => {
27
+ scrollToBottom();
28
+ });
22
29
  const scrollToBottom = async () => {
23
- if (conversationContainer.value) {
30
+ if (conversationContainerRef.value && !isUserScrolling.value) {
24
31
  await Vue.nextTick();
25
- conversationContainer.value.scrollIntoView({ block: "end" });
32
+ conversationContainerRef.value.scrollTop = conversationContainerRef.value.scrollHeight;
33
+ }
34
+ };
35
+ const handleScroll = () => {
36
+ if (conversationContainerRef.value) {
37
+ const isAtBottom = conversationContainerRef.value.scrollTop + conversationContainerRef.value.clientHeight >= conversationContainerRef.value.scrollHeight - 5;
38
+ if (isAtBottom) {
39
+ isUserScrolling.value = false;
40
+ scrollToBottom();
41
+ } else {
42
+ isUserScrolling.value = true;
43
+ }
26
44
  }
27
45
  };
28
- const conversations = Vue.computed(() => {
29
- const result = [];
30
- let currentSpeaker = null;
31
- let currentTimestamp = null;
32
- let currentMessages = [];
33
- processedConversations.value.forEach((item) => {
34
- const [start, end] = item.timestamp.split("->");
35
- const timestampMinute = start.slice(0, 5);
36
- if (item.speaker === currentSpeaker && timestampMinute === currentTimestamp) {
37
- currentMessages.push(item.content);
46
+ const transcribedMessageList = Vue.computed(() => {
47
+ const aggregatedMessageList = [];
48
+ let currentAggregatedMessage = null;
49
+ for (const message of rawTranscribedMessageList.value) {
50
+ if (!currentAggregatedMessage || message.sender !== currentAggregatedMessage.sender || message.startMsTs - currentAggregatedMessage.startMsTs > timeInterval) {
51
+ currentAggregatedMessage = {
52
+ messages: [message],
53
+ sender: message.sender,
54
+ startMsTs: message.startMsTs
55
+ };
56
+ aggregatedMessageList.push(currentAggregatedMessage);
38
57
  } else {
39
- if (currentSpeaker !== null) {
40
- result.push({
41
- timestamp: currentTimestamp,
42
- speaker: currentSpeaker,
43
- messages: currentMessages
44
- });
45
- }
46
- currentSpeaker = item.speaker;
47
- currentTimestamp = timestampMinute;
48
- currentMessages = [item.content];
58
+ currentAggregatedMessage.messages.push(message);
49
59
  }
50
- });
51
- if (currentSpeaker !== null) {
52
- result.push({
53
- timestamp: currentTimestamp,
54
- speaker: currentSpeaker,
55
- messages: currentMessages
56
- });
57
60
  }
58
- return result;
61
+ return aggregatedMessageList;
59
62
  });
60
- roomService.roomService.aiTask.on(aiTask.AI_TASK.TRANSCRIPTION_TASK, (data) => {
63
+ Vue.watch(rawTranscribedMessageList, () => {
64
+ scrollToBottom();
65
+ });
66
+ const handleAITranscriptionTask = async (data) => {
61
67
  if (!data) return;
62
- processedConversations.value = processConversation(
63
- data.transcriptionText.value
64
- );
68
+ rawTranscribedMessageList.value = [...data.transcribedMessageList];
69
+ };
70
+ Vue.onMounted(() => {
71
+ roomService.roomService.dataReportManager.reportCount(dataReportManager.MetricsKey.aiTask);
72
+ roomService.roomService.aiTask.on(aiTask.AI_TASK.TRANSCRIPTION_TASK, handleAITranscriptionTask);
73
+ });
74
+ Vue.onUnmounted(() => {
75
+ roomService.roomService.aiTask.off(aiTask.AI_TASK.TRANSCRIPTION_TASK, handleAITranscriptionTask);
65
76
  });
66
- function processConversation(data) {
67
- const pattern = /(\d{2}:\d{2}:\d{2}->\d{2}:\d{2}:\d{2})\s+([\u4e00-\u9fa5\w]+):\s*(.*)/;
68
- const conversations2 = [];
69
- const lines = data.split("\n");
70
- lines.forEach((line) => {
71
- const match = pattern.exec(line);
72
- if (match) {
73
- const timestamp = match[1];
74
- const speaker = match[2];
75
- const content = match[3];
76
- conversations2.push({
77
- timestamp,
78
- speaker,
79
- content
80
- });
81
- }
82
- });
83
- conversations2.sort((a, b) => {
84
- const timeA = a.timestamp.split("->")[0];
85
- const timeB = b.timestamp.split("->")[0];
86
- return timeA.localeCompare(timeB);
87
- });
88
- return conversations2;
89
- }
90
77
  return (_ctx, _cache) => {
91
78
  return Vue.openBlock(), Vue.createElementBlock("div", {
92
79
  class: "conversation",
93
- ref_key: "conversationContainer",
94
- ref: conversationContainer
80
+ ref_key: "conversationContainerRef",
81
+ ref: conversationContainerRef,
82
+ onScroll: handleScroll
95
83
  }, [
96
- (Vue.openBlock(true), Vue.createElementBlock(Vue.Fragment, null, Vue.renderList(conversations.value, (item, index) => {
84
+ (Vue.openBlock(true), Vue.createElementBlock(Vue.Fragment, null, Vue.renderList(transcribedMessageList.value, (group) => {
97
85
  return Vue.openBlock(), Vue.createElementBlock("div", {
98
- key: index,
99
- class: "conversation-item"
86
+ key: group.startMsTs,
87
+ class: "conversation-group"
100
88
  }, [
101
89
  Vue.createElementVNode("div", _hoisted_1, [
102
- Vue.createElementVNode("span", _hoisted_2, Vue.toDisplayString(item.speaker), 1),
103
- Vue.createElementVNode("span", _hoisted_3, Vue.toDisplayString(item.timestamp), 1)
90
+ Vue.createElementVNode("span", _hoisted_2, Vue.toDisplayString(Vue.unref(roomService.roomService).roomStore.getDisplayName(group.sender)), 1),
91
+ Vue.createElementVNode("span", _hoisted_3, Vue.toDisplayString(Vue.unref(utils.formatTimestampToTime)(group.startMsTs)), 1)
104
92
  ]),
105
- Vue.createElementVNode("div", _hoisted_4, [
106
- (Vue.openBlock(true), Vue.createElementBlock(Vue.Fragment, null, Vue.renderList(item.messages, (msg, msgIndex) => {
107
- return Vue.openBlock(), Vue.createElementBlock("div", { key: msgIndex }, Vue.toDisplayString(msg), 1);
108
- }), 128))
109
- ])
93
+ (Vue.openBlock(true), Vue.createElementBlock(Vue.Fragment, null, Vue.renderList(group.messages, (message, messageIndex) => {
94
+ return Vue.openBlock(), Vue.createElementBlock("div", {
95
+ key: messageIndex,
96
+ class: "content"
97
+ }, Vue.toDisplayString(message.text), 1);
98
+ }), 128))
110
99
  ]);
111
100
  }), 128))
112
- ], 512);
101
+ ], 544);
113
102
  };
114
103
  }
115
104
  });
@@ -4,11 +4,11 @@ const Vue = require("vue");
4
4
  const TUIChatEngine = require("@tencentcloud/chat-uikit-engine");
5
5
  require("../../../adapter-vue.js");
6
6
  const messageInputEditor = require("./message-input-editor.vue.js");
7
- const index = require("./message-input-at/index.vue.js");
7
+ const index$1 = require("./message-input-at/index.vue.js");
8
8
  const messageInputButton = require("./message-input-button.vue.js");
9
- const index$1 = require("./message-input-quote/index.vue.js");
9
+ const index$2 = require("./message-input-quote/index.vue.js");
10
10
  const sendMessage = require("../utils/sendMessage.js");
11
- const index$2 = require("../emoji-config/index.js");
11
+ const index = require("../emoji-config/index.js");
12
12
  const env = require("../../../utils/env.js");
13
13
  const _hoisted_1 = { class: "message-input-wrapper" };
14
14
  const _sfc_main = /* @__PURE__ */ Vue.defineComponent({
@@ -68,7 +68,7 @@ const _sfc_main = /* @__PURE__ */ Vue.defineComponent({
68
68
  if (!_editorContentList || !currentConversation.value) return;
69
69
  const editorContentList = _editorContentList.map((editor2) => {
70
70
  if (editor2.type === "text") {
71
- editor2.payload.text = index$2.transformTextWithEmojiNamesToKeys(editor2.payload.text);
71
+ editor2.payload.text = index.transformTextWithEmojiNamesToKeys(editor2.payload.text);
72
72
  }
73
73
  return editor2;
74
74
  });
@@ -125,7 +125,7 @@ const _sfc_main = /* @__PURE__ */ Vue.defineComponent({
125
125
  key: 0,
126
126
  onSendMessage: sendMessage$1
127
127
  })) : Vue.createCommentVNode("", true),
128
- props.enableAt ? (Vue.openBlock(), Vue.createBlock(index.default, {
128
+ props.enableAt ? (Vue.openBlock(), Vue.createBlock(index$1.default, {
129
129
  key: 1,
130
130
  ref_key: "messageInputAtRef",
131
131
  ref: messageInputAtRef,
@@ -133,7 +133,7 @@ const _sfc_main = /* @__PURE__ */ Vue.defineComponent({
133
133
  onOnAtListOpen: onAtListOpen
134
134
  }, null, 512)) : Vue.createCommentVNode("", true)
135
135
  ], 2),
136
- Vue.createVNode(index$1.default)
136
+ Vue.createVNode(index$2.default)
137
137
  ]);
138
138
  };
139
139
  }