mirror of
https://github.com/APIParkLab/APIPark.git
synced 2026-06-14 20:41:15 +08:00
add:init ai balance
This commit is contained in:
@@ -23,6 +23,14 @@ type imlAPIService struct {
|
||||
universally.IServiceDelete
|
||||
}
|
||||
|
||||
func (i *imlAPIService) CountByProvider(ctx context.Context, provider string) (int64, error) {
|
||||
return i.store.Count(ctx, "", map[string]interface{}{"provider": provider})
|
||||
}
|
||||
|
||||
func (i *imlAPIService) CountByModel(ctx context.Context, model string) (int64, error) {
|
||||
return i.store.Count(ctx, "", map[string]interface{}{"model": model})
|
||||
}
|
||||
|
||||
func (i *imlAPIService) DeleteByService(ctx context.Context, serviceId string) error {
|
||||
_, err := i.store.DeleteWhere(ctx, map[string]interface{}{"service": serviceId})
|
||||
if err != nil {
|
||||
|
||||
@@ -15,6 +15,8 @@ type IAPIService interface {
|
||||
universally.IServiceDelete
|
||||
CountMapByProvider(ctx context.Context, keyword string, conditions map[string]interface{}) (map[string]int64, error)
|
||||
CountMapByModel(ctx context.Context, keyword string, conditions map[string]interface{}) (map[string]int64, error)
|
||||
CountByModel(ctx context.Context, model string) (int64, error)
|
||||
CountByProvider(ctx context.Context, provider string) (int64, error)
|
||||
DeleteByService(ctx context.Context, serviceId string) error
|
||||
}
|
||||
|
||||
|
||||
@@ -126,5 +126,8 @@ func updateHandler(e *ai.Provider, i *SetProvider) {
|
||||
if i.Status != nil {
|
||||
e.Status = *i.Status
|
||||
}
|
||||
if i.Priority != nil {
|
||||
e.Priority = *i.Priority
|
||||
}
|
||||
e.UpdateAt = time.Now()
|
||||
}
|
||||
|
||||
@@ -32,6 +32,7 @@ type SetProvider struct {
|
||||
Name *string
|
||||
DefaultLLM *string
|
||||
Config *string
|
||||
Priority *int
|
||||
Status *int
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user