mirror of
https://github.com/Jerryplusy/crystelf-plugin.git
synced 2025-12-05 15:41:56 +00:00
fix(ai): 修复AI处理逻辑并添加默认回复
This commit is contained in:
parent
414fe08f45
commit
bef44e65c9
@ -89,10 +89,10 @@ async function index(e) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (e.user_id === e.bot.uin) {
|
if (e.user_id === e.bot.uin) {
|
||||||
return;
|
return e.reply(segment.image(await Meme.getMeme(aiConfig.character, 'default')));
|
||||||
}
|
}
|
||||||
const userMessage = await extractUserMessage(e.msg, nickname, e);
|
const userMessage = await extractUserMessage(e.msg, nickname, e);
|
||||||
if (!userMessage) {
|
if (!userMessage || userMessage.length === 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const adapter = await YunzaiUtils.getAdapter(e);
|
const adapter = await YunzaiUtils.getAdapter(e);
|
||||||
@ -130,6 +130,9 @@ async function extractUserMessage(msg, nickname, e) {
|
|||||||
returnMessage += `[${e.sender?.nickname},id:${e.user_id}]说:${message}\n`;
|
returnMessage += `[${e.sender?.nickname},id:${e.user_id}]说:${message}\n`;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
if(at.length === 1 && at[0] === e.bot.uin){
|
||||||
|
return [];
|
||||||
|
}
|
||||||
if (at.length > 0) {
|
if (at.length > 0) {
|
||||||
at.forEach((at) => {
|
at.forEach((at) => {
|
||||||
if (at === e.bot.uin) {
|
if (at === e.bot.uin) {
|
||||||
@ -146,7 +149,7 @@ async function extractUserMessage(msg, nickname, e) {
|
|||||||
return returnMessage;
|
return returnMessage;
|
||||||
}
|
}
|
||||||
logger.warn('[crystelf-ai] 字符串匹配失败,使用空字符串操作');
|
logger.warn('[crystelf-ai] 字符串匹配失败,使用空字符串操作');
|
||||||
return '';
|
return [''];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user