-
Notifications
You must be signed in to change notification settings - Fork 9
添加openai缓存计费显示 #20
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
Open
CSCITech
wants to merge
17
commits into
main
Choose a base branch
from
cscitech
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
添加openai缓存计费显示 #20
Changes from all commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
c365acc
添加openai缓存计费显示
CSCITech d07cf81
修复前端渲染
CSCITech 6b6e051
优化前端
CSCITech 233a35c
优化前端
CSCITech a408869
优化前端
CSCITech 8ae50e9
fix bugs
CSCITech 4beaba5
fix bugs
CSCITech f9e7aae
fix bugs
CSCITech f7980b0
fix bugs
CSCITech 1f41bda
fix bugs
CSCITech 7ca7906
fix bugs
CSCITech 5ad05b2
fix bugs
CSCITech 0d021af
fix bugs
CSCITech 12190b1
fix bugs
CSCITech c9417da
fix bugs
CSCITech b8941bb
fix bugs
CSCITech 65f7ce3
fix bugs
CSCITech File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,49 @@ | ||
| package common | ||
|
|
||
| import ( | ||
| "testing" | ||
| "time" | ||
|
|
||
| "github.com/alicebob/miniredis/v2" | ||
| "github.com/go-redis/redis/v8" | ||
| "github.com/stretchr/testify/require" | ||
| ) | ||
|
|
||
| func TestVersionedHashDeletionRejectsStaleRefillsAndReleasesEntityKeys(t *testing.T) { | ||
| server := miniredis.RunT(t) | ||
| oldRDB := RDB | ||
| RDB = redis.NewClient(&redis.Options{Addr: server.Addr()}) | ||
| t.Cleanup(func() { | ||
| require.NoError(t, RDB.Close()) | ||
| RDB = oldRDB | ||
| }) | ||
|
|
||
| cacheKey := "cache:test-entity" | ||
| versionKey := "cache-version:test-entity" | ||
| version, err := RedisGetCacheVersion(versionKey) | ||
| require.NoError(t, err) | ||
| require.Positive(t, version) | ||
|
|
||
| stored, err := RedisHSetFieldIfVersion(cacheKey, versionKey, version, "Quota", 10, time.Minute) | ||
| require.NoError(t, err) | ||
| require.True(t, stored) | ||
|
|
||
| require.NoError(t, RedisInvalidateVersionedHash(cacheKey, versionKey)) | ||
| newVersion, err := RedisGetCacheVersion(versionKey) | ||
| require.NoError(t, err) | ||
| require.Greater(t, newVersion, version) | ||
| stored, err = RedisHSetFieldIfVersion(cacheKey, versionKey, version, "Quota", 20, time.Minute) | ||
| require.NoError(t, err) | ||
| require.False(t, stored) | ||
|
|
||
| require.NoError(t, RedisDeleteVersionedHash(cacheKey, versionKey)) | ||
| require.False(t, server.Exists(cacheKey)) | ||
| require.False(t, server.Exists(versionKey)) | ||
| stored, err = RedisHSetFieldIfVersion(cacheKey, versionKey, newVersion, "Quota", 30, time.Minute) | ||
| require.NoError(t, err) | ||
| require.False(t, stored) | ||
|
|
||
| recreatedVersion, err := RedisGetCacheVersion(versionKey) | ||
| require.NoError(t, err) | ||
| require.Greater(t, recreatedVersion, newVersion) | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.