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

BUGFIX: 更新令牌时的一些问题 #1933

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Laisky
Copy link
Collaborator

@Laisky Laisky commented Nov 20, 2024

问题

  1. 如果 token 的状态为 TokenStatusExpiredTokenStatusExhausted,更新 token 的过期时间或余额也无法重新激活 Token
  2. Token 的余额(RemainQuota)实际上无法被编辑,点击保存后其实不会更新数据库

复现方式

问题 1

将某个 Token 的余额耗尽,直到 API 出现 额度已用尽 的提示后,更新余额,也无法重新再激活 Token。

问题 2

编辑 token 余额然后再刷新就会发现,token 的余额不会变化

修复

编辑 Token 时,同步更新 Token 的 StatusRemainQuota

一些其他的修复

顺手跑了下 gofmt,还补上了漏掉的几个 claude 模型和价格。

隐患

当初设计 UpdateToken 这个接口的时候,没有更新 StatusRemainQuota 是否有什么特殊的考量?

Copy link

codecov bot commented Nov 20, 2024

Codecov Report

Attention: Patch coverage is 0% with 22 lines in your changes missing coverage. Please review.

Project coverage is 1.21%. Comparing base (6ab87f8) to head (423c119).

Files with missing lines Patch % Lines
controller/token.go 0.00% 18 Missing ⚠️
relay/adaptor/ollama/main.go 0.00% 3 Missing ⚠️
monitor/manage.go 0.00% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff            @@
##            main   #1933      +/-   ##
========================================
- Coverage   1.21%   1.21%   -0.01%     
========================================
  Files        145     145              
  Lines      12281   12296      +15     
========================================
  Hits         149     149              
- Misses     12118   12133      +15     
  Partials      14      14              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.


🚨 Try these New Features:

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.

1 participant