From 30decd43aae5ebd195d31f5f16321dd336a6bf55 Mon Sep 17 00:00:00 2001 From: fanyinbo <1553199396@qq.com> Date: Tue, 26 Dec 2023 09:42:55 +0800 Subject: [PATCH] Optimize model test Signed-off-by: fanyinbo <1553199396@qq.com> --- .../api/job/converter/ModelCocoRequestConverter.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/backend/src/main/java/ai/basic/x1/adapter/api/job/converter/ModelCocoRequestConverter.java b/backend/src/main/java/ai/basic/x1/adapter/api/job/converter/ModelCocoRequestConverter.java index c0f462cb..b808d8aa 100644 --- a/backend/src/main/java/ai/basic/x1/adapter/api/job/converter/ModelCocoRequestConverter.java +++ b/backend/src/main/java/ai/basic/x1/adapter/api/job/converter/ModelCocoRequestConverter.java @@ -7,6 +7,8 @@ import java.util.List; +import static ai.basic.x1.util.Constants.FILE; + /** * @author zhujh */ @@ -22,7 +24,13 @@ public static ImageDetectionReqDTO convert(ModelMessageBO message) { if (CollUtil.isEmpty(fileNodes)) { throw new IllegalArgumentException("file is not found"); } - String url = fileNodes.get(0).getFile().getInternalUrl(); + var fileNodeBO = fileNodes.get(0); + String url; + if (fileNodeBO.getType().equals(FILE)) { + url = fileNodeBO.getFile().getInternalUrl(); + } else { + url = fileNodeBO.getFiles().get(0).getFile().getInternalUrl(); + } if (StrUtil.isEmpty(url)) { throw new IllegalArgumentException("file url is empty"); }