package ai

import (
	"context"
	"fmt"
	"github.com/zeromicro/go-zero/core/logx"
	"sundynix-micro-go/app/plant/api/internal/svc"
	plantPb "sundynix-micro-go/app/plant/rpc/plant"
)

type ClearAiChatHistoryLogic struct {
	logx.Logger
	ctx    context.Context
	svcCtx *svc.ServiceContext
}

func NewClearAiChatHistoryLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ClearAiChatHistoryLogic {
	return &ClearAiChatHistoryLogic{Logger: logx.WithContext(ctx), ctx: ctx, svcCtx: svcCtx}
}

func (l *ClearAiChatHistoryLogic) ClearAiChatHistory() error {
	userId := fmt.Sprintf("%v", l.ctx.Value("userId"))
	_, err := l.svcCtx.PlantRpc.ClearAiChatHistory(l.ctx, &plantPb.GetProfileReq{UserId: userId})
	return err
}
