mirror of
https://github.com/tencentmusic/supersonic.git
synced 2025-12-12 12:37:55 +00:00
(improvement)(chat) show cases distinct by queryText (#275)
Co-authored-by: jolunoluo
This commit is contained in:
@@ -20,11 +20,14 @@ import com.tencent.supersonic.chat.persistence.repository.ChatQueryRepository;
|
|||||||
import com.tencent.supersonic.chat.persistence.repository.ChatRepository;
|
import com.tencent.supersonic.chat.persistence.repository.ChatRepository;
|
||||||
|
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
|
import java.util.LinkedHashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
import java.util.function.Function;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import com.tencent.supersonic.chat.service.ChatService;
|
import com.tencent.supersonic.chat.service.ChatService;
|
||||||
@@ -164,6 +167,10 @@ public class ChatServiceImpl implements ChatService {
|
|||||||
Map<String, Object> data = queryResp.getQueryResult().getQueryResults().get(0);
|
Map<String, Object> data = queryResp.getQueryResult().getQueryResults().get(0);
|
||||||
return CollectionUtils.isEmpty(data);
|
return CollectionUtils.isEmpty(data);
|
||||||
});
|
});
|
||||||
|
queryResps = new ArrayList<>(queryResps.stream()
|
||||||
|
.collect(Collectors.toMap(QueryResp::getQueryText, Function.identity(),
|
||||||
|
(existing, replacement) -> existing, LinkedHashMap::new))
|
||||||
|
.values());
|
||||||
fillParseInfo(queryResps);
|
fillParseInfo(queryResps);
|
||||||
Map<Long, List<QueryResp>> showCaseMap = queryResps.stream()
|
Map<Long, List<QueryResp>> showCaseMap = queryResps.stream()
|
||||||
.collect(Collectors.groupingBy(QueryResp::getChatId));
|
.collect(Collectors.groupingBy(QueryResp::getChatId));
|
||||||
|
|||||||
@@ -66,7 +66,7 @@
|
|||||||
and user_name = #{userName}
|
and user_name = #{userName}
|
||||||
</if>
|
</if>
|
||||||
order by score, chat_id desc
|
order by score, chat_id desc
|
||||||
)
|
) a
|
||||||
limit #{start}, #{limit}
|
limit #{start}, #{limit}
|
||||||
) q2 on q1.chat_id = q2.chat_id
|
) q2 on q1.chat_id = q2.chat_id
|
||||||
where agent_id = ${agentId} and (score is null or score > 1)
|
where agent_id = ${agentId} and (score is null or score > 1)
|
||||||
|
|||||||
Reference in New Issue
Block a user