mirror of
https://github.com/Jerryplusy/crystelf-plugin.git
synced 2025-12-05 15:41:56 +00:00
feat:优化上下文
This commit is contained in:
parent
1ed09b5c32
commit
d1584e4402
14
apps/ai.js
14
apps/ai.js
@ -110,7 +110,7 @@ async function index(e) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function extractUserMessage(msg, nickname,e) {
|
async function extractUserMessage(msg, nickname, e) {
|
||||||
if (e.message) {
|
if (e.message) {
|
||||||
let text = [];
|
let text = [];
|
||||||
let at = [];
|
let at = [];
|
||||||
@ -118,8 +118,7 @@ function extractUserMessage(msg, nickname,e) {
|
|||||||
logger.info(message);
|
logger.info(message);
|
||||||
if (message.type === 'text') {
|
if (message.type === 'text') {
|
||||||
text.push(message.text);
|
text.push(message.text);
|
||||||
}
|
} else if (message.type === 'at') {
|
||||||
else if(message.type === 'at'){
|
|
||||||
at.push(message.qq);
|
at.push(message.qq);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@ -131,9 +130,18 @@ function extractUserMessage(msg, nickname,e) {
|
|||||||
}
|
}
|
||||||
if (at.length > 0) {
|
if (at.length > 0) {
|
||||||
at.forEach((at) => {
|
at.forEach((at) => {
|
||||||
|
if(at === e.bot.uin){
|
||||||
|
returnMessage += `[${e.sender?.nickname},id:${e.user_id}]@(at)了你,你的id是${at}\n`;
|
||||||
|
}
|
||||||
|
else{
|
||||||
returnMessage += `[${e.sender?.nickname},id:${e.user_id}]@(at)了一个人,id是${at}\n`;
|
returnMessage += `[${e.sender?.nickname},id:${e.user_id}]@(at)了一个人,id是${at}\n`;
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
const imgUrls = await YunzaiUtils.getImages(e, 1, true);
|
||||||
|
if(imgUrls){
|
||||||
|
returnMessage += `[${e.sender?.nickname},id:${e.user_id}]发送了一张图片(你可能暂时无法查看)\n`;
|
||||||
|
}
|
||||||
return returnMessage;
|
return returnMessage;
|
||||||
}
|
}
|
||||||
logger.warn('[crystelf-ai] 字符串匹配失败,使用空字符串操作');
|
logger.warn('[crystelf-ai] 字符串匹配失败,使用空字符串操作');
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user