mirror of
https://github.com/APIParkLab/APIPark.git
synced 2026-06-14 20:41:15 +08:00
Add support for creating online models and integrating custom model providers
This commit is contained in:
@@ -22,6 +22,7 @@ type IProviderController interface {
|
||||
UpdateProviderDefaultLLM(ctx *gin.Context, id string, input *ai_dto.UpdateLLM) error
|
||||
Delete(ctx *gin.Context, id string) error
|
||||
//Sort(ctx *gin.Context, input *ai_dto.Sort) error
|
||||
AddProvider(ctx *gin.Context, input *ai_dto.NewProvider) (*ai_dto.SimpleProvider, error)
|
||||
}
|
||||
|
||||
type IStatisticController interface {
|
||||
|
||||
@@ -2,7 +2,9 @@ package ai
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"github.com/APIParkLab/APIPark/module/ai"
|
||||
ai_dto "github.com/APIParkLab/APIPark/module/ai/dto"
|
||||
@@ -21,6 +23,13 @@ func (i *imlProviderController) Delete(ctx *gin.Context, id string) error {
|
||||
return i.module.Delete(ctx, id)
|
||||
}
|
||||
|
||||
func (i *imlProviderController) AddProvider(ctx *gin.Context, input *ai_dto.NewProvider) (*ai_dto.SimpleProvider, error) {
|
||||
if strings.TrimSpace(input.Name) == "" {
|
||||
return nil, fmt.Errorf("name is empty")
|
||||
}
|
||||
return i.module.AddProvider(ctx, input)
|
||||
}
|
||||
|
||||
//func (i *imlProviderController) Sort(ctx *gin.Context, input *ai_dto.Sort) error {
|
||||
// return i.module.Sort(ctx, input)
|
||||
//}
|
||||
@@ -67,6 +76,9 @@ func (i *imlProviderController) Disable(ctx *gin.Context, id string) error {
|
||||
}
|
||||
|
||||
func (i *imlProviderController) UpdateProviderConfig(ctx *gin.Context, id string, input *ai_dto.UpdateConfig) error {
|
||||
if strings.TrimSpace(id) == "" {
|
||||
return fmt.Errorf("id is empty")
|
||||
}
|
||||
return i.module.UpdateProviderConfig(ctx, id, input)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user