From c483bb891ac2542951b112566088d9ef68cbda46 Mon Sep 17 00:00:00 2001 From: lexluo09 <39718951+lexluo09@users.noreply.github.com> Date: Wed, 25 Dec 2024 20:52:52 +0800 Subject: [PATCH] [fix][chat] Fix the issue with the order of parallel execution in the map. (#1976) --- .../headless/chat/mapper/BaseMatchStrategy.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/headless/chat/src/main/java/com/tencent/supersonic/headless/chat/mapper/BaseMatchStrategy.java b/headless/chat/src/main/java/com/tencent/supersonic/headless/chat/mapper/BaseMatchStrategy.java index 8c4a35741..59a504cdf 100644 --- a/headless/chat/src/main/java/com/tencent/supersonic/headless/chat/mapper/BaseMatchStrategy.java +++ b/headless/chat/src/main/java/com/tencent/supersonic/headless/chat/mapper/BaseMatchStrategy.java @@ -27,7 +27,7 @@ public abstract class BaseMatchStrategy implements MatchStr @Override public Map> match(ChatQueryContext chatQueryContext, List terms, - Set detectDataSetIds) { + Set detectDataSetIds) { String text = chatQueryContext.getRequest().getQueryText(); if (Objects.isNull(terms) || StringUtils.isEmpty(text)) { return null; @@ -43,7 +43,7 @@ public abstract class BaseMatchStrategy implements MatchStr } public List detect(ChatQueryContext chatQueryContext, List terms, - Set detectDataSetIds) { + Set detectDataSetIds) { throw new RuntimeException("Not implemented"); } @@ -73,11 +73,15 @@ public abstract class BaseMatchStrategy implements MatchStr protected void executeTasks(List> tasks) { try { threadPoolConfig.getMapExecutor().invokeAll(tasks); - } catch (InterruptedException e) { + for (Callable future : tasks) { + future.call(); + } + } catch (Exception e) { Thread.currentThread().interrupt(); throw new RuntimeException("Task execution interrupted", e); } } + public double getThreshold(Double threshold, Double minThreshold, MapModeEnum mapModeEnum) { if (MapModeEnum.STRICT.equals(mapModeEnum)) { return 1.0d;