优化聊天会话管理,支持 websocket 断开重连之后能继续连接会话上下文

This commit is contained in:
RockYang
2023-03-24 14:24:49 +08:00
parent 2067aa3f83
commit bb019f3552
9 changed files with 244 additions and 317 deletions

View File

@@ -2,15 +2,14 @@
/**
* storage handler
*/
import Storage from 'good-storage'
const SessionIdKey = 'ChatGPT_SESSION_ID';
export const Global = {}
export function getSessionId() {
return Storage.get(SessionIdKey)
return sessionStorage.getItem(SessionIdKey)
}
export function setSessionId(value) {
Storage.set(SessionIdKey, value)
sessionStorage.setItem(SessionIdKey, value)
}