finish nvidia

This commit is contained in:
Liujian
2024-10-16 16:17:21 +08:00
parent 2d94bbaef7
commit 44aa842f20
2 changed files with 8 additions and 4 deletions
@@ -31,4 +31,4 @@ provider_credential_schema:
placeholder:
zh_Hans: 在此输入您的 API Key
en_US: Enter your API Key
address: https://api.openai.com
address: https://integrate.api.nvidia.com
+7 -3
View File
@@ -106,17 +106,21 @@ func (i *imlServiceController) CreateAIService(ctx *gin.Context, teamID string,
input.Prefix = input.Id[:8]
}
}
pv, err := i.providerModule.Provider(ctx, *input.Provider)
if err != nil {
return nil, err
}
p, has := model_runtime.GetProvider(*input.Provider)
if !has {
return nil, fmt.Errorf("provider not found")
}
m, has := p.DefaultModel(model_runtime.ModelTypeLLM)
m, has := p.GetModel(pv.DefaultLLM)
if !has {
return nil, fmt.Errorf("provider default llm not found")
return nil, fmt.Errorf("model %s not found", pv.DefaultLLM)
}
var info *service_dto.Service
err := i.transaction.Transaction(ctx, func(txCtx context.Context) error {
err = i.transaction.Transaction(ctx, func(txCtx context.Context) error {
var err error
info, err = i.module.Create(ctx, teamID, input)
if err != nil {