```
type Task interface {
	Init()
	SetPre(payload interface{}) interface{}
	SetPost(payload interface{}) interface{}
	SetGuiding(guiding string) interface{}
	SetTaskStatus(process float64)
	SummarizeTask() []openai.ChatCompletionMessage
	GetTimeout() int
	GetRelatedTask() []Task
	GetStatus() float64
	GetTaskType() TaskType
	GetTaskID() string
	GetDisableChat() bool
	GetTaskTopic() string
	Run(doneChan chan<- models.TaskRunResult, input models.UserPost)
	HandleTimeOut()
	UpdateTaskLastUserSaid()
	GetLastUserSaidTime() int64
}

type TaskBase struct {
	userID       primitive.ObjectID
	taskID       string
	Timeout      int
	RelatedTask  []Task
	Status       float64
	TaskType     TaskType
	disableChat  bool
	lastUserSaid int64
	Conversation *Conversation
}

func (tb *TaskBase) AppendMessage(messages []openai.ChatCompletionMessage) {
	for _, message := range messages {
		tb.Conversation.AddMessage(message.Role, message.Content)
	}
}

func (tb *TaskBase) UpdateTaskLastUserSaid() {
	tb.lastUserSaid = time.Now().UnixMicro()
}

func (tb *TaskBase) GetLastUserSaidTime() int64 {
	return tb.lastUserSaid
}

func (tb *TaskBase) GetUserId() primitive.ObjectID {
	return tb.userID
}

func (tb *TaskBase) GetDisableChat() bool {
	return tb.disableChat
}

// 实现 Task 接口的方法
func (tb *TaskBase) SetTaskStatus(process float64) {
	tb.Status = process
}

func (tb *TaskBase) GetTaskID() string {
	return tb.taskID
}

func (tb *TaskBase) GetTimeout() int {
	return tb.Timeout
}

func (tb *TaskBase) GetRelatedTask() []Task {
	return tb.RelatedTask
}

func (tb *TaskBase) GetStatus() float64 {
	return tb.Status
}

func (tb *TaskBase) GetTaskType() TaskType {
	return tb.TaskType
}
```
请你根据我这里的Task 接口帮我实现一个EvaTask的struct ，这个task 功能是接受用户消息，然后将用户消息连同一些我准备好的提示词发送给assistant，然后对AI返回的JSON数据进行解析，获取到AI任务当前Task 的进度，如果大于等于1 就进入收尾函数，下面是我之前写的一个例子，但是不够优雅，请你帮我理解我的要求，然后更优雅的实现golang代码
```
package task

import (
	"context"
	"encoding/json"
	"log"
	"time"
	"xagent/models"
	service "xagent/service/user"
	"xagent/utils"

	"github.com/sashabaranov/go-openai"
	"go.mongodb.org/mongo-driver/bson/primitive"
)

var jsonFormat = `{
	"studySavours": [
	  {
		"knowns": "学生年级",
		"score": 8
	  }
	],
	"knowledgeLevel": 7,
	"savours": [
	  "电影",
	  "文学"
	],
	"passion": 4,
	"character": ["友好、关心他人、善于协调。富有同情心、领导力强、激励他人。果断、战略性思维、领导力强。"],
	"expect": ["热心","幽默","老师"]
  }`

type EvaTask struct {
	TaskBase
	InitMessage    openai.ChatCompletionMessage
	PreMessage     openai.ChatCompletionMessage
	PostMessage    openai.ChatCompletionMessage
	GuidingMessage openai.ChatCompletionMessage
	Knowledge      string
	MustClose      int64 // 这些秒后关闭任务
	startTime      int64
	epoch          int64
	models.UserOverview
}

func (et *EvaTask) GetTaskTopic() string {
	return et.Knowledge
}

func (e *EvaTask) marshalEvaBase() string {
	eb, _ := json.Marshal(e.UserOverview)
	return string(eb)
}

// HandleTimeOut implements Task.
func (e *EvaTask) HandleTimeOut() {
	// TODO 发送提示消息
	var serverResponse models.ServerResponse
	serverResponse.TaskID = e.GetTaskID()
	serverResponse.MessageID = utils.NewUUIDStr()
	serverResponse.Contents = []openai.ChatMessagePart{
		{
			Type: openai.ChatMessagePartTypeText,
			Text: "你已经好久没回我消息了，能告诉我你在想什么吗？",
		},
	}
	serverResponse.Role = models.AssistantRole
	e.Conversation.SendToClientChan <- utils.NewWsResp(serverResponse, "ok", 0, "aiSaid")
}

// Init implements Task.
func (e *EvaTask) Init() {
	ctx, cancel := context.WithTimeout(context.Background(), time.Minute)
	defer cancel()
	e.InitMessage = openai.ChatCompletionMessage{
		Role:    openai.ChatMessageRoleSystem,
		Content: taskPrompts.Eva.InitPrompt + "你现在可以主动询问学生一些信息了",
	}
	e.AppendMessage([]openai.ChatCompletionMessage{e.InitMessage})

	message, err := e.Conversation.GetAIMsgRespNoJson(ctx)
	if err != nil {
		e.Conversation.SendToClientChan <- utils.WsResendResponse(e.GetTaskID())
		log.Println(err, "服务器内部错误，ai 返回内容失败", message)
		return
	}

	guidingRes := e.SetGuiding(message.Content[0].Text.Value)
	var serverResponse models.ServerResponse
	switch v := guidingRes.(type) {
	case error:
		e.Conversation.SendToClientChan <- utils.WsResendResponse(e.GetTaskID())
	case []openai.ChatCompletionMessage:
		// 任务正常进行
		serverResponse.Role = models.Role(v[0].Role)
		serverResponse.Contents = []openai.ChatMessagePart{
			{
				Type: openai.ChatMessagePartTypeText,
				Text: v[0].Content,
			},
		}
	}
	serverResponse.TaskID = e.GetTaskID()
	serverResponse.MessageID = utils.NewUUIDStr()
	e.Conversation.SendToClientChan <- utils.NewWsResp(serverResponse, "ok", 0, "aiSaid")
}

// Run implements Task.
func (e *EvaTask) Run(doneChan chan<- models.TaskRunResult, input models.UserPost) {
	startTime := e.startTime
	endTime := startTime + e.MustClose

	nowTime := time.Now().Unix()
	progress := float64(nowTime-startTime) / float64(endTime-startTime)
	var serverResponse models.ServerResponse
	e.SetTaskStatus(progress)
	e.epoch += 1

	if progress < 1 && e.epoch < 5 {
		e.AppendMessage([]openai.ChatCompletionMessage{{
			Role:    openai.ChatMessageRoleUser,
			Content: input.Input.(string),
		},
			{
				Role:    openai.ChatMessageRoleSystem,
				Content: taskPrompts.Eva.GuidingPrompt,
			}})
	} else {
		e.SetPost(jsonFormat)
		e.AppendMessage([]openai.ChatCompletionMessage{e.PostMessage})
	}
	ctx, cancel := context.WithTimeout(context.Background(), time.Minute)
	defer cancel()
	var aiResponse string
	if e.GetStatus() < 1 && e.epoch < 5 {
		message, err := e.Conversation.GetAIMsgRespNoJson(ctx)
		if err != nil {
			e.Conversation.SendToClientChan <- utils.WsResendResponse(e.GetTaskID())
			doneChan <- models.CONTINUE
		}
		aiResponse = message.Content[0].Text.Value
	} else {
		message, err := e.Conversation.GetAIMsgRespEvaJson(ctx, openai.ChatMessageRoleSystem, "现在你已经对这位学生的基本情况了解了，请你输出下面要求json格式的数据")
		if err != nil {
			e.Conversation.SendToClientChan <- utils.WsResendResponse(e.GetTaskID())
			doneChan <- models.CONTINUE
		}
		aiResponse = message.Content[0].Text.Value
	}
	guidingRes := e.SetGuiding(aiResponse)
	switch v := guidingRes.(type) {
	case error:
		e.Conversation.SendToClientChan <- utils.WsResendResponse(e.GetTaskID())
		doneChan <- models.CONTINUE
	case []openai.ChatCompletionMessage:
		// 任务正常进行
		serverResponse.Role = models.Role(v[0].Role)
		serverResponse.Contents = []openai.ChatMessagePart{
			{
				Type: openai.ChatMessagePartTypeText,
				Text: v[0].Content,
			},
		}
	}
	serverResponse.TaskID = e.GetTaskID()

	if e.epoch < 5 && e.GetStatus() < 1 {
		// TODO create a new go routine to send related topic to client
		e.Conversation.SendToClientChan <- utils.NewWsResp(serverResponse, "ok", 0, "aiSaid")
		doneChan <- models.CONTINUE
		return
	} else {
		// 在对话中标记当前知识点学习完成了
		doneChan <- models.DONE
	}
}

// SetGuiding implements Task.
func (e *EvaTask) SetGuiding(guiding string) interface{} {
	if e.GetStatus() >= 1 || e.epoch >= 5 {
		err := json.Unmarshal([]byte(guiding), &e.UserOverview)
		if err != nil {
			return err
		}
		log.Println(e.marshalEvaBase(), "评测用户的数据")

		// 任务完成，更新用户评测数据到数据库
		e.finish()

		return []openai.ChatCompletionMessage{
			{
				Role:    openai.ChatMessageRoleAssistant,
				Content: "我已经了解了你的一些基本信息了，我们开始下面的学习吧",
			},
		}
	}

	return []openai.ChatCompletionMessage{
		{
			Role:    openai.ChatMessageRoleAssistant,
			Content: guiding,
		},
	}
}

func (e *EvaTask) finish() {
	userid := e.GetUserId()
	uSummaryService := service.NewUserSummaryService(userid)
	uSummaryService.UpdateUserOverview(e.UserOverview)
	uSummaryService.UpdateUserTaskSummary([]models.TagCount{{Tag: "通过对话测试新用户的能力水平", Count: 1}})
}

// SetPost implements Task.
func (e *EvaTask) SetPost(payload interface{}) interface{} {
	e.PostMessage = openai.ChatCompletionMessage{
		Role:    "system",
		Content: taskPrompts.Eva.PostPrompt,
	}
	return e.PostMessage
}

// SetPre implements Task.
func (e *EvaTask) SetPre(payload interface{}) interface{} {
	knowledge := payload.(string)
	e.PreMessage = openai.ChatCompletionMessage{
		Role:    "system",
		Content: taskPrompts.Eva.PrePrompt + knowledge,
	}
	return e.PreMessage
}

// SummarizeTask implements Task.
func (e *EvaTask) SummarizeTask() []openai.ChatCompletionMessage {
	return []openai.ChatCompletionMessage{}
}

func NewEvaTask(knowledge string, timeout int, relatedTasks []Task, userid primitive.ObjectID, conv *Conversation) (*EvaTask, error) {
	taskid := utils.NewUUIDStr()
	task := &EvaTask{
		TaskBase: TaskBase{
			Timeout:      timeout,
			Status:       0,
			RelatedTask:  relatedTasks,
			TaskType:     Eva,
			taskID:       taskid,
			userID:       userid,
			Conversation: conv,
		},
		startTime: time.Now().Unix(),
		MustClose: 300, // 会话要在五分钟内完成
		epoch:     0,
	}
	log.Println("新建Eva task，传递进来的knowledge：", knowledge)
	task.SetPre(knowledge)
	mu.Lock()
	tasks[taskid] = task
	mu.Unlock()
	return task, nil
}

```