mirror of
https://github.com/ikechan8370/chatgpt-plugin.git
synced 2025-12-16 21:37:11 +00:00
feat: 改用调接口拿聊天记录,不用自己记录了
This commit is contained in:
parent
3885527a7d
commit
1c79ff00b7
3 changed files with 17 additions and 74 deletions
10
apps/chat.js
10
apps/chat.js
|
|
@ -1015,6 +1015,16 @@ export class chatgpt extends plugin {
|
|||
opt.qq = e.sender.user_id
|
||||
opt.nickname = e.sender.card
|
||||
opt.groupName = e.group.name
|
||||
let latestChat = await e.group.getChatHistory(0, 1)
|
||||
let seq = latestChat[0].seq
|
||||
let chats = []
|
||||
while (chats.length < Config.groupContextLength) {
|
||||
let chatHistory = await e.group.getChatHistory(seq, 20)
|
||||
chats.push(...chatHistory)
|
||||
}
|
||||
chats = chats.slice(0, Config.groupContextLength)
|
||||
console.log(chats)
|
||||
opt.chats = chats
|
||||
}
|
||||
response = await bingAIClient.sendMessage(prompt, opt, (token) => {
|
||||
reply += token
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue