[improvement][chat]Support user feedback to multiple candidate semantic parses.#1847

This commit is contained in:
jerryjzhang
2024-10-28 17:31:33 +08:00
parent 5dda539798
commit b3d4440781
9 changed files with 51 additions and 34 deletions

View File

@@ -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;

View File

@@ -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);