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 @@ -33,6 +33,8 @@ public enum TextType {

MARK_DOWN("```", "```"),

RESULT_SET("```result_set", "```"),

TEXT(null, null);

private final String startSign;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -210,13 +210,17 @@ private Map<String, Object> executeSqlQuery(OverAllState state, Integer currentS

// Create display flux for user experience only
Flux<ChatResponse> displayFlux = Flux.create(emitter -> {
// todo: 先返回Flux流,再去执行SQL查询
emitter.next(ChatResponseUtil.createResponse("开始执行SQL..."));
emitter.next(ChatResponseUtil.createResponse("执行SQL查询"));
emitter.next(ChatResponseUtil.createPureResponse(TextType.SQL.getStartSign()));
emitter.next(ChatResponseUtil.createResponse(sqlQuery));
emitter.next(ChatResponseUtil.createPureResponse(TextType.SQL.getEndSign()));
emitter.next(ChatResponseUtil.createResponse("执行SQL完成"));
// todo: 输出SQL执行结果
emitter.next(ChatResponseUtil.createResponse("SQL查询结果:"));
emitter.next(ChatResponseUtil.createPureResponse(TextType.RESULT_SET.getStartSign()));
emitter.next(ChatResponseUtil.createPureResponse(jsonStr));
emitter.next(ChatResponseUtil.createPureResponse(TextType.RESULT_SET.getEndSign()));
emitter.complete();
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ export enum TextType {
SQL = 'SQL',
HTML = 'HTML',
MARK_DOWN = 'MARK_DOWN',
RESULT_SET = 'RESULT_SET',
TEXT = 'TEXT',
}

Expand Down
41 changes: 41 additions & 0 deletions spring-ai-alibaba-data-agent-frontend/src/services/resultSet.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/*
* Copyright 2024-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

/**
* 结果集数据结构
*/
export interface ResultSetData {
column: string[];
data: Array<Record<string, string>>;
errorMsg?: string;
}

/**
* 分页配置
*/
export interface PaginationConfig {
currentPage: number;
pageSize: number;
total: number;
}

/**
* 结果集显示配置
*/
export interface ResultSetDisplayConfig {
showSqlResults: boolean;
pageSize: number;
}
Loading
Loading