add models task

This commit is contained in:
Sakurasan
2025-04-21 01:40:06 +08:00
parent 470e49b850
commit 73e53c2333
2 changed files with 9 additions and 6 deletions

View File

@@ -10,7 +10,7 @@ import (
)
func (p *Proxy) HandleModels(c *gin.Context) {
models, err := p.getCache()
models, err := p.getModelCache()
if err != nil {
dto.Fail(c, http.StatusBadGateway, err.Error())
return
@@ -25,7 +25,7 @@ func (p *Proxy) HandleModels(c *gin.Context) {
dto.Success(c, ms)
}
func (p *Proxy) setCache() error {
func (p *Proxy) setModelCache() error {
apikeys, err := p.apiKeyDao.FindKeys(nil)
models := make(map[string]bool)
if err == nil && len(apikeys) > 0 {
@@ -52,7 +52,7 @@ func (p *Proxy) setCache() error {
return p.cache.Set("models", support_models)
}
func (p *Proxy) getCache() ([]string, error) {
func (p *Proxy) getModelCache() ([]string, error) {
models, err := p.cache.Get("models")
return models.([]string), err
}