Browse Source

fix:remove some code

jimmyyem 6 months ago
parent
commit
475441e25f

+ 0 - 2
desc/wechat/agent.api

@@ -21,10 +21,8 @@ type (
         Examples  *string `json:"examples,optional"`
 
 		DatasetId *string `json:"dataset_id,optional"`
-		Dataset DatasetInfo `json:"dataset,optional"`
 
 		CollectionId *string `json:"collection_id,optional"`
-		Collection CollectionInfo `json:"collection,optional"`
     }
 
     // The response data of agent list | Agent列表数据

+ 0 - 35
internal/logic/agent/get_agent_by_id_logic.go

@@ -4,8 +4,6 @@ import (
 	"context"
 	"wechat-api/ent"
 	"wechat-api/ent/agent"
-	"wechat-api/hook/fastgpt"
-
 	"wechat-api/internal/svc"
 	"wechat-api/internal/types"
 	"wechat-api/internal/utils/dberrorhandler"
@@ -37,37 +35,6 @@ 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,
@@ -85,9 +52,7 @@ 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
 }

+ 0 - 4
internal/logic/agent/get_agent_list_logic.go

@@ -55,8 +55,6 @@ func (l *GetAgentListLogic) GetAgentList(req *types.AgentListReq) (*types.AgentL
 	resp.Msg = errormsg.Success
 	resp.Data.Total = data.PageDetails.Total
 
-	dataset, collection := types.DatasetInfo{}, types.CollectionInfo{}
-
 	for _, v := range data.List {
 		resp.Data.Data = append(resp.Data.Data,
 			types.AgentInfo{
@@ -71,9 +69,7 @@ func (l *GetAgentListLogic) GetAgentList(req *types.AgentListReq) (*types.AgentL
 				Background:   &v.Background,
 				Examples:     &v.Examples,
 				DatasetId:    &v.DatasetID,
-				Dataset:      dataset,
 				CollectionId: &v.CollectionID,
-				Collection:   collection,
 			})
 	}
 

+ 4 - 5
internal/types/types.go

@@ -382,11 +382,10 @@ type AgentInfo struct {
 	// background | 背景介绍
 	Background *string `json:"background,optional"`
 	// examples | 对话案例
-	Examples     *string        `json:"examples,optional"`
-	DatasetId    *string        `json:"dataset_id,optional"`
-	Dataset      DatasetInfo    `json:"dataset,optional"`
-	CollectionId *string        `json:"collection_id,optional"`
-	Collection   CollectionInfo `json:"collection,optional"`
+	Examples  *string `json:"examples,optional"`
+	DatasetId *string `json:"dataset_id,optional"`
+	//		Dataset DatasetInfo `json:"dataset,optional"`
+	CollectionId *string `json:"collection_id,optional"`
 }
 
 // The response data of agent list | Agent列表数据