mirror of
https://github.com/LLM-Red-Team/kimi-free-api.git
synced 2024-12-23 07:29:20 +08:00
修改日志输出和注意力注入prompt
This commit is contained in:
parent
ff59201961
commit
66cddd522b
@ -383,18 +383,18 @@ function messagesPrepare(messages: any[]) {
|
|||||||
&& latestMessage.content.some(v => (typeof v === 'object' && ['file', 'image_url'].includes(v['type'])));
|
&& latestMessage.content.some(v => (typeof v === 'object' && ['file', 'image_url'].includes(v['type'])));
|
||||||
if (hasFileOrImage) {
|
if (hasFileOrImage) {
|
||||||
let newFileMessage = {
|
let newFileMessage = {
|
||||||
"content": "关注用户最新发送文件和消息结尾",
|
"content": "关注用户最新发送的文件和消息",
|
||||||
"role": "system"
|
"role": "system"
|
||||||
};
|
};
|
||||||
validMessages.splice(validMessages.length - 1, 0, newFileMessage);
|
validMessages.splice(validMessages.length - 1, 0, newFileMessage);
|
||||||
logger.info("检查注入文件消息");
|
logger.info("注入提升尾部文件注意力system prompt");
|
||||||
} else {
|
} else {
|
||||||
let newTextMessage = {
|
let newTextMessage = {
|
||||||
"content": "关注用户消息的结尾",
|
"content": "关注用户最新的消息",
|
||||||
"role": "system"
|
"role": "system"
|
||||||
};
|
};
|
||||||
validMessages.splice(validMessages.length - 1, 0, newTextMessage);
|
validMessages.splice(validMessages.length - 1, 0, newTextMessage);
|
||||||
logger.info("检查注入文本消息");
|
logger.info("注入提升尾部消息注意力system prompt");
|
||||||
}
|
}
|
||||||
|
|
||||||
const content = validMessages.reduce((content, message) => {
|
const content = validMessages.reduce((content, message) => {
|
||||||
@ -408,7 +408,7 @@ function messagesPrepare(messages: any[]) {
|
|||||||
return content += `${message.role || 'user'}:${wrapUrlsToTags(message.content)}\n`;
|
return content += `${message.role || 'user'}:${wrapUrlsToTags(message.content)}\n`;
|
||||||
}, '');
|
}, '');
|
||||||
|
|
||||||
logger.info("上传消息:" + content);
|
logger.info("\n对话合并:\n" + content);
|
||||||
return [
|
return [
|
||||||
{ role: 'user', content }
|
{ role: 'user', content }
|
||||||
]
|
]
|
||||||
|
Loading…
Reference in New Issue
Block a user