mirror of
https://github.com/ikechan8370/chatgpt-plugin.git
synced 2025-12-16 21:37:11 +00:00
Feat: 新增云转码模式选择 (#380)
* 修复后台API反代地址未能正确显示的问题 * 更新渲染页面配置 * 添加个人聊天模式配置 * 将用户数据获取改到common中 * 修复错误的渲染页面参数 * 修复bug * 添加Live2D * 修复渲染页面错误 * 修复渲染传入值 * 更新渲染 * 修复图表渲染bug * 调整live2d模型大小 * 修复live2d无法关闭问题 * 修复错误的传值 * 修复ai命名 * 更新渲染 * 添加用户独立设定 * 更新渲染配置适配个人设置 * 修复合并导致的渲染文件异常删除 * 修复用户数据缺失问题 * 修复旧版本数据缺失问题 * 修复bing参数不存在问题,兼容miao的截图 * 修复受限token重试时不被排除的问题 * 修复个人模式下结束对话的模式错误 * 更新渲染页面,将预览版转为正式版 * 修复传统渲染无法调用截图功能的问题 * 文字模式也进行一次缓存 * 更新README * Update README.md * 更新渲染 * 更新渲染页面 * 添加版本信息 * 遗漏参数 * 丢失引用 * 补充路由 * 添加云转码功能 * 判断node-silk是否正常合成 * 云转码提示 * 修复图片渲染出错 * 云转码支持发送Buffer * 添加云转码模式支持 * 更新描述 --------- Co-authored-by: ikechan8370 <geyinchibuaa@gmail.com>
This commit is contained in:
parent
55f060dc5f
commit
49d8dce984
13 changed files with 122 additions and 34 deletions
|
|
@ -522,9 +522,22 @@ export function supportGuoba () {
|
|||
{
|
||||
field: 'cloudTranscode',
|
||||
label: '云转码API地址',
|
||||
bottomHelpMessage: '目前只支持node-silk语音转码,如果本地无法安装node-silk可填写http://alcedogroup.com:3031',
|
||||
bottomHelpMessage: '目前只支持node-silk语音转码,可在本地node-silk无法使用时尝试使用云端资源转码',
|
||||
component: 'Input'
|
||||
},
|
||||
{
|
||||
field: 'cloudMode',
|
||||
label: '云转码API发送数据模式',
|
||||
bottomHelpMessage: '默认发送数据链接,如果你部署的是本地服务,请改为文件',
|
||||
component: 'Select',
|
||||
componentProps: {
|
||||
options: [
|
||||
{ label: '文件', value: 'file' },
|
||||
{ label: '链接', value: 'url' },
|
||||
{ label: '数据', value: 'buffer' }
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
field: 'noiseScale',
|
||||
label: 'noiseScale',
|
||||
|
|
|
|||
|
|
@ -17,4 +17,5 @@
|
|||
* 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.59d1ab94.js"></script><script defer="defer" type="module" src="/js/app.e96e0e6a.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.40504512.js" nomodule></script><script defer="defer" src="/js/app-legacy.5df11576.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.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>
|
||||
|
|
|
|||
21
server/static/js/app-legacy.2b7469b6.js
Normal file
21
server/static/js/app-legacy.2b7469b6.js
Normal file
File diff suppressed because one or more lines are too long
1
server/static/js/app-legacy.2b7469b6.js.map
Normal file
1
server/static/js/app-legacy.2b7469b6.js.map
Normal file
File diff suppressed because one or more lines are too long
21
server/static/js/app.5fabf316.js
Normal file
21
server/static/js/app.5fabf316.js
Normal file
File diff suppressed because one or more lines are too long
1
server/static/js/app.5fabf316.js.map
Normal file
1
server/static/js/app.5fabf316.js.map
Normal file
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
1
server/static/js/chunk-vendors-legacy.f38f83ce.js.map
Normal file
1
server/static/js/chunk-vendors-legacy.f38f83ce.js.map
Normal file
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
|
|
@ -103,6 +103,7 @@ const defaultConfig = {
|
|||
slackClaudeGlobalPreset: '',
|
||||
slackClaudeSpecifiedChannel: '',
|
||||
cloudTranscode: '',
|
||||
cloudMode: 'url',
|
||||
version: 'v2.5.6'
|
||||
}
|
||||
const _path = process.cwd()
|
||||
|
|
|
|||
|
|
@ -35,27 +35,56 @@ async function uploadRecord (recordUrl) {
|
|||
if (pcm2slk) {
|
||||
result = await getPttBuffer(recordUrl, Bot.config.ffmpeg_path)
|
||||
} else if (Config.cloudTranscode) {
|
||||
const resultOption = {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
body: JSON.stringify({recordUrl: recordUrl})
|
||||
}
|
||||
const resultres = await fetch(`${Config.cloudTranscode}/audio`, resultOption)
|
||||
if (!resultres.ok) {
|
||||
try {
|
||||
if (Config.cloudMode === 'buffer' || Config.cloudMode === 'file') {
|
||||
let response = await fetch(recordUrl, {
|
||||
method: 'GET',
|
||||
headers: {
|
||||
'User-Agent': 'Dalvik/2.1.0 (Linux; U; Android 12; MI 9 Build/SKQ1.211230.001)'
|
||||
},
|
||||
})
|
||||
if (Config.cloudMode === 'file') {
|
||||
const file = await response.blob()
|
||||
const formData = new FormData()
|
||||
formData.append('file', file)
|
||||
const resultres = await fetch(`${Config.cloudTranscode}/audio`, {
|
||||
method: 'POST',
|
||||
body: formData
|
||||
})
|
||||
result = await resultres.json()
|
||||
} else {
|
||||
const buf = Buffer.from(await response.arrayBuffer())
|
||||
const resultres = await fetch(`${Config.cloudTranscode}/audio`, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
body: JSON.stringify({recordBuffer: buf})
|
||||
})
|
||||
result = await resultres.json()
|
||||
}
|
||||
} else {
|
||||
const resultres = await fetch(`${Config.cloudTranscode}/audio`, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
body: JSON.stringify({recordUrl: recordUrl})
|
||||
})
|
||||
result = await resultres.json()
|
||||
}
|
||||
if (result.error) {
|
||||
logger.error('云转码API报错:' + result.error)
|
||||
return false
|
||||
}
|
||||
result.buffer = Buffer.from(result.buffer.data)
|
||||
} catch (err) {
|
||||
logger.error('云转码API报错:' + err)
|
||||
return false
|
||||
}
|
||||
result = await resultres.json()
|
||||
if (result.error) {
|
||||
logger.error('云转码API报错:' + result.error)
|
||||
return false
|
||||
}
|
||||
result.buffer = Buffer.from(result.buffer.data)
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
|
||||
if (!result.buffer) {
|
||||
return false
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue