refactor: IDL structure modification (#475)

This commit is contained in:
liuyunchao-1998
2025-08-07 15:59:51 +08:00
committed by GitHub
parent b25bf6728a
commit e7d25319ff
221 changed files with 8289 additions and 17471 deletions

View File

@@ -23,12 +23,13 @@ import (
"fmt"
"github.com/coze-dev/coze-studio/backend/application/plugin"
"github.com/coze-dev/coze-studio/backend/application/singleagent"
"github.com/coze-dev/coze-studio/backend/application/upload"
"github.com/coze-dev/coze-studio/backend/domain/plugin/conf"
"github.com/cloudwego/hertz/pkg/app"
"github.com/cloudwego/hertz/pkg/protocol/consts"
bot_open_api "github.com/coze-dev/coze-studio/backend/api/model/ocean/cloud/bot_open_api"
"github.com/coze-dev/coze-studio/backend/api/model/app/bot_open_api"
)
// OauthAuthorizationCode .
@@ -63,3 +64,43 @@ func OauthAuthorizationCode(ctx context.Context, c *app.RequestContext) {
return
}
// UploadFileOpen .
// @router /v1/files/upload [POST]
func UploadFileOpen(ctx context.Context, c *app.RequestContext) {
var err error
var req bot_open_api.UploadFileOpenRequest
err = c.BindAndValidate(&req)
if err != nil {
c.String(consts.StatusBadRequest, err.Error())
return
}
resp := new(bot_open_api.UploadFileOpenResponse)
resp, err = upload.SVC.UploadFileOpen(ctx, &req)
if err != nil {
internalServerErrorResponse(ctx, c, err)
return
}
c.JSON(consts.StatusOK, resp)
}
// GetBotOnlineInfo .
// @router /v1/bot/get_online_info [GET]
func GetBotOnlineInfo(ctx context.Context, c *app.RequestContext) {
var err error
var req bot_open_api.GetBotOnlineInfoReq
err = c.BindAndValidate(&req)
if err != nil {
c.String(consts.StatusBadRequest, err.Error())
return
}
resp, err := singleagent.SingleAgentSVC.GetAgentOnlineInfo(ctx, &req)
if err != nil {
internalServerErrorResponse(ctx, c, err)
return
}
c.JSON(consts.StatusOK, resp)
}

View File

@@ -23,9 +23,8 @@ import (
"github.com/cloudwego/hertz/pkg/app"
"github.com/cloudwego/hertz/pkg/protocol/consts"
"github.com/coze-dev/coze-studio/backend/api/model/knowledge/document"
"github.com/coze-dev/coze-studio/backend/api/model/table"
"github.com/coze-dev/coze-studio/backend/api/model/data/database/table"
"github.com/coze-dev/coze-studio/backend/api/model/data/knowledge"
"github.com/coze-dev/coze-studio/backend/application/memory"
"github.com/coze-dev/coze-studio/backend/application/singleagent"
)
@@ -341,7 +340,7 @@ func GetDatabaseTableSchema(ctx context.Context, c *app.RequestContext) {
return
}
var resp *document.GetTableSchemaInfoResponse
var resp *knowledge.GetTableSchemaInfoResponse
resp, err = memory.DatabaseApplicationSVC.GetDatabaseTableSchema(ctx, &req)
if err != nil {
internalServerErrorResponse(ctx, c, err)

View File

@@ -30,7 +30,7 @@ import (
"github.com/cloudwego/hertz/pkg/app"
"github.com/cloudwego/hertz/pkg/protocol/consts"
developer_api "github.com/coze-dev/coze-studio/backend/api/model/ocean/cloud/developer_api"
"github.com/coze-dev/coze-studio/backend/api/model/app/developer_api"
"github.com/coze-dev/coze-studio/backend/application/base/ctxutil"
"github.com/coze-dev/coze-studio/backend/application/modelmgr"
"github.com/coze-dev/coze-studio/backend/application/singleagent"

View File

@@ -24,12 +24,11 @@ import (
"github.com/cloudwego/hertz/pkg/app"
"github.com/cloudwego/hertz/pkg/protocol/consts"
"github.com/coze-dev/coze-studio/backend/api/model/intelligence"
"github.com/coze-dev/coze-studio/backend/api/model/intelligence/common"
project "github.com/coze-dev/coze-studio/backend/api/model/project"
publish "github.com/coze-dev/coze-studio/backend/api/model/publish"
task "github.com/coze-dev/coze-studio/backend/api/model/task"
"github.com/coze-dev/coze-studio/backend/api/model/app/intelligence"
"github.com/coze-dev/coze-studio/backend/api/model/app/intelligence/common"
project "github.com/coze-dev/coze-studio/backend/api/model/app/intelligence/project"
publish "github.com/coze-dev/coze-studio/backend/api/model/app/intelligence/publish"
task "github.com/coze-dev/coze-studio/backend/api/model/app/intelligence/task"
appApplication "github.com/coze-dev/coze-studio/backend/application/app"
"github.com/coze-dev/coze-studio/backend/application/search"
)

View File

@@ -24,8 +24,10 @@ import (
"github.com/cloudwego/hertz/pkg/app"
"github.com/cloudwego/hertz/pkg/protocol/consts"
dataset "github.com/coze-dev/coze-studio/backend/api/model/flow/dataengine/dataset"
dataset "github.com/coze-dev/coze-studio/backend/api/model/data/knowledge"
"github.com/coze-dev/coze-studio/backend/application/knowledge"
application "github.com/coze-dev/coze-studio/backend/application/knowledge"
"github.com/coze-dev/coze-studio/backend/application/memory"
"github.com/coze-dev/coze-studio/backend/application/upload"
)
@@ -526,3 +528,48 @@ func ExtractPhotoCaption(ctx context.Context, c *app.RequestContext) {
}
c.JSON(consts.StatusOK, resp)
}
// GetDocumentTableInfo .
// @router /api/memory/doc_table_info [GET]
func GetDocumentTableInfo(ctx context.Context, c *app.RequestContext) {
var err error
var req dataset.GetDocumentTableInfoRequest
err = c.BindAndValidate(&req)
if err != nil {
c.String(consts.StatusBadRequest, err.Error())
return
}
resp := new(dataset.GetDocumentTableInfoResponse)
resp, err = knowledge.KnowledgeSVC.GetDocumentTableInfo(ctx, &req)
if err != nil {
internalServerErrorResponse(ctx, c, err)
return
}
c.JSON(consts.StatusOK, resp)
}
// GetModeConfig .
// @router /api/memory/table_mode_config [GET]
func GetModeConfig(ctx context.Context, c *app.RequestContext) {
var err error
var req dataset.GetModeConfigRequest
err = c.BindAndValidate(&req)
if err != nil {
c.String(consts.StatusBadRequest, err.Error())
return
}
if req.BotID == 0 {
invalidParamRequestResponse(c, "bot_id is zero")
return
}
resp, err := memory.DatabaseApplicationSVC.GetModeConfig(ctx, &req)
if err != nil {
internalServerErrorResponse(ctx, c, err)
return
}
c.JSON(consts.StatusOK, resp)
}

View File

@@ -24,12 +24,9 @@ import (
"github.com/cloudwego/hertz/pkg/app"
"github.com/cloudwego/hertz/pkg/protocol/consts"
"github.com/coze-dev/coze-studio/backend/api/model/knowledge/document"
"github.com/coze-dev/coze-studio/backend/api/model/kvmemory"
"github.com/coze-dev/coze-studio/backend/api/model/project_memory"
table "github.com/coze-dev/coze-studio/backend/api/model/table"
"github.com/coze-dev/coze-studio/backend/api/model/data/variable/kvmemory"
"github.com/coze-dev/coze-studio/backend/api/model/data/variable/project_memory"
appApplication "github.com/coze-dev/coze-studio/backend/application/app"
"github.com/coze-dev/coze-studio/backend/application/knowledge"
"github.com/coze-dev/coze-studio/backend/application/memory"
"github.com/coze-dev/coze-studio/backend/pkg/lang/conv"
)
@@ -230,48 +227,3 @@ func GetPlayGroundMemory(ctx context.Context, c *app.RequestContext) {
c.JSON(consts.StatusOK, resp)
}
// GetDocumentTableInfo .
// @router /api/memory/doc_table_info [GET]
func GetDocumentTableInfo(ctx context.Context, c *app.RequestContext) {
var err error
var req document.GetDocumentTableInfoRequest
err = c.BindAndValidate(&req)
if err != nil {
c.String(consts.StatusBadRequest, err.Error())
return
}
resp := new(document.GetDocumentTableInfoResponse)
resp, err = knowledge.KnowledgeSVC.GetDocumentTableInfo(ctx, &req)
if err != nil {
internalServerErrorResponse(ctx, c, err)
return
}
c.JSON(consts.StatusOK, resp)
}
// GetModeConfig .
// @router /api/memory/table_mode_config [GET]
func GetModeConfig(ctx context.Context, c *app.RequestContext) {
var err error
var req table.GetModeConfigRequest
err = c.BindAndValidate(&req)
if err != nil {
c.String(consts.StatusBadRequest, err.Error())
return
}
if req.BotID == 0 {
invalidParamRequestResponse(c, "bot_id is zero")
return
}
resp, err := memory.DatabaseApplicationSVC.GetModeConfig(ctx, &req)
if err != nil {
internalServerErrorResponse(ctx, c, err)
return
}
c.JSON(consts.StatusOK, resp)
}

View File

@@ -23,8 +23,7 @@ import (
"github.com/cloudwego/hertz/pkg/app"
"github.com/cloudwego/hertz/pkg/protocol/consts"
"github.com/coze-dev/coze-studio/backend/api/model/ocean/cloud/playground"
"github.com/coze-dev/coze-studio/backend/api/model/playground"
appApplication "github.com/coze-dev/coze-studio/backend/application/app"
"github.com/coze-dev/coze-studio/backend/application/prompt"
"github.com/coze-dev/coze-studio/backend/application/shortcutcmd"
@@ -371,43 +370,3 @@ func GetFileUrls(ctx context.Context, c *app.RequestContext) {
c.JSON(consts.StatusOK, resp)
}
// UploadFileOpen .
// @router /v1/files/upload [POST]
func UploadFileOpen(ctx context.Context, c *app.RequestContext) {
var err error
var req playground.UploadFileOpenRequest
err = c.BindAndValidate(&req)
if err != nil {
c.String(consts.StatusBadRequest, err.Error())
return
}
resp := new(playground.UploadFileOpenResponse)
resp, err = upload.SVC.UploadFileOpen(ctx, &req)
if err != nil {
internalServerErrorResponse(ctx, c, err)
return
}
c.JSON(consts.StatusOK, resp)
}
// GetBotOnlineInfo .
// @router /v1/bot/get_online_info [GET]
func GetBotOnlineInfo(ctx context.Context, c *app.RequestContext) {
var err error
var req playground.GetBotOnlineInfoReq
err = c.BindAndValidate(&req)
if err != nil {
c.String(consts.StatusBadRequest, err.Error())
return
}
resp, err := singleagent.SingleAgentSVC.GetAgentOnlineInfo(ctx, &req)
if err != nil {
internalServerErrorResponse(ctx, c, err)
return
}
c.JSON(consts.StatusOK, resp)
}

View File

@@ -25,8 +25,8 @@ import (
"github.com/cloudwego/hertz/pkg/app"
"github.com/cloudwego/hertz/pkg/protocol/consts"
"github.com/coze-dev/coze-studio/backend/api/model/ocean/cloud/plugin_develop"
common "github.com/coze-dev/coze-studio/backend/api/model/plugin_develop_common"
"github.com/coze-dev/coze-studio/backend/api/model/plugin_develop"
common "github.com/coze-dev/coze-studio/backend/api/model/plugin_develop/common"
"github.com/coze-dev/coze-studio/backend/application/plugin"
appworkflow "github.com/coze-dev/coze-studio/backend/application/workflow"
)

View File

@@ -22,18 +22,18 @@ import (
"context"
"strconv"
"github.com/coze-dev/coze-studio/backend/api/model/ocean/cloud/workflow"
product_public_api "github.com/coze-dev/coze-studio/backend/api/model/marketplace/product_public_api"
"github.com/coze-dev/coze-studio/backend/api/model/workflow"
appworkflow "github.com/coze-dev/coze-studio/backend/application/workflow"
"github.com/cloudwego/hertz/pkg/app"
"github.com/cloudwego/hertz/pkg/protocol/consts"
"github.com/coze-dev/coze-studio/backend/api/model/ocean/cloud/developer_api"
"github.com/coze-dev/coze-studio/backend/api/model/app/developer_api"
"github.com/coze-dev/coze-studio/backend/api/model/flow/marketplace/product_common"
"github.com/coze-dev/coze-studio/backend/api/model/flow/marketplace/product_public_api"
"github.com/coze-dev/coze-studio/backend/api/model/ocean/cloud/bot_common"
"github.com/coze-dev/coze-studio/backend/api/model/ocean/cloud/playground"
"github.com/coze-dev/coze-studio/backend/api/model/app/bot_common"
"github.com/coze-dev/coze-studio/backend/api/model/marketplace/product_common"
"github.com/coze-dev/coze-studio/backend/api/model/playground"
appApplication "github.com/coze-dev/coze-studio/backend/application/app"
"github.com/coze-dev/coze-studio/backend/application/modelmgr"
"github.com/coze-dev/coze-studio/backend/application/plugin"

View File

@@ -29,7 +29,7 @@ import (
"github.com/cloudwego/hertz/pkg/protocol/consts"
"github.com/cloudwego/hertz/pkg/protocol/sse"
"github.com/coze-dev/coze-studio/backend/api/model/ocean/cloud/workflow"
"github.com/coze-dev/coze-studio/backend/api/model/workflow"
appworkflow "github.com/coze-dev/coze-studio/backend/application/workflow"
"github.com/coze-dev/coze-studio/backend/domain/workflow/entity/vo"
"github.com/coze-dev/coze-studio/backend/pkg/lang/ptr"

View File

@@ -50,9 +50,9 @@ import (
modelknowledge "github.com/coze-dev/coze-studio/backend/api/model/crossdomain/knowledge"
plugin2 "github.com/coze-dev/coze-studio/backend/api/model/crossdomain/plugin"
pluginmodel "github.com/coze-dev/coze-studio/backend/api/model/crossdomain/plugin"
"github.com/coze-dev/coze-studio/backend/api/model/ocean/cloud/playground"
pluginAPI "github.com/coze-dev/coze-studio/backend/api/model/ocean/cloud/plugin_develop"
"github.com/coze-dev/coze-studio/backend/api/model/ocean/cloud/workflow"
"github.com/coze-dev/coze-studio/backend/api/model/playground"
pluginAPI "github.com/coze-dev/coze-studio/backend/api/model/plugin_develop"
"github.com/coze-dev/coze-studio/backend/api/model/workflow"
"github.com/coze-dev/coze-studio/backend/application/base/ctxutil"
appknowledge "github.com/coze-dev/coze-studio/backend/application/knowledge"
appmemory "github.com/coze-dev/coze-studio/backend/application/memory"