mirror of
https://github.com/tencentmusic/supersonic.git
synced 2025-12-11 03:58:14 +00:00
[improvement][chat]Support user feedback to multiple candidate semantic parses.#1847
This commit is contained in:
@@ -3,6 +3,7 @@ package com.tencent.supersonic.headless.core.cache;
|
||||
import com.tencent.supersonic.common.util.ContextUtils;
|
||||
import com.tencent.supersonic.headless.api.pojo.request.SemanticQueryReq;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.List;
|
||||
@@ -18,7 +19,10 @@ public class DefaultQueryCache implements QueryCache {
|
||||
CacheManager cacheManager = ContextUtils.getBean(CacheManager.class);
|
||||
if (isCache(semanticQueryReq)) {
|
||||
Object result = cacheManager.get(cacheKey);
|
||||
log.info("query from cache, key:{},result:{}", cacheKey, result);
|
||||
if (Objects.nonNull(result)) {
|
||||
log.info("query from cache, key:{},result:{}", cacheKey,
|
||||
StringUtils.normalizeSpace(result.toString()));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
return null;
|
||||
|
||||
@@ -131,7 +131,10 @@ public class S2SemanticLayerService implements SemanticLayerService {
|
||||
|
||||
String cacheKey = queryCache.getCacheKey(queryReq);
|
||||
Object query = queryCache.query(queryReq, cacheKey);
|
||||
log.info("cacheKey:{},query:{}", cacheKey, query);
|
||||
if (Objects.nonNull(query)) {
|
||||
log.info("cacheKey:{},query:{}", cacheKey,
|
||||
StringUtils.normalizeSpace(query.toString()));
|
||||
}
|
||||
if (Objects.nonNull(query)) {
|
||||
SemanticQueryResp queryResp = (SemanticQueryResp) query;
|
||||
queryResp.setUseCache(true);
|
||||
|
||||
Reference in New Issue
Block a user