mirror of
https://github.com/APIParkLab/APIPark.git
synced 2026-06-12 18:11:34 +08:00
finish ai balance
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
package ai_balance
|
||||
|
||||
import (
|
||||
"reflect"
|
||||
|
||||
ai_balance_dto "github.com/APIParkLab/APIPark/module/ai-balance/dto"
|
||||
"github.com/eolinker/go-common/autowire"
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
type IBalanceController interface {
|
||||
List(ctx *gin.Context, keyword string) ([]*ai_balance_dto.Item, error)
|
||||
Sort(ctx *gin.Context, input *ai_balance_dto.Sort) error
|
||||
Create(ctx *gin.Context, input *ai_balance_dto.Create) error
|
||||
Delete(ctx *gin.Context, id string) error
|
||||
}
|
||||
|
||||
func init() {
|
||||
autowire.Auto[IBalanceController](func() reflect.Value {
|
||||
return reflect.ValueOf(new(imlBalanceController))
|
||||
})
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
package ai_balance
|
||||
|
||||
import (
|
||||
ai_balance "github.com/APIParkLab/APIPark/module/ai-balance"
|
||||
ai_balance_dto "github.com/APIParkLab/APIPark/module/ai-balance/dto"
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
var _ IBalanceController = (*imlBalanceController)(nil)
|
||||
|
||||
type imlBalanceController struct {
|
||||
module ai_balance.IBalanceModule `autowired:""`
|
||||
}
|
||||
|
||||
func (i *imlBalanceController) List(ctx *gin.Context, keyword string) ([]*ai_balance_dto.Item, error) {
|
||||
return i.module.List(ctx, keyword)
|
||||
}
|
||||
|
||||
func (i *imlBalanceController) Sort(ctx *gin.Context, input *ai_balance_dto.Sort) error {
|
||||
return i.module.Sort(ctx, input)
|
||||
}
|
||||
|
||||
func (i *imlBalanceController) Create(ctx *gin.Context, input *ai_balance_dto.Create) error {
|
||||
return i.module.Create(ctx, input)
|
||||
}
|
||||
|
||||
func (i *imlBalanceController) Delete(ctx *gin.Context, id string) error {
|
||||
return i.module.Delete(ctx, id)
|
||||
}
|
||||
@@ -17,6 +17,7 @@ type ILocalModelController interface {
|
||||
RemoveModel(ctx *gin.Context, model string) error
|
||||
Update(ctx *gin.Context, model string, input *ai_local_dto.Update) error
|
||||
State(ctx *gin.Context, model string) (*ai_local_dto.DeployState, *ai_local_dto.ModelInfo, error)
|
||||
SimpleList(ctx *gin.Context) ([]*ai_local_dto.SimpleItem, error)
|
||||
}
|
||||
|
||||
func init() {
|
||||
|
||||
@@ -53,6 +53,10 @@ type imlLocalModelController struct {
|
||||
transaction store.ITransaction `autowired:""`
|
||||
}
|
||||
|
||||
func (i *imlLocalModelController) SimpleList(ctx *gin.Context) ([]*ai_local_dto.SimpleItem, error) {
|
||||
return i.module.SimpleList(ctx)
|
||||
}
|
||||
|
||||
func (i *imlLocalModelController) State(ctx *gin.Context, model string) (*ai_local_dto.DeployState, *ai_local_dto.ModelInfo, error) {
|
||||
return i.module.ModelState(ctx, model)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user