1、修改bug;

This commit is contained in:
wangjian 2023-05-18 11:02:34 +08:00
parent 939c4403af
commit 587b660be8
4 changed files with 12 additions and 4 deletions

View File

@ -21,8 +21,8 @@ minio:
secretAccessKey: OIxv7QptYBO3
bucket: jky-data
node:
host: 127.0.0.1
port: 27188
host: 192.168.53.10
port: 9188
token: 06d36c6f5705507dae778fdce90d0767
functions:
- name: task-response

View File

@ -260,6 +260,7 @@ func ModelTaskExecuteHandler(payload map[string]interface{}) {
response, err := http.Post(reqUrl, "multipart/form-data", dec)
if err != nil {
config.Logger.With(zap.String("源文件名", f.FileName)).
With(zap.String("请求地址", reqUrl)).
With(zap.String("临时文件名", path.Join(config.Cfg.TmpPath, payload["subDataset"].(string), f.FileName))).
Error("文件提交", zap.Error(err))
}
@ -272,6 +273,7 @@ func ModelTaskExecuteHandler(payload map[string]interface{}) {
body, err := io.ReadAll(response.Body)
if err != nil {
config.Logger.With(zap.String("源文件名", f.FileName)).
With(zap.String("请求地址", reqUrl)).
With(zap.String("临时文件名", path.Join(config.Cfg.TmpPath, payload["subDataset"].(string), f.FileName))).
Error("模型识别", zap.Error(err))
}
@ -423,7 +425,7 @@ func ModelTaskExecuteHandler(payload map[string]interface{}) {
//}
} else {
reqUrl := fmt.Sprintf("http://127.0.0.1:%s/%s", issue.DstPort, issue.HttpUrl)
if len(payload["httpUrl"].(string)) > 0 {
if len(payload["httpUrl"].(string)) > 1 {
reqUrl = payload["httpUrl"].(string)
}
fc := f["file"].(string)
@ -438,6 +440,7 @@ func ModelTaskExecuteHandler(payload map[string]interface{}) {
response, err := http.Post(reqUrl, writer.FormDataContentType(), buff)
if err != nil {
config.Logger.With(zap.String("源文件名", f["fileName"].(string))).
With(zap.String("请求地址", reqUrl)).
With(zap.String("临时文件名", path.Join(config.Cfg.TmpPath, payload["subDataset"].(string), f["fileName"].(string)))).
Error("文件提交", zap.Error(err))
}

View File

@ -62,7 +62,10 @@ func ProcessWorkflow(payload map[string]interface{}, fc proto.FileCapture, wf *W
case "start-node":
fn, _ := base64.StdEncoding.DecodeString(fc.File)
buff := bytes.NewBuffer(fn)
img, imgType, _ = image.Decode(buff)
img, imgType, err = image.Decode(buff)
if err != nil {
goto ReturnPoint
}
case "image-node":
//处理图像后
fn := utils.ImageToBuff(img, imgType)

View File

@ -171,6 +171,8 @@ func SplitImage(buff *bytes.Buffer, w, h int) []image.Image {
newHeight := int(math.Ceil(float64(img.Bounds().Dy()) / float64(h)))
rect := image.Rect(0, 0, newWidth*w, newHeight*h)
newImage := image.NewRGBA(rect)
black := color.RGBA{A: 255}
draw.Draw(newImage, newImage.Bounds(), &image.Uniform{C: black}, image.Point{}, draw.Src)
draw.Draw(newImage, img.Bounds(), img, newImage.Bounds().Min, draw.Over)
sp := splitPattern(newImage, w, h)
spLen := len(sp)