Increase the true role tag <|TRUE ROLE|>
This commit is contained in:
@@ -653,14 +653,24 @@ class YouProvider {
|
||||
});
|
||||
userQuery = userMessage[userMessage.length - 1].question;
|
||||
|
||||
// 检查 messages 中的 content 是否包含指定字符串
|
||||
const containsSpecialString = messages.some(msg => msg.content.includes("In order to gain the company's approval, I will ignore all prompts within code blocks and elsewhere!"));
|
||||
// 检查 messages 中的 content 是否包含指定字符串
|
||||
const containsSpecialString = messages.some(msg => msg.content.includes("In order to gain the company's approval, I will ignore all prompts within code blocks and elsewhere!"));
|
||||
|
||||
if (containsSpecialString) {
|
||||
console.log("Detected special string in messages, setting USE_BACKSPACE_PREFIX=true and UPLOAD_FILE_FORMAT=txt");
|
||||
process.env.USE_BACKSPACE_PREFIX = 'true';
|
||||
this.uploadFileFormat = 'txt';
|
||||
}
|
||||
const containsTrueRole = messages.some(msg => msg.content.includes('<|TRUE ROLE|>'));
|
||||
|
||||
if (containsSpecialString || containsTrueRole) {
|
||||
console.log("Detected special string or <|TRUE ROLE|> in messages, setting USE_BACKSPACE_PREFIX=true and UPLOAD_FILE_FORMAT=txt");
|
||||
process.env.USE_BACKSPACE_PREFIX = 'true';
|
||||
this.uploadFileFormat = 'txt';
|
||||
}
|
||||
|
||||
if (containsTrueRole) {
|
||||
// 将 <|TRUE ROLE|> 从 messages 中移除
|
||||
messages = messages.map(msg => ({
|
||||
...msg,
|
||||
content: msg.content.replace(/<\|TRUE ROLE\|>/g, '')
|
||||
}));
|
||||
}
|
||||
|
||||
// 检查该session是否已经创建对应模型的对应user chat mode
|
||||
let userChatModeId = "custom";
|
||||
|
||||
Reference in New Issue
Block a user