diff --git a/src/components/ArcanaSettingsTab.ts b/src/components/ArcanaSettingsTab.ts index c275179..e288889 100644 --- a/src/components/ArcanaSettingsTab.ts +++ b/src/components/ArcanaSettingsTab.ts @@ -57,6 +57,218 @@ export default class ArcanaSettingsTab extends PluginSettingTab { }); }); + new Setting(containerEl) + .setName('Text to Speech Language') + .setDesc('The language used in AI\'s speech recognition') + .addDropdown(dropdown => { + dropdown + .addOption ('en', 'english') + .addOption ('zh', 'chinese') + .addOption ('de', 'german') + .addOption ('es', 'spanish') + .addOption ('ru', 'russian') + .addOption ('ko', 'korean') + .addOption ('fr', 'french') + .addOption ('ja', 'japanese') + .addOption ('pt', 'portuguese') + .addOption ('tr', 'turkish') + .addOption ('pl', 'polish') + .addOption ('ca', 'catalan') + .addOption ('nl', 'dutch') + .addOption ('ar', 'arabic') + .addOption ('sv', 'swedish') + .addOption ('it', 'italian') + .addOption ('id', 'indonesian') + .addOption ('hi', 'hindi') + .addOption ('fi', 'finnish') + .addOption ('vi', 'vietnamese') + .addOption ('he', 'hebrew') + .addOption ('uk', 'ukrainian') + .addOption ('el', 'greek') + .addOption ('ms', 'malay') + .addOption ('cs', 'czech') + .addOption ('ro', 'romanian') + .addOption ('da', 'danish') + .addOption ('hu', 'hungarian') + .addOption ('ta', 'tamil') + .addOption ('no', 'norwegian') + .addOption ('th', 'thai') + .addOption ('ur', 'urdu') + .addOption ('hr', 'croatian') + .addOption ('bg', 'bulgarian') + .addOption ('lt', 'lithuanian') + .addOption ('la', 'latin') + .addOption ('mi', 'maori') + .addOption ('ml', 'malayalam') + .addOption ('cy', 'welsh') + .addOption ('sk', 'slovak') + .addOption ('te', 'telugu') + .addOption ('fa', 'persian') + .addOption ('lv', 'latvian') + .addOption ('bn', 'bengali') + .addOption ('sr', 'serbian') + .addOption ('az', 'azerbaijani') + .addOption ('sl', 'slovenian') + .addOption ('kn', 'kannada') + .addOption ('et', 'estonian') + .addOption ('mk', 'macedonian') + .addOption ('br', 'breton') + .addOption ('eu', 'basque') + .addOption ('is', 'icelandic') + .addOption ('hy', 'armenian') + .addOption ('ne', 'nepali') + .addOption ('mn', 'mongolian') + .addOption ('bs', 'bosnian') + .addOption ('kk', 'kazakh') + .addOption ('sq', 'albanian') + .addOption ('sw', 'swahili') + .addOption ('gl', 'galician') + .addOption ('mr', 'marathi') + .addOption ('pa', 'punjabi') + .addOption ('si', 'sinhala') + .addOption ('km', 'khmer') + .addOption ('sn', 'shona') + .addOption ('yo', 'yoruba') + .addOption ('so', 'somali') + .addOption ('af', 'afrikaans') + .addOption ('oc', 'occitan') + .addOption ('ka', 'georgian') + .addOption ('be', 'belarusian') + .addOption ('tg', 'tajik') + .addOption ('sd', 'sindhi') + .addOption ('gu', 'gujarati') + .addOption ('am', 'amharic') + .addOption ('yi', 'yiddish') + .addOption ('lo', 'lao') + .addOption ('uz', 'uzbek') + .addOption ('fo', 'faroese') + .addOption ('ht', 'haitian creole') + .addOption ('ps', 'pashto') + .addOption ('tk', 'turkmen') + .addOption ('nn', 'nynorsk') + .addOption ('mt', 'maltese') + .addOption ('sa', 'sanskrit') + .addOption ('lb', 'luxembourgish') + .addOption ('my', 'myanmar') + .addOption ('bo', 'tibetan') + .addOption ('tl', 'tagalog') + .addOption ('mg', 'malagasy') + .addOption ('as', 'assamese') + .addOption ('tt', 'tatar') + .addOption ('ha', 'hawaiian') + .addOption ('ln', 'lingala') + .addOption ('ha', 'hausa') + .addOption ('ba', 'bashkir') + .addOption ('jw', 'javanese') + .addOption ('su', 'sundanese') + .addOption ('yu', 'cantonese') + .addOption ('en', 'english') + .addOption ('zh', 'chinese') + .addOption ('de', 'german') + .addOption ('es', 'spanish') + .addOption ('ru', 'russian') + .addOption ('ko', 'korean') + .addOption ('fr', 'french') + .addOption ('ja', 'japanese') + .addOption ('pt', 'portuguese') + .addOption ('tr', 'turkish') + .addOption ('pl', 'polish') + .addOption ('ca', 'catalan') + .addOption ('nl', 'dutch') + .addOption ('ar', 'arabic') + .addOption ('sv', 'swedish') + .addOption ('it', 'italian') + .addOption ('id', 'indonesian') + .addOption ('hi', 'hindi') + .addOption ('fi', 'finnish') + .addOption ('vi', 'vietnamese') + .addOption ('he', 'hebrew') + .addOption ('uk', 'ukrainian') + .addOption ('el', 'greek') + .addOption ('ms', 'malay') + .addOption ('cs', 'czech') + .addOption ('ro', 'romanian') + .addOption ('da', 'danish') + .addOption ('hu', 'hungarian') + .addOption ('ta', 'tamil') + .addOption ('no', 'norwegian') + .addOption ('th', 'thai') + .addOption ('ur', 'urdu') + .addOption ('hr', 'croatian') + .addOption ('bg', 'bulgarian') + .addOption ('lt', 'lithuanian') + .addOption ('la', 'latin') + .addOption ('mi', 'maori') + .addOption ('ml', 'malayalam') + .addOption ('cy', 'welsh') + .addOption ('sk', 'slovak') + .addOption ('te', 'telugu') + .addOption ('fa', 'persian') + .addOption ('lv', 'latvian') + .addOption ('bn', 'bengali') + .addOption ('sr', 'serbian') + .addOption ('az', 'azerbaijani') + .addOption ('sl', 'slovenian') + .addOption ('kn', 'kannada') + .addOption ('et', 'estonian') + .addOption ('mk', 'macedonian') + .addOption ('br', 'breton') + .addOption ('eu', 'basque') + .addOption ('is', 'icelandic') + .addOption ('hy', 'armenian') + .addOption ('ne', 'nepali') + .addOption ('mn', 'mongolian') + .addOption ('bs', 'bosnian') + .addOption ('kk', 'kazakh') + .addOption ('sq', 'albanian') + .addOption ('sw', 'swahili') + .addOption ('gl', 'galician') + .addOption ('mr', 'marathi') + .addOption ('pa', 'punjabi') + .addOption ('si', 'sinhala') + .addOption ('km', 'khmer') + .addOption ('sn', 'shona') + .addOption ('yo', 'yoruba') + .addOption ('so', 'somali') + .addOption ('af', 'afrikaans') + .addOption ('oc', 'occitan') + .addOption ('ka', 'georgian') + .addOption ('be', 'belarusian') + .addOption ('tg', 'tajik') + .addOption ('sd', 'sindhi') + .addOption ('gu', 'gujarati') + .addOption ('am', 'amharic') + .addOption ('yi', 'yiddish') + .addOption ('lo', 'lao') + .addOption ('uz', 'uzbek') + .addOption ('fo', 'faroese') + .addOption ('ht', 'haitian creole') + .addOption ('ps', 'pashto') + .addOption ('tk', 'turkmen') + .addOption ('nn', 'nynorsk') + .addOption ('mt', 'maltese') + .addOption ('sa', 'sanskrit') + .addOption ('lb', 'luxembourgish') + .addOption ('my', 'myanmar') + .addOption ('bo', 'tibetan') + .addOption ('tl', 'tagalog') + .addOption ('mg', 'malagasy') + .addOption ('as', 'assamese') + .addOption ('tt', 'tatar') + .addOption ('haw', 'hawaiian') + .addOption ('ln', 'lingala') + .addOption ('ha', 'hausa') + .addOption ('ba', 'bashkir') + .addOption ('jw', 'javanese') + .addOption ('su', 'sundanese') + .addOption ('yue', 'cantonese') + .setValue(this.plugin.settings.INPUT_LANGUAGE) + .onChange(async value => { + this.plugin.settings.INPUT_LANGUAGE = value as string; + await this.plugin.saveSettings(); + }); + }); + new Setting(containerEl) .setName('Temperature') .setDesc('The randomness of the generated text') diff --git a/src/include/ArcanaAgent.ts b/src/include/ArcanaAgent.ts index af80641..cfab6cf 100644 --- a/src/include/ArcanaAgent.ts +++ b/src/include/ArcanaAgent.ts @@ -33,7 +33,7 @@ export class ArcanaAgent { const transcription = await openai.audio.transcriptions.create({ file: file, model: 'whisper-1', - language: 'en', + language: this.arcana.settings.INPUT_LANGUAGE, }); return transcription.text; } diff --git a/src/include/ArcanaSettings.ts b/src/include/ArcanaSettings.ts index 7068ff7..103ceb0 100644 --- a/src/include/ArcanaSettings.ts +++ b/src/include/ArcanaSettings.ts @@ -7,6 +7,7 @@ export function isAvailableModel(model: string): model is AvailableModels { export default interface ArcanaSettings { OPEN_AI_API_KEY: string; MODEL_TYPE: AvailableModels; + INPUT_LANGUAGE: string; TEMPERATURE: number; TOP_P: number; //Plugins diff --git a/src/main.ts b/src/main.ts index 191f685..635d5b6 100644 --- a/src/main.ts +++ b/src/main.ts @@ -28,6 +28,7 @@ import PoloPlugin from './plugins/Polo/Polo'; const DEFAULT_SETTINGS: ArcanaSettings = { OPEN_AI_API_KEY: '', MODEL_TYPE: 'gpt-3.5-turbo', + INPUT_LANGUAGE: 'en', TEMPERATURE: 0.7, TOP_P: 1, PluginSettings: {},