mirror of
https://github.com/yangjian102621/geekai.git
synced 2025-09-19 01:36:38 +08:00
add config api for setting the ChatContextExpireTime
This commit is contained in:
parent
cb2b01127b
commit
eb562ea3c9
@ -6,7 +6,7 @@
|
||||
|
||||
* [x] 使用 level DB 保存用户聊天记录
|
||||
* [x] 用户聊天鉴权,设置口令模式
|
||||
* [ ] 定期清理不在线的会话 sessionID 和聊天上下文记录
|
||||
* [x] 定期清理不在线的会话 sessionID 和聊天上下文记录
|
||||
* [x] 给 Token 设置调用次数
|
||||
* [x] OpenAI API 负载均衡,限制每个 API Key 每分钟之内调用次数不超过 15次,防止被封
|
||||
* [x] 角色设定,预设一些角色,比如程序员,客服,作家,老师,艺术家...
|
||||
|
@ -117,7 +117,7 @@ func (s *Server) Run(webRoot embed.FS, path string, debug bool) {
|
||||
for {
|
||||
for key, context := range s.ChatContexts {
|
||||
// 清理超过 60min 没有更新,则表示为过期会话
|
||||
if time.Now().Unix()-context.LastAccessTime > 3600 {
|
||||
if time.Now().Unix()-context.LastAccessTime > int64(s.Config.Chat.ChatContextExpireTime) {
|
||||
logger.Infof("清理会话上下文: %s", key)
|
||||
delete(s.ChatContexts, key)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user