package agent import ( "context" "github.com/suyuan32/simple-admin-common/msg/errormsg" "github.com/zeromicro/go-zero/core/errorx" "wechat-api/hook/fastgpt" "wechat-api/internal/svc" "wechat-api/internal/types" "github.com/zeromicro/go-zero/core/logx" ) type GetAgentCollectionInfoLogic struct { logx.Logger ctx context.Context svcCtx *svc.ServiceContext } func NewGetAgentCollectionInfoLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetAgentCollectionInfoLogic { return &GetAgentCollectionInfoLogic{ Logger: logx.WithContext(ctx), ctx: ctx, svcCtx: svcCtx} } func (l *GetAgentCollectionInfoLogic) GetAgentCollectionInfo(req *types.CollectionDetailReq) (*types.CollectionInfoResp, error) { resp, err := fastgpt.GetCollectionDetail(*req.ID) if err != nil { return nil, errorx.NewInvalidArgumentError("fastgpt get collection failed " + err.Error()) } if resp.Code == 200 { return &types.CollectionInfoResp{ BaseDataInfo: types.BaseDataInfo{ Code: 0, Msg: errormsg.Success, }, Data: types.CollectionInfo{ ID: &resp.Data.ID, ParentID: &resp.Data.ParentID, TmbId: &resp.Data.TmbID, Type: &resp.Data.Type, Name: &resp.Data.Name, TrainingType: &resp.Data.TrainingType, ChunkSize: &resp.Data.ChunkSize, ChunkSplitter: &resp.Data.ChunkSplitter, QaPrompt: &resp.Data.QaPrompt, RawTextLength: &resp.Data.RawTextLength, CanWrite: &resp.Data.CanWrite, SourceName: &resp.Data.SourceName, DatasetId: types.DatasetId{ ID: &resp.Data.DatasetID.ID, ParentID: &resp.Data.DatasetID.ParentID, TeamId: &resp.Data.DatasetID.TeamID, TmbId: &resp.Data.DatasetID.TmbID, Type: &resp.Data.DatasetID.Type, Status: &resp.Data.DatasetID.Status, Avatar: &resp.Data.DatasetID.Avatar, Name: &resp.Data.DatasetID.Name, VectorModel: &resp.Data.DatasetID.VectorModel, AgentModel: &resp.Data.DatasetID.AgentModel, Intro: &resp.Data.DatasetID.Intro, }, }, }, nil } return nil, errorx.NewInvalidArgumentError(resp.StatusText) }