package controller import ( "context" "rag-local/kb/model/dto" "rag-local/kb/model/entity" "rag-local/kb/service" ) type conversation struct{} var Conversation = &conversation{} func (c *conversation) List(ctx context.Context, req *dto.ListConversationReq) (*dto.ListConversationRes, error) { list, err := service.ConversationService.List(ctx) if err != nil { return nil, err } return &dto.ListConversationRes{List: list}, nil } func (c *conversation) Save(ctx context.Context, req *dto.SaveConversationReq) (*dto.SaveConversationRes, error) { id, err := service.ConversationService.Save(ctx, &entity.Conversation{ Id: req.Id, DatasetId: req.DatasetId, Title: req.Title, }) if err != nil { return nil, err } return &dto.SaveConversationRes{Id: id}, nil } func (c *conversation) Delete(ctx context.Context, req *dto.DeleteConversationReq) (*dto.DeleteConversationRes, error) { if err := service.ConversationService.Delete(ctx, req.Id); err != nil { return nil, err } return &dto.DeleteConversationRes{}, nil }