1
This commit is contained in:
@@ -17,6 +17,7 @@ import (
|
||||
"rag-local/kb/service"
|
||||
|
||||
"github.com/gogf/gf/v2/errors/gerror"
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
)
|
||||
|
||||
type contract struct{}
|
||||
@@ -116,6 +117,18 @@ func (c *contract) Detail(ctx context.Context, req *dto.GetContractDetailReq) (*
|
||||
return &dto.GetContractDetailRes{Task: task, Clauses: clauses, Marks: marks}, nil
|
||||
}
|
||||
|
||||
func (c *contract) Annotated(ctx context.Context, req *dto.AnnotatedContractReq) (*dto.AnnotatedContractRes, error) {
|
||||
htmlStr, err := service.AnnotationService.AnnotatedHTML(ctx, req.Id)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
// 直接写响应体(html),中间件检测到已写入则不包装 JSON
|
||||
r := g.RequestFromCtx(ctx)
|
||||
r.Response.Header().Set("Content-Type", "text/html; charset=utf-8")
|
||||
r.Response.Write(htmlStr)
|
||||
return &dto.AnnotatedContractRes{}, nil
|
||||
}
|
||||
|
||||
func (c *contract) Delete(ctx context.Context, req *dto.DeleteContractReq) (*dto.DeleteContractRes, error) {
|
||||
if err := service.AnnotationService.Delete(ctx, req.Id); err != nil {
|
||||
return nil, err
|
||||
|
||||
Reference in New Issue
Block a user