mirror of
https://github.com/APIParkLab/APIPark.git
synced 2026-06-14 20:41:15 +08:00
init service consumer
This commit is contained in:
@@ -9,6 +9,9 @@ import (
|
|||||||
"net/http"
|
"net/http"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
"github.com/APIParkLab/APIPark/module/subscribe"
|
||||||
|
subscribe_dto "github.com/APIParkLab/APIPark/module/subscribe/dto"
|
||||||
|
|
||||||
"github.com/APIParkLab/APIPark/model/plugin_model"
|
"github.com/APIParkLab/APIPark/model/plugin_model"
|
||||||
"github.com/APIParkLab/APIPark/service/api"
|
"github.com/APIParkLab/APIPark/service/api"
|
||||||
|
|
||||||
@@ -44,7 +47,9 @@ type imlLocalModelController struct {
|
|||||||
serviceModule service.IServiceModule `autowired:""`
|
serviceModule service.IServiceModule `autowired:""`
|
||||||
catalogueModule catalogue.ICatalogueModule `autowired:""`
|
catalogueModule catalogue.ICatalogueModule `autowired:""`
|
||||||
aiAPIModule ai_api.IAPIModule `autowired:""`
|
aiAPIModule ai_api.IAPIModule `autowired:""`
|
||||||
|
appModule service.IAppModule `autowired:""`
|
||||||
routerModule router.IRouterModule `autowired:""`
|
routerModule router.IRouterModule `autowired:""`
|
||||||
|
subscribeModule subscribe.ISubscribeModule `autowired:""`
|
||||||
docModule service.IServiceDocModule `autowired:""`
|
docModule service.IServiceDocModule `autowired:""`
|
||||||
transaction store.ITransaction `autowired:""`
|
transaction store.ITransaction `autowired:""`
|
||||||
}
|
}
|
||||||
@@ -226,7 +231,7 @@ func (i *imlLocalModelController) initAILocalService(ctx context.Context, model
|
|||||||
Type: "local",
|
Type: "local",
|
||||||
}
|
}
|
||||||
name := "Demo AI API"
|
name := "Demo AI API"
|
||||||
description := "A demo that shows you how to use a e a Chat API."
|
description := "This is a demo that shows you how to use a Chat API."
|
||||||
apiId := uuid.NewString()
|
apiId := uuid.NewString()
|
||||||
err = i.aiAPIModule.Create(
|
err = i.aiAPIModule.Create(
|
||||||
ctx,
|
ctx,
|
||||||
@@ -281,7 +286,15 @@ func (i *imlLocalModelController) initAILocalService(ctx context.Context, model
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
apps, err := i.appModule.Search(ctx, teamID, "")
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
for _, app := range apps {
|
||||||
|
i.subscribeModule.AddSubscriber(ctx, serviceId, &subscribe_dto.AddSubscriber{
|
||||||
|
Application: app.Id,
|
||||||
|
})
|
||||||
|
}
|
||||||
return i.docModule.SaveServiceDoc(ctx, serviceId, &service_dto.SaveServiceDoc{
|
return i.docModule.SaveServiceDoc(ctx, serviceId, &service_dto.SaveServiceDoc{
|
||||||
Doc: "",
|
Doc: "",
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -386,7 +386,7 @@ func (i *imlServiceController) createAIService(ctx *gin.Context, teamID string,
|
|||||||
Type: modelType,
|
Type: modelType,
|
||||||
}
|
}
|
||||||
name := "Demo AI API "
|
name := "Demo AI API "
|
||||||
description := "A demo that shows you how to use Chat API."
|
description := "This is a demo that shows you how to use a Chat API."
|
||||||
apiId := uuid.New().String()
|
apiId := uuid.New().String()
|
||||||
err = i.aiAPIModule.Create(
|
err = i.aiAPIModule.Create(
|
||||||
ctx,
|
ctx,
|
||||||
|
|||||||
Reference in New Issue
Block a user