Skip to content

Commit

Permalink
fix: 增加新版本voicevox的新speakers
Browse files Browse the repository at this point in the history
  • Loading branch information
ikechan8370 committed Apr 29, 2023
2 parents d3bd7be + 0c5a5e8 commit 76d2616
Show file tree
Hide file tree
Showing 25 changed files with 166 additions and 147 deletions.
32 changes: 16 additions & 16 deletions apps/chat.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,10 @@ if (Config.proxy) {
const defaultPropmtPrefix = ', a large language model trained by OpenAI. You answer as concisely as possible for each response (e.g. don’t be verbose). It is very important that you answer as concisely as possible, so please remember this. If you are generating a list, do not have too many items. Keep the number of items short.'
const newFetch = (url, options = {}) => {
const defaultOptions = Config.proxy
? {
? {
agent: proxy(Config.proxy)
}
: {}
: {}
const mergedOptions = {
...defaultOptions,
...options
Expand Down Expand Up @@ -651,7 +651,7 @@ export class chatgpt extends plugin {
*/
async chatgpt (e) {
if (!e.isMaster && e.isPrivate && !Config.enablePrivateChat) {
await this.reply('ChatGpt私聊通道已关闭。')
// await this.reply('ChatGpt私聊通道已关闭。')
return false
}
if (e.isGroup) {
Expand Down Expand Up @@ -1765,19 +1765,19 @@ export class chatgpt extends plugin {
Authorization: 'Bearer ' + Config.apiKey
}
})
.then(response => response.json())
.then(data => {
if (data.error) {
this.reply('获取失败:' + data.error.code)
return false
} else {
let total_granted = data.total_granted.toFixed(2)
let total_used = data.total_used.toFixed(2)
let total_available = data.total_available.toFixed(2)
let expires_at = new Date(data.grants.data[0].expires_at * 1000).toLocaleDateString().replace(/\//g, '-')
this.reply('总额度:$' + total_granted + '\n已经使用额度:$' + total_used + '\n当前剩余额度:$' + total_available + '\n到期日期(UTC):' + expires_at)
}
})
.then(response => response.json())
.then(data => {
if (data.error) {
this.reply('获取失败:' + data.error.code)
return false
} else {
let total_granted = data.total_granted.toFixed(2)
let total_used = data.total_used.toFixed(2)
let total_available = data.total_available.toFixed(2)
let expires_at = new Date(data.grants.data[0].expires_at * 1000).toLocaleDateString().replace(/\//g, '-')
this.reply('总额度:$' + total_granted + '\n已经使用额度:$' + total_used + '\n当前剩余额度:$' + total_available + '\n到期日期(UTC):' + expires_at)
}
})
}

/**
Expand Down
6 changes: 6 additions & 0 deletions guoba.support.js
Original file line number Diff line number Diff line change
Expand Up @@ -705,6 +705,12 @@ export function supportGuoba () {
bottomHelpMessage: '聊天页面渲染窗口的宽度',
component: 'InputNumber'
},
{
field: 'cloudRender',
label: '云渲染',
bottomHelpMessage: '是否使用云资源进行图片渲染,需要开放服务器端口后才能使用,不支持旧版本渲染',
component: 'Switch'
},
{
field: 'chatViewBotName',
label: 'Bot命名',
Expand Down
22 changes: 22 additions & 0 deletions server/static/css/app.13fc2dfe.css

Large diffs are not rendered by default.

22 changes: 0 additions & 22 deletions server/static/css/app.db850df4.css

This file was deleted.

3 changes: 1 addition & 2 deletions server/static/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,4 @@
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
-->

<!doctype html><html lang="en"><head><meta charset="utf-8"/><meta http-equiv="X-UA-Compatible" content="IE=edge"/><meta name="viewport" content="width=device-width,initial-scale=1"/><link rel="shortcut icon" href="/favicon.ico"/><link rel="apple-touch-icon" sizes="76x76" href="/apple-icon.png"/><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.11.1/dist/katex.min.css"/><script src="https://cdn.jsdelivr.net/npm/katex@0.11.1/dist/katex.min.js"></script><script src="https://cdnjs.cloudflare.com/ajax/libs/mermaid/8.6.3/mermaid.min.js"></script><title>ChatGPT-Plugin</title><script defer="defer" type="module" src="/js/chunk-vendors.f0ab5903.js"></script><script defer="defer" type="module" src="/js/app.5fabf316.js"></script><link href="/css/chunk-vendors.0ede84b4.css" rel="stylesheet"><link href="/css/app.db850df4.css" rel="stylesheet"><script defer="defer" src="/js/chunk-vendors-legacy.f38f83ce.js" nomodule></script><script defer="defer" src="/js/app-legacy.2b7469b6.js" nomodule></script></head><body class="text-blueGray-700 antialiased"><noscript><strong>We're sorry but vue-notus doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><div id="app"></div></body></html>
<!doctype html><html lang="en"><head><meta charset="utf-8"/><meta http-equiv="X-UA-Compatible" content="IE=edge"/><meta name="viewport" content="width=device-width,initial-scale=1"/><link rel="shortcut icon" href="/favicon.ico"/><link rel="apple-touch-icon" sizes="76x76" href="/apple-icon.png"/><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.11.1/dist/katex.min.css"/><script src="https://cdn.jsdelivr.net/npm/katex@0.11.1/dist/katex.min.js"></script><script src="https://cdnjs.cloudflare.com/ajax/libs/mermaid/8.6.3/mermaid.min.js"></script><title>ChatGPT-Plugin</title><script defer="defer" type="module" src="/js/chunk-vendors.94518e59.js"></script><script defer="defer" type="module" src="/js/app.dac4caf6.js"></script><link href="/css/chunk-vendors.0ede84b4.css" rel="stylesheet"><link href="/css/app.13fc2dfe.css" rel="stylesheet"><script defer="defer" src="/js/chunk-vendors-legacy.ad38f327.js" nomodule></script><script defer="defer" src="/js/app-legacy.7e5f8de2.js" nomodule></script></head><body class="text-blueGray-700 antialiased"><noscript><strong>We're sorry but vue-notus doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><div id="app"></div></body></html>
21 changes: 0 additions & 21 deletions server/static/js/app-legacy.2b7469b6.js

This file was deleted.

1 change: 0 additions & 1 deletion server/static/js/app-legacy.2b7469b6.js.map

This file was deleted.

21 changes: 0 additions & 21 deletions server/static/js/app-legacy.5df11576.js

This file was deleted.

1 change: 0 additions & 1 deletion server/static/js/app-legacy.5df11576.js.map

This file was deleted.

21 changes: 21 additions & 0 deletions server/static/js/app-legacy.7e5f8de2.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions server/static/js/app-legacy.7e5f8de2.js.map

Large diffs are not rendered by default.

21 changes: 0 additions & 21 deletions server/static/js/app.5fabf316.js

This file was deleted.

1 change: 0 additions & 1 deletion server/static/js/app.5fabf316.js.map

This file was deleted.

21 changes: 21 additions & 0 deletions server/static/js/app.dac4caf6.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions server/static/js/app.dac4caf6.js.map

Large diffs are not rendered by default.

21 changes: 0 additions & 21 deletions server/static/js/app.e96e0e6a.js

This file was deleted.

1 change: 0 additions & 1 deletion server/static/js/app.e96e0e6a.js.map

This file was deleted.

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions server/static/js/chunk-vendors-legacy.ad38f327.js.map

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion server/static/js/chunk-vendors-legacy.f38f83ce.js.map

This file was deleted.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

36 changes: 36 additions & 0 deletions utils/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,42 @@ export async function render (e, pluginKey, htmlPath, data = {}, renderCfg = {})
}

export async function renderUrl (e, url, renderCfg = {}) {
// 云渲染
if (Config.cloudRender) {
url = url.replace(`127.0.0.1:${Config.serverPort || 3321}`, Config.serverHost || `${await getPublicIP()}:${Config.serverPort || 3321}`)
const resultres = await fetch(`${Config.cloudTranscode}/screenshot`, {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({
url: url,
option: {
width: renderCfg.Viewport.width || 1280,
height: renderCfg.Viewport.height || 720,
timeout: 120000,
selector: Config.live2d ? "#live2d-widget" : "body",
wait: renderCfg.wait || 1000
},
type: 'image'
})
})
if (resultres.ok) {
const buff = Buffer.from(await resultres.arrayBuffer())
if(buff) {
const base64 = segment.image(buff)
if (renderCfg.retType === 'base64') {
return base64
}
let ret = true
if (base64) {
ret = await e.reply(base64)
}
return renderCfg.retType === 'msgId' ? ret : true
}
}
}

await _puppeteer.browserInit()
const page = await _puppeteer.browser.newPage()
let base64
Expand Down
5 changes: 3 additions & 2 deletions utils/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,14 +103,15 @@ const defaultConfig = {
slackClaudeGlobalPreset: '',
slackClaudeSpecifiedChannel: '',
cloudTranscode: 'https://silk.201666.xyz',
cloudMode: 'file',
cloudRender: false,
cloudMode: 'url',
ttsMode: 'vits-uma-genshin-honkai', // or azure
azureTTSKey: '',
azureTTSRegion: '',
azureTTSSpeaker: 'zh-CN-XiaochenNeural',
voicevoxSpace: '',
voicevoxTTSSpeaker: '护士机器子T',
version: 'v2.5.7'
version: 'v2.5.8'

}
const _path = process.cwd()
Expand Down
23 changes: 22 additions & 1 deletion utils/tts/voicevox.js
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,27 @@ const supportConfigurations = [
speaker_uuid: '7d1e7ba7-f957-40e5-a3fc-da49f769ab65',
styles: [{ name: 'ノーマル', id: 53 }],
version: '0.14.2'
}]
}, {
supported_features: { permitted_synthesis_morphing: 'ALL' },
name: '春歌ナナ',
speaker_uuid: 'ba5d2428-f7e0-4c20-ac41-9dd56e9178b4',
styles: [{ name: 'ノーマル', id: 54 }],
version: '0.14.3'
},
{
supported_features: { permitted_synthesis_morphing: 'ALL' },
name: '猫使アル',
speaker_uuid: '00a5c10c-d3bd-459f-83fd-43180b521a44',
styles: [{ name: 'ノーマル', id: 55 }, { name: 'おちつき', id: 56 }, { name: 'うきうき', id: 57 }],
version: '0.14.3'
},
{
supported_features: { permitted_synthesis_morphing: 'ALL' },
name: '猫使ビィ',
speaker_uuid: 'c20a2254-0349-4470-9fc8-e5c0f8cf3404',
styles: [{ name: 'ノーマル', id: 58 }, { name: 'おちつき', id: 59 }, { name: '人見知り', id: 60 }],
version: '0.14.3'
}
]

export default { generateAudio, supportConfigurations }

0 comments on commit 76d2616

Please sign in to comment.