style: run format:apply

This commit is contained in:
2026-01-14 01:32:45 -03:00
parent bff1bf3856
commit 7c282105d3
2 changed files with 29 additions and 27 deletions
+5 -3
View File
@@ -50,9 +50,11 @@ const cmd: Command = {
const modes = TTSManager.get.getModules();
const filtered: string[] = modes
.filter((mode) =>
mode.name.toLowerCase().startsWith(focused.value.toLowerCase())
)
.filter((mode) => {
return mode.name
? mode.name.toLowerCase().startsWith(focused.value.toLowerCase())
: undefined;
})
.map((mode) => mode.name)
.slice(0, 25);
+23 -23
View File
@@ -1,37 +1,37 @@
import { TTSModule, TTSResponse } from "../tts";
import { TTSModule, TTSResponse } from '../tts';
import { VoicesManager, Communicate } from 'edge-tts-universal';
class AzureTTS implements TTSModule {
private voices: Array<string> | undefined = undefined;
private voices: Array<string> | undefined = undefined;
public name: string = "Azure";
public name: string = 'Azure';
async getVoices(): Promise<Array<string> | undefined> {
if (!this.voices) {
const voiceMgr = await VoicesManager.create();
const voiceQuery = await voiceMgr.find({});
async getVoices(): Promise<Array<string> | undefined> {
if (!this.voices) {
const voiceMgr = await VoicesManager.create();
const voiceQuery = await voiceMgr.find({});
this.voices = voiceQuery.map((voice) => voice.ShortName);
}
this.voices = voiceQuery.map((voice) => voice.ShortName);
}
return this.voices;
};
return this.voices;
}
async generate(voice: string, text: string): Promise<TTSResponse> {
const comm = new Communicate(text, {
voice: voice
});
async generate(voice: string, text: string): Promise<TTSResponse> {
const comm = new Communicate(text, {
voice: voice
});
const buffers: Buffer[] = [];
for await (const chunk of comm.stream()) {
if (chunk.type === 'audio' && chunk.data) {
buffers.push(chunk.data);
}
}
const buffers: Buffer[] = [];
for await (const chunk of comm.stream()) {
if (chunk.type === 'audio' && chunk.data) {
buffers.push(chunk.data);
}
}
return { data: Buffer.concat(buffers) };
};
return { data: Buffer.concat(buffers) };
}
}
export default new AzureTTS();