diff --git a/backend/consts/proxy.go b/backend/consts/proxy.go index f4c72eb..aa3dabe 100644 --- a/backend/consts/proxy.go +++ b/backend/consts/proxy.go @@ -6,4 +6,5 @@ const ( ReportActionAccept ReportAction = "accept" ReportActionSuggest ReportAction = "suggest" ReportActionFileWritten ReportAction = "file_written" + ReportActionReject ReportAction = "reject" ) diff --git a/backend/domain/proxy.go b/backend/domain/proxy.go index 11fc83d..6142805 100644 --- a/backend/domain/proxy.go +++ b/backend/domain/proxy.go @@ -45,10 +45,13 @@ type AcceptCompletionReq struct { } type ReportReq struct { - Action consts.ReportAction `json:"action"` - ID string `json:"id"` // task_id or resp_id - Content string `json:"content"` // 内容 - Tool string `json:"tool"` // 工具 + Action consts.ReportAction `json:"action"` + ID string `json:"id"` // task_id or resp_id + Content string `json:"content"` // 内容 + Tool string `json:"tool"` // 工具 + UserInput string `json:"user_input"` // 用户输入的新文本(用于reject action) + SourceCode string `json:"source_code"` // 当前文件的原文(用于reject action) + CursorPosition int64 `json:"cursor_position"` // 光标位置(用于reject action) } type RecordParam struct { diff --git a/backend/internal/openai/handler/v1/v1.go b/backend/internal/openai/handler/v1/v1.go index 46208bf..4cc859e 100644 --- a/backend/internal/openai/handler/v1/v1.go +++ b/backend/internal/openai/handler/v1/v1.go @@ -101,7 +101,7 @@ func (h *V1Handler) AcceptCompletion(c *web.Context, req domain.AcceptCompletion // // @Tags OpenAIV1 // @Summary 报告 -// @Description 报告 +// @Description 报告,支持多种操作:accept(接受补全)、suggest(建议)、reject(拒绝补全并记录用户输入)、file_written(文件写入) // @ID report // @Accept json // @Produce json