(improvement)(Chat)The chat history also returns the time taken for parsing and SQL generation (#1084)

Co-authored-by: jolunoluo
This commit is contained in:
LXW
2024-06-03 21:18:32 +08:00
committed by GitHub
parent 5e9c960263
commit 4648e8d875
20 changed files with 69 additions and 2953 deletions

View File

@@ -1,6 +1,7 @@
package com.tencent.supersonic.chat.api.pojo.response;
import com.tencent.supersonic.headless.api.pojo.SemanticParseInfo;
import com.tencent.supersonic.headless.api.pojo.response.ParseTimeCostResp;
import com.tencent.supersonic.headless.api.pojo.response.QueryResult;
import lombok.Data;
import java.util.Date;
@@ -19,5 +20,6 @@ public class QueryResp {
private QueryResult queryResult;
private List<SemanticParseInfo> parseInfos;
private List<SimilarQueryRecallResp> similarQueries;
private ParseTimeCostResp parseTimeCost = new ParseTimeCostResp();
}

View File

@@ -1,12 +1,17 @@
package com.tencent.supersonic.chat.server.persistence.dataobject;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import java.util.Date;
@Data
@TableName("s2_chat_query")
public class ChatQueryDO {
/**
*/
@TableId(type = IdType.AUTO)
private Long questionId;
/**
@@ -47,4 +52,6 @@ public class ChatQueryDO {
private String similarQueries;
private String parseTimeCost;
}

View File

@@ -1,790 +0,0 @@
package com.tencent.supersonic.chat.server.persistence.dataobject;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
public class ChatQueryDOExample {
/**
* s2_chat_query
*/
protected String orderByClause;
/**
* s2_chat_query
*/
protected boolean distinct;
/**
* s2_chat_query
*/
protected List<Criteria> oredCriteria;
/**
* s2_chat_query
*/
protected Integer limitStart;
/**
* s2_chat_query
*/
protected Integer limitEnd;
/**
* @mbg.generated
*/
public ChatQueryDOExample() {
oredCriteria = new ArrayList<Criteria>();
}
/**
* @mbg.generated
*/
public void setOrderByClause(String orderByClause) {
this.orderByClause = orderByClause;
}
/**
* @mbg.generated
*/
public String getOrderByClause() {
return orderByClause;
}
/**
* @mbg.generated
*/
public void setDistinct(boolean distinct) {
this.distinct = distinct;
}
/**
* @mbg.generated
*/
public boolean isDistinct() {
return distinct;
}
/**
* @mbg.generated
*/
public List<Criteria> getOredCriteria() {
return oredCriteria;
}
/**
* @mbg.generated
*/
public void or(Criteria criteria) {
oredCriteria.add(criteria);
}
/**
* @mbg.generated
*/
public Criteria or() {
Criteria criteria = createCriteriaInternal();
oredCriteria.add(criteria);
return criteria;
}
/**
* @mbg.generated
*/
public Criteria createCriteria() {
Criteria criteria = createCriteriaInternal();
if (oredCriteria.size() == 0) {
oredCriteria.add(criteria);
}
return criteria;
}
/**
* @mbg.generated
*/
protected Criteria createCriteriaInternal() {
Criteria criteria = new Criteria();
return criteria;
}
/**
* @mbg.generated
*/
public void clear() {
oredCriteria.clear();
orderByClause = null;
distinct = false;
}
/**
* @mbg.generated
*/
public void setLimitStart(Integer limitStart) {
this.limitStart = limitStart;
}
/**
* @mbg.generated
*/
public Integer getLimitStart() {
return limitStart;
}
/**
* @mbg.generated
*/
public void setLimitEnd(Integer limitEnd) {
this.limitEnd = limitEnd;
}
/**
* @mbg.generated
*/
public Integer getLimitEnd() {
return limitEnd;
}
/**
* s2_chat_query null
*/
protected abstract static class GeneratedCriteria {
protected List<Criterion> criteria;
protected GeneratedCriteria() {
super();
criteria = new ArrayList<Criterion>();
}
public boolean isValid() {
return criteria.size() > 0;
}
public List<Criterion> getAllCriteria() {
return criteria;
}
public List<Criterion> getCriteria() {
return criteria;
}
protected void addCriterion(String condition) {
if (condition == null) {
throw new RuntimeException("Value for condition cannot be null");
}
criteria.add(new Criterion(condition));
}
protected void addCriterion(String condition, Object value, String property) {
if (value == null) {
throw new RuntimeException("Value for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value));
}
protected void addCriterion(String condition, Object value1, Object value2, String property) {
if (value1 == null || value2 == null) {
throw new RuntimeException("Between values for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value1, value2));
}
public Criteria andQuestionIdIsNull() {
addCriterion("question_id is null");
return (Criteria) this;
}
public Criteria andQuestionIdIsNotNull() {
addCriterion("question_id is not null");
return (Criteria) this;
}
public Criteria andQuestionIdEqualTo(Long value) {
addCriterion("question_id =", value, "questionId");
return (Criteria) this;
}
public Criteria andQuestionIdNotEqualTo(Long value) {
addCriterion("question_id <>", value, "questionId");
return (Criteria) this;
}
public Criteria andQuestionIdGreaterThan(Long value) {
addCriterion("question_id >", value, "questionId");
return (Criteria) this;
}
public Criteria andQuestionIdGreaterThanOrEqualTo(Long value) {
addCriterion("question_id >=", value, "questionId");
return (Criteria) this;
}
public Criteria andQuestionIdLessThan(Long value) {
addCriterion("question_id <", value, "questionId");
return (Criteria) this;
}
public Criteria andQuestionIdLessThanOrEqualTo(Long value) {
addCriterion("question_id <=", value, "questionId");
return (Criteria) this;
}
public Criteria andQuestionIdIn(List<Long> values) {
addCriterion("question_id in", values, "questionId");
return (Criteria) this;
}
public Criteria andQuestionIdNotIn(List<Long> values) {
addCriterion("question_id not in", values, "questionId");
return (Criteria) this;
}
public Criteria andQuestionIdBetween(Long value1, Long value2) {
addCriterion("question_id between", value1, value2, "questionId");
return (Criteria) this;
}
public Criteria andQuestionIdNotBetween(Long value1, Long value2) {
addCriterion("question_id not between", value1, value2, "questionId");
return (Criteria) this;
}
public Criteria andAgentIdIsNull() {
addCriterion("agent_id is null");
return (Criteria) this;
}
public Criteria andAgentIdIsNotNull() {
addCriterion("agent_id is not null");
return (Criteria) this;
}
public Criteria andAgentIdEqualTo(Integer value) {
addCriterion("agent_id =", value, "agentId");
return (Criteria) this;
}
public Criteria andAgentIdNotEqualTo(Integer value) {
addCriterion("agent_id <>", value, "agentId");
return (Criteria) this;
}
public Criteria andAgentIdGreaterThan(Integer value) {
addCriterion("agent_id >", value, "agentId");
return (Criteria) this;
}
public Criteria andAgentIdGreaterThanOrEqualTo(Integer value) {
addCriterion("agent_id >=", value, "agentId");
return (Criteria) this;
}
public Criteria andAgentIdLessThan(Integer value) {
addCriterion("agent_id <", value, "agentId");
return (Criteria) this;
}
public Criteria andAgentIdLessThanOrEqualTo(Integer value) {
addCriterion("agent_id <=", value, "agentId");
return (Criteria) this;
}
public Criteria andAgentIdIn(List<Integer> values) {
addCriterion("agent_id in", values, "agentId");
return (Criteria) this;
}
public Criteria andAgentIdNotIn(List<Integer> values) {
addCriterion("agent_id not in", values, "agentId");
return (Criteria) this;
}
public Criteria andAgentIdBetween(Integer value1, Integer value2) {
addCriterion("agent_id between", value1, value2, "agentId");
return (Criteria) this;
}
public Criteria andAgentIdNotBetween(Integer value1, Integer value2) {
addCriterion("agent_id not between", value1, value2, "agentId");
return (Criteria) this;
}
public Criteria andCreateTimeIsNull() {
addCriterion("create_time is null");
return (Criteria) this;
}
public Criteria andCreateTimeIsNotNull() {
addCriterion("create_time is not null");
return (Criteria) this;
}
public Criteria andCreateTimeEqualTo(Date value) {
addCriterion("create_time =", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeNotEqualTo(Date value) {
addCriterion("create_time <>", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeGreaterThan(Date value) {
addCriterion("create_time >", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeGreaterThanOrEqualTo(Date value) {
addCriterion("create_time >=", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeLessThan(Date value) {
addCriterion("create_time <", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeLessThanOrEqualTo(Date value) {
addCriterion("create_time <=", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeIn(List<Date> values) {
addCriterion("create_time in", values, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeNotIn(List<Date> values) {
addCriterion("create_time not in", values, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeBetween(Date value1, Date value2) {
addCriterion("create_time between", value1, value2, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeNotBetween(Date value1, Date value2) {
addCriterion("create_time not between", value1, value2, "createTime");
return (Criteria) this;
}
public Criteria andUserNameIsNull() {
addCriterion("user_name is null");
return (Criteria) this;
}
public Criteria andUserNameIsNotNull() {
addCriterion("user_name is not null");
return (Criteria) this;
}
public Criteria andUserNameEqualTo(String value) {
addCriterion("user_name =", value, "userName");
return (Criteria) this;
}
public Criteria andUserNameNotEqualTo(String value) {
addCriterion("user_name <>", value, "userName");
return (Criteria) this;
}
public Criteria andUserNameGreaterThan(String value) {
addCriterion("user_name >", value, "userName");
return (Criteria) this;
}
public Criteria andUserNameGreaterThanOrEqualTo(String value) {
addCriterion("user_name >=", value, "userName");
return (Criteria) this;
}
public Criteria andUserNameLessThan(String value) {
addCriterion("user_name <", value, "userName");
return (Criteria) this;
}
public Criteria andUserNameLessThanOrEqualTo(String value) {
addCriterion("user_name <=", value, "userName");
return (Criteria) this;
}
public Criteria andUserNameLike(String value) {
addCriterion("user_name like", value, "userName");
return (Criteria) this;
}
public Criteria andUserNameNotLike(String value) {
addCriterion("user_name not like", value, "userName");
return (Criteria) this;
}
public Criteria andUserNameIn(List<String> values) {
addCriterion("user_name in", values, "userName");
return (Criteria) this;
}
public Criteria andUserNameNotIn(List<String> values) {
addCriterion("user_name not in", values, "userName");
return (Criteria) this;
}
public Criteria andUserNameBetween(String value1, String value2) {
addCriterion("user_name between", value1, value2, "userName");
return (Criteria) this;
}
public Criteria andUserNameNotBetween(String value1, String value2) {
addCriterion("user_name not between", value1, value2, "userName");
return (Criteria) this;
}
public Criteria andQueryStateIsNull() {
addCriterion("query_state is null");
return (Criteria) this;
}
public Criteria andQueryStateIsNotNull() {
addCriterion("query_state is not null");
return (Criteria) this;
}
public Criteria andQueryStateEqualTo(Integer value) {
addCriterion("query_state =", value, "queryState");
return (Criteria) this;
}
public Criteria andQueryStateNotEqualTo(Integer value) {
addCriterion("query_state <>", value, "queryState");
return (Criteria) this;
}
public Criteria andQueryStateGreaterThan(Integer value) {
addCriterion("query_state >", value, "queryState");
return (Criteria) this;
}
public Criteria andQueryStateGreaterThanOrEqualTo(Integer value) {
addCriterion("query_state >=", value, "queryState");
return (Criteria) this;
}
public Criteria andQueryStateLessThan(Integer value) {
addCriterion("query_state <", value, "queryState");
return (Criteria) this;
}
public Criteria andQueryStateLessThanOrEqualTo(Integer value) {
addCriterion("query_state <=", value, "queryState");
return (Criteria) this;
}
public Criteria andQueryStateIn(List<Integer> values) {
addCriterion("query_state in", values, "queryState");
return (Criteria) this;
}
public Criteria andQueryStateNotIn(List<Integer> values) {
addCriterion("query_state not in", values, "queryState");
return (Criteria) this;
}
public Criteria andQueryStateBetween(Integer value1, Integer value2) {
addCriterion("query_state between", value1, value2, "queryState");
return (Criteria) this;
}
public Criteria andQueryStateNotBetween(Integer value1, Integer value2) {
addCriterion("query_state not between", value1, value2, "queryState");
return (Criteria) this;
}
public Criteria andChatIdIsNull() {
addCriterion("chat_id is null");
return (Criteria) this;
}
public Criteria andChatIdIsNotNull() {
addCriterion("chat_id is not null");
return (Criteria) this;
}
public Criteria andChatIdEqualTo(Long value) {
addCriterion("chat_id =", value, "chatId");
return (Criteria) this;
}
public Criteria andChatIdNotEqualTo(Long value) {
addCriterion("chat_id <>", value, "chatId");
return (Criteria) this;
}
public Criteria andChatIdGreaterThan(Long value) {
addCriterion("chat_id >", value, "chatId");
return (Criteria) this;
}
public Criteria andChatIdGreaterThanOrEqualTo(Long value) {
addCriterion("chat_id >=", value, "chatId");
return (Criteria) this;
}
public Criteria andChatIdLessThan(Long value) {
addCriterion("chat_id <", value, "chatId");
return (Criteria) this;
}
public Criteria andChatIdLessThanOrEqualTo(Long value) {
addCriterion("chat_id <=", value, "chatId");
return (Criteria) this;
}
public Criteria andChatIdIn(List<Long> values) {
addCriterion("chat_id in", values, "chatId");
return (Criteria) this;
}
public Criteria andChatIdNotIn(List<Long> values) {
addCriterion("chat_id not in", values, "chatId");
return (Criteria) this;
}
public Criteria andChatIdBetween(Long value1, Long value2) {
addCriterion("chat_id between", value1, value2, "chatId");
return (Criteria) this;
}
public Criteria andChatIdNotBetween(Long value1, Long value2) {
addCriterion("chat_id not between", value1, value2, "chatId");
return (Criteria) this;
}
public Criteria andScoreIsNull() {
addCriterion("score is null");
return (Criteria) this;
}
public Criteria andScoreIsNotNull() {
addCriterion("score is not null");
return (Criteria) this;
}
public Criteria andScoreEqualTo(Integer value) {
addCriterion("score =", value, "score");
return (Criteria) this;
}
public Criteria andScoreNotEqualTo(Integer value) {
addCriterion("score <>", value, "score");
return (Criteria) this;
}
public Criteria andScoreGreaterThan(Integer value) {
addCriterion("score >", value, "score");
return (Criteria) this;
}
public Criteria andScoreGreaterThanOrEqualTo(Integer value) {
addCriterion("score >=", value, "score");
return (Criteria) this;
}
public Criteria andScoreLessThan(Integer value) {
addCriterion("score <", value, "score");
return (Criteria) this;
}
public Criteria andScoreLessThanOrEqualTo(Integer value) {
addCriterion("score <=", value, "score");
return (Criteria) this;
}
public Criteria andScoreIn(List<Integer> values) {
addCriterion("score in", values, "score");
return (Criteria) this;
}
public Criteria andScoreNotIn(List<Integer> values) {
addCriterion("score not in", values, "score");
return (Criteria) this;
}
public Criteria andScoreBetween(Integer value1, Integer value2) {
addCriterion("score between", value1, value2, "score");
return (Criteria) this;
}
public Criteria andScoreNotBetween(Integer value1, Integer value2) {
addCriterion("score not between", value1, value2, "score");
return (Criteria) this;
}
public Criteria andFeedbackIsNull() {
addCriterion("feedback is null");
return (Criteria) this;
}
public Criteria andFeedbackIsNotNull() {
addCriterion("feedback is not null");
return (Criteria) this;
}
public Criteria andFeedbackEqualTo(String value) {
addCriterion("feedback =", value, "feedback");
return (Criteria) this;
}
public Criteria andFeedbackNotEqualTo(String value) {
addCriterion("feedback <>", value, "feedback");
return (Criteria) this;
}
public Criteria andFeedbackGreaterThan(String value) {
addCriterion("feedback >", value, "feedback");
return (Criteria) this;
}
public Criteria andFeedbackGreaterThanOrEqualTo(String value) {
addCriterion("feedback >=", value, "feedback");
return (Criteria) this;
}
public Criteria andFeedbackLessThan(String value) {
addCriterion("feedback <", value, "feedback");
return (Criteria) this;
}
public Criteria andFeedbackLessThanOrEqualTo(String value) {
addCriterion("feedback <=", value, "feedback");
return (Criteria) this;
}
public Criteria andFeedbackLike(String value) {
addCriterion("feedback like", value, "feedback");
return (Criteria) this;
}
public Criteria andFeedbackNotLike(String value) {
addCriterion("feedback not like", value, "feedback");
return (Criteria) this;
}
public Criteria andFeedbackIn(List<String> values) {
addCriterion("feedback in", values, "feedback");
return (Criteria) this;
}
public Criteria andFeedbackNotIn(List<String> values) {
addCriterion("feedback not in", values, "feedback");
return (Criteria) this;
}
public Criteria andFeedbackBetween(String value1, String value2) {
addCriterion("feedback between", value1, value2, "feedback");
return (Criteria) this;
}
public Criteria andFeedbackNotBetween(String value1, String value2) {
addCriterion("feedback not between", value1, value2, "feedback");
return (Criteria) this;
}
}
/**
* s2_chat_query
*/
public static class Criteria extends GeneratedCriteria {
protected Criteria() {
super();
}
}
/**
* s2_chat_query null
*/
public static class Criterion {
private String condition;
private Object value;
private Object secondValue;
private boolean noValue;
private boolean singleValue;
private boolean betweenValue;
private boolean listValue;
private String typeHandler;
protected Criterion(String condition) {
super();
this.condition = condition;
this.typeHandler = null;
this.noValue = true;
}
protected Criterion(String condition, Object value, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.typeHandler = typeHandler;
if (value instanceof List<?>) {
this.listValue = true;
} else {
this.singleValue = true;
}
}
protected Criterion(String condition, Object value) {
this(condition, value, null);
}
protected Criterion(String condition, Object value, Object secondValue, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.secondValue = secondValue;
this.typeHandler = typeHandler;
this.betweenValue = true;
}
protected Criterion(String condition, Object value, Object secondValue) {
this(condition, value, secondValue, null);
}
public String getCondition() {
return condition;
}
public Object getValue() {
return value;
}
public Object getSecondValue() {
return secondValue;
}
public boolean isNoValue() {
return noValue;
}
public boolean isSingleValue() {
return singleValue;
}
public boolean isBetweenValue() {
return betweenValue;
}
public boolean isListValue() {
return listValue;
}
public String getTypeHandler() {
return typeHandler;
}
}
}

View File

@@ -1,960 +0,0 @@
package com.tencent.supersonic.chat.server.persistence.dataobject;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
public class PluginDOExample {
/**
* s2_plugin
*/
protected String orderByClause;
/**
* s2_plugin
*/
protected boolean distinct;
/**
* s2_plugin
*/
protected List<Criteria> oredCriteria;
/**
* s2_plugin
*/
protected Integer limitStart;
/**
* s2_plugin
*/
protected Integer limitEnd;
/**
* @mbg.generated
*/
public PluginDOExample() {
oredCriteria = new ArrayList<Criteria>();
}
/**
* @mbg.generated
*/
public void setOrderByClause(String orderByClause) {
this.orderByClause = orderByClause;
}
/**
* @mbg.generated
*/
public String getOrderByClause() {
return orderByClause;
}
/**
* @mbg.generated
*/
public void setDistinct(boolean distinct) {
this.distinct = distinct;
}
/**
* @mbg.generated
*/
public boolean isDistinct() {
return distinct;
}
/**
* @mbg.generated
*/
public List<Criteria> getOredCriteria() {
return oredCriteria;
}
/**
* @mbg.generated
*/
public void or(Criteria criteria) {
oredCriteria.add(criteria);
}
/**
* @mbg.generated
*/
public Criteria or() {
Criteria criteria = createCriteriaInternal();
oredCriteria.add(criteria);
return criteria;
}
/**
* @mbg.generated
*/
public Criteria createCriteria() {
Criteria criteria = createCriteriaInternal();
if (oredCriteria.size() == 0) {
oredCriteria.add(criteria);
}
return criteria;
}
/**
* @mbg.generated
*/
protected Criteria createCriteriaInternal() {
Criteria criteria = new Criteria();
return criteria;
}
/**
* @mbg.generated
*/
public void clear() {
oredCriteria.clear();
orderByClause = null;
distinct = false;
}
/**
* @mbg.generated
*/
public void setLimitStart(Integer limitStart) {
this.limitStart = limitStart;
}
/**
* @mbg.generated
*/
public Integer getLimitStart() {
return limitStart;
}
/**
* @mbg.generated
*/
public void setLimitEnd(Integer limitEnd) {
this.limitEnd = limitEnd;
}
/**
* @mbg.generated
*/
public Integer getLimitEnd() {
return limitEnd;
}
/**
* s2_plugin null
*/
protected abstract static class GeneratedCriteria {
protected List<Criterion> criteria;
protected GeneratedCriteria() {
super();
criteria = new ArrayList<Criterion>();
}
public boolean isValid() {
return criteria.size() > 0;
}
public List<Criterion> getAllCriteria() {
return criteria;
}
public List<Criterion> getCriteria() {
return criteria;
}
protected void addCriterion(String condition) {
if (condition == null) {
throw new RuntimeException("Value for condition cannot be null");
}
criteria.add(new Criterion(condition));
}
protected void addCriterion(String condition, Object value, String property) {
if (value == null) {
throw new RuntimeException("Value for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value));
}
protected void addCriterion(String condition, Object value1, Object value2, String property) {
if (value1 == null || value2 == null) {
throw new RuntimeException("Between values for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value1, value2));
}
public Criteria andIdIsNull() {
addCriterion("id is null");
return (Criteria) this;
}
public Criteria andIdIsNotNull() {
addCriterion("id is not null");
return (Criteria) this;
}
public Criteria andIdEqualTo(Long value) {
addCriterion("id =", value, "id");
return (Criteria) this;
}
public Criteria andIdNotEqualTo(Long value) {
addCriterion("id <>", value, "id");
return (Criteria) this;
}
public Criteria andIdGreaterThan(Long value) {
addCriterion("id >", value, "id");
return (Criteria) this;
}
public Criteria andIdGreaterThanOrEqualTo(Long value) {
addCriterion("id >=", value, "id");
return (Criteria) this;
}
public Criteria andIdLessThan(Long value) {
addCriterion("id <", value, "id");
return (Criteria) this;
}
public Criteria andIdLessThanOrEqualTo(Long value) {
addCriterion("id <=", value, "id");
return (Criteria) this;
}
public Criteria andIdIn(List<Long> values) {
addCriterion("id in", values, "id");
return (Criteria) this;
}
public Criteria andIdNotIn(List<Long> values) {
addCriterion("id not in", values, "id");
return (Criteria) this;
}
public Criteria andIdBetween(Long value1, Long value2) {
addCriterion("id between", value1, value2, "id");
return (Criteria) this;
}
public Criteria andIdNotBetween(Long value1, Long value2) {
addCriterion("id not between", value1, value2, "id");
return (Criteria) this;
}
public Criteria andTypeIsNull() {
addCriterion("type is null");
return (Criteria) this;
}
public Criteria andTypeIsNotNull() {
addCriterion("type is not null");
return (Criteria) this;
}
public Criteria andTypeEqualTo(String value) {
addCriterion("type =", value, "type");
return (Criteria) this;
}
public Criteria andTypeNotEqualTo(String value) {
addCriterion("type <>", value, "type");
return (Criteria) this;
}
public Criteria andTypeGreaterThan(String value) {
addCriterion("type >", value, "type");
return (Criteria) this;
}
public Criteria andTypeGreaterThanOrEqualTo(String value) {
addCriterion("type >=", value, "type");
return (Criteria) this;
}
public Criteria andTypeLessThan(String value) {
addCriterion("type <", value, "type");
return (Criteria) this;
}
public Criteria andTypeLessThanOrEqualTo(String value) {
addCriterion("type <=", value, "type");
return (Criteria) this;
}
public Criteria andTypeLike(String value) {
addCriterion("type like", value, "type");
return (Criteria) this;
}
public Criteria andTypeNotLike(String value) {
addCriterion("type not like", value, "type");
return (Criteria) this;
}
public Criteria andTypeIn(List<String> values) {
addCriterion("type in", values, "type");
return (Criteria) this;
}
public Criteria andTypeNotIn(List<String> values) {
addCriterion("type not in", values, "type");
return (Criteria) this;
}
public Criteria andTypeBetween(String value1, String value2) {
addCriterion("type between", value1, value2, "type");
return (Criteria) this;
}
public Criteria andTypeNotBetween(String value1, String value2) {
addCriterion("type not between", value1, value2, "type");
return (Criteria) this;
}
public Criteria andModelIsNull() {
addCriterion("model is null");
return (Criteria) this;
}
public Criteria andModelIsNotNull() {
addCriterion("model is not null");
return (Criteria) this;
}
public Criteria andModelEqualTo(String value) {
addCriterion("model =", value, "model");
return (Criteria) this;
}
public Criteria andModelNotEqualTo(String value) {
addCriterion("model <>", value, "model");
return (Criteria) this;
}
public Criteria andModelGreaterThan(String value) {
addCriterion("model >", value, "model");
return (Criteria) this;
}
public Criteria andModelGreaterThanOrEqualTo(String value) {
addCriterion("model >=", value, "model");
return (Criteria) this;
}
public Criteria andModelLessThan(String value) {
addCriterion("model <", value, "model");
return (Criteria) this;
}
public Criteria andModelLessThanOrEqualTo(String value) {
addCriterion("model <=", value, "model");
return (Criteria) this;
}
public Criteria andModelLike(String value) {
addCriterion("model like", value, "model");
return (Criteria) this;
}
public Criteria andModelNotLike(String value) {
addCriterion("model not like", value, "model");
return (Criteria) this;
}
public Criteria andModelIn(List<String> values) {
addCriterion("model in", values, "model");
return (Criteria) this;
}
public Criteria andModelNotIn(List<String> values) {
addCriterion("model not in", values, "model");
return (Criteria) this;
}
public Criteria andModelBetween(String value1, String value2) {
addCriterion("model between", value1, value2, "model");
return (Criteria) this;
}
public Criteria andModelNotBetween(String value1, String value2) {
addCriterion("model not between", value1, value2, "model");
return (Criteria) this;
}
public Criteria andPatternIsNull() {
addCriterion("pattern is null");
return (Criteria) this;
}
public Criteria andPatternIsNotNull() {
addCriterion("pattern is not null");
return (Criteria) this;
}
public Criteria andPatternEqualTo(String value) {
addCriterion("pattern =", value, "pattern");
return (Criteria) this;
}
public Criteria andPatternNotEqualTo(String value) {
addCriterion("pattern <>", value, "pattern");
return (Criteria) this;
}
public Criteria andPatternGreaterThan(String value) {
addCriterion("pattern >", value, "pattern");
return (Criteria) this;
}
public Criteria andPatternGreaterThanOrEqualTo(String value) {
addCriterion("pattern >=", value, "pattern");
return (Criteria) this;
}
public Criteria andPatternLessThan(String value) {
addCriterion("pattern <", value, "pattern");
return (Criteria) this;
}
public Criteria andPatternLessThanOrEqualTo(String value) {
addCriterion("pattern <=", value, "pattern");
return (Criteria) this;
}
public Criteria andPatternLike(String value) {
addCriterion("pattern like", value, "pattern");
return (Criteria) this;
}
public Criteria andPatternNotLike(String value) {
addCriterion("pattern not like", value, "pattern");
return (Criteria) this;
}
public Criteria andPatternIn(List<String> values) {
addCriterion("pattern in", values, "pattern");
return (Criteria) this;
}
public Criteria andPatternNotIn(List<String> values) {
addCriterion("pattern not in", values, "pattern");
return (Criteria) this;
}
public Criteria andPatternBetween(String value1, String value2) {
addCriterion("pattern between", value1, value2, "pattern");
return (Criteria) this;
}
public Criteria andPatternNotBetween(String value1, String value2) {
addCriterion("pattern not between", value1, value2, "pattern");
return (Criteria) this;
}
public Criteria andParseModeIsNull() {
addCriterion("parse_mode is null");
return (Criteria) this;
}
public Criteria andParseModeIsNotNull() {
addCriterion("parse_mode is not null");
return (Criteria) this;
}
public Criteria andParseModeEqualTo(String value) {
addCriterion("parse_mode =", value, "parseMode");
return (Criteria) this;
}
public Criteria andParseModeNotEqualTo(String value) {
addCriterion("parse_mode <>", value, "parseMode");
return (Criteria) this;
}
public Criteria andParseModeGreaterThan(String value) {
addCriterion("parse_mode >", value, "parseMode");
return (Criteria) this;
}
public Criteria andParseModeGreaterThanOrEqualTo(String value) {
addCriterion("parse_mode >=", value, "parseMode");
return (Criteria) this;
}
public Criteria andParseModeLessThan(String value) {
addCriterion("parse_mode <", value, "parseMode");
return (Criteria) this;
}
public Criteria andParseModeLessThanOrEqualTo(String value) {
addCriterion("parse_mode <=", value, "parseMode");
return (Criteria) this;
}
public Criteria andParseModeLike(String value) {
addCriterion("parse_mode like", value, "parseMode");
return (Criteria) this;
}
public Criteria andParseModeNotLike(String value) {
addCriterion("parse_mode not like", value, "parseMode");
return (Criteria) this;
}
public Criteria andParseModeIn(List<String> values) {
addCriterion("parse_mode in", values, "parseMode");
return (Criteria) this;
}
public Criteria andParseModeNotIn(List<String> values) {
addCriterion("parse_mode not in", values, "parseMode");
return (Criteria) this;
}
public Criteria andParseModeBetween(String value1, String value2) {
addCriterion("parse_mode between", value1, value2, "parseMode");
return (Criteria) this;
}
public Criteria andParseModeNotBetween(String value1, String value2) {
addCriterion("parse_mode not between", value1, value2, "parseMode");
return (Criteria) this;
}
public Criteria andNameIsNull() {
addCriterion("name is null");
return (Criteria) this;
}
public Criteria andNameIsNotNull() {
addCriterion("name is not null");
return (Criteria) this;
}
public Criteria andNameEqualTo(String value) {
addCriterion("name =", value, "name");
return (Criteria) this;
}
public Criteria andNameNotEqualTo(String value) {
addCriterion("name <>", value, "name");
return (Criteria) this;
}
public Criteria andNameGreaterThan(String value) {
addCriterion("name >", value, "name");
return (Criteria) this;
}
public Criteria andNameGreaterThanOrEqualTo(String value) {
addCriterion("name >=", value, "name");
return (Criteria) this;
}
public Criteria andNameLessThan(String value) {
addCriterion("name <", value, "name");
return (Criteria) this;
}
public Criteria andNameLessThanOrEqualTo(String value) {
addCriterion("name <=", value, "name");
return (Criteria) this;
}
public Criteria andNameLike(String value) {
addCriterion("name like", value, "name");
return (Criteria) this;
}
public Criteria andNameNotLike(String value) {
addCriterion("name not like", value, "name");
return (Criteria) this;
}
public Criteria andNameIn(List<String> values) {
addCriterion("name in", values, "name");
return (Criteria) this;
}
public Criteria andNameNotIn(List<String> values) {
addCriterion("name not in", values, "name");
return (Criteria) this;
}
public Criteria andNameBetween(String value1, String value2) {
addCriterion("name between", value1, value2, "name");
return (Criteria) this;
}
public Criteria andNameNotBetween(String value1, String value2) {
addCriterion("name not between", value1, value2, "name");
return (Criteria) this;
}
public Criteria andCreatedAtIsNull() {
addCriterion("created_at is null");
return (Criteria) this;
}
public Criteria andCreatedAtIsNotNull() {
addCriterion("created_at is not null");
return (Criteria) this;
}
public Criteria andCreatedAtEqualTo(Date value) {
addCriterion("created_at =", value, "createdAt");
return (Criteria) this;
}
public Criteria andCreatedAtNotEqualTo(Date value) {
addCriterion("created_at <>", value, "createdAt");
return (Criteria) this;
}
public Criteria andCreatedAtGreaterThan(Date value) {
addCriterion("created_at >", value, "createdAt");
return (Criteria) this;
}
public Criteria andCreatedAtGreaterThanOrEqualTo(Date value) {
addCriterion("created_at >=", value, "createdAt");
return (Criteria) this;
}
public Criteria andCreatedAtLessThan(Date value) {
addCriterion("created_at <", value, "createdAt");
return (Criteria) this;
}
public Criteria andCreatedAtLessThanOrEqualTo(Date value) {
addCriterion("created_at <=", value, "createdAt");
return (Criteria) this;
}
public Criteria andCreatedAtIn(List<Date> values) {
addCriterion("created_at in", values, "createdAt");
return (Criteria) this;
}
public Criteria andCreatedAtNotIn(List<Date> values) {
addCriterion("created_at not in", values, "createdAt");
return (Criteria) this;
}
public Criteria andCreatedAtBetween(Date value1, Date value2) {
addCriterion("created_at between", value1, value2, "createdAt");
return (Criteria) this;
}
public Criteria andCreatedAtNotBetween(Date value1, Date value2) {
addCriterion("created_at not between", value1, value2, "createdAt");
return (Criteria) this;
}
public Criteria andCreatedByIsNull() {
addCriterion("created_by is null");
return (Criteria) this;
}
public Criteria andCreatedByIsNotNull() {
addCriterion("created_by is not null");
return (Criteria) this;
}
public Criteria andCreatedByEqualTo(String value) {
addCriterion("created_by =", value, "createdBy");
return (Criteria) this;
}
public Criteria andCreatedByNotEqualTo(String value) {
addCriterion("created_by <>", value, "createdBy");
return (Criteria) this;
}
public Criteria andCreatedByGreaterThan(String value) {
addCriterion("created_by >", value, "createdBy");
return (Criteria) this;
}
public Criteria andCreatedByGreaterThanOrEqualTo(String value) {
addCriterion("created_by >=", value, "createdBy");
return (Criteria) this;
}
public Criteria andCreatedByLessThan(String value) {
addCriterion("created_by <", value, "createdBy");
return (Criteria) this;
}
public Criteria andCreatedByLessThanOrEqualTo(String value) {
addCriterion("created_by <=", value, "createdBy");
return (Criteria) this;
}
public Criteria andCreatedByLike(String value) {
addCriterion("created_by like", value, "createdBy");
return (Criteria) this;
}
public Criteria andCreatedByNotLike(String value) {
addCriterion("created_by not like", value, "createdBy");
return (Criteria) this;
}
public Criteria andCreatedByIn(List<String> values) {
addCriterion("created_by in", values, "createdBy");
return (Criteria) this;
}
public Criteria andCreatedByNotIn(List<String> values) {
addCriterion("created_by not in", values, "createdBy");
return (Criteria) this;
}
public Criteria andCreatedByBetween(String value1, String value2) {
addCriterion("created_by between", value1, value2, "createdBy");
return (Criteria) this;
}
public Criteria andCreatedByNotBetween(String value1, String value2) {
addCriterion("created_by not between", value1, value2, "createdBy");
return (Criteria) this;
}
public Criteria andUpdatedAtIsNull() {
addCriterion("updated_at is null");
return (Criteria) this;
}
public Criteria andUpdatedAtIsNotNull() {
addCriterion("updated_at is not null");
return (Criteria) this;
}
public Criteria andUpdatedAtEqualTo(Date value) {
addCriterion("updated_at =", value, "updatedAt");
return (Criteria) this;
}
public Criteria andUpdatedAtNotEqualTo(Date value) {
addCriterion("updated_at <>", value, "updatedAt");
return (Criteria) this;
}
public Criteria andUpdatedAtGreaterThan(Date value) {
addCriterion("updated_at >", value, "updatedAt");
return (Criteria) this;
}
public Criteria andUpdatedAtGreaterThanOrEqualTo(Date value) {
addCriterion("updated_at >=", value, "updatedAt");
return (Criteria) this;
}
public Criteria andUpdatedAtLessThan(Date value) {
addCriterion("updated_at <", value, "updatedAt");
return (Criteria) this;
}
public Criteria andUpdatedAtLessThanOrEqualTo(Date value) {
addCriterion("updated_at <=", value, "updatedAt");
return (Criteria) this;
}
public Criteria andUpdatedAtIn(List<Date> values) {
addCriterion("updated_at in", values, "updatedAt");
return (Criteria) this;
}
public Criteria andUpdatedAtNotIn(List<Date> values) {
addCriterion("updated_at not in", values, "updatedAt");
return (Criteria) this;
}
public Criteria andUpdatedAtBetween(Date value1, Date value2) {
addCriterion("updated_at between", value1, value2, "updatedAt");
return (Criteria) this;
}
public Criteria andUpdatedAtNotBetween(Date value1, Date value2) {
addCriterion("updated_at not between", value1, value2, "updatedAt");
return (Criteria) this;
}
public Criteria andUpdatedByIsNull() {
addCriterion("updated_by is null");
return (Criteria) this;
}
public Criteria andUpdatedByIsNotNull() {
addCriterion("updated_by is not null");
return (Criteria) this;
}
public Criteria andUpdatedByEqualTo(String value) {
addCriterion("updated_by =", value, "updatedBy");
return (Criteria) this;
}
public Criteria andUpdatedByNotEqualTo(String value) {
addCriterion("updated_by <>", value, "updatedBy");
return (Criteria) this;
}
public Criteria andUpdatedByGreaterThan(String value) {
addCriterion("updated_by >", value, "updatedBy");
return (Criteria) this;
}
public Criteria andUpdatedByGreaterThanOrEqualTo(String value) {
addCriterion("updated_by >=", value, "updatedBy");
return (Criteria) this;
}
public Criteria andUpdatedByLessThan(String value) {
addCriterion("updated_by <", value, "updatedBy");
return (Criteria) this;
}
public Criteria andUpdatedByLessThanOrEqualTo(String value) {
addCriterion("updated_by <=", value, "updatedBy");
return (Criteria) this;
}
public Criteria andUpdatedByLike(String value) {
addCriterion("updated_by like", value, "updatedBy");
return (Criteria) this;
}
public Criteria andUpdatedByNotLike(String value) {
addCriterion("updated_by not like", value, "updatedBy");
return (Criteria) this;
}
public Criteria andUpdatedByIn(List<String> values) {
addCriterion("updated_by in", values, "updatedBy");
return (Criteria) this;
}
public Criteria andUpdatedByNotIn(List<String> values) {
addCriterion("updated_by not in", values, "updatedBy");
return (Criteria) this;
}
public Criteria andUpdatedByBetween(String value1, String value2) {
addCriterion("updated_by between", value1, value2, "updatedBy");
return (Criteria) this;
}
public Criteria andUpdatedByNotBetween(String value1, String value2) {
addCriterion("updated_by not between", value1, value2, "updatedBy");
return (Criteria) this;
}
}
/**
* s2_plugin
*/
public static class Criteria extends GeneratedCriteria {
protected Criteria() {
super();
}
}
/**
* s2_plugin null
*/
public static class Criterion {
private String condition;
private Object value;
private Object secondValue;
private boolean noValue;
private boolean singleValue;
private boolean betweenValue;
private boolean listValue;
private String typeHandler;
protected Criterion(String condition) {
super();
this.condition = condition;
this.typeHandler = null;
this.noValue = true;
}
protected Criterion(String condition, Object value, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.typeHandler = typeHandler;
if (value instanceof List<?>) {
this.listValue = true;
} else {
this.singleValue = true;
}
}
protected Criterion(String condition, Object value) {
this(condition, value, null);
}
protected Criterion(String condition, Object value, Object secondValue, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.secondValue = secondValue;
this.typeHandler = typeHandler;
this.betweenValue = true;
}
protected Criterion(String condition, Object value, Object secondValue) {
this(condition, value, secondValue, null);
}
public String getCondition() {
return condition;
}
public Object getValue() {
return value;
}
public Object getSecondValue() {
return secondValue;
}
public boolean isNoValue() {
return noValue;
}
public boolean isSingleValue() {
return singleValue;
}
public boolean isBetweenValue() {
return betweenValue;
}
public boolean isListValue() {
return listValue;
}
public String getTypeHandler() {
return typeHandler;
}
}
}

View File

@@ -1,21 +1,10 @@
package com.tencent.supersonic.chat.server.persistence.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.tencent.supersonic.chat.server.persistence.dataobject.ChatQueryDO;
import com.tencent.supersonic.chat.server.persistence.dataobject.ChatQueryDOExample;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
@Mapper
public interface ChatQueryDOMapper {
public interface ChatQueryDOMapper extends BaseMapper<ChatQueryDO> {
int insert(ChatQueryDO record);
List<ChatQueryDO> selectByExampleWithBLOBs(ChatQueryDOExample example);
int updateByPrimaryKeyWithBLOBs(ChatQueryDO record);
Boolean deleteByPrimaryKey(Long questionId);
ChatQueryDO selectByPrimaryKey(Long questionId);
}

View File

@@ -1,13 +1,14 @@
package com.tencent.supersonic.chat.server.persistence.repository;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.github.pagehelper.PageInfo;
import com.tencent.supersonic.chat.api.pojo.request.ChatParseReq;
import com.tencent.supersonic.chat.api.pojo.request.PageQueryInfoReq;
import com.tencent.supersonic.chat.api.pojo.response.QueryResp;
import com.tencent.supersonic.chat.server.persistence.dataobject.ChatParseDO;
import com.tencent.supersonic.chat.server.persistence.dataobject.ChatQueryDO;
import com.tencent.supersonic.headless.api.pojo.SemanticParseInfo;
import com.tencent.supersonic.headless.api.pojo.response.ParseResp;
import com.tencent.supersonic.chat.api.pojo.response.QueryResp;
import java.util.List;
@@ -21,10 +22,10 @@ public interface ChatQueryRepository {
List<QueryResp> queryShowCase(PageQueryInfoReq pageQueryInfoCommend, int agentId);
ChatQueryDO getLastChatQuery(long chatId);
int updateChatQuery(ChatQueryDO chatQueryDO);
void updateChatQuery(ChatQueryDO chatQueryDO, UpdateWrapper<ChatQueryDO> updateWrapper);
Long createChatQuery(ChatParseReq chatParseReq);
List<ChatParseDO> batchSaveParseInfo(ChatParseReq chatParseReq, ParseResp parseResult,
@@ -34,8 +35,6 @@ public interface ChatQueryRepository {
List<ChatParseDO> getParseInfoList(List<Long> questionIds);
Boolean deleteChatQuery(Long questionId);
List<ParseResp> getContextualParseInfo(Integer chatId);
}

View File

@@ -1,6 +1,8 @@
package com.tencent.supersonic.chat.server.persistence.repository.impl;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.tencent.supersonic.chat.api.pojo.request.ChatParseReq;
@@ -8,8 +10,6 @@ import com.tencent.supersonic.chat.api.pojo.request.PageQueryInfoReq;
import com.tencent.supersonic.chat.api.pojo.response.SimilarQueryRecallResp;
import com.tencent.supersonic.chat.server.persistence.dataobject.ChatParseDO;
import com.tencent.supersonic.chat.server.persistence.dataobject.ChatQueryDO;
import com.tencent.supersonic.chat.server.persistence.dataobject.ChatQueryDOExample;
import com.tencent.supersonic.chat.server.persistence.dataobject.ChatQueryDOExample.Criteria;
import com.tencent.supersonic.chat.server.persistence.mapper.ChatParseMapper;
import com.tencent.supersonic.chat.server.persistence.mapper.ChatQueryDOMapper;
import com.tencent.supersonic.chat.server.persistence.mapper.custom.ShowCaseCustomMapper;
@@ -19,10 +19,12 @@ import com.tencent.supersonic.common.util.PageUtils;
import com.tencent.supersonic.headless.api.pojo.SemanticParseInfo;
import com.tencent.supersonic.headless.api.pojo.response.ParseResp;
import com.tencent.supersonic.chat.api.pojo.response.QueryResp;
import com.tencent.supersonic.headless.api.pojo.response.ParseTimeCostResp;
import com.tencent.supersonic.headless.api.pojo.response.QueryResult;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Primary;
import org.springframework.stereotype.Repository;
import org.springframework.util.CollectionUtils;
@@ -38,37 +40,33 @@ import java.util.stream.Collectors;
@Slf4j
public class ChatQueryRepositoryImpl implements ChatQueryRepository {
private final ChatQueryDOMapper chatQueryDOMapper;
@Autowired
private ChatQueryDOMapper chatQueryDOMapper;
private final ChatParseMapper chatParseMapper;
@Autowired
private ChatParseMapper chatParseMapper;
private final ShowCaseCustomMapper showCaseCustomMapper;
public ChatQueryRepositoryImpl(ChatQueryDOMapper chatQueryDOMapper,
ChatParseMapper chatParseMapper,
ShowCaseCustomMapper showCaseCustomMapper) {
this.chatQueryDOMapper = chatQueryDOMapper;
this.chatParseMapper = chatParseMapper;
this.showCaseCustomMapper = showCaseCustomMapper;
}
@Autowired
private ShowCaseCustomMapper showCaseCustomMapper;
@Override
public PageInfo<QueryResp> getChatQuery(PageQueryInfoReq pageQueryInfoReq, Long chatId) {
ChatQueryDOExample example = new ChatQueryDOExample();
example.setOrderByClause("question_id desc");
Criteria criteria = example.createCriteria();
QueryWrapper<ChatQueryDO> queryWrapper = new QueryWrapper<>();
if (chatId != null) {
criteria.andChatIdEqualTo(chatId);
queryWrapper.lambda().eq(ChatQueryDO::getChatId, chatId);
}
if (StringUtils.isNotBlank(pageQueryInfoReq.getUserName())) {
criteria.andUserNameEqualTo(pageQueryInfoReq.getUserName());
queryWrapper.lambda().eq(ChatQueryDO::getUserName, pageQueryInfoReq.getUserName());
}
if (!CollectionUtils.isEmpty(pageQueryInfoReq.getIds())) {
criteria.andQuestionIdIn(pageQueryInfoReq.getIds());
queryWrapper.lambda().in(ChatQueryDO::getQuestionId, pageQueryInfoReq.getIds());
}
queryWrapper.lambda().orderByDesc(ChatQueryDO::getQuestionId);
PageInfo<ChatQueryDO> pageInfo = PageHelper.startPage(pageQueryInfoReq.getCurrent(),
pageQueryInfoReq.getPageSize())
.doSelectPageInfo(() -> chatQueryDOMapper.selectByExampleWithBLOBs(example));
.doSelectPageInfo(() -> chatQueryDOMapper.selectList(queryWrapper));
PageInfo<QueryResp> chatQueryVOPageInfo = PageUtils.pageInfo2PageInfoVo(pageInfo);
chatQueryVOPageInfo.setList(
@@ -89,7 +87,7 @@ public class ChatQueryRepositoryImpl implements ChatQueryRepository {
@Override
public ChatQueryDO getChatQueryDO(Long queryId) {
return chatQueryDOMapper.selectByPrimaryKey(queryId);
return chatQueryDOMapper.selectById(queryId);
}
@Override
@@ -110,6 +108,8 @@ public class ChatQueryRepositoryImpl implements ChatQueryRepository {
}
queryResp.setSimilarQueries(JSONObject.parseArray(chatQueryDO.getSimilarQueries(),
SimilarQueryRecallResp.class));
queryResp.setParseTimeCost(JsonUtil.toObject(chatQueryDO.getParseTimeCost(),
ParseTimeCostResp.class));
return queryResp;
}
@@ -161,23 +161,13 @@ public class ChatQueryRepositoryImpl implements ChatQueryRepository {
}
@Override
public ChatQueryDO getLastChatQuery(long chatId) {
ChatQueryDOExample example = new ChatQueryDOExample();
example.setOrderByClause("question_id desc");
example.setLimitEnd(1);
example.setLimitStart(0);
Criteria criteria = example.createCriteria();
criteria.andChatIdEqualTo(chatId);
List<ChatQueryDO> chatQueryDOS = chatQueryDOMapper.selectByExampleWithBLOBs(example);
if (!CollectionUtils.isEmpty(chatQueryDOS)) {
return chatQueryDOS.get(0);
}
return null;
public int updateChatQuery(ChatQueryDO chatQueryDO) {
return chatQueryDOMapper.updateById(chatQueryDO);
}
@Override
public int updateChatQuery(ChatQueryDO chatQueryDO) {
return chatQueryDOMapper.updateByPrimaryKeyWithBLOBs(chatQueryDO);
public void updateChatQuery(ChatQueryDO chatQueryDO, UpdateWrapper<ChatQueryDO> updateWrapper) {
chatQueryDOMapper.update(chatQueryDO, updateWrapper);
}
public ChatParseDO getParseInfo(Long questionId, int parseId) {
@@ -189,11 +179,6 @@ public class ChatQueryRepositoryImpl implements ChatQueryRepository {
return chatParseMapper.getParseInfoList(questionIds);
}
@Override
public Boolean deleteChatQuery(Long questionId) {
return chatQueryDOMapper.deleteByPrimaryKey(questionId);
}
@Override
public List<ParseResp> getContextualParseInfo(Integer chatId) {
List<ChatParseDO> chatParseDOList = chatParseMapper.getContextualParseInfo(chatId);

View File

@@ -1,9 +1,11 @@
package com.tencent.supersonic.chat.server.processor.parse;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.github.pagehelper.PageInfo;
import com.google.common.collect.Lists;
import com.tencent.supersonic.chat.api.pojo.request.PageQueryInfoReq;
import com.tencent.supersonic.chat.api.pojo.response.QueryResp;
import com.tencent.supersonic.chat.api.pojo.response.SimilarQueryRecallResp;
import com.tencent.supersonic.chat.server.persistence.dataobject.ChatQueryDO;
import com.tencent.supersonic.chat.server.persistence.repository.ChatQueryRepository;
@@ -11,7 +13,6 @@ import com.tencent.supersonic.chat.server.pojo.ChatParseContext;
import com.tencent.supersonic.chat.server.util.SimilarQueryManager;
import com.tencent.supersonic.common.util.ContextUtils;
import com.tencent.supersonic.headless.api.pojo.response.ParseResp;
import com.tencent.supersonic.chat.api.pojo.response.QueryResp;
import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
import org.springframework.util.CollectionUtils;
@@ -82,7 +83,10 @@ public class QueryRecommendProcessor implements ParseResultProcessor {
private void updateChatQuery(ChatQueryDO chatQueryDO) {
ChatQueryRepository chatQueryRepository = ContextUtils.getBean(ChatQueryRepository.class);
chatQueryRepository.updateChatQuery(chatQueryDO);
UpdateWrapper<ChatQueryDO> updateWrapper = new UpdateWrapper<>();
updateWrapper.eq("question_id", chatQueryDO.getQuestionId());
updateWrapper.set("parse_time_cost", chatQueryDO.getSimilarQueries());
chatQueryRepository.updateChatQuery(chatQueryDO, updateWrapper);
}
}

View File

@@ -41,6 +41,8 @@ public interface ChatManageService {
int updateQuery(ChatQueryDO chatQueryDO);
void updateParseCostTime(ParseResp parseResp);
List<ChatParseDO> batchAddParse(ChatParseReq chatParseReq, ParseResp parseResult);
SemanticParseInfo getParseInfo(Long questionId, int parseId);

View File

@@ -177,6 +177,13 @@ public class ChatManageServiceImpl implements ChatManageService {
return chatQueryRepository.updateChatQuery(chatQueryDO);
}
@Override
public void updateParseCostTime(ParseResp parseResp) {
ChatQueryDO chatQueryDO = chatQueryRepository.getChatQueryDO(parseResp.getQueryId());
chatQueryDO.setParseTimeCost(JsonUtil.toString(parseResp.getParseTimeCost()));
updateQuery(chatQueryDO);
}
@Override
public List<ChatParseDO> batchAddParse(ChatParseReq chatParseReq, ParseResp parseResult) {
List<SemanticParseInfo> candidateParses = parseResult.getSelectedParses();

View File

@@ -76,6 +76,7 @@ public class ChatServiceImpl implements ChatService {
chatParseReq.setQueryText(chatParseContext.getQueryText());
parseResp.setQueryText(chatParseContext.getQueryText());
chatManageService.batchAddParse(chatParseReq, parseResp);
chatManageService.updateParseCostTime(parseResp);
return parseResp;
}

View File

@@ -1,126 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.tencent.supersonic.chat.server.persistence.mapper.ChatQueryDOMapper">
<resultMap id="BaseResultMap" type="com.tencent.supersonic.chat.server.persistence.dataobject.ChatQueryDO">
<id column="question_id" jdbcType="BIGINT" property="questionId" />
<result column="agent_id" jdbcType="INTEGER" property="agentId" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
<result column="user_name" jdbcType="VARCHAR" property="userName" />
<result column="query_state" jdbcType="INTEGER" property="queryState" />
<result column="chat_id" jdbcType="BIGINT" property="chatId" />
<result column="score" jdbcType="INTEGER" property="score" />
<result column="feedback" jdbcType="VARCHAR" property="feedback" />
</resultMap>
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="com.tencent.supersonic.chat.server.persistence.dataobject.ChatQueryDO">
<result column="query_text" jdbcType="LONGVARCHAR" property="queryText" />
<result column="query_result" jdbcType="LONGVARCHAR" property="queryResult" />
<result column="similar_queries" jdbcType="LONGVARCHAR" property="similarQueries"/>
</resultMap>
<sql id="Example_Where_Clause">
<where>
<foreach collection="oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Base_Column_List">
question_id, agent_id, create_time, user_name, query_state, chat_id, score, feedback
</sql>
<sql id="Blob_Column_List">
query_text, query_result, similar_queries
</sql>
<select id="selectByExampleWithBLOBs" parameterType="com.tencent.supersonic.chat.server.persistence.dataobject.ChatQueryDOExample" resultMap="ResultMapWithBLOBs">
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List" />
,
<include refid="Blob_Column_List" />
from s2_chat_query
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
<if test="orderByClause != null">
order by ${orderByClause}
</if>
</select>
<select id="selectByPrimaryKey" resultMap="ResultMapWithBLOBs">
select * from s2_chat_query
where question_id = #{questionId,jdbcType=BIGINT}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
delete from s2_chat_query
where question_id = #{questionId,jdbcType=BIGINT}
</delete>
<insert id="insert" parameterType="com.tencent.supersonic.chat.server.persistence.dataobject.ChatQueryDO" useGeneratedKeys="true" keyProperty="questionId">
insert into s2_chat_query (agent_id, create_time, user_name,
query_state, chat_id, score,
feedback, query_text, query_result, similar_queries
)
values (#{agentId,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP}, #{userName,jdbcType=VARCHAR},
#{queryState,jdbcType=INTEGER}, #{chatId,jdbcType=BIGINT}, #{score,jdbcType=INTEGER},
#{feedback,jdbcType=VARCHAR}, #{queryText,jdbcType=LONGVARCHAR}, #{queryResult,jdbcType=LONGVARCHAR},
#{similarQueries, jdbcType=LONGVARCHAR}
)
</insert>
<update id="updateByPrimaryKeyWithBLOBs" parameterType="com.tencent.supersonic.chat.server.persistence.dataobject.ChatQueryDO">
update s2_chat_query
<set>
<if test="createTime != null">
create_time = #{createTime,jdbcType=TIMESTAMP},
</if>
<if test="userName != null">
user_name = #{userName,jdbcType=VARCHAR},
</if>
<if test="queryState != null">
query_state = #{queryState,jdbcType=INTEGER},
</if>
<if test="chatId != null">
chat_id = #{chatId,jdbcType=BIGINT},
</if>
<if test="score != null">
score = #{score,jdbcType=INTEGER},
</if>
<if test="feedback != null">
feedback = #{feedback,jdbcType=VARCHAR},
</if>
<if test="queryText != null">
query_text = #{queryText,jdbcType=LONGVARCHAR},
</if>
<if test="queryResult != null">
query_result = #{queryResult,jdbcType=LONGVARCHAR},
</if>
<if test="similarQueries != null">
similar_queries = #{similarQueries,jdbcType=LONGVARCHAR},
</if>
</set>
where question_id = #{questionId,jdbcType=BIGINT}
</update>
</mapper>

View File

@@ -165,7 +165,7 @@ public class S2ArtistDemo extends S2BaseDemo {
public long addDataSet(DomainResp singerDomain, DomainResp singerModelSet, ModelResp singerModel) {
DataSetReq dataSetReq = new DataSetReq();
dataSetReq.setName("艺人库");
dataSetReq.setName("艺人库数据集");
dataSetReq.setBizName("singer");
dataSetReq.setDomainId(singerDomain.getId());
dataSetReq.setDescription("包含艺人相关标签和指标信息");

View File

@@ -92,7 +92,7 @@ public class S2VisitsDemo extends S2BaseDemo {
//create metrics and dimensions
DimensionResp departmentDimension = getDimension("department", userModel);
MetricResp metricUv = addMetric_uv(userModel, departmentDimension);
MetricResp metricUv = addMetric_uv(pvUvModel, departmentDimension);
MetricResp metricPv = getMetric("pv", pvUvModel);
addMetric_pv_avg(metricPv, metricUv, departmentDimension, pvUvModel);
@@ -463,7 +463,7 @@ public class S2VisitsDemo extends S2BaseDemo {
public DataSetResp addDataSet(DomainResp s2Domain, DomainResp s2ModelSet) {
DataSetReq dataSetReq = new DataSetReq();
dataSetReq.setName("超音数");
dataSetReq.setName("超音数数据集");
dataSetReq.setBizName("s2");
dataSetReq.setDomainId(s2Domain.getId());
dataSetReq.setDescription("包含超音数访问统计相关的指标和维度等");

View File

@@ -316,4 +316,7 @@ alter table s2_agent add column `multi_turn_config` varchar(2000) COLLATE utf8_u
alter table s2_model add column `ext` varchar(1000) DEFAULT NULL;
--20240601
alter table s2_sys_parameter rename to s2_system_config;
alter table s2_sys_parameter rename to s2_system_config;
--20240603
alter table s2_chat_query add column `parse_time_cost` varchar(1024);

View File

@@ -38,6 +38,7 @@ CREATE TABLE IF NOT EXISTS `s2_chat_query`
`score` int DEFAULT '0',
`feedback` varchar(1024) DEFAULT '',
`similar_queries` varchar(1024) DEFAULT '',
`parse_time_cost` varchar(1024) DEFAULT '',
PRIMARY KEY (`question_id`)
);

View File

@@ -171,6 +171,7 @@ CREATE TABLE `s2_chat_query`
`score` int(11) DEFAULT '0',
`feedback` varchar(1024) DEFAULT '',
`similar_queries` varchar(1024) DEFAULT '',
`parse_time_cost` varchar(1024) DEFAULT '',
PRIMARY KEY (`question_id`)
) ENGINE = InnoDB DEFAULT CHARSET = utf8;

View File

@@ -23,12 +23,12 @@ public class MetaDiscoveryTest extends BaseTest {
queryMapReq.setQueryText("对比alice和lucy的访问次数");
queryMapReq.setTopN(10);
queryMapReq.setUser(User.getFakeUser());
queryMapReq.setDataSetNames(Collections.singletonList("超音数"));
queryMapReq.setDataSetNames(Collections.singletonList("超音数数据集"));
MapInfoResp mapMeta = metaDiscoveryService.getMapMeta(queryMapReq);
Assertions.assertNotNull(mapMeta);
Assertions.assertNotEquals(0, mapMeta.getDataSetMapInfo().get("超音数").getMapFields());
Assertions.assertNotEquals(0, mapMeta.getDataSetMapInfo().get("超音数").getTopFields());
Assertions.assertNotEquals(0, mapMeta.getDataSetMapInfo().get("超音数数据集").getMapFields());
Assertions.assertNotEquals(0, mapMeta.getDataSetMapInfo().get("超音数数据集").getTopFields());
}
@Test

View File

@@ -38,6 +38,7 @@ CREATE TABLE IF NOT EXISTS `s2_chat_query`
`score` int DEFAULT '0',
`feedback` varchar(1024) DEFAULT '',
`similar_queries` varchar(1024) DEFAULT '',
`parse_time_cost` varchar(1024) DEFAULT '',
PRIMARY KEY (`question_id`)
);