(improvement)(chat) fix embedding null pointer (#712)

This commit is contained in:
mainmain
2024-02-02 10:59:33 +08:00
committed by GitHub
parent 1004f71ba4
commit 4d4922d269
12 changed files with 132 additions and 49 deletions

View File

@@ -11,6 +11,8 @@ import com.tencent.supersonic.chat.core.utils.HanlpHelper;
import com.tencent.supersonic.common.util.ContextUtils;
import com.tencent.supersonic.common.util.embedding.Retrieval;
import java.util.List;
import java.util.Objects;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
@@ -37,7 +39,9 @@ public class EmbeddingMapper extends BaseMapper {
SchemaElement schemaElement = JSONObject.parseObject(JSONObject.toJSONString(matchResult.getMetadata()),
SchemaElement.class);
if (Objects.isNull(matchResult.getMetadata())) {
continue;
}
String modelIdStr = matchResult.getMetadata().get("modelId");
if (StringUtils.isBlank(modelIdStr)) {
continue;

View File

@@ -106,7 +106,9 @@ public class EmbeddingMatchStrategy extends BaseMatchStrategy<EmbeddingResult> {
if (StringUtils.isBlank(modelIdStr)) {
return true;
}
return detectModelIds.contains(Long.parseLong(modelIdStr));
//return detectModelIds.contains(Long.parseLong(modelIdStr));
Double modelId = Double.parseDouble(modelIdStr);
return detectModelIds.contains(modelId.longValue());
});
}
}