优化页面

This commit is contained in:
pengxiaolong
2025-06-11 22:16:44 +08:00
parent 3c2d7e5959
commit 931d867c09
806 changed files with 87462 additions and 331 deletions

View File

@@ -0,0 +1,50 @@
"use strict";
const common_vendor = require("../../../../common/vendor.js");
const _Convertor = class _Convertor {
constructor() {
this.isUseCache = true;
this.convertCache = /* @__PURE__ */ new Map();
}
static getInstance() {
if (!_Convertor.instance) {
_Convertor.instance = new _Convertor();
}
return _Convertor.instance;
}
async get(message) {
if (this.isUseCache) {
const cache = this.convertCache.get(message.ID);
if (cache !== void 0) {
return cache;
}
}
const currentMessage = common_vendor.Jt.getMessageModel(message.ID);
if (!currentMessage) {
return Promise.reject("message not found");
}
const response = await common_vendor.Qt.convertVoiceToText({
message: currentMessage
});
let { data: { result } = {} } = response;
if (result) {
this.convertCache.set(currentMessage.ID, result);
} else {
result = "";
}
return result;
}
clear() {
this.convertCache.clear();
}
disableCache() {
this.isUseCache = false;
}
enableCache() {
this.isUseCache = true;
}
};
_Convertor.instance = void 0;
let Convertor = _Convertor;
const convertor = Convertor.getInstance();
exports.convertor = convertor;
//# sourceMappingURL=../../../../../.sourcemap/mp-weixin/TUIKit/components/TUIChat/utils/convertVoiceToText.js.map