Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

import com.alibaba.cloud.ai.connector.accessor.Accessor;
import com.alibaba.cloud.ai.connector.config.DbConfig;
import com.alibaba.cloud.ai.constant.Constant;
import com.alibaba.cloud.ai.dispatcher.*;
import com.alibaba.cloud.ai.graph.GraphRepresentation;
import com.alibaba.cloud.ai.graph.KeyStrategy;
Expand Down Expand Up @@ -103,6 +104,8 @@ public StateGraph nl2sqlGraph(ChatClient.Builder chatClientBuilder) throws Graph
HashMap<String, KeyStrategy> keyStrategyHashMap = new HashMap<>();
// User input
keyStrategyHashMap.put(INPUT_KEY, new ReplaceStrategy());
// Dataset ID
keyStrategyHashMap.put(Constant.AGENT_ID, new ReplaceStrategy());
// Agent ID
keyStrategyHashMap.put(AGENT_ID, new ReplaceStrategy());
// Business knowledge
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,12 @@

/**
* Semantic model configuration entity class
* @author jast
*/
public class SemanticModelDTO {

private Long id; // Unique identifier

private Long agentId; // Agent ID
private String agentId; // Agent ID

private String originalFieldName; // Original field name

Expand All @@ -44,7 +43,7 @@ public class SemanticModelDTO {
public SemanticModelDTO() {
}

public SemanticModelDTO(Long agentId, String originalFieldName, String agentFieldName, String fieldSynonyms,
public SemanticModelDTO(String agentId, String originalFieldName, String agentFieldName, String fieldSynonyms,
String fieldDescription, Boolean defaultRecall, Boolean enabled, String fieldType,
String originalDescription) {
this.agentId = agentId;
Expand Down Expand Up @@ -72,11 +71,11 @@ public SemanticModelDTO(String originalFieldName, String agentFieldName, String
}

// Getters and Setters
public Long getAgentId() {
public String getAgentId() {
return agentId;
}

public void setAgentId(Long agentId) {
public void setAgentId(String agentId) {
this.agentId = agentId;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,18 +49,10 @@ public SemanticModelRecallService(JdbcTemplate jdbcTemplate) {
// Get agent fields by data_set_id
public List<SemanticModelDTO> getFieldByDataSetId(String dataSetId) {
return this.jdbcTemplate.query(FIELD_GET_BY_DATASET_IDS, new Object[] { dataSetId }, (rs, rowNum) -> {
SemanticModelDTO dto = new SemanticModelDTO();
Long agentIdLong = rs.getObject("agent_id", Long.class);
dto.setAgentId(agentIdLong);
dto.setOriginalFieldName(rs.getString("origin_name"));
dto.setAgentFieldName(rs.getString("field_name"));
dto.setFieldSynonyms(rs.getString("synonyms"));
dto.setFieldDescription(rs.getString("description"));
dto.setOriginalDescription(rs.getString("origin_description"));
dto.setFieldType(rs.getString("type"));
dto.setDefaultRecall(rs.getObject("is_recall", Boolean.class));
dto.setEnabled(rs.getObject("status", Boolean.class));
return dto;
return new SemanticModelDTO(rs.getString("agent_id"), rs.getString("origin_name"),
rs.getString("field_name"), rs.getString("synonyms"), rs.getString("description"),
rs.getObject("is_recall", Boolean.class), rs.getObject("status", Boolean.class),
rs.getString("type"), rs.getString("origin_description"));
});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,8 @@ public String search(
catch (Exception ignore) {
}

Optional<OverAllState> invoke = compiledGraph.call(
Map.of(INPUT_KEY, query, AGENT_ID, agentId, HUMAN_REVIEW_ENABLED, humanReviewEnabled));
Optional<OverAllState> invoke = compiledGraph.call(Map.of(INPUT_KEY, query, Constant.AGENT_ID, dataSetId,
AGENT_ID, agentId, HUMAN_REVIEW_ENABLED, humanReviewEnabled));
OverAllState overAllState = invoke.get();
// 注意:在新的人类反馈实现中,计划内容通过流式处理发送给前端
// 这里不再需要单独获取计划内容
Expand Down
Loading