1import {paramMock} from "./utils" 2 3export function mockAI() { 4 const TTSCallBackMock = { 5 key: "[PC preview] unknow key" 6 }; 7 global.systemplugin.ai = {}; 8 global.systemplugin.ai.TTS = { 9 getTTSClient: function () { 10 console.warn("ai.TTS.getTTSClient interface mocked in the Previewer. How this interface works on the" + 11 " Previewer may be different from that on a real device.") 12 return TTSClient 13 }, 14 }; 15 const TTSClient = { 16 init: function (...args) { 17 console.warn("TTSClient.init interface mocked in the Previewer. How this interface works on the Previewer may" + 18 " be different from that on a real device.") 19 return paramMock.paramBooleanMock 20 }, 21 isSpeaking: function () { 22 console.warn("TTSClient.isSpeaking interface mocked in the Previewer. How this interface works on the Previewer may" + 23 " be different from that on a real device.") 24 return paramMock.paramBooleanMock 25 }, 26 setAudioType: function (...args) { 27 console.warn("TTSClient.setAudioType interface mocked in the Previewer. How this interface works on the Previewer may" + 28 " be different from that on a real device.") 29 return paramMock.paramBooleanMock 30 }, 31 setParams: function (...args) { 32 console.warn("TTSClient.setParams interface mocked in the Previewer. How this interface works on the Previewer may" + 33 " be different from that on a real device.") 34 return paramMock.paramBooleanMock 35 }, 36 connectService: function () { 37 console.warn("TTSClient.connectService interface mocked in the Previewer. How this interface works on the Previewer may" + 38 " be different from that on a real device.") 39 }, 40 setIsSaveTtsData: function (...args) { 41 console.warn("TTSClient.setIsSaveTtsData interface mocked in the Previewer. How this interface works on the Previewer may" + 42 " be different from that on a real device.") 43 args[0].success() 44 hasComplete(args[0].complete) 45 }, 46 release: function () { 47 console.warn("TTSClient.release interface mocked in the Previewer. How this interface works on the Previewer may" + 48 " be different from that on a real device.") 49 }, 50 speakLongText: function (...args) { 51 console.warn("TTSClient.speakLongText interface mocked in the Previewer. How this interface works on the Previewer may" + 52 " be different from that on a real device.") 53 args[0].success() 54 hasComplete(args[0].complete) 55 }, 56 speakText: function (...args) { 57 console.warn("TTSClient.speakText interface mocked in the Previewer. How this interface works on the Previewer may" + 58 " be different from that on a real device.") 59 args[0].success() 60 hasComplete(args[0].complete) 61 }, 62 stopSpeak: function () { 63 console.warn("TTSClient.stopSpeak interface mocked in the Previewer. How this interface works on the Previewer may" + 64 " be different from that on a real device.") 65 }, 66 destroy: function () { 67 console.warn("TTSClient.destroy interface mocked in the Previewer. How this interface works on the Previewer may" + 68 " be different from that on a real device.") 69 }, 70 on: function (...args) { 71 console.warn("TTSClient.on interface mocked in the Previewer. How this interface works on the Previewer may be" + 72 " different from that on a real device.") 73 const len = args.length 74 args[len - 1].call(this, TTSCallBackMock) 75 }, 76 getSupportMaxLength: function () { 77 console.warn("TTSClient.getSupportMaxLength interface mocked in the Previewer. How this interface works on the Previewer may" + 78 " be different from that on a real device.") 79 return paramMock.paramNumberMock 80 }, 81 getVersion: function () { 82 console.warn("TTSClient.getVersion interface mocked in the Previewer. How this interface works on the Previewer may" + 83 " be different from that on a real device.") 84 return paramMock.paramStringMock 85 }, 86 }; 87}