wechat-bot
wechat-bot copied to clipboard
有没有办法做到连续语境呢
可以的,这么写
const api = new ChatGPTAPI({
sessionToken: process.env.SESSION_TOKEN
})
const conversation = api.getConversation()
// send a message and wait for the response
const response0 = await conversation.sendMessage('What is OpenAI?')
// send a follow-up prompt to the previous message and wait for the response
const response1 = await conversation.sendMessage('Can you expand on that?')
// send another follow-up to the same conversation
const response2 = await conversation.sendMessage('Oh cool; thank you')
这是官方的例子,但是实际用的时候一般只发一次,没有起到作用
哦,我知道,因为每次都会new新的会话所以不连续
对的,把那个单独放最外面

@Alex-Shen1121 更新依赖,默认的版本没有这个api
@Alex-Shen1121 更新依赖,默认的版本没有这个api
@ottocsb 请问更新哪个依赖啊?
@liuliuzx chatgpt
哦哦, 最新的提交已经更新依赖了~上一个版本缺少部分 api
对的,把那个单放最外面
放最外面啥意思阿?放在哪里?
放最外面啥意思阿?放在哪里?
哦哦,就是把 api 的声明放到函数外面。 已经更新代码了,重新 pull 下
现在的上下文语意好像还是没有连续起来
现在的上下文语意好像还是没有连续起来
是因为现在问答依赖不是chatGpt 变成openAi 了
接入最新版chatgpt,加上conversation支持就好了。
https://github.com/hushicai/wechat-bot/commit/dee4761f27699f70cd33ac4ea085bacec1af83dd
