fix: 增加新版本voicevox的新speakers

This commit is contained in:
葛胤池 2023-04-29 19:16:54 +08:00
commit 76d261666a
25 changed files with 166 additions and 147 deletions

View file

@ -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. dont 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
@ -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) {
@ -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)
}
})
}
/**

View file

@ -705,6 +705,12 @@ export function supportGuoba () {
bottomHelpMessage: '聊天页面渲染窗口的宽度',
component: 'InputNumber'
},
{
field: 'cloudRender',
label: '云渲染',
bottomHelpMessage: '是否使用云资源进行图片渲染,需要开放服务器端口后才能使用,不支持旧版本渲染',
component: 'Switch'
},
{
field: 'chatViewBotName',
label: 'Bot命名',

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -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>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -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

View file

@ -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()

View file

@ -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 }