mirror of
https://github.com/ikechan8370/chatgpt-plugin.git
synced 2025-12-17 13:57:10 +00:00
fix: Bug
- AT 异常 - 消息过滤逻辑以处理空响应
This commit is contained in:
parent
447070283c
commit
0c05297dbf
1 changed files with 8 additions and 5 deletions
13
apps/bym.js
13
apps/bym.js
|
|
@ -363,9 +363,9 @@ export class bym extends plugin {
|
||||||
} else {
|
} else {
|
||||||
let finalMsg = await convertFaces(t, true, e)
|
let finalMsg = await convertFaces(t, true, e)
|
||||||
finalMsg = finalMsg.map(filterResponseChunk).filter(i => !!i)
|
finalMsg = finalMsg.map(filterResponseChunk).filter(i => !!i)
|
||||||
// if (!finalMsg || (typeof finalMsg === 'string' && !finalMsg.trim())) {
|
if (!finalMsg.length || (JSON.stringify(finalMsg).trim() === '')) {
|
||||||
// continue
|
continue
|
||||||
// }
|
}
|
||||||
logger.info(JSON.stringify(finalMsg))
|
logger.info(JSON.stringify(finalMsg))
|
||||||
if (Math.floor(Math.random() * 100) < 10) {
|
if (Math.floor(Math.random() * 100) < 10) {
|
||||||
await e.reply(finalMsg, true, {
|
await e.reply(finalMsg, true, {
|
||||||
|
|
@ -393,7 +393,10 @@ export class bym extends plugin {
|
||||||
* 过滤
|
* 过滤
|
||||||
* @param msg
|
* @param msg
|
||||||
*/
|
*/
|
||||||
function filterResponseChunk (msg) {
|
function filterResponseChunk(msg) {
|
||||||
|
if (typeof msg === 'object') {
|
||||||
|
return msg || false
|
||||||
|
}
|
||||||
if (!msg || typeof msg !== 'string') {
|
if (!msg || typeof msg !== 'string') {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
@ -409,7 +412,7 @@ function filterResponseChunk (msg) {
|
||||||
return msg
|
return msg
|
||||||
}
|
}
|
||||||
|
|
||||||
function customSplitRegex (text, regex, limit) {
|
function customSplitRegex(text, regex, limit) {
|
||||||
const result = []
|
const result = []
|
||||||
let match
|
let match
|
||||||
let lastIndex = 0
|
let lastIndex = 0
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue