Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: 修复 session_timeout 配置项不生效的bug,优化相关缓存逻辑,同时余额、查对话功能权限优化 #210

Merged
merged 8 commits into from
Apr 15, 2023

Conversation

ffinly
Copy link
Contributor

@ffinly ffinly commented Apr 14, 2023

在提出此拉取请求时,我确认了以下几点(请复选框):

  • 我已阅读并理解贡献者指南
  • 我已检查没有与此请求重复的拉取请求。
  • 我已经考虑过,并确认这份呈件对其他人很有价值。
  • 我接受此提交可能不会被使用,并根据维护人员的意愿关闭拉取请求。

本次更新内容如下:

  1. 主要修复session_timeout 配置项(会话超时时间,默认600秒,在会话时间内所有发送给机器人的信息会作为上下文)不生效的bug,优化相关缓存逻辑
  2. 余额、查对话功能仅管理员可用(outgoing下无法使用),非管理员发起指令,机器人将无任何回应

修改相关说明如下:

  1. chatgpt.go文件中原来是从session_timeout配置项取值来设置与chatgpt的连接超时,这里设置成600默认,能满足需要。无需再从配置项获取
  2. user_base.go文件中原来并未从session_timeout配置项取值,而是设置的默认2小时失效,5小时清空失效缓存。这里修改为从配置项中获取,修复bug,同时将缓存清理时间改为1小时,可一定程度上降低内存占用
  3. process_request.go文件中新增 FormatTimeDuation 方法来处理时间的格式化展示
  4. process_request.go文件中新增 单群/聊 切换时的提示:如切换至与默认聊天模式一致则不提示超时时间,从而提醒用户
  5. process_request.go文件中新增 余额、查对话功能仅管理员可用的逻辑

@eryajf eryajf merged commit fb55006 into eryajf:main Apr 15, 2023
@ffinly ffinly deleted the fix-sessionTimeout branch June 15, 2023 06:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants