fix: 思考转发;claude上下文

This commit is contained in:
ikechan8370 2025-02-27 20:19:38 +08:00
parent cf31d40cf4
commit d6cb085c40
2 changed files with 22 additions and 1 deletions

View file

@ -788,7 +788,7 @@ export class chatgpt extends plugin {
let thinking = chatMessage.thinking_text
for (let processor of postProcessors) {
let output = await processor.processInner({
text: response, thinking
text: response, thinking_text: thinking
})
response = output.text
thinking = output.thinking_text

View file

@ -262,6 +262,27 @@ class Core {
system: opt.system.claude,
max_tokens: Config.apiMaxToken
}
if (opt.settings.enableGroupContext && e.isGroup) {
let chats = await getChatHistoryGroup(e, Config.groupContextLength)
const namePlaceholder = '[name]'
const defaultBotName = 'GeminiPro'
const groupContextTip = Config.groupContextTip
let botName = e.isGroup ? (e.group.pickMember(getUin(e)).card || e.group.pickMember(getUin(e)).nickname) : e.bot.nickname
option.system = option.system.replaceAll(namePlaceholder, botName || defaultBotName) +
((opt.settings.enableGroupContext && e.group_id) ? groupContextTip : '')
option.system += 'Attention, you are currently chatting in a qq group, then one who asks you now is' + `${e.sender.card || e.sender.nickname}(${e.sender.user_id}).`
option.system += `the group name is ${e.group.name || e.group_name}, group id is ${e.group_id}.`
option.system += `Your nickname is ${botName} in the group,`
if (chats) {
option.system += 'There is the conversation history in the group, you must chat according to the conversation history context"'
option.system += chats
.map(chat => {
let sender = chat.sender || {}
return `${sender.card || sender.nickname}】(qq${sender.user_id}, ${roleMap[sender.role] || 'normal user'}${sender.area ? 'from ' + sender.area + ', ' : ''} ${sender.age} years old, 群头衔:${sender.title}, gender: ${sender.sex}, time${formatDate(new Date(chat.time * 1000))}, messageId: ${chat.message_id}) 说:${chat.raw_message}`
})
.join('\n')
}
}
let img = await getImg(e)
if (img && img.length > 0) {
const response = await fetch(img[0])