Closed vvmspace closed 1 year ago
我解决了
// 内存属性
const keyApiData = {}
// 先获取下内存中有没有key实例,没有就创建,有就读取
if (keyApiData[optionsKey.apiKey] === undefined) {
keyApiData[optionsKey.apiKey] = new ChatGPTAPI({ ...optionsKey })
}
api = keyApiData[optionsKey.apiKey]
我解决了
// 内存属性 const keyApiData = {} // 先获取下内存中有没有key实例,没有就创建,有就读取 if (keyApiData[optionsKey.apiKey] === undefined) { keyApiData[optionsKey.apiKey] = new ChatGPTAPI({ ...optionsKey }) } api = keyApiData[optionsKey.apiKey]
我也遇到了同样的问题,按照你的方式并没有解决。你是如何解决这个问题。parentMessageId这个参数,存储下来也不好用
You can pass a custom key/value store to store and fetch previous messages.
The default uses an in-memory store. Search existing issues or take a look at this example for how to do this: https://github.com/transitive-bullshit/chatgpt-twitter-bot/blob/main/src/index.ts#L134-L149
Verify latest release
chatgpt
releaseVerify webapp is working
Environment details
Describe the Bug
The problem was described there: https://github.com/transitive-bullshit/chatgpt-api/issues/316
But issue was closed.
The problem is when you get a new API instance, for example, this will not retain history:
But this will:
It means that we need always initialized object for user's chat. It is not always possible.
For example I'm using Serverless and repository ups on function call only.