|
@@ -4,6 +4,7 @@ import (
|
|
|
"context"
|
|
|
"wechat-api/ent"
|
|
|
"wechat-api/ent/agent"
|
|
|
+ "wechat-api/hook/fastgpt"
|
|
|
|
|
|
"wechat-api/internal/svc"
|
|
|
"wechat-api/internal/types"
|
|
@@ -36,6 +37,37 @@ func (l *GetAgentByIdLogic) GetAgentById(req *types.IDReq) (*types.AgentInfoResp
|
|
|
return nil, dberrorhandler.DefaultEntError(l.Logger, err, req)
|
|
|
}
|
|
|
|
|
|
+ var dataset types.DatasetInfo
|
|
|
+ if data.DatasetID != "" {
|
|
|
+ datasetResp, err := fastgpt.GetDatasetDetail(data.DatasetID)
|
|
|
+ if err != nil {
|
|
|
+ return nil, err
|
|
|
+ }
|
|
|
+ dataset.ID = &datasetResp.Data.ID
|
|
|
+ dataset.ParentID = &datasetResp.Data.ParentID
|
|
|
+ dataset.Name = &datasetResp.Data.Name
|
|
|
+ dataset.TeamId = &datasetResp.Data.TeamID
|
|
|
+ dataset.TmbId = &datasetResp.Data.TmbID
|
|
|
+ dataset.Intro = &datasetResp.Data.Intro
|
|
|
+ dataset.Type = &datasetResp.Data.Type
|
|
|
+ dataset.Avatar = &datasetResp.Data.Avatar
|
|
|
+ dataset.Status = &datasetResp.Data.Status
|
|
|
+ }
|
|
|
+
|
|
|
+ var collection types.CollectionInfo
|
|
|
+ if data.CollectionID != "" {
|
|
|
+ collectionResp, err := fastgpt.GetCollectionDetail(data.CollectionID)
|
|
|
+ if err != nil {
|
|
|
+ return nil, err
|
|
|
+ }
|
|
|
+ collection.ID = &collectionResp.Data.ID
|
|
|
+ collection.ParentID = &collectionResp.Data.ParentID
|
|
|
+ collection.TmbId = &collectionResp.Data.TmbID
|
|
|
+ collection.Name = &collectionResp.Data.Name
|
|
|
+ collection.Type = &collectionResp.Data.Type
|
|
|
+ collection.SourceName = &collectionResp.Data.SourceName
|
|
|
+ }
|
|
|
+
|
|
|
return &types.AgentInfoResp{
|
|
|
BaseDataInfo: types.BaseDataInfo{
|
|
|
Code: 0,
|
|
@@ -53,7 +85,9 @@ func (l *GetAgentByIdLogic) GetAgentById(req *types.IDReq) (*types.AgentInfoResp
|
|
|
Background: &data.Background,
|
|
|
Examples: &data.Examples,
|
|
|
DatasetId: &data.DatasetID,
|
|
|
+ Dataset: dataset,
|
|
|
CollectionId: &data.CollectionID,
|
|
|
+ Collection: collection,
|
|
|
},
|
|
|
}, nil
|
|
|
}
|