mirror of
https://github.com/tencentmusic/supersonic.git
synced 2025-12-15 06:27:21 +00:00
[improvement][Headless] Embedding supports Chinese by default and fixes the issue of abnormal number recognition (#726)
This commit is contained in:
@@ -2,7 +2,6 @@ package com.tencent.supersonic.headless.server.listener;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.tencent.supersonic.common.config.EmbeddingConfig;
|
||||
import com.tencent.supersonic.common.pojo.Constants;
|
||||
import com.tencent.supersonic.common.pojo.DataEvent;
|
||||
import com.tencent.supersonic.common.pojo.enums.EventType;
|
||||
import com.tencent.supersonic.common.util.ComponentFactory;
|
||||
@@ -43,8 +42,7 @@ public class MetaEmbeddingListener implements ApplicationListener<DataEvent> {
|
||||
.map(dataItem -> {
|
||||
EmbeddingQuery embeddingQuery = new EmbeddingQuery();
|
||||
embeddingQuery.setQueryId(
|
||||
dataItem.getId().toString() + Constants.UNDERLINE
|
||||
+ dataItem.getType().name().toLowerCase());
|
||||
dataItem.getId() + dataItem.getType().name().toLowerCase());
|
||||
embeddingQuery.setQuery(dataItem.getName());
|
||||
Map meta = JSONObject.parseObject(JSONObject.toJSONString(dataItem), Map.class);
|
||||
embeddingQuery.setMetadata(meta);
|
||||
|
||||
@@ -132,7 +132,7 @@ public class DimensionServiceImpl implements DimensionService {
|
||||
if (!oldName.equals(dimensionDO.getName())) {
|
||||
sendEvent(DataItem.builder().modelId(dimensionDO.getModelId() + Constants.UNDERLINE)
|
||||
.newName(dimensionReq.getName()).name(oldName).type(TypeEnums.DIMENSION)
|
||||
.id(dimensionDO.getId()).build(), EventType.UPDATE);
|
||||
.id(dimensionDO.getId() + Constants.UNDERLINE).build(), EventType.UPDATE);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -366,8 +366,9 @@ public class DimensionServiceImpl implements DimensionService {
|
||||
|
||||
private void sendEventBatch(List<DimensionDO> dimensionDOS, EventType eventType) {
|
||||
List<DataItem> dataItems = dimensionDOS.stream()
|
||||
.map(dimensionDO -> DataItem.builder().id(dimensionDO.getId()).name(dimensionDO.getName())
|
||||
.modelId(dimensionDO.getModelId() + Constants.UNDERLINE).type(TypeEnums.DIMENSION).build())
|
||||
.map(dimensionDO -> DataItem.builder().id(dimensionDO.getId() + Constants.UNDERLINE)
|
||||
.name(dimensionDO.getName()).modelId(dimensionDO.getModelId() + Constants.UNDERLINE)
|
||||
.type(TypeEnums.DIMENSION).build())
|
||||
.collect(Collectors.toList());
|
||||
eventPublisher.publishEvent(new DataEvent(this, dataItems, eventType));
|
||||
}
|
||||
|
||||
@@ -449,7 +449,7 @@ public class MetricServiceImpl implements MetricService {
|
||||
private DataItem getDataItem(MetricDO metricDO) {
|
||||
MetricResp metricResp = MetricConverter.convert2MetricResp(metricDO,
|
||||
new HashMap<>(), Lists.newArrayList());
|
||||
return DataItem.builder().id(metricDO.getId()).name(metricDO.getName())
|
||||
return DataItem.builder().id(metricDO.getId() + Constants.UNDERLINE).name(metricDO.getName())
|
||||
.bizName(metricDO.getBizName())
|
||||
.modelId(metricDO.getModelId() + Constants.UNDERLINE)
|
||||
.type(TypeEnums.METRIC).defaultAgg(metricResp.getDefaultAgg()).build();
|
||||
|
||||
Reference in New Issue
Block a user