From dc5d69d780005811364865770dc31d21bfdb283f Mon Sep 17 00:00:00 2001 From: Jpabon Date: Sun, 12 Nov 2023 09:58:06 -0500 Subject: [PATCH 1/9] Implementando i18n, english, spanish, chinese --- package-lock.json | 294 +- package.json | 5 +- src/assets/i18n/i18n.ts | 969 +++++ src/components/aside/Aside.vue | 10 +- src/components/aside/Version.vue | 25 +- src/components/configpage/BiliBtn.vue | 4 +- src/components/configpage/ConfigPage.vue | 34 +- src/components/configpage/Donate.vue | 18 +- src/components/footer/Footer.vue | 4 +- src/components/main/Main.vue | 29 +- src/components/main/MainOptions.vue | 56 +- src/components/main/emoji-config.ts | 87 +- src/components/main/options-config.ts | 340 +- src/global/initLocalStore.ts | 9 +- src/main.ts | 2 + yarn.lock | 4558 +++++++++++----------- 16 files changed, 3900 insertions(+), 2544 deletions(-) create mode 100644 src/assets/i18n/i18n.ts diff --git a/package-lock.json b/package-lock.json index 1f365dd..7617c95 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "tts-vue", - "version": "1.9.9", + "version": "1.9.15", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "tts-vue", - "version": "1.9.9", + "version": "1.9.15", "license": "MIT", "dependencies": { "@types/ws": "^8.5.4", @@ -14,9 +14,11 @@ "electron-log": "^4.4.8", "electron-store": "^8.0.2", "element-plus": "2.2.9", + "microsoft-cognitiveservices-speech-sdk": "^1.30.1", "nodejs-websocket": "^1.7.2", "pinia": "^2.0.17", "uuid": "^8.3.2", + "vue-i18n": "^9.6.5", "ws": "^8.13.0" }, "devDependencies": { @@ -166,6 +168,47 @@ "@floating-ui/core": "^0.7.3" } }, + "node_modules/@intlify/core-base": { + "version": "9.6.5", + "resolved": "https://registry.npmjs.org/@intlify/core-base/-/core-base-9.6.5.tgz", + "integrity": "sha512-LzbGXiZkMWPIHnHI0g6q554S87Cmh2mmCmjytK/3pDQfjI84l+dgGoeQuKj02q7EbULRuUUgYVZVqAwEUawXGg==", + "dependencies": { + "@intlify/message-compiler": "9.6.5", + "@intlify/shared": "9.6.5" + }, + "engines": { + "node": ">= 16" + }, + "funding": { + "url": "https://github.com/sponsors/kazupon" + } + }, + "node_modules/@intlify/message-compiler": { + "version": "9.6.5", + "resolved": "https://registry.npmjs.org/@intlify/message-compiler/-/message-compiler-9.6.5.tgz", + "integrity": "sha512-WeJ499thIj0p7JaIO1V3JaJbqdqfBykS5R8fElFs5hNeotHtPAMBs4IiA+8/KGFkAbjJusgFefCq6ajP7F7+4Q==", + "dependencies": { + "@intlify/shared": "9.6.5", + "source-map-js": "^1.0.2" + }, + "engines": { + "node": ">= 16" + }, + "funding": { + "url": "https://github.com/sponsors/kazupon" + } + }, + "node_modules/@intlify/shared": { + "version": "9.6.5", + "resolved": "https://registry.npmjs.org/@intlify/shared/-/shared-9.6.5.tgz", + "integrity": "sha512-gD7Ey47Xi4h/t6P+S04ymMSoA3wVRxGqjxuIMglwRO8POki9h164Epu2N8wk/GHXM/hR6ZGcsx2HArCCENjqSQ==", + "engines": { + "node": ">= 16" + }, + "funding": { + "url": "https://github.com/sponsors/kazupon" + } + }, "node_modules/@malept/cross-spawn-promise": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/@malept/cross-spawn-promise/-/cross-spawn-promise-1.1.1.tgz", @@ -362,6 +405,11 @@ "resolved": "https://registry.npmjs.org/@types/web-bluetooth/-/web-bluetooth-0.0.14.tgz", "integrity": "sha512-5d2RhCard1nQUC3aHcq/gHzWYO6K0WJmAbjO7mQJgCQKtZpgXxv1rOM6O/dBDhDYYVutk1sciOgNSe+5YyfM8A==" }, + "node_modules/@types/webrtc": { + "version": "0.0.37", + "resolved": "https://registry.npmjs.org/@types/webrtc/-/webrtc-0.0.37.tgz", + "integrity": "sha512-JGAJC/ZZDhcrrmepU4sPLQLIOIAgs5oIK+Ieq90K8fdaNMhfdfqmYatJdgif1NDQtvrSlTOGJDUYHIDunuufOg==" + }, "node_modules/@types/ws": { "version": "8.5.4", "resolved": "https://registry.npmmirror.com/@types/ws/-/ws-8.5.4.tgz", @@ -486,9 +534,9 @@ } }, "node_modules/@vue/devtools-api": { - "version": "6.2.1", - "resolved": "https://registry.npmjs.org/@vue/devtools-api/-/devtools-api-6.2.1.tgz", - "integrity": "sha512-OEgAMeQXvCoJ+1x8WyQuVZzFo0wcyCmUR3baRVLmKBo1LmYZWMlRiXlux5jd0fqVJu6PfDbOrZItVqUEzLobeQ==" + "version": "6.5.1", + "resolved": "https://registry.npmjs.org/@vue/devtools-api/-/devtools-api-6.5.1.tgz", + "integrity": "sha512-+KpckaAQyfbvshdDW5xQylLni1asvNSGme1JFs8I1+/H5pHEhqUKMEQD/qn3Nx5+/nycBq11qAEi8lk+LXI2dA==" }, "node_modules/@vue/reactivity": { "version": "3.2.37", @@ -638,7 +686,6 @@ "version": "6.0.2", "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-6.0.2.tgz", "integrity": "sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ==", - "dev": true, "dependencies": { "debug": "4" }, @@ -957,6 +1004,16 @@ } ] }, + "node_modules/bent": { + "version": "7.3.12", + "resolved": "https://registry.npmjs.org/bent/-/bent-7.3.12.tgz", + "integrity": "sha512-T3yrKnVGB63zRuoco/7Ybl7BwwGZR0lceoVG5XmQyMIH9s19SV5m+a8qam4if0zQuAmOQTyPTPmsQBdAorGK3w==", + "dependencies": { + "bytesish": "^0.4.1", + "caseless": "~0.12.0", + "is-stream": "^2.0.0" + } + }, "node_modules/bluebird": { "version": "3.7.2", "resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.7.2.tgz", @@ -1167,6 +1224,11 @@ "node": ">= 10.0.0" } }, + "node_modules/bytesish": { + "version": "0.4.4", + "resolved": "https://registry.npmjs.org/bytesish/-/bytesish-0.4.4.tgz", + "integrity": "sha512-i4uu6M4zuMUiyfZN4RU2+i9+peJh//pXhd9x1oSe1LBkZ3LEbCoygu8W0bXTukU1Jme2txKuotpCZRaC3FLxcQ==" + }, "node_modules/cacheable-request": { "version": "6.1.0", "resolved": "https://registry.npmjs.org/cacheable-request/-/cacheable-request-6.1.0.tgz", @@ -1221,6 +1283,11 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/caseless": { + "version": "0.12.0", + "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz", + "integrity": "sha512-4tYFyifaFfGacoiObjJegolkwSU4xQNGbVgUiNYVUxbQ2x2lUsFvY4hVgVzGiIe6WLOPqycWXA40l+PWsxthUw==" + }, "node_modules/chalk": { "version": "4.1.2", "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", @@ -1553,7 +1620,6 @@ "version": "4.3.4", "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", - "dev": true, "dependencies": { "ms": "2.1.2" }, @@ -3091,6 +3157,17 @@ "node": ">=8" } }, + "node_modules/is-stream": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.1.tgz", + "integrity": "sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg==", + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/is-typedarray": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz", @@ -3322,6 +3399,71 @@ "resolved": "https://registry.npmjs.org/memoize-one/-/memoize-one-6.0.0.tgz", "integrity": "sha512-rkpe71W0N0c0Xz6QD0eJETuWAJGnJ9afsl1srmwPrI+yBCkge5EycXXbYRyvL29zZVUWQCY7InPRCv3GDXuZNw==" }, + "node_modules/microsoft-cognitiveservices-speech-sdk": { + "version": "1.33.1", + "resolved": "https://registry.npmjs.org/microsoft-cognitiveservices-speech-sdk/-/microsoft-cognitiveservices-speech-sdk-1.33.1.tgz", + "integrity": "sha512-mVXgU98dd1nvK2xHNpXimqe7VmA5QdMAn8kAkqSouoCo1MU3BhRpb6ueuYRn5kvxSfPHypud2knQBh+PItVcdw==", + "dependencies": { + "@types/webrtc": "^0.0.37", + "agent-base": "^6.0.1", + "bent": "^7.3.12", + "https-proxy-agent": "^4.0.0", + "uuid": "^9.0.0", + "ws": "^7.5.6" + } + }, + "node_modules/microsoft-cognitiveservices-speech-sdk/node_modules/https-proxy-agent": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-4.0.0.tgz", + "integrity": "sha512-zoDhWrkR3of1l9QAL8/scJZyLu8j/gBkcwcaQOZh7Gyh/+uJQzGVETdgT30akuwkpL8HTRfssqI3BZuV18teDg==", + "dependencies": { + "agent-base": "5", + "debug": "4" + }, + "engines": { + "node": ">= 6.0.0" + } + }, + "node_modules/microsoft-cognitiveservices-speech-sdk/node_modules/https-proxy-agent/node_modules/agent-base": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-5.1.1.tgz", + "integrity": "sha512-TMeqbNl2fMW0nMjTEPOwe3J/PRFP4vqeoNuQMG0HlMrtm5QxKqdvAkZ1pRBQ/ulIyDD5Yq0nJ7YbdD8ey0TO3g==", + "engines": { + "node": ">= 6.0.0" + } + }, + "node_modules/microsoft-cognitiveservices-speech-sdk/node_modules/uuid": { + "version": "9.0.1", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-9.0.1.tgz", + "integrity": "sha512-b+1eJOlsR9K8HJpow9Ok3fiWOWSIcIzXodvv0rQjVoOVNpWMpxf1wZNpt4y9h10odCNrqnYp1OBzRktckBe3sA==", + "funding": [ + "https://github.com/sponsors/broofa", + "https://github.com/sponsors/ctavan" + ], + "bin": { + "uuid": "dist/bin/uuid" + } + }, + "node_modules/microsoft-cognitiveservices-speech-sdk/node_modules/ws": { + "version": "7.5.9", + "resolved": "https://registry.npmjs.org/ws/-/ws-7.5.9.tgz", + "integrity": "sha512-F+P9Jil7UiSKSkppIiD94dN07AwvFixvLIj1Og1Rl9GGMuNipJnV9JzjD6XuqmAeiswGvUmNLjr5cFuXwNS77Q==", + "engines": { + "node": ">=8.3.0" + }, + "peerDependencies": { + "bufferutil": "^4.0.1", + "utf-8-validate": "^5.0.2" + }, + "peerDependenciesMeta": { + "bufferutil": { + "optional": true + }, + "utf-8-validate": { + "optional": true + } + } + }, "node_modules/mime": { "version": "2.6.0", "resolved": "https://registry.npmjs.org/mime/-/mime-2.6.0.tgz", @@ -3428,8 +3570,7 @@ "node_modules/ms": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", - "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", - "dev": true + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" }, "node_modules/nanoid": { "version": "3.3.4", @@ -4578,6 +4719,25 @@ "@vue/shared": "3.2.37" } }, + "node_modules/vue-i18n": { + "version": "9.6.5", + "resolved": "https://registry.npmjs.org/vue-i18n/-/vue-i18n-9.6.5.tgz", + "integrity": "sha512-dpUEjKHg7pEsaS7ZPPxp1CflaR7bGmsvZJEhnszHPKl9OTNyno5j/DvMtMSo41kpddq4felLA7GK2prjpnXVlw==", + "dependencies": { + "@intlify/core-base": "9.6.5", + "@intlify/shared": "9.6.5", + "@vue/devtools-api": "^6.5.0" + }, + "engines": { + "node": ">= 16" + }, + "funding": { + "url": "https://github.com/sponsors/kazupon" + }, + "peerDependencies": { + "vue": "^3.0.0" + } + }, "node_modules/vue-tsc": { "version": "0.38.9", "resolved": "https://registry.npmjs.org/vue-tsc/-/vue-tsc-0.38.9.tgz", @@ -4847,6 +5007,29 @@ "@floating-ui/core": "^0.7.3" } }, + "@intlify/core-base": { + "version": "9.6.5", + "resolved": "https://registry.npmjs.org/@intlify/core-base/-/core-base-9.6.5.tgz", + "integrity": "sha512-LzbGXiZkMWPIHnHI0g6q554S87Cmh2mmCmjytK/3pDQfjI84l+dgGoeQuKj02q7EbULRuUUgYVZVqAwEUawXGg==", + "requires": { + "@intlify/message-compiler": "9.6.5", + "@intlify/shared": "9.6.5" + } + }, + "@intlify/message-compiler": { + "version": "9.6.5", + "resolved": "https://registry.npmjs.org/@intlify/message-compiler/-/message-compiler-9.6.5.tgz", + "integrity": "sha512-WeJ499thIj0p7JaIO1V3JaJbqdqfBykS5R8fElFs5hNeotHtPAMBs4IiA+8/KGFkAbjJusgFefCq6ajP7F7+4Q==", + "requires": { + "@intlify/shared": "9.6.5", + "source-map-js": "^1.0.2" + } + }, + "@intlify/shared": { + "version": "9.6.5", + "resolved": "https://registry.npmjs.org/@intlify/shared/-/shared-9.6.5.tgz", + "integrity": "sha512-gD7Ey47Xi4h/t6P+S04ymMSoA3wVRxGqjxuIMglwRO8POki9h164Epu2N8wk/GHXM/hR6ZGcsx2HArCCENjqSQ==" + }, "@malept/cross-spawn-promise": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/@malept/cross-spawn-promise/-/cross-spawn-promise-1.1.1.tgz", @@ -5007,6 +5190,11 @@ "resolved": "https://registry.npmjs.org/@types/web-bluetooth/-/web-bluetooth-0.0.14.tgz", "integrity": "sha512-5d2RhCard1nQUC3aHcq/gHzWYO6K0WJmAbjO7mQJgCQKtZpgXxv1rOM6O/dBDhDYYVutk1sciOgNSe+5YyfM8A==" }, + "@types/webrtc": { + "version": "0.0.37", + "resolved": "https://registry.npmjs.org/@types/webrtc/-/webrtc-0.0.37.tgz", + "integrity": "sha512-JGAJC/ZZDhcrrmepU4sPLQLIOIAgs5oIK+Ieq90K8fdaNMhfdfqmYatJdgif1NDQtvrSlTOGJDUYHIDunuufOg==" + }, "@types/ws": { "version": "8.5.4", "resolved": "https://registry.npmmirror.com/@types/ws/-/ws-8.5.4.tgz", @@ -5125,9 +5313,9 @@ } }, "@vue/devtools-api": { - "version": "6.2.1", - "resolved": "https://registry.npmjs.org/@vue/devtools-api/-/devtools-api-6.2.1.tgz", - "integrity": "sha512-OEgAMeQXvCoJ+1x8WyQuVZzFo0wcyCmUR3baRVLmKBo1LmYZWMlRiXlux5jd0fqVJu6PfDbOrZItVqUEzLobeQ==" + "version": "6.5.1", + "resolved": "https://registry.npmjs.org/@vue/devtools-api/-/devtools-api-6.5.1.tgz", + "integrity": "sha512-+KpckaAQyfbvshdDW5xQylLni1asvNSGme1JFs8I1+/H5pHEhqUKMEQD/qn3Nx5+/nycBq11qAEi8lk+LXI2dA==" }, "@vue/reactivity": { "version": "3.2.37", @@ -5224,7 +5412,6 @@ "version": "6.0.2", "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-6.0.2.tgz", "integrity": "sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ==", - "dev": true, "requires": { "debug": "4" } @@ -5463,6 +5650,16 @@ "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==", "dev": true }, + "bent": { + "version": "7.3.12", + "resolved": "https://registry.npmjs.org/bent/-/bent-7.3.12.tgz", + "integrity": "sha512-T3yrKnVGB63zRuoco/7Ybl7BwwGZR0lceoVG5XmQyMIH9s19SV5m+a8qam4if0zQuAmOQTyPTPmsQBdAorGK3w==", + "requires": { + "bytesish": "^0.4.1", + "caseless": "~0.12.0", + "is-stream": "^2.0.0" + } + }, "bluebird": { "version": "3.7.2", "resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.7.2.tgz", @@ -5634,6 +5831,11 @@ "sax": "^1.2.4" } }, + "bytesish": { + "version": "0.4.4", + "resolved": "https://registry.npmjs.org/bytesish/-/bytesish-0.4.4.tgz", + "integrity": "sha512-i4uu6M4zuMUiyfZN4RU2+i9+peJh//pXhd9x1oSe1LBkZ3LEbCoygu8W0bXTukU1Jme2txKuotpCZRaC3FLxcQ==" + }, "cacheable-request": { "version": "6.1.0", "resolved": "https://registry.npmjs.org/cacheable-request/-/cacheable-request-6.1.0.tgz", @@ -5672,6 +5874,11 @@ "integrity": "sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA==", "dev": true }, + "caseless": { + "version": "0.12.0", + "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz", + "integrity": "sha512-4tYFyifaFfGacoiObjJegolkwSU4xQNGbVgUiNYVUxbQ2x2lUsFvY4hVgVzGiIe6WLOPqycWXA40l+PWsxthUw==" + }, "chalk": { "version": "4.1.2", "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", @@ -5927,7 +6134,6 @@ "version": "4.3.4", "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", - "dev": true, "requires": { "ms": "2.1.2" } @@ -6995,6 +7201,11 @@ "integrity": "sha512-Fd4gABb+ycGAmKou8eMftCupSir5lRxqf4aD/vd0cD2qc4HL07OjCeuHMr8Ro4CoMaeCKDB0/ECBOVWjTwUvPQ==", "dev": true }, + "is-stream": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.1.tgz", + "integrity": "sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg==" + }, "is-typedarray": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz", @@ -7180,6 +7391,48 @@ "resolved": "https://registry.npmjs.org/memoize-one/-/memoize-one-6.0.0.tgz", "integrity": "sha512-rkpe71W0N0c0Xz6QD0eJETuWAJGnJ9afsl1srmwPrI+yBCkge5EycXXbYRyvL29zZVUWQCY7InPRCv3GDXuZNw==" }, + "microsoft-cognitiveservices-speech-sdk": { + "version": "1.33.1", + "resolved": "https://registry.npmjs.org/microsoft-cognitiveservices-speech-sdk/-/microsoft-cognitiveservices-speech-sdk-1.33.1.tgz", + "integrity": "sha512-mVXgU98dd1nvK2xHNpXimqe7VmA5QdMAn8kAkqSouoCo1MU3BhRpb6ueuYRn5kvxSfPHypud2knQBh+PItVcdw==", + "requires": { + "@types/webrtc": "^0.0.37", + "agent-base": "^6.0.1", + "bent": "^7.3.12", + "https-proxy-agent": "^4.0.0", + "uuid": "^9.0.0", + "ws": "^7.5.6" + }, + "dependencies": { + "https-proxy-agent": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-4.0.0.tgz", + "integrity": "sha512-zoDhWrkR3of1l9QAL8/scJZyLu8j/gBkcwcaQOZh7Gyh/+uJQzGVETdgT30akuwkpL8HTRfssqI3BZuV18teDg==", + "requires": { + "agent-base": "5", + "debug": "4" + }, + "dependencies": { + "agent-base": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-5.1.1.tgz", + "integrity": "sha512-TMeqbNl2fMW0nMjTEPOwe3J/PRFP4vqeoNuQMG0HlMrtm5QxKqdvAkZ1pRBQ/ulIyDD5Yq0nJ7YbdD8ey0TO3g==" + } + } + }, + "uuid": { + "version": "9.0.1", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-9.0.1.tgz", + "integrity": "sha512-b+1eJOlsR9K8HJpow9Ok3fiWOWSIcIzXodvv0rQjVoOVNpWMpxf1wZNpt4y9h10odCNrqnYp1OBzRktckBe3sA==" + }, + "ws": { + "version": "7.5.9", + "resolved": "https://registry.npmjs.org/ws/-/ws-7.5.9.tgz", + "integrity": "sha512-F+P9Jil7UiSKSkppIiD94dN07AwvFixvLIj1Og1Rl9GGMuNipJnV9JzjD6XuqmAeiswGvUmNLjr5cFuXwNS77Q==", + "requires": {} + } + } + }, "mime": { "version": "2.6.0", "resolved": "https://registry.npmjs.org/mime/-/mime-2.6.0.tgz", @@ -7256,8 +7509,7 @@ "ms": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", - "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", - "dev": true + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" }, "nanoid": { "version": "3.3.4", @@ -8108,6 +8360,16 @@ "@vue/shared": "3.2.37" } }, + "vue-i18n": { + "version": "9.6.5", + "resolved": "https://registry.npmjs.org/vue-i18n/-/vue-i18n-9.6.5.tgz", + "integrity": "sha512-dpUEjKHg7pEsaS7ZPPxp1CflaR7bGmsvZJEhnszHPKl9OTNyno5j/DvMtMSo41kpddq4felLA7GK2prjpnXVlw==", + "requires": { + "@intlify/core-base": "9.6.5", + "@intlify/shared": "9.6.5", + "@vue/devtools-api": "^6.5.0" + } + }, "vue-tsc": { "version": "0.38.9", "resolved": "https://registry.npmjs.org/vue-tsc/-/vue-tsc-0.38.9.tgz", diff --git a/package.json b/package.json index e04752e..ce63dc4 100644 --- a/package.json +++ b/package.json @@ -42,8 +42,9 @@ "element-plus": "2.2.9", "microsoft-cognitiveservices-speech-sdk": "^1.30.1", "nodejs-websocket": "^1.7.2", - "ws": "^8.13.0", "pinia": "^2.0.17", - "uuid": "^8.3.2" + "uuid": "^8.3.2", + "vue-i18n": "^9.6.5", + "ws": "^8.13.0" } } diff --git a/src/assets/i18n/i18n.ts b/src/assets/i18n/i18n.ts new file mode 100644 index 0000000..f1117ba --- /dev/null +++ b/src/assets/i18n/i18n.ts @@ -0,0 +1,969 @@ +// src/i18n.js +import { createI18n } from 'vue-i18n'; + +const messages = { + en: { + // Mensajes en inglés + aside: { + text: 'Text', + batch: 'Batch', + settings: 'Settings', + documents: 'Documents' + }, + version: { + checkUpdate: 'Check for updates', + currentVersion: 'Current Version:', + latestVersion: 'Latest Version:', + updateAvailable: 'Update Available', + noUpdate: 'You are up to date!', + updateInfo: 'Update Information', + confirm: 'OK', + downloadLinks: 'Download Links', + password: 'Password: em1n', + }, + bilibtn: { + goToBilibili: 'Go to Bilibili', + }, + configPage: { + downloadPath: 'Download Path', + retryCount: 'Retry Count', + retryInterval: 'Retry Interval (s)', + speechKey: 'SpeechKey', + serviceRegion: 'ServiceRegion', + autoplay: 'Autoplay', + updateNotification: 'Update Notification', + titleStyle: 'Title Bar Style', + auditionText: 'Audition Text', + templateEdit: 'Template Edit', + name: 'Name', + action: 'Action', + delete: 'Delete', + refreshConfig: 'Refresh Configuration', + configFile: 'Configuration File', + openLogs: 'Open Logs', + clearLogs: 'Clear Logs', + // Otras traducciones... + }, + donate: { + appreciation: 'If you think this project is good,', + encouragement: 'Feel free to Star, Fork, and PR. Your Star is the best encouragement for the author :)', + guideReminder: 'If you encounter any problems, please read carefully the "Documentation" → "User Guide" section, including "Feature Introduction" and "FAQ".', + feedback: 'For other opinions or suggestions, you can @mention or privately chat with the group owner or manager in "Documentation" → "Join Q Group", or raise issues on GitHub or Gitee.', + buyCoffeeTitle: 'Buy the author a coffee 🍻', + wechatPayment: 'Use WeChat for payment', + hoverForAlipay: 'Hover for Alipay payment', + buyDrinkTitle: 'Buy the author a drink ☕️', + alipayPayment: 'Use Alipay for payment', + hoverForWechat: 'Move the mouse away for WeChat payment', + }, + + footer: { + downloadAudio: 'Download Audio', + // Otras traducciones... + }, + styles: { + assistant: "Assistant", + chat: "Chat", + customerservice: "Customer Service", + newscast: "Newscast", + affectionate: "Affectionate", + angry: "Angry", + calm: "Calm", + cheerful: "Cheerful", + disgruntled: "Disgruntled", + fearful: "Fearful", + gentle: "Gentle", + lyrical: "Lyrical", + sad: "Sad", + serious: "Serious", + "poetry-reading": "Poetry Reading", + "narration-professional": "Professional Narration", + "newscast-casual": "Casual Newscast", + embarrassed: "Embarrassed", + depressed: "Depressed", + envious: "Envious", + "narration-relaxed": "Relaxed Narration", + Advertisement_upbeat: "Upbeat Advertisement", + "Narration-relaxed": "Relaxed Narration", + Sports_commentary: "Sports Commentary", + Sports_commentary_excited: "Excited Sports Commentary", + "documentary-narration": "Documentary Narration", + excited: "Excited", + friendly: "Friendly", + terrified: "Terrified", + shouting: "Shouting", + unfriendly: "Unfriendly", + whispering: "Whispering", + hopeful: "Hopeful" + }, + roles: { + YoungAdultFemale: "Young Adult Female", + YoungAdultMale: "Young Adult Male", + OlderAdultFemale: "Older Adult Female", + OlderAdultMale: "Older Adult Male", + SeniorFemale: "Senior Female", + SeniorMale: "Senior Male", + Girl: "Girl", + Boy: "Boy", + Narrator: "Narrator" + }, + main: { + action: "Action", + textTab: "Text", + ssmlTab: "SSML", + placeholder: "Please input", + fileName: "File Name", + filePath: "File Path", + fileSize: "Word Count", + status: "Status", + ready: "Ready", + remove: "Remove", + play: "Play", + openInFolder: "Open in Folder", + selectFiles: "Select Files", + fileFormatTip: "The format of text: *.txt", + clearAll: "Clear All", + doc: "Documentation", + // Otros textos... + }, + options: { + api: "Interface", + selectApi: "Select API", + language: "Language", + selectLanguage: "Select Language", + voice: "Voice", + selectVoice: "Select Voice", + speakingStyle: "Speaking Style", + selectSpeakingStyle: "Select Speaking Style", + rolePlaying: "Role Playing", + selectRole: "Select Role", + speed: "Speed", + pitch: "Pitch", + saveConfig: "Save Configuration", + selectConfig: "Select Configuration", + startConversion: "Start Conversion", + edgeApiWarning: "The Edge interface does not support automatic slicing and the maximum text length is unknown. Please preprocess text manually as needed.", + configureAzure: "Please configure Azure's Speech service key and region first.", + saveSuccess: "Configuration saved successfully.", + cancelSave: "Save cancelled.", + inputWarning: "Please enter text content.", + emptyListWarning: "The list is empty.", + waitMessage: "Please wait..." + }, + lang: { + AF_ZA: "Afrikaans (South Africa)", + AM_ET: "Amharic (Ethiopia)", + AR_AE: "Arabic (United Arab Emirates)", + AR_BH: "Arabic (Bahrain)", + AR_DZ: "Arabic (Algeria)", + AR_EG: "Arabic (Egypt)", + AR_IL: "Arabic (Israel)", + AR_IQ: "Arabic (Iraq)", + AR_JO: "Arabic (Jordan)", + AR_KW: "Arabic (Kuwait)", + AR_LB: "Arabic (Lebanon)", + AR_LY: "Arabic (Libya)", + AR_MA: "Arabic (Morocco)", + AR_OM: "Arabic (Oman)", + AR_PS: "Arabic (Palestinian Authority)", + AR_QA: "Arabic (Qatar)", + AR_SA: "Arabic (Saudi Arabia)", + AR_SY: "Arabic (Syria)", + AR_TN: "Arabic (Tunisia)", + AR_YE: "Arabic (Yemen)", + AS_IN: "Assamese (India)", + AZ_AZ: "Azerbaijani (Azerbaijan)", + BG_BG: "Bulgarian (Bulgaria)", + BN_BD: "Bengali (Bangladesh)", + BN_IN: "Bengali (India)", + BS_BA: "Bosnian (Bosnia and Herzegovina)", + CA_ES: "Catalan (Spain)", + CS_CZ: "Czech (Czech Republic)", + CY_GB: "Welsh (United Kingdom)", + DA_DK: "Danish (Denmark)", + DE_AT: "German (Austria)", + DE_CH: "German (Switzerland)", + DE_DE: "German (Germany)", + EL_GR: "Greek (Greece)", + EN_AU: "English (Australia)", + EN_CA: "English (Canada)", + EN_GB: "English (United Kingdom)", + EN_GH: "English (Ghana)", + EN_HK: "English (Hong Kong SAR)", + EN_IE: "English (Ireland)", + EN_IN: "English (India)", + EN_KE: "English (Kenya)", + EN_NG: "English (Nigeria)", + EN_NZ: "English (New Zealand)", + EN_PH: "English (Philippines)", + EN_SG: "English (Singapore)", + EN_TZ: "English (Tanzania)", + EN_US: "English (United States)", + EN_ZA: "English (South Africa)", + ES_AR: "Spanish (Argentina)", + ES_BO: "Spanish (Bolivia)", + ES_CL: "Spanish (Chile)", + ES_CO: "Spanish (Colombia)", + ES_CR: "Spanish (Costa Rica)", + ES_CU: "Spanish (Cuba)", + ES_DO: "Spanish (Dominican Republic)", + ES_EC: "Spanish (Ecuador)", + ES_ES: "Spanish (Spain)", + ES_GQ: "Spanish (Equatorial Guinea)", + ES_GT: "Spanish (Guatemala)", + ES_HN: "Spanish (Honduras)", + ES_MX: "Spanish (Mexico)", + ES_NI: "Spanish (Nicaragua)", + ES_PA: "Spanish (Panama)", + ES_PE: "Spanish (Peru)", + ES_PR: "Spanish (Puerto Rico)", + ES_PY: "Spanish (Paraguay)", + ES_SV: "Spanish (El Salvador)", + ES_US: "Spanish (United States)", + ES_UY: "Spanish (Uruguay)", + ES_VE: "Spanish (Venezuela)", + ET_EE: "Estonian (Estonia)", + EU_ES: "Basque (Basque)", + FA_IR: "Persian (Iran)", + FIL_PH: "Filipino (Philippines)", + FI_FI: "Finnish (Finland)", + FR_BE: "French (Belgium)", + FR_CA: "French (Canada)", + FR_CH: "French (Switzerland)", + FR_FR: "French (France)", + GA_IE: "Irish (Ireland)", + GL_ES: "Galician (Galicia)", + GU_IN: "Gujarati (India)", + HE_IL: "Hebrew (Israel)", + HI_IN: "Hindi (India)", + HR_HR: "Croatian (Croatia)", + HU_HU: "Hungarian (Hungary)", + HY_AM: "Armenian (Armenia)", + ID_ID: "Indonesian (Indonesia)", + IS_IS: "Icelandic (Iceland)", + IT_CH: "Italian (Switzerland)", + IT_IT: "Italian (Italy)", + JA_JP: "Japanese (Japan)", + JV_ID: "Javanese (Indonesia)", + KA_GE: "Georgian (Georgia)", + KK_KZ: "Kazakh (Kazakhstan)", + KM_KH: "Khmer (Cambodia)", + KN_IN: "Kannada (India)", + KO_KR: "Korean (South Korea)", + LO_LA: "Lao (Laos)", + LT_LT: "Lithuanian (Lithuania)", + LV_LV: "Latvian (Latvia)", + MK_MK: "Macedonian (North Macedonia)", + ML_IN: "Malayalam (India)", + MN_MN: "Mongolian (Mongolia)", + MR_IN: "Marathi (India)", + MS_MY: "Malay (Malaysia)", + MT_MT: "Maltese (Malta)", + MY_MM: "Burmese (Myanmar)", + NB_NO: "Norwegian Bokmål (Norway)", + NE_NP: "Nepali (Nepal)", + NL_BE: "Dutch (Belgium)", + NL_NL: "Dutch (Netherlands)", + OR_IN: "Odia (India)", + PA_IN: "Punjabi (India)", + PL_PL: "Polish (Poland)", + PS_AF: "Pashto (Afghanistan)", + PT_BR: "Portuguese (Brazil)", + PT_PT: "Portuguese (Portugal)", + RO_MD: "Romanian (Moldova)", + RO_RO: "Romanian (Romania)", + RU_RU: "Russian (Russia)", + SI_LK: "Sinhala (Sri Lanka)", + SK_SK: "Slovak (Slovakia)", + SL_SI: "Slovenian (Slovenia)", + SO_SO: "Somali (Somalia)", + SQ_AL: "Albanian (Albania)", + SR_ME: "Serbian (Cyrillic, Montenegro)", + SR_RS: "Serbian (Serbia)", + SR_XK: "Serbian (Cyrillic, Kosovo)", + SU_ID: "Sundanese (Indonesia)", + SV_SE: "Swedish (Sweden)", + SW_KE: "Swahili (Kenya)", + SW_TZ: "Swahili (Tanzania)", + TA_IN: "Tamil (India)", + TA_LK: "Tamil (Sri Lanka)", + TA_MY: "Tamil (Malaysia)", + TA_SG: "Tamil (Singapore)", + TE_IN: "Telugu (India)", + TH_TH: "Thai (Thailand)", + TR_TR: "Turkish (Turkey)", + UK_UA: "Ukrainian (Ukraine)", + UR_IN: "Urdu (India)", + UR_PK: "Urdu (Pakistan)", + UZ_UZ: "Uzbek (Uzbekistan)", + VI_VN: "Vietnamese (Vietnam)", + WUU_CN: "Chinese (Wu, Simplified)", + X_CUSTOM: "Custom Language", + YUE_CN: "Chinese (Cantonese, Simplified)", + ZH_CN: "Chinese (Mandarin, Simplified)", + ZH_CN_Bilingual: "Chinese (Mandarin, Simplified), English Bilingual", + ZH_CN_HENAN: "Chinese (Central Plains Henan, Simplified)", + ZH_CN_LIAONING: "Chinese (Northeastern Mandarin, Simplified)", + ZH_CN_SHAANXI: "Chinese (Central Plains Shaanxi, Simplified)", + ZH_CN_SHANDONG: "Chinese (Ji–Lu Mandarin, Simplified)", + ZH_CN_SICHUAN: "Chinese (Southwestern Mandarin, Simplified)", + ZH_HK: "Chinese (Cantonese, Traditional)", + ZH_TW: "Chinese (Taiwan Mandarin)", + ZU_ZA: "Zulu (South Africa)", + nalytics: "Language analysis", + onversationAnalysisPreviewHint: + "The call summary is currently a closed public preview and is only available for approved resources.", + fAudio: "Language of audio", + esource: "Language resource", + echnologiesUsed: "Language technologies used", + InPreview: "Language in preview", + }, + initialLocalStore:{ + audition: "If you think this project is good, Star, Fork and PR are welcome. Your Star is the best encouragement to the author." + } + }, + es: { + // Mensajes en español + aside: { + text: 'Texto', + batch: 'Lote', + settings: 'Configuración', + documents: 'Documentos' + }, + version: { + checkUpdate: 'Buscar actualizaciones', + currentVersion: 'Versión Actual:', + latestVersion: 'Última Versión:', + updateAvailable: 'Actualización disponible', + noUpdate: '¡Estás actualizado!', + updateInfo: 'Información de la actualización', + confirm: 'OK', + downloadLinks: 'Enlaces de Descarga', + password: 'Contraseña: em1n', + }, + bilibtn: { + goToBilibili: 'Ir a Bilibili', + }, + donate: { + appreciation: 'Si piensas que este proyecto es bueno,', + encouragement: 'No dudes en dar Star, hacer Fork y PR. Tu Star es el mejor ánimo para el autor :)', + guideReminder: 'Si encuentras algún problema, por favor lee detenidamente la sección "Documentación" → "Guía del Usuario", incluyendo "Introducción de Funciones" y "Preguntas Frecuentes".', + feedback: 'Para otras opiniones o sugerencias, puedes mencionar o chatear en privado con el dueño del grupo o el administrador en "Documentación" → "Unirse al Grupo Q", o plantear problemas en GitHub o Gitee.', + buyCoffeeTitle: 'Compra al autor un café 🍻', + wechatPayment: 'Usa WeChat para el pago', + hoverForAlipay: 'Pasa el ratón para pagar con Alipay', + buyDrinkTitle: 'Compra al autor una bebida ☕️', + alipayPayment: 'Usa Alipay para el pago', + hoverForWechat: 'Aleja el ratón para usar WeChat para el pago', + }, + configPage: { + downloadPath: 'Ruta de Descarga', + retryCount: 'Número de Intentos', + retryInterval: 'Intervalo de Reintentos (s)', + speechKey: 'Clave de Voz', + serviceRegion: 'Región del Servicio', + autoplay: 'Reproducción Automática', + updateNotification: 'Notificación de Actualización', + titleStyle: 'Estilo de la Barra de Título', + auditionText: 'Texto de Audición', + templateEdit: 'Edición de Plantilla', + name: 'Nombre', + action: 'Acción', + delete: 'Eliminar', + refreshConfig: 'Refrescar Configuración', + configFile: 'Archivo de Configuración', + openLogs: 'Abrir Registros', + clearLogs: 'Limpiar Registros', + // Otras traducciones... + }, + footer: { + downloadAudio: 'Download Audio', + // Otras traducciones... + }, + styles: { + assistant: "Asistente", + chat: "Charla", + customerservice: "Servicio al Cliente", + newscast: "Noticiero", + affectionate: "Cariñoso", + angry: "Enojado", + calm: "Tranquilo", + cheerful: "Alegre", + disgruntled: "Disgustado", + fearful: "Temeroso", + gentle: "Suave", + lyrical: "Lírico", + sad: "Triste", + serious: "Serio", + "poetry-reading": "Lectura de Poesía", + "narration-professional": "Narración Profesional", + "newscast-casual": "Noticiero Informal", + embarrassed: "Avergonzado", + depressed: "Deprimido", + envious: "Envidioso", + "narration-relaxed": "Narración Relajada", + Advertisement_upbeat: "Publicidad Optimista", + "Narration-relaxed": "Narración Relajada", + Sports_commentary: "Comentario Deportivo", + Sports_commentary_excited: "Comentario Deportivo Emocionado", + "documentary-narration": "Narración de Documentales", + excited: "Emocionado", + friendly: "Amigable", + terrified: "Aterrorizado", + shouting: "Gritando", + unfriendly: "Antipático", + whispering: "Susurrando", + hopeful: "Esperanzado" + }, + roles: { + YoungAdultFemale: "Mujer Joven Adulta", + YoungAdultMale: "Hombre Joven Adulto", + OlderAdultFemale: "Mujer Adulta Mayor", + OlderAdultMale: "Hombre Adulto Mayor", + SeniorFemale: "Mujer Senior", + SeniorMale: "Hombre Senior", + Girl: "Niña", + Boy: "Niño", + Narrator: "Narrador" + }, + main: { + textTab: "Texto", + ssmlTab: "SSML", + placeholder: "Por favor ingrese", + fileName: "Nombre de Archivo", + filePath: "Ruta de Archivo", + fileSize: "Conteo de Palabras", + status: "Estado", + ready: "Listo", + remove: "Eliminar", + play: "Reproducir", + openInFolder: "Abrir en Carpeta", + selectFiles: "Seleccionar Archivos", + clearAll: "Limpiar Todo", + doc: "Documentación", + // Otros textos... + }, + options: { + api: "Interfaz", + selectApi: "Seleccionar API", + language: "Idioma", + selectLanguage: "Seleccionar Idioma", + voice: "Voz", + selectVoice: "Seleccionar Voz", + speakingStyle: "Estilo de Habla", + selectSpeakingStyle: "Seleccionar Estilo de Habla", + rolePlaying: "Juego de Roles", + selectRole: "Seleccionar Rol", + speed: "Velocidad", + pitch: "Tono", + saveConfig: "Guardar Configuración", + selectConfig: "Seleccionar Configuración", + startConversion: "Iniciar Conversión", + edgeApiWarning: "La interfaz de Edge no admite el corte automático y la longitud máxima del texto es desconocida. Por favor, procese manualmente el texto según sea necesario.", + configureAzure: "Por favor, configure primero la clave y la región del servicio de voz de Azure.", + saveSuccess: "Configuración guardada con éxito.", + cancelSave: "Guardado cancelado.", + inputWarning: "Por favor, introduzca el contenido del texto.", + emptyListWarning: "La lista está vacía.", + }, + lang: { + AF_ZA: "Afrikáans (Sudáfrica)", + AM_ET: "Amárico (Etiopía)", + AR_AE: "Árabe (Emiratos Árabes Unidos)", + AR_BH: "árabe (Bahrein)", + AR_DZ: "árabe (Argelia)", + AR_EG: "Árabe (Egipto)", + AR_IL: "árabe (Israel)", + AR_IQ: "árabe (Irak)", + AR_JO: "árabe (Jordania)", + AR_KW: "árabe (Kuwait)", + AR_LB: "Árabe (Líbano)", + AR_LY: "árabe (Libia)", + AR_MA: "árabe (Marruecos)", + AR_OM: "árabe (Omán)", + AR_PS: "Árabe (Autoridad Palestina)", + AR_QA: "árabe (Qatar)", + AR_SA: "Árabe (Arabia Saudita)", + AR_SY: "árabe (sirio)", + AR_TN: "árabe (Túnez)", + AR_YE: "árabe (Yemen)", + AS_IN: "Asamés (India)", + AZ_AZ: "Azerbaiyán (Azerbaiyán)", + BG_BG: "búlgaro (Bulgaria)", + BN_BD: "bengalí (bengalí)", + BN_IN: "bengalí (India)", + BS_BA: "bosnio (Bosnia y Herzegovina)", + CA_ES: "Catalán (España)", + CS_CZ: "Checo(Checo)", + CY_GB: "Galés (Reino Unido)", + DA_DK: "danés (Dinamarca)", + DE_AT: "alemán (Austria)", + DE_CH: "Alemán (Suiza)", + DE_DE: "Alemán (Alemania)", + EL_GR: "Griego (Grecia)", + EN_AU: "Inglés (Australia)", + EN_CA: "Inglés (Canadá)", + EN_GB: "Inglés (Reino Unido)", + EN_GH: "Inglés (Ghana)", + EN_HK: "Inglés (RAE de Hong Kong)", + EN_IE: "inglés (Irlanda)", + EN_IN: "Inglés (India)", + EN_KE: "Inglés (Kenia)", + EN_NG: "Inglés (Nigeria)", + EN_NZ: "Inglés (Nueva Zelanda)", + EN_PH: "Inglés (Filipinas)", + EN_SG: "Inglés (Singapur)", + EN_TZ: "Inglés (Tanzania)", + EN_US: "Inglés (Estados Unidos)", + EN_ZA: "Inglés (Sudáfrica)", + ES_AR: "Español (Argentina)", + ES_BO: "Español (Bolivia)", + ES_CL: "Español (Chile)", + ES_CO: "Español (Colombia)", + ES_CR: "Español (Costa Rica)", + ES_CU: "Español (Cuba)", + ES_DO: "Español (República Dominicana)", + ES_EC: "Español (Ecuador)", + ES_ES: "Español (España)", + ES_GQ: "Español (Guinea Ecuatorial)", + ES_GT: "Español (Guatemala)", + ES_HN: "Español(Honduras)", + ES_MX: "Español (México)", + ES_NI: "Español(Nicaragua)", + ES_PA: "Español (Panamá)", + ES_PE: "Español (Perú)", + ES_PR: "Español (Puerto Rico)", + ES_PY: "Español(Paraguay)", + ES_SV: "Español(El Salvador)", + ES_US: "Español (Estados Unidos)", + ES_UY: "Español (Uruguay)", + ES_VE: "Español (Venezuela)", + ET_EE: "Estonio (Estonia)", + EU_ES: "euskera (euskera)", + FA_IR: "persa (Irán)", + FIL_PH: "Filipino (Filipinas)", + FI_FI: "finlandés (Finlandia)", + FR_BE: "Francés (Bélgica)", + FR_CA: "Francés (Canadá)", + FR_CH: "Francés (Suiza)", + FR_FR: "Francés (Francia)", + GA_IE: "irlandés (Irlanda)", + GL_ES: "gallego (gallego)", + GU_IN: "Gujarati (India)", + HE_IL: "hebreo (Israel)", + HI_IN: "Hindi(India)", + HR_HR: "croata (croata)", + HU_HU: "húngaro (Hungría)", + HY_AM: "armenio (armenio)", + ID_ID: "indonesio (Indonesia)", + IS_IS: "islandés (Islandia)", + IT_CH: "Italiano (Suiza)", + IT_IT: "Italiano (Italia)", + JA_JP: "japonés (Japón)", + JV_ID: "javanés (Indonesia)", + KA_GE: "georgiano (Georgia)", + KK_KZ: "Kazajo (Kazajstán)", + KM_KH: "jemer (Camboya)", + KN_IN: "Canarés (India)", + KO_KR: "coreano (Corea del Sur)", + LO_LA: "Lao (Laos)", + LT_LT: "lituano (Lituania)", + LV_LV: "Letón (letón)", + MK_MK: "Macedonio (Macedonia del Norte)", + ML_IN: "Malayalam (India)", + MN_MN: "mongol (mongol)", + MR_IN: "maratí (India)", + MS_MY: "Malayo (Malasia)", + MT_MT: "Maltés (Malta)", + MY_MM: "Birmano (Myanmar)", + NB_NO: "Escrito en noruego (Noruega)", + NE_NP: "Nepalí (Nepal)", + NL_BE: "Holandés (Bélgica)", + NL_NL: "Holandés (Países Bajos)", + OR_IN: "Odia (India)", + PA_IN: "Punjabí (India)", + PL_PL: "polaco (Polonia)", + PS_AF: "Pashto (Afganistán)", + PT_BR: "portugués (Brasil)", + PT_PT: "portugués (Portugal)", + RO_MD: "rumano(Molvador)", + RO_RO: "rumano (Rumania)", + RU_RU: "ruso (ruso)", + SI_LK: "cingalés (Sri Lanka)", + SK_SK: "eslovaco (Eslovaquia)", + SL_SI: "Esloveno (Eslovenia)", + SO_SO: "Somalí (Somalí)", + SQ_AL: "Albanés (Albania)", + SR_ME: "serbio (cirílico, montenegro)", + SR_RS: "serbio (serbio)", + SR_XK: "serbio (cirílico, Kosovo)", + SU_ID: "Sundanés (Indonesia)", + SV_SE: "sueco (Suecia)", + SW_KE: "Suajili (Kenia)", + SW_TZ: "Suajili (Tanzania)", + TA_IN: "Tamil (India)", + TA_LK: "Tamil (Sri Lanka)", + TA_MY: "Tamil (Malasia)", + TA_SG: "Tamil (Singapur)", + TE_IN: "Telugu (India)", + TH_TH: "Tailandés (Tailandia)", + TR_TR: "Turco (Türkiye)", + UK_UA: "ucraniano (ucraniano)", + UR_IN: "Urdu (India)", + UR_PK: "Urdu (Pakistán)", + UZ_UZ: "uzbeko (Uzbekistán)", + VI_VN: "vietnamita (Vietnam)", + WUU_CN: "Chino (dialecto Wu, simplificado)", + X_CUSTOM: "Idioma personalizado", + YUE_CN: "Chino (cantonés, simplificado)", + ZH_CN: "Chino (mandarín, simplificado)", + ZH_CN_Bilingual: "Chino (mandarín, simplificado), inglés bilingüe", + ZH_CN_HENAN: "Chino (mandarín Henan de las llanuras centrales, simplificado)", + ZH_CN_LIAONING: "Chino (mandarín nororiental, simplificado)", + ZH_CN_SHAANXI: "Chino (chino mandarín Shaanxi, simplificado)", + ZH_CN_SHANDONG: "Chino (Jilu Mandarín, simplificado)", + ZH_CN_SICHUAN: "Chino (mandarín del suroeste, simplificado)", + ZH_HK: "Chino (cantonés, tradicional)", + ZH_TW: "Chino (mandarín de Taiwán)", + ZU_ZA: "Zulu (Sudáfrica)", + nalytics: "Análisis del lenguaje", + onversationAnalysisPreviewHint: + "Los resúmenes de las llamadas se encuentran actualmente en vista previa pública cerrada y solo están disponibles para los recursos aprobados.", + fAudio: "Idioma del audio", + esource: "Recurso de idioma", + echnologiesUsed: "Tecnologías lingüísticas utilizadas", + InPreview: "Idioma en vista previa", + }, + initialLocalStore:{ + audition: "Si piensas que este proyecto es bueno, Star, Fork y PR son bienvenidos. Tu Star es el mejor ánimo para el autor." + } + }, + zh: { + // Mensajes en chino + aside: { + text: '文本', + batch: '批量', + settings: '设置', + documents: '文档' + }, + version: { + checkUpdate: '检查更新', + currentVersion: '当前版本:', + latestVersion: '最新版本:', + updateAvailable: '有可用更新', + noUpdate: '您的软件是最新的!', + updateInfo: '更新信息', + confirm: '确定', + downloadLinks: '下载链接', + password: '密码:em1n', + }, + bilibtn: { + goToBilibili: '前往三连', + }, + configPage: { + downloadPath: '下载路径', + retryCount: '重试次数', + retryInterval: '重试间隔(s)', + speechKey: 'SpeechKey', + serviceRegion: 'ServiceRegion', + autoplay: '自动播放', + updateNotification: '新版本提醒', + titleStyle: '标题栏样式', + auditionText: '试听文本', + templateEdit: '模板编辑', + name: '名字', + action: '操作', + delete: '删除', + refreshConfig: '刷新配置', + configFile: '配置文件', + openLogs: '打开日志', + clearLogs: '清理日志', + // Otras traducciones... + }, + donate: { + appreciation: '如果你觉得这个项目还不错,', + encouragement: '欢迎给予Star、Fork和PR。你的Star是对作者最好的鼓励 :)', + guideReminder: '使用遇到问题请仔细阅读"文档"→"使用指南"中的"功能介绍"和"常见问题"。', + feedback: '其他意见或建议可以在"文档"→"加入Q群"中艾特或私聊群主或者管理,也可以在GitHub或者Gitee提出issues。', + buyCoffeeTitle: '请作者喝杯咖啡 🍻', + wechatPayment: '使用微信支付', + hoverForAlipay: '鼠标悬停使用支付宝支付', + buyDrinkTitle: '请作者喝杯饮料 ☕️', + alipayPayment: '使用支付宝支付', + hoverForWechat: '移开鼠标使用微信支付', + }, + footer: { + downloadAudio: 'Download Audio', + // Otras traducciones... + }, + "styles": { + assistant: "助手", + chat: "聊天", + customerservice: "客服", + newscast: "新闻播报", + affectionate: "深情的", + angry: "愤怒的", + calm: "冷静的", + cheerful: "快乐的", + disgruntled: "不满的", + fearful: "害怕的", + gentle: "温柔的", + lyrical: "抒情的", + sad: "悲伤的", + serious: "严肃的", + "poetry-reading": "诗歌朗诵", + "narration-professional": "专业旁白", + "newscast-casual": "随意新闻播报", + embarrassed: "尴尬的", + depressed: "沮丧的", + envious: "嫉妒的", + "narration-relaxed": "轻松旁白", + Advertisement_upbeat: "积极向上的广告", + "Narration-relaxed": "轻松旁白", + Sports_commentary: "体育解说", + Sports_commentary_excited: "激动的体育解说", + "documentary-narration": "纪录片旁白", + excited: "兴奋的", + friendly: "友好的", + terrified: "恐惧的", + shouting: "大喊", + unfriendly: "不友好的", + whispering: "耳语", + hopeful: "充满希望的" + }, + "roles": { + YoungAdultFemale: "年轻成年女性", + YoungAdultMale: "年轻成年男性", + OlderAdultFemale: "年长成年女性", + OlderAdultMale: "年长成年男性", + SeniorFemale: "老年女性", + SeniorMale: "老年男性", + Girl: "女孩", + Boy: "男孩", + Narrator: "旁白" + }, + main: { + textTab: "文本", + ssmlTab: "SSML", + placeholder: "请输入", + fileName: "文件名", + filePath: "文件路径", + fileSize: "字数统计", + status: "状态", + ready: "就绪", + remove: "移除", + play: "播放", + openInFolder: "在文件夹中打开", + selectFiles: "选择文件", + clearAll: "清空", + doc: "文档", + // Otros textos... + }, + options: { + api: "接口", + selectApi: "选择接口", + language: "语言", + selectLanguage: "选择语言", + voice: "语音", + selectVoice: "选择语音", + speakingStyle: "说话风格", + selectSpeakingStyle: "选择说话风格", + rolePlaying: "角色扮演", + selectRole: "选择角色", + speed: "语速", + pitch: "音调", + saveConfig: "保存配置", + selectConfig: "选择配置", + startConversion: "开始转换", + edgeApiWarning: "Edge接口不支持自动切片,最长支持文本长度未知。请根据自身需求手动预处理文本。", + configureAzure: "请先配置Azure的Speech服务密钥和区域。", + saveSuccess: "保存成功。", + cancelSave: "取消保存。", + inputWarning: "请输入文字内容。", + emptyListWarning: "列表内容为空。", + waitMessage: "请稍候..." + }, + lang: { + AF_ZA: "南非荷兰语(南非)", + AM_ET: "阿姆哈拉语(埃塞俄比亚)", + AR_AE: "阿拉伯语(阿拉伯联合酋长国)", + AR_BH: "阿拉伯语(巴林)", + AR_DZ: "阿拉伯语(阿尔及利亚)", + AR_EG: "阿拉伯语(埃及)", + AR_IL: "阿拉伯语(以色列)", + AR_IQ: "阿拉伯语(伊拉克)", + AR_JO: "阿拉伯语(约旦)", + AR_KW: "阿拉伯语(科威特)", + AR_LB: "阿拉伯语(黎巴嫩)", + AR_LY: "阿拉伯语(利比亚)", + AR_MA: "阿拉伯语(摩洛哥)", + AR_OM: "阿拉伯语(阿曼)", + AR_PS: "阿拉伯语(巴勒斯坦民族权力机构)", + AR_QA: "阿拉伯语(卡塔尔)", + AR_SA: "阿拉伯语(沙特阿拉伯)", + AR_SY: "阿拉伯语(叙利亚)", + AR_TN: "阿拉伯语(突尼斯)", + AR_YE: "阿拉伯语(也门)", + AS_IN: "阿萨姆语(印度)", + AZ_AZ: "阿塞拜疆语(阿塞拜疆) ", + BG_BG: "保加利亚语(保加利亚)", + BN_BD: "孟加拉语(孟加拉)", + BN_IN: "孟加拉语(印度)", + BS_BA: "波斯尼亚语(波斯尼亚和黑塞哥维那)", + CA_ES: "加泰罗尼亚语(西班牙)", + CS_CZ: "捷克语(捷克)", + CY_GB: "威尔士语(英国)", + DA_DK: "丹麦语(丹麦)", + DE_AT: "德语(奥地利)", + DE_CH: "德语(瑞士)", + DE_DE: "德语(德国)", + EL_GR: "希腊语(希腊)", + EN_AU: "英语(澳大利亚)", + EN_CA: "英语(加拿大)", + EN_GB: "英语(英国)", + EN_GH: "英语(加纳)", + EN_HK: "英语(香港特别行政区)", + EN_IE: "英语(爱尔兰)", + EN_IN: "英语(印度)", + EN_KE: "英语(肯尼亚)", + EN_NG: "英语(尼日利亚)", + EN_NZ: "英语(新西兰)", + EN_PH: "英语(菲律宾)", + EN_SG: "英语(新加坡)", + EN_TZ: "英语(坦桑尼亚)", + EN_US: "英语(美国)", + EN_ZA: "英语(南非)", + ES_AR: "西班牙语(阿根廷)", + ES_BO: "西班牙语(玻利维亚)", + ES_CL: "西班牙语(智利)", + ES_CO: "西班牙语(哥伦比亚)", + ES_CR: "西班牙语(哥斯达黎加)", + ES_CU: "西班牙语(古巴)", + ES_DO: "西班牙语(多米尼加共和国)", + ES_EC: "西班牙语(厄瓜多尔)", + ES_ES: "西班牙语(西班牙)", + ES_GQ: "西班牙语(赤道几内亚)", + ES_GT: "西班牙语(危地马拉)", + ES_HN: "西班牙语(洪都拉斯)", + ES_MX: "西班牙语(墨西哥)", + ES_NI: "西班牙语(尼加拉瓜)", + ES_PA: "西班牙语(巴拿马)", + ES_PE: "西班牙语(秘鲁)", + ES_PR: "西班牙语(波多黎各)", + ES_PY: "西班牙语(巴拉圭)", + ES_SV: "西班牙语(萨尔瓦多)", + ES_US: "西班牙语(美国)", + ES_UY: "西班牙语(乌拉圭)", + ES_VE: "西班牙语(委内瑞拉)", + ET_EE: "爱沙尼亚语(爱沙尼亚)", + EU_ES: "巴斯克语(巴斯克语)", + FA_IR: "波斯语(伊朗)", + FIL_PH: "菲律宾语(菲律宾)", + FI_FI: "芬兰语(芬兰)", + FR_BE: "法语(比利时)", + FR_CA: "法语(加拿大)", + FR_CH: "法语(瑞士)", + FR_FR: "法语(法国)", + GA_IE: "爱尔兰语(爱尔兰)", + GL_ES: "加利西亚语(加利西亚语)", + GU_IN: "古吉拉特语(印度)", + HE_IL: "希伯来语(以色列)", + HI_IN: "印地语(印度)", + HR_HR: "克罗地亚语(克罗地亚)", + HU_HU: "匈牙利语(匈牙利)", + HY_AM: "亚美尼亚语(亚美尼亚)", + ID_ID: "印度尼西亚语(印度尼西亚)", + IS_IS: "冰岛语(冰岛)", + IT_CH: "意大利语(瑞士)", + IT_IT: "意大利语(意大利)", + JA_JP: "日语(日本)", + JV_ID: "爪哇语(印度尼西亚)", + KA_GE: "格鲁吉亚语(格鲁吉亚)", + KK_KZ: "哈萨克语(哈萨克斯坦)", + KM_KH: "高棉语(柬埔寨)", + KN_IN: "埃纳德语(印度)", + KO_KR: "韩语(韩国)", + LO_LA: "老挝语(老挝) ", + LT_LT: "立陶宛语(立陶宛)", + LV_LV: "拉脱维亚语(拉脱维亚)", + MK_MK: "马其顿语(北马其顿)", + ML_IN: "马拉雅拉姆语(印度)", + MN_MN: "蒙古语(蒙古)", + MR_IN: "马拉地语(印度)", + MS_MY: "马来语(马来西亚)", + MT_MT: "马耳他语(马耳他)", + MY_MM: "缅甸语(缅甸)", + NB_NO: "书面挪威语(挪威)", + NE_NP: "尼泊尔语(尼泊尔)", + NL_BE: "荷兰语(比利时)", + NL_NL: "荷兰语(荷兰)", + OR_IN: "奥里亚语(印度)", + PA_IN: "旁遮普语(印度)", + PL_PL: "波兰语(波兰)", + PS_AF: "普什图语(阿富汗)", + PT_BR: "葡萄牙语(巴西)", + PT_PT: "葡萄牙语(葡萄牙)", + RO_MD: "罗马尼亚语(摩尔瓦多)", + RO_RO: "罗马尼亚语(罗马尼亚)", + RU_RU: "俄语(俄罗斯)", + SI_LK: "僧伽罗语(斯里兰卡)", + SK_SK: "斯洛伐克语(斯洛伐克)", + SL_SI: "斯洛文尼亚语(斯洛文尼亚)", + SO_SO: "索马里语(索马里)", + SQ_AL: "阿尔巴尼亚语(阿尔巴尼亚)", + SR_ME: "塞尔维亚语(西里尔文,黑山)", + SR_RS: "塞尔维亚语(塞尔维亚)", + SR_XK: "塞尔维亚语(西里尔语,科索沃)", + SU_ID: "巽他语(印度尼西亚)", + SV_SE: "瑞典语(瑞典)", + SW_KE: "斯瓦希里语(肯尼亚)", + SW_TZ: "斯瓦希里语(坦桑尼亚)", + TA_IN: "泰米尔语(印度)", + TA_LK: "泰米尔语(斯里兰卡)", + TA_MY: "泰米尔语(马来西亚)", + TA_SG: "泰米尔语(新加坡)", + TE_IN: "泰卢固语(印度)", + TH_TH: "泰语(泰国)", + TR_TR: "土耳其语(Türkiye)", + UK_UA: "乌克兰语(乌克兰)", + UR_IN: "乌尔都语(印度)", + UR_PK: "乌尔都语(巴基斯坦)", + UZ_UZ: "乌兹别克语(乌兹别克斯坦)", + VI_VN: "越南语(越南)", + WUU_CN: "中文(吴语,简体)", + X_CUSTOM: "自定义语言", + YUE_CN: "中文(粤语,简体)", + ZH_CN: "中文(普通话,简体)", + ZH_CN_Bilingual: "中文(普通话,简体),英语双语", + ZH_CN_HENAN: "中文(中原官话河南,简体)", + ZH_CN_LIAONING: "中文(东北官话,简体)", + ZH_CN_SHAANXI: "中文(中原官话陕西,简体)", + ZH_CN_SHANDONG: "中文(冀鲁官话,简体)", + ZH_CN_SICHUAN: "中文(西南官话,简体)", + ZH_HK: "中文(粤语,繁体)", + ZH_TW: "中文(台湾普通话)", + ZU_ZA: "祖鲁语(南非)", + nalytics: "语言分析", + onversationAnalysisPreviewHint: + "通话摘要目前为封闭公共预览版,仅适用于已批准的资源。", + fAudio: "Language of audio", + esource: "语言资源", + echnologiesUsed: "使用的语言技术", + InPreview: "预览中的语言", + }, + initialLocalStore:{ + audition: "如果你觉得这个项目还不错, 欢迎Star、Fork和PR。你的Star是对作者最好的鼓励。" + } + + }, + // Otros idiomas... +}; + +const i18n = createI18n({ + legacy: false, // Usa la Composition API + locale: 'es', // Idioma por defecto + fallbackLocale: 'es', // Idioma de reserva + messages, +}); + +export default i18n; diff --git a/src/components/aside/Aside.vue b/src/components/aside/Aside.vue index a5f2f47..19efa8d 100644 --- a/src/components/aside/Aside.vue +++ b/src/components/aside/Aside.vue @@ -7,19 +7,19 @@ > - 文本 + {{ t('aside.text') }} - 批量 + {{ t('aside.batch') }} - 设置 + {{ t('aside.setting') }} - 文档 + {{ t('aside.documents') }} @@ -29,6 +29,8 @@ diff --git a/src/store/play.ts b/src/store/play.ts index 70f3c30..06be384 100644 --- a/src/store/play.ts +++ b/src/store/play.ts @@ -1,4 +1,5 @@ import { ipcRenderer } from "electron"; +import { PromptGPT } from "@/types/prompGPT"; async function getTTSData( inps: any, @@ -25,9 +26,8 @@ async function getTTSData( SSML = ` - + ${inps.inputValue} @@ -81,5 +81,18 @@ async function retrySpeechInvocation(SSML: string, retryCount: number, delay: nu function sleep(ms: number) { return new Promise(resolve => setTimeout(resolve, ms)); } +// promptGPT +async function getDataGPT(options: PromptGPT) { + let { promptGPT, model, key, retryCount, retryInterval=1 } = options; + // 判断retryCount是否为0或者null,如果是则不重试 + if (!retryCount) { + retryCount = 1; + } + if (!retryInterval) { + retryInterval = 1; + } + const result = await ipcRenderer.invoke("promptGPT", promptGPT, model, key); + return result; +} -export default getTTSData; +export { getTTSData, getDataGPT }; diff --git a/src/store/store.ts b/src/store/store.ts index 59eaedf..3d221b5 100644 --- a/src/store/store.ts +++ b/src/store/store.ts @@ -1,7 +1,7 @@ // @/store/firstStore.js import { defineStore } from "pinia"; -import getTTSData from "./play"; +import { getTTSData, getDataGPT } from "./play"; import { ElMessage, ElMessageBox } from "element-plus"; import { h } from "vue"; const fs = require("fs"); @@ -86,9 +86,8 @@ export const useTtsStore = defineStore("ttsStore", { this.inputs.ssmlValue = ` - + ${text} @@ -149,6 +148,30 @@ export const useTtsStore = defineStore("ttsStore", { }) ); }, + async startChatGPT(promptGPT: string) { + await getDataGPT( + { + promptGPT: promptGPT, + key: this.config.speechKey, + model: this.config.serviceRegion, + retryCount: this.config.retryCount, + retryInterval: this.config.retryInterval, + } + ) + .then((res: any) => { + this.inputs.inputValue = res; + this.setSSMLValue(); + // this.start(); + }) + .catch((err: any) => { + console.error(err); + ElMessage({ + message: "转换失败\n" + String(err), + type: "error", + duration: 3000, + }); + }); + }, async start() { console.log("清空缓存中"); let resFlag = true; @@ -217,8 +240,7 @@ export const useTtsStore = defineStore("ttsStore", { this.currMp3Buffer = Buffer.concat([this.currMp3Buffer, buffers]); ipcRenderer.send( "log.info", - `第${index + 1}次转换完成,此时Buffer长度为:${ - this.currMp3Buffer.length + `第${index + 1}次转换完成,此时Buffer长度为:${this.currMp3Buffer.length }` ); } catch (error) { @@ -360,8 +382,7 @@ export const useTtsStore = defineStore("ttsStore", { buffer = Buffer.concat([buffer, buffers]); ipcRenderer.send( "log.info", - `第${index + 1}次转换完成,此时Buffer长度为:${ - buffer.length + `第${index + 1}次转换完成,此时Buffer长度为:${buffer.length }` ); } catch (error) { @@ -436,8 +457,8 @@ export const useTtsStore = defineStore("ttsStore", { console.log('当前设置的格式:', this.config.formatType); -//------------------------------------------------------------------------------------------------------------------------------------- - + //------------------------------------------------------------------------------------------------------------------------------------- + const filePath = path.join(this.config.savePath, currTime + this.config.formatType); if (this.config.formatType == ".mp3") { fs.writeFileSync(path.resolve(filePath), this.currMp3Buffer); @@ -461,7 +482,7 @@ export const useTtsStore = defineStore("ttsStore", { ipcRenderer.send("log.info", `下载完成:${filePath}`); } else { - // 将 this.currMp3Buffer 转换为可读流 + // 将 this.currMp3Buffer 转换为可读流 const inputStream = new Readable(); inputStream.push(this.currMp3Buffer); inputStream.push(null); // 结束流 @@ -509,7 +530,7 @@ export const useTtsStore = defineStore("ttsStore", { }) .run(); } -//------------------------------------------------------------------------------------------------------------------------------------- + //------------------------------------------------------------------------------------------------------------------------------------- }, async audition(val: string) { diff --git a/src/types/prompGPT.ts b/src/types/prompGPT.ts new file mode 100644 index 0000000..c5b1c6b --- /dev/null +++ b/src/types/prompGPT.ts @@ -0,0 +1,9 @@ +interface PromptGPT { + promptGPT: string, + model: string, + key: string, + retryCount: number, + retryInterval: number, +} + +export { PromptGPT} \ No newline at end of file From b6cf3fdd051099a78872b028e62d4f6ed4770598 Mon Sep 17 00:00:00 2001 From: Jpabon Date: Sun, 12 Nov 2023 21:44:41 -0500 Subject: [PATCH 8/9] Implement gtp-api, with model OpenAI --- electron/main/index.ts | 3 +- electron/utils/gpt-api.ts | 20 +- package-lock.json | 363 +++++++++++++++++++++++ package.json | 3 +- src/assets/i18n/i18n.ts | 19 +- src/components/configpage/ConfigPage.vue | 42 +++ src/components/main/Main.vue | 6 +- src/store/store.ts | 18 +- yarn.lock | 155 +++++++++- 9 files changed, 614 insertions(+), 15 deletions(-) diff --git a/electron/main/index.ts b/electron/main/index.ts index 754bdc0..d44b7f4 100644 --- a/electron/main/index.ts +++ b/electron/main/index.ts @@ -5,6 +5,7 @@ import api from "../utils/api"; import edgeApi from "../utils/edge-api"; import azureApi from "../utils/azure-api"; import logger from "../utils/log"; +import { gptApi } from "../utils/gpt-api"; // Disable GPU Acceleration for Windows 7 //if (release().startsWith("6.1")) app.disableHardwareAcceleration(); @@ -189,7 +190,7 @@ ipcMain.handle("azureApi", async (event, ssml, key, region) => { }); // const result = await ipcRenderer.invoke("promptGPT", promptGPT, model, key); ipcMain.handle("promptGPT", async (event, promptGPT, model, key) => { - const res = api.promptGPT(promptGPT, model, key); + const res = gptApi(promptGPT, model, key); return res; }); diff --git a/electron/utils/gpt-api.ts b/electron/utils/gpt-api.ts index 23675bd..87012a4 100644 --- a/electron/utils/gpt-api.ts +++ b/electron/utils/gpt-api.ts @@ -1 +1,19 @@ -npm install axios +import OpenAI from 'openai'; +import logger from "../utils/log"; + +const gptApi = async (promptGPT: string, model: string, key: string) => { + logger.info(`promptGPT: ${promptGPT}`); + const openai = new OpenAI({ + apiKey: key, + }); + logger.info(`model: ${model}`); + const chatCompletion = await openai.chat.completions.create({ + messages: [{ role: 'user', content: promptGPT }], + model: model, + }); + logger.info(`chatCompletion: ${JSON.stringify(chatCompletion)}`); + + return chatCompletion.choices[0].message.content; +} + +export { gptApi }; \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index d4ac087..b1ad00b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -18,6 +18,7 @@ "fluent-ffmpeg": "2.1.2", "microsoft-cognitiveservices-speech-sdk": "1.30.1", "nodejs-websocket": "1.7.2", + "openai": "^4.0.0", "pinia": "2.0.17", "uuid": "8.3.2", "vue-i18n": "9.6.5", @@ -501,6 +502,15 @@ "resolved": "https://registry.npmjs.org/@types/node/-/node-16.11.45.tgz", "integrity": "sha512-3rKg/L5x0rofKuuUt5zlXzOnKyIHXmIu5R8A0TuNDMF2062/AOIDBciFIjToLEJ/9F9DzkHNot+BpNsMI1OLdQ==" }, + "node_modules/@types/node-fetch": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/@types/node-fetch/-/node-fetch-2.6.9.tgz", + "integrity": "sha512-bQVlnMLFJ2d35DkPNjEPmd9ueO/rh5EiaZt2bhqiSarPjZIuIV6bPQVqcrEyvNo+AfTrRGVazle1tl597w3gfA==", + "dependencies": { + "@types/node": "*", + "form-data": "^4.0.0" + } + }, "node_modules/@types/plist": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/@types/plist/-/plist-3.0.2.tgz", @@ -798,6 +808,17 @@ "integrity": "sha512-sAP4LldeWNz0lNzmTird3uWfFDWWTeg6V/MsmyyLR9X1idwKBWIgt/ZvinqQldJm3LecKEs1emkbquO6PCiLVQ==", "dev": true }, + "node_modules/abort-controller": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/abort-controller/-/abort-controller-3.0.0.tgz", + "integrity": "sha512-h8lQ8tacZYnR3vNQTgibj+tODHI5/+l06Au2Pcriv/Gmet0eaj4TwWH41sO9wnHDiQsEj19q0drzdWdeAHtweg==", + "dependencies": { + "event-target-shim": "^5.0.0" + }, + "engines": { + "node": ">=6.5" + } + }, "node_modules/agent-base": { "version": "6.0.2", "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-6.0.2.tgz", @@ -809,6 +830,17 @@ "node": ">= 6.0.0" } }, + "node_modules/agentkeepalive": { + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/agentkeepalive/-/agentkeepalive-4.5.0.tgz", + "integrity": "sha512-5GG/5IbQQpC9FpkRGsSvZI5QYeSCzlJHdpBQntCsuTOxhKD8lqKhrleg2Yi7yvMIf82Ycmmqln9U8V9qwEiJew==", + "dependencies": { + "humanize-ms": "^1.2.1" + }, + "engines": { + "node": ">= 8.0.0" + } + }, "node_modules/ajv": { "version": "6.12.6", "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", @@ -1099,6 +1131,11 @@ "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", "dev": true }, + "node_modules/base-64": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/base-64/-/base-64-0.1.0.tgz", + "integrity": "sha512-Y5gU45svrR5tI2Vt/X9GPd3L0HNIKzGu202EjxrXMpuc2V2CiKgemAbUUsqYmZJvPtCXoUKjNZwBJzsNScUbXA==" + }, "node_modules/base64-js": { "version": "1.5.1", "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz", @@ -1419,6 +1456,14 @@ "url": "https://github.com/chalk/chalk?sponsor=1" } }, + "node_modules/charenc": { + "version": "0.0.2", + "resolved": "https://registry.npmjs.org/charenc/-/charenc-0.0.2.tgz", + "integrity": "sha512-yrLQ/yVUFXkzg7EDQsPieE/53+0RlaWTs+wBrvW36cyilJ2SaDWfl4Yj7MtLTXleV9uEKefbAGUPv2/iWSooRA==", + "engines": { + "node": "*" + } + }, "node_modules/chownr": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/chownr/-/chownr-2.0.0.tgz", @@ -1698,6 +1743,14 @@ "node": ">= 8" } }, + "node_modules/crypt": { + "version": "0.0.2", + "resolved": "https://registry.npmjs.org/crypt/-/crypt-0.0.2.tgz", + "integrity": "sha512-mCxBlsHFYh9C+HVpiEacem8FEBnMXgU9gy4zmNC+SXAZNB/1idgp/aulFJ4FgCi7GPEVbfyng092GqL2k2rmow==", + "engines": { + "node": "*" + } + }, "node_modules/crypto-random-string": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/crypto-random-string/-/crypto-random-string-2.0.0.tgz", @@ -1806,6 +1859,15 @@ "dev": true, "optional": true }, + "node_modules/digest-fetch": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/digest-fetch/-/digest-fetch-1.3.0.tgz", + "integrity": "sha512-CGJuv6iKNM7QyZlM2T3sPAdZWd/p9zQiRNS9G+9COUCwzWFTs0Xp8NF5iePx7wtvhDykReiRRrSeNb4oMmB8lA==", + "dependencies": { + "base-64": "^0.1.0", + "md5": "^2.3.0" + } + }, "node_modules/dir-compare": { "version": "2.4.0", "resolved": "https://registry.npmjs.org/dir-compare/-/dir-compare-2.4.0.tgz", @@ -2638,6 +2700,14 @@ "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-2.0.2.tgz", "integrity": "sha512-Rfkk/Mp/DL7JVje3u18FxFujQlTNR2q6QfMSMB7AvCBx91NGj/ba3kCfza0f6dVDbw7YlRf/nDrn7pQrCCyQ/w==" }, + "node_modules/event-target-shim": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/event-target-shim/-/event-target-shim-5.0.1.tgz", + "integrity": "sha512-i/2XbnSz/uxRCU6+NdVJgKWDTM427+MqYbkQzD321DuCQJUqOuJKIA0IM2+W2xtYHdKOmZ4dR6fExsd4SXL+WQ==", + "engines": { + "node": ">=6" + } + }, "node_modules/extract-zip": { "version": "1.7.0", "resolved": "https://registry.npmjs.org/extract-zip/-/extract-zip-1.7.0.tgz", @@ -2794,6 +2864,23 @@ "node": ">= 6" } }, + "node_modules/form-data-encoder": { + "version": "1.7.2", + "resolved": "https://registry.npmjs.org/form-data-encoder/-/form-data-encoder-1.7.2.tgz", + "integrity": "sha512-qfqtYan3rxrnCk1VYaA4H+Ms9xdpPqvLZa6xmMgFvhO32x7/3J/ExcTd6qpxM0vH2GdMI+poehyBZvqfMTto8A==" + }, + "node_modules/formdata-node": { + "version": "4.4.1", + "resolved": "https://registry.npmjs.org/formdata-node/-/formdata-node-4.4.1.tgz", + "integrity": "sha512-0iirZp3uVDjVGt9p49aTaqjk84TrglENEDuqfdlZQ1roC9CWlPk6Avf8EEnZNcAqPonwkG35x4n3ww/1THYAeQ==", + "dependencies": { + "node-domexception": "1.0.0", + "web-streams-polyfill": "4.0.0-beta.3" + }, + "engines": { + "node": ">= 12.20" + } + }, "node_modules/fs-extra": { "version": "8.1.0", "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-8.1.0.tgz", @@ -3127,6 +3214,14 @@ "node": ">= 6" } }, + "node_modules/humanize-ms": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/humanize-ms/-/humanize-ms-1.2.1.tgz", + "integrity": "sha512-Fl70vYtsAFb/C06PTS9dZBo7ihau+Tu/DNCk/OyHhea07S+aeMWpFFkUaXRa8fI+ScZbEI8dfSxwY7gxZ9SAVQ==", + "dependencies": { + "ms": "^2.0.0" + } + }, "node_modules/iconv-corefoundation": { "version": "1.1.7", "resolved": "https://registry.npmjs.org/iconv-corefoundation/-/iconv-corefoundation-1.1.7.tgz", @@ -3217,6 +3312,11 @@ "integrity": "sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew==", "dev": true }, + "node_modules/is-buffer": { + "version": "1.1.6", + "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.6.tgz", + "integrity": "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==" + }, "node_modules/is-ci": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/is-ci/-/is-ci-3.0.1.tgz", @@ -3531,6 +3631,16 @@ "node": ">=10" } }, + "node_modules/md5": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/md5/-/md5-2.3.0.tgz", + "integrity": "sha512-T1GITYmFaKuO91vxyoQMFETst+O71VUPEU3ze5GNzDm0OWdP8v1ziTaAEPUr/3kLsY3Sftgz242A1SetQiDL7g==", + "dependencies": { + "charenc": "0.0.2", + "crypt": "0.0.2", + "is-buffer": "~1.1.6" + } + }, "node_modules/memoize-one": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/memoize-one/-/memoize-one-6.0.0.tgz", @@ -3726,6 +3836,43 @@ "dev": true, "optional": true }, + "node_modules/node-domexception": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/node-domexception/-/node-domexception-1.0.0.tgz", + "integrity": "sha512-/jKZoMpw0F8GRwl4/eLROPA3cfcXtLApP0QzLmUT/HuPCZWyB7IY9ZrMeKw2O/nFIqPQB3PVM9aYm0F312AXDQ==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/jimmywarting" + }, + { + "type": "github", + "url": "https://paypal.me/jimmywarting" + } + ], + "engines": { + "node": ">=10.5.0" + } + }, + "node_modules/node-fetch": { + "version": "2.7.0", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.7.0.tgz", + "integrity": "sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==", + "dependencies": { + "whatwg-url": "^5.0.0" + }, + "engines": { + "node": "4.x || >=6.0.0" + }, + "peerDependencies": { + "encoding": "^0.1.0" + }, + "peerDependenciesMeta": { + "encoding": { + "optional": true + } + } + }, "node_modules/nodejs-websocket": { "version": "1.7.2", "resolved": "https://registry.npmjs.org/nodejs-websocket/-/nodejs-websocket-1.7.2.tgz", @@ -3803,6 +3950,32 @@ "node": ">=6" } }, + "node_modules/openai": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/openai/-/openai-4.0.0.tgz", + "integrity": "sha512-UHv70gIw20pxu9tiUueE9iS+4U4eTGiTgQr+zlJ5aX4oj6LUUp+7mBn0xAqilawftwUB/biohPth2vcZFmoNYw==", + "dependencies": { + "@types/node": "^18.11.18", + "@types/node-fetch": "^2.6.4", + "abort-controller": "^3.0.0", + "agentkeepalive": "^4.2.1", + "digest-fetch": "^1.3.0", + "form-data-encoder": "1.7.2", + "formdata-node": "^4.3.2", + "node-fetch": "^2.6.7" + }, + "bin": { + "openai": "bin/cli" + } + }, + "node_modules/openai/node_modules/@types/node": { + "version": "18.18.9", + "resolved": "https://registry.npmjs.org/@types/node/-/node-18.18.9.tgz", + "integrity": "sha512-0f5klcuImLnG4Qreu9hPj/rEfFq6YRc5n2mAjSsH+ec/mJL+3voBH0+8T7o8RpFjH7ovc+TRsL/c7OYIQsPTfQ==", + "dependencies": { + "undici-types": "~5.26.4" + } + }, "node_modules/p-cancelable": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/p-cancelable/-/p-cancelable-1.1.0.tgz", @@ -4587,6 +4760,11 @@ "node": ">=6" } }, + "node_modules/tr46": { + "version": "0.0.3", + "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", + "integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==" + }, "node_modules/truncate-utf8-bytes": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/truncate-utf8-bytes/-/truncate-utf8-bytes-1.0.2.tgz", @@ -4647,6 +4825,11 @@ "node": ">=4.2.0" } }, + "node_modules/undici-types": { + "version": "5.26.5", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-5.26.5.tgz", + "integrity": "sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==" + }, "node_modules/unique-string": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/unique-string/-/unique-string-2.0.0.tgz", @@ -4889,6 +5072,28 @@ "typescript": "*" } }, + "node_modules/web-streams-polyfill": { + "version": "4.0.0-beta.3", + "resolved": "https://registry.npmjs.org/web-streams-polyfill/-/web-streams-polyfill-4.0.0-beta.3.tgz", + "integrity": "sha512-QW95TCTaHmsYfHDybGMwO5IJIM93I/6vTRk+daHTWFPhwh+C8Cg7j7XyKrwrj8Ib6vYXe0ocYNrmzY4xAAN6ug==", + "engines": { + "node": ">= 14" + } + }, + "node_modules/webidl-conversions": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", + "integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==" + }, + "node_modules/whatwg-url": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz", + "integrity": "sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==", + "dependencies": { + "tr46": "~0.0.3", + "webidl-conversions": "^3.0.0" + } + }, "node_modules/which": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", @@ -5366,6 +5571,15 @@ "resolved": "https://registry.npmjs.org/@types/node/-/node-16.11.45.tgz", "integrity": "sha512-3rKg/L5x0rofKuuUt5zlXzOnKyIHXmIu5R8A0TuNDMF2062/AOIDBciFIjToLEJ/9F9DzkHNot+BpNsMI1OLdQ==" }, + "@types/node-fetch": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/@types/node-fetch/-/node-fetch-2.6.9.tgz", + "integrity": "sha512-bQVlnMLFJ2d35DkPNjEPmd9ueO/rh5EiaZt2bhqiSarPjZIuIV6bPQVqcrEyvNo+AfTrRGVazle1tl597w3gfA==", + "requires": { + "@types/node": "*", + "form-data": "^4.0.0" + } + }, "@types/plist": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/@types/plist/-/plist-3.0.2.tgz", @@ -5602,6 +5816,14 @@ "integrity": "sha512-sAP4LldeWNz0lNzmTird3uWfFDWWTeg6V/MsmyyLR9X1idwKBWIgt/ZvinqQldJm3LecKEs1emkbquO6PCiLVQ==", "dev": true }, + "abort-controller": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/abort-controller/-/abort-controller-3.0.0.tgz", + "integrity": "sha512-h8lQ8tacZYnR3vNQTgibj+tODHI5/+l06Au2Pcriv/Gmet0eaj4TwWH41sO9wnHDiQsEj19q0drzdWdeAHtweg==", + "requires": { + "event-target-shim": "^5.0.0" + } + }, "agent-base": { "version": "6.0.2", "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-6.0.2.tgz", @@ -5610,6 +5832,14 @@ "debug": "4" } }, + "agentkeepalive": { + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/agentkeepalive/-/agentkeepalive-4.5.0.tgz", + "integrity": "sha512-5GG/5IbQQpC9FpkRGsSvZI5QYeSCzlJHdpBQntCsuTOxhKD8lqKhrleg2Yi7yvMIf82Ycmmqln9U8V9qwEiJew==", + "requires": { + "humanize-ms": "^1.2.1" + } + }, "ajv": { "version": "6.12.6", "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", @@ -5837,6 +6067,11 @@ "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", "dev": true }, + "base-64": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/base-64/-/base-64-0.1.0.tgz", + "integrity": "sha512-Y5gU45svrR5tI2Vt/X9GPd3L0HNIKzGu202EjxrXMpuc2V2CiKgemAbUUsqYmZJvPtCXoUKjNZwBJzsNScUbXA==" + }, "base64-js": { "version": "1.5.1", "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz", @@ -6082,6 +6317,11 @@ "supports-color": "^7.1.0" } }, + "charenc": { + "version": "0.0.2", + "resolved": "https://registry.npmjs.org/charenc/-/charenc-0.0.2.tgz", + "integrity": "sha512-yrLQ/yVUFXkzg7EDQsPieE/53+0RlaWTs+wBrvW36cyilJ2SaDWfl4Yj7MtLTXleV9uEKefbAGUPv2/iWSooRA==" + }, "chownr": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/chownr/-/chownr-2.0.0.tgz", @@ -6299,6 +6539,11 @@ "which": "^2.0.1" } }, + "crypt": { + "version": "0.0.2", + "resolved": "https://registry.npmjs.org/crypt/-/crypt-0.0.2.tgz", + "integrity": "sha512-mCxBlsHFYh9C+HVpiEacem8FEBnMXgU9gy4zmNC+SXAZNB/1idgp/aulFJ4FgCi7GPEVbfyng092GqL2k2rmow==" + }, "crypto-random-string": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/crypto-random-string/-/crypto-random-string-2.0.0.tgz", @@ -6375,6 +6620,15 @@ "dev": true, "optional": true }, + "digest-fetch": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/digest-fetch/-/digest-fetch-1.3.0.tgz", + "integrity": "sha512-CGJuv6iKNM7QyZlM2T3sPAdZWd/p9zQiRNS9G+9COUCwzWFTs0Xp8NF5iePx7wtvhDykReiRRrSeNb4oMmB8lA==", + "requires": { + "base-64": "^0.1.0", + "md5": "^2.3.0" + } + }, "dir-compare": { "version": "2.4.0", "resolved": "https://registry.npmjs.org/dir-compare/-/dir-compare-2.4.0.tgz", @@ -6922,6 +7176,11 @@ "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-2.0.2.tgz", "integrity": "sha512-Rfkk/Mp/DL7JVje3u18FxFujQlTNR2q6QfMSMB7AvCBx91NGj/ba3kCfza0f6dVDbw7YlRf/nDrn7pQrCCyQ/w==" }, + "event-target-shim": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/event-target-shim/-/event-target-shim-5.0.1.tgz", + "integrity": "sha512-i/2XbnSz/uxRCU6+NdVJgKWDTM427+MqYbkQzD321DuCQJUqOuJKIA0IM2+W2xtYHdKOmZ4dR6fExsd4SXL+WQ==" + }, "extract-zip": { "version": "1.7.0", "resolved": "https://registry.npmjs.org/extract-zip/-/extract-zip-1.7.0.tgz", @@ -7049,6 +7308,20 @@ "mime-types": "^2.1.12" } }, + "form-data-encoder": { + "version": "1.7.2", + "resolved": "https://registry.npmjs.org/form-data-encoder/-/form-data-encoder-1.7.2.tgz", + "integrity": "sha512-qfqtYan3rxrnCk1VYaA4H+Ms9xdpPqvLZa6xmMgFvhO32x7/3J/ExcTd6qpxM0vH2GdMI+poehyBZvqfMTto8A==" + }, + "formdata-node": { + "version": "4.4.1", + "resolved": "https://registry.npmjs.org/formdata-node/-/formdata-node-4.4.1.tgz", + "integrity": "sha512-0iirZp3uVDjVGt9p49aTaqjk84TrglENEDuqfdlZQ1roC9CWlPk6Avf8EEnZNcAqPonwkG35x4n3ww/1THYAeQ==", + "requires": { + "node-domexception": "1.0.0", + "web-streams-polyfill": "4.0.0-beta.3" + } + }, "fs-extra": { "version": "8.1.0", "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-8.1.0.tgz", @@ -7301,6 +7574,14 @@ "debug": "4" } }, + "humanize-ms": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/humanize-ms/-/humanize-ms-1.2.1.tgz", + "integrity": "sha512-Fl70vYtsAFb/C06PTS9dZBo7ihau+Tu/DNCk/OyHhea07S+aeMWpFFkUaXRa8fI+ScZbEI8dfSxwY7gxZ9SAVQ==", + "requires": { + "ms": "^2.0.0" + } + }, "iconv-corefoundation": { "version": "1.1.7", "resolved": "https://registry.npmjs.org/iconv-corefoundation/-/iconv-corefoundation-1.1.7.tgz", @@ -7362,6 +7643,11 @@ "integrity": "sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew==", "dev": true }, + "is-buffer": { + "version": "1.1.6", + "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.6.tgz", + "integrity": "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==" + }, "is-ci": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/is-ci/-/is-ci-3.0.1.tgz", @@ -7597,6 +7883,16 @@ "escape-string-regexp": "^4.0.0" } }, + "md5": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/md5/-/md5-2.3.0.tgz", + "integrity": "sha512-T1GITYmFaKuO91vxyoQMFETst+O71VUPEU3ze5GNzDm0OWdP8v1ziTaAEPUr/3kLsY3Sftgz242A1SetQiDL7g==", + "requires": { + "charenc": "0.0.2", + "crypt": "0.0.2", + "is-buffer": "~1.1.6" + } + }, "memoize-one": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/memoize-one/-/memoize-one-6.0.0.tgz", @@ -7733,6 +8029,19 @@ "dev": true, "optional": true }, + "node-domexception": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/node-domexception/-/node-domexception-1.0.0.tgz", + "integrity": "sha512-/jKZoMpw0F8GRwl4/eLROPA3cfcXtLApP0QzLmUT/HuPCZWyB7IY9ZrMeKw2O/nFIqPQB3PVM9aYm0F312AXDQ==" + }, + "node-fetch": { + "version": "2.7.0", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.7.0.tgz", + "integrity": "sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==", + "requires": { + "whatwg-url": "^5.0.0" + } + }, "nodejs-websocket": { "version": "1.7.2", "resolved": "https://registry.npmjs.org/nodejs-websocket/-/nodejs-websocket-1.7.2.tgz", @@ -7791,6 +8100,31 @@ } } }, + "openai": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/openai/-/openai-4.0.0.tgz", + "integrity": "sha512-UHv70gIw20pxu9tiUueE9iS+4U4eTGiTgQr+zlJ5aX4oj6LUUp+7mBn0xAqilawftwUB/biohPth2vcZFmoNYw==", + "requires": { + "@types/node": "^18.11.18", + "@types/node-fetch": "^2.6.4", + "abort-controller": "^3.0.0", + "agentkeepalive": "^4.2.1", + "digest-fetch": "^1.3.0", + "form-data-encoder": "1.7.2", + "formdata-node": "^4.3.2", + "node-fetch": "^2.6.7" + }, + "dependencies": { + "@types/node": { + "version": "18.18.9", + "resolved": "https://registry.npmjs.org/@types/node/-/node-18.18.9.tgz", + "integrity": "sha512-0f5klcuImLnG4Qreu9hPj/rEfFq6YRc5n2mAjSsH+ec/mJL+3voBH0+8T7o8RpFjH7ovc+TRsL/c7OYIQsPTfQ==", + "requires": { + "undici-types": "~5.26.4" + } + } + } + }, "p-cancelable": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/p-cancelable/-/p-cancelable-1.1.0.tgz", @@ -8368,6 +8702,11 @@ "integrity": "sha512-Iq25XBt6zD5npPhlLVXGFN3/gyR2/qODcKNNyTMd4vbm39HUaOiAM4PMq0eMVC/Tkxz+Zjdsc55g9yyz+Yq00Q==", "dev": true }, + "tr46": { + "version": "0.0.3", + "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", + "integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==" + }, "truncate-utf8-bytes": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/truncate-utf8-bytes/-/truncate-utf8-bytes-1.0.2.tgz", @@ -8412,6 +8751,11 @@ "integrity": "sha512-C0WQT0gezHuw6AdY1M2jxUO83Rjf0HP7Sk1DtXj6j1EwkQNZrHAg2XPWlq62oqEhYvONq5pkC2Y9oPljWToLmQ==", "devOptional": true }, + "undici-types": { + "version": "5.26.5", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-5.26.5.tgz", + "integrity": "sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==" + }, "unique-string": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/unique-string/-/unique-string-2.0.0.tgz", @@ -8589,6 +8933,25 @@ "@volar/vue-typescript": "0.38.3" } }, + "web-streams-polyfill": { + "version": "4.0.0-beta.3", + "resolved": "https://registry.npmjs.org/web-streams-polyfill/-/web-streams-polyfill-4.0.0-beta.3.tgz", + "integrity": "sha512-QW95TCTaHmsYfHDybGMwO5IJIM93I/6vTRk+daHTWFPhwh+C8Cg7j7XyKrwrj8Ib6vYXe0ocYNrmzY4xAAN6ug==" + }, + "webidl-conversions": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", + "integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==" + }, + "whatwg-url": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz", + "integrity": "sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==", + "requires": { + "tr46": "~0.0.3", + "webidl-conversions": "^3.0.0" + } + }, "which": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", diff --git a/package.json b/package.json index e149377..efeb648 100644 --- a/package.json +++ b/package.json @@ -44,9 +44,10 @@ "fluent-ffmpeg": "2.1.2", "microsoft-cognitiveservices-speech-sdk": "1.30.1", "nodejs-websocket": "1.7.2", + "openai": "^4.0.0", "pinia": "2.0.17", "uuid": "8.3.2", "vue-i18n": "9.6.5", "ws": "8.13.0" } -} \ No newline at end of file +} diff --git a/src/assets/i18n/i18n.ts b/src/assets/i18n/i18n.ts index 04a59d8..ff7b020 100644 --- a/src/assets/i18n/i18n.ts +++ b/src/assets/i18n/i18n.ts @@ -53,6 +53,8 @@ const messages = { speed: 'Speed', pitch: 'Pitch', remove: 'Remove', + openAIKey: 'OpenAI Key', + gptModel: 'Model GPT', // Otras traducciones... }, donate: { @@ -120,6 +122,9 @@ const messages = { Narrator: "Narrator" }, main: { + titleGenerateTextGPT: "Generate Text with GPT", + descriptionGenerateTextGPT: "Generate text with GPT-3 or GPT-4, the most powerful AI model in the world.", + placeholderGPT: "Please enter the prompt text", action: "Action", textTab: "Text", ssmlTab: "SSML", @@ -397,11 +402,13 @@ const messages = { speed: 'Velocidad', pitch: 'Tono', remove: 'Eliminar', + openAIKey: 'OpenAI key', + gptModel: 'Modelo GPT', // Otras traducciones... }, footer: { - downloadAudio: 'Download Audio', - format: 'Format', + downloadAudio: 'Descargar Audio', + format: 'Formato', // Otras traducciones... }, styles: { @@ -451,6 +458,9 @@ const messages = { Narrator: "Narrador" }, main: { + titleGenerateTextGPT: "Genera Texto con GPT", + descriptionGenerateTextGPT: "Genera texto con GPT-3 o GPT-4, el modelo de IA más potente del mundo.", + placeholderGPT: "Por favor ingrese el texto de la sugerencia", action: "Acción", textTab: "Texto", ssmlTab: "SSML", @@ -715,6 +725,8 @@ const messages = { speed: '语速', pitch: '音调', remove: '删除', + openAIKey: '打开AIKey', + gptModel: '模型GPT', // Otras traducciones... }, donate: { @@ -781,6 +793,9 @@ const messages = { Narrator: "旁白" }, main: { + titleGenerateTextGPT: "生成文本GPT", + descriptionGenerateTextGPT: "使用GPT-3或GPT-4,世界上最强大的AI模型,生成文本。", + placeholderGPT: "请输入提示文本", textTab: "文本", ssmlTab: "SSML", placeholder: "请输入", diff --git a/src/components/configpage/ConfigPage.vue b/src/components/configpage/ConfigPage.vue index 8030d67..219b0e9 100644 --- a/src/components/configpage/ConfigPage.vue +++ b/src/components/configpage/ConfigPage.vue @@ -66,6 +66,29 @@ :placeholder="t('configPage.serviceRegionPlaceHolder')" /> + + + + + + + + { // Actualiza el idioma en i18n y guarda la configuración i18n.global.locale.value = config.value.language; @@ -285,6 +317,16 @@ const setServiceRegion = () => { successMessage(); }; +const setOpenAIKey = () => { + ttsStore.setOpenAIKey(); + successMessage(); +}; + +const setGPTModel = () => { + ttsStore.setGPTModel(); + successMessage(); +}; + const setRetryCount = () => { if (config.value.retryCount == '' || config.value.retryCount < 0) { config.value.retryCount = 1; diff --git a/src/components/main/Main.vue b/src/components/main/Main.vue index e0d7bd6..7621465 100644 --- a/src/components/main/Main.vue +++ b/src/components/main/Main.vue @@ -34,10 +34,10 @@ --> - - {{ t('main.chatGPT') }} + + {{ t('main.descriptionGenerateTextGPT') }}
- +