fix findkey
This commit is contained in:
@@ -184,13 +184,9 @@ func (p *Proxy) Do(usage *model.Usage) error {
|
||||
|
||||
func (p *Proxy) SelectApiKey(model string) error {
|
||||
akpikeys, err := p.apiKeyDao.FindApiKeysBySupportModel(p.db, model)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if len(akpikeys) == 0 {
|
||||
return errors.New("no available apikey")
|
||||
} else {
|
||||
if strings.HasPrefix(model, "gpt") {
|
||||
|
||||
if err != nil || len(akpikeys) == 0 {
|
||||
if strings.HasPrefix(model, "gpt") || strings.HasPrefix(model, "o1") || strings.HasPrefix(model, "o3") {
|
||||
keys, err := p.apiKeyDao.FindKeys(map[string]any{"type = ?": "openai"})
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -216,7 +212,6 @@ func (p *Proxy) SelectApiKey(model string) error {
|
||||
}
|
||||
if len(akpikeys) == 0 {
|
||||
return errors.New("no available apikey")
|
||||
|
||||
}
|
||||
|
||||
if len(akpikeys) == 1 {
|
||||
|
||||
Reference in New Issue
Block a user