mirror of
https://github.com/tencentmusic/supersonic.git
synced 2025-12-13 21:17:08 +00:00
(improvement)(Headless) initializing by adding tag data. (#836)
This commit is contained in:
@@ -106,6 +106,9 @@ public class TagMetaServiceImpl implements TagMetaService {
|
|||||||
@Override
|
@Override
|
||||||
public TagResp getTag(Long id, User user) {
|
public TagResp getTag(Long id, User user) {
|
||||||
TagDO tagDO = tagRepository.getTagById(id);
|
TagDO tagDO = tagRepository.getTagById(id);
|
||||||
|
if (Objects.isNull(tagDO)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
TagResp tagResp = convert2Resp(tagDO);
|
TagResp tagResp = convert2Resp(tagDO);
|
||||||
List<TagResp> tagRespList = Arrays.asList(tagResp);
|
List<TagResp> tagRespList = Arrays.asList(tagResp);
|
||||||
fillModelInfo(tagRespList);
|
fillModelInfo(tagRespList);
|
||||||
|
|||||||
@@ -62,6 +62,9 @@ public class TagQueryServiceImpl implements TagQueryService {
|
|||||||
itemValueResp.setItemId(itemValueReq.getItemId());
|
itemValueResp.setItemId(itemValueReq.getItemId());
|
||||||
itemValueResp.setType(SchemaElementType.TAG);
|
itemValueResp.setType(SchemaElementType.TAG);
|
||||||
TagResp tag = tagMetaService.getTag(itemValueReq.getItemId(), user);
|
TagResp tag = tagMetaService.getTag(itemValueReq.getItemId(), user);
|
||||||
|
if (Objects.isNull(tag)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
checkTag(tag);
|
checkTag(tag);
|
||||||
itemValueResp.setName(tag.getName());
|
itemValueResp.setName(tag.getName());
|
||||||
itemValueResp.setBizName(tag.getBizName());
|
itemValueResp.setBizName(tag.getBizName());
|
||||||
|
|||||||
@@ -40,6 +40,7 @@ import com.tencent.supersonic.headless.api.pojo.enums.DimensionType;
|
|||||||
import com.tencent.supersonic.headless.api.pojo.enums.IdentifyType;
|
import com.tencent.supersonic.headless.api.pojo.enums.IdentifyType;
|
||||||
import com.tencent.supersonic.headless.api.pojo.enums.MetricDefineType;
|
import com.tencent.supersonic.headless.api.pojo.enums.MetricDefineType;
|
||||||
import com.tencent.supersonic.headless.api.pojo.enums.SemanticType;
|
import com.tencent.supersonic.headless.api.pojo.enums.SemanticType;
|
||||||
|
import com.tencent.supersonic.headless.api.pojo.enums.TagDefineType;
|
||||||
import com.tencent.supersonic.headless.api.pojo.request.DataSetReq;
|
import com.tencent.supersonic.headless.api.pojo.request.DataSetReq;
|
||||||
import com.tencent.supersonic.headless.api.pojo.request.DatabaseReq;
|
import com.tencent.supersonic.headless.api.pojo.request.DatabaseReq;
|
||||||
import com.tencent.supersonic.headless.api.pojo.request.DimensionReq;
|
import com.tencent.supersonic.headless.api.pojo.request.DimensionReq;
|
||||||
@@ -47,6 +48,7 @@ import com.tencent.supersonic.headless.api.pojo.request.DomainReq;
|
|||||||
import com.tencent.supersonic.headless.api.pojo.request.MetricReq;
|
import com.tencent.supersonic.headless.api.pojo.request.MetricReq;
|
||||||
import com.tencent.supersonic.headless.api.pojo.request.ModelReq;
|
import com.tencent.supersonic.headless.api.pojo.request.ModelReq;
|
||||||
import com.tencent.supersonic.headless.api.pojo.request.TagObjectReq;
|
import com.tencent.supersonic.headless.api.pojo.request.TagObjectReq;
|
||||||
|
import com.tencent.supersonic.headless.api.pojo.request.TagReq;
|
||||||
import com.tencent.supersonic.headless.server.service.DataSetService;
|
import com.tencent.supersonic.headless.server.service.DataSetService;
|
||||||
import com.tencent.supersonic.headless.server.service.DatabaseService;
|
import com.tencent.supersonic.headless.server.service.DatabaseService;
|
||||||
import com.tencent.supersonic.headless.server.service.DimensionService;
|
import com.tencent.supersonic.headless.server.service.DimensionService;
|
||||||
@@ -113,6 +115,7 @@ public class ModelDemoDataLoader {
|
|||||||
addModel_4();
|
addModel_4();
|
||||||
updateDimension();
|
updateDimension();
|
||||||
updateMetric();
|
updateMetric();
|
||||||
|
addTags();
|
||||||
updateMetric_pv();
|
updateMetric_pv();
|
||||||
addDataSet_1();
|
addDataSet_1();
|
||||||
addDataSet_2();
|
addDataSet_2();
|
||||||
@@ -370,6 +373,20 @@ public class ModelDemoDataLoader {
|
|||||||
modelService.createModel(modelReq, user);
|
modelService.createModel(modelReq, user);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void addTags() {
|
||||||
|
addTag(4L);
|
||||||
|
addTag(5L);
|
||||||
|
addTag(6L);
|
||||||
|
addTag(7L);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void addTag(Long itemId) {
|
||||||
|
TagReq tagReq = new TagReq();
|
||||||
|
tagReq.setTagDefineType(TagDefineType.DIMENSION);
|
||||||
|
tagReq.setItemId(itemId);
|
||||||
|
tagMetaService.create(tagReq, User.getFakeUser());
|
||||||
|
}
|
||||||
|
|
||||||
public void updateDimension() throws Exception {
|
public void updateDimension() throws Exception {
|
||||||
DimensionReq dimensionReq = new DimensionReq();
|
DimensionReq dimensionReq = new DimensionReq();
|
||||||
dimensionReq.setType(DimensionType.categorical.name());
|
dimensionReq.setType(DimensionType.categorical.name());
|
||||||
|
|||||||
@@ -59,8 +59,8 @@ s2:
|
|||||||
langchain4j:
|
langchain4j:
|
||||||
#1.chat-model
|
#1.chat-model
|
||||||
chat-model:
|
chat-model:
|
||||||
provider: open_ai
|
provider: local_ai
|
||||||
openai:
|
local_ai:
|
||||||
api-key: api_key
|
api-key: api_key
|
||||||
model-name: gpt-3.5-turbo-16k
|
model-name: gpt-3.5-turbo-16k
|
||||||
temperature: 0.0
|
temperature: 0.0
|
||||||
|
|||||||
@@ -0,0 +1,26 @@
|
|||||||
|
package com.tencent.supersonic.headless;
|
||||||
|
|
||||||
|
import static org.junit.Assert.assertTrue;
|
||||||
|
|
||||||
|
import com.tencent.supersonic.auth.api.authentication.pojo.User;
|
||||||
|
import com.tencent.supersonic.headless.api.pojo.SchemaElementType;
|
||||||
|
import com.tencent.supersonic.headless.api.pojo.request.ItemValueReq;
|
||||||
|
import com.tencent.supersonic.headless.api.pojo.response.ItemValueResp;
|
||||||
|
import com.tencent.supersonic.headless.server.service.TagQueryService;
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
|
||||||
|
public class QueryTagValueTest extends BaseTest {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
protected TagQueryService tagQueryService;
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testQueryTagValue() throws Exception {
|
||||||
|
ItemValueReq itemValueReq = new ItemValueReq();
|
||||||
|
itemValueReq.setItemId(1L);
|
||||||
|
itemValueReq.setType(SchemaElementType.DIMENSION);
|
||||||
|
ItemValueResp itemValueResp = tagQueryService.queryTagValue(itemValueReq, User.getFakeUser());
|
||||||
|
assertTrue(itemValueResp != null);
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user