Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix:1555修复通义千问返回结果不能解析问题 #1563

Open
wants to merge 10 commits into
base: dev
Choose a base branch
from
Open
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
7 changes: 4 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ jobs:
java-version: "17"
distribution: "temurin"
java-package: "jre"
architecture: "x64"

# Install jre MacOS arm64
- name: Install Jre MacOS arm64
Expand All @@ -86,7 +87,7 @@ jobs:
- name: Enable tls1
if: ${{ runner.os == 'Windows' }}
run: |
# sed -i '' "s/\(^jdk.tls.disabledAlgorithms=\)\(.*\)\( TLSv1, TLSv1.1,\)\(.*\)/\1\2\4/" "${{ env.JAVA_HOME }}/conf/security/java.security"
# sed -i '' "s/\(^jdk.tls.disabledAlgorithms=\)\(.*\)\( TLSv1, TLSv1.1,\)\(.*\)/\1\2\4/" "${{ env.JAVA_HOME }}\conf\security\java.security"
$filePath = "${{ env.JAVA_HOME }}\conf\security\java.security"
$content = Get-Content $filePath -Raw
$updatedContent = $content -replace '^(jdk.tls.disabledAlgorithms=)(.*)( TLSv1, TLSv1.1,)(.*)', '$1$2$4'
Expand Down Expand Up @@ -210,7 +211,7 @@ jobs:
run: |
xcrun notarytool store-credentials "Chat2DB" --apple-id "${{secrets.MAC_APPLE_ID}}" --password "${{secrets.MAC_APPLE_PASSWORD}}" --team-id "${{secrets.MAC_TEAM_ID}}"
xcrun notarytool submit chat2db-client/release/Chat2DB-${{ steps.chat2db_version.outputs.substring }}.dmg --keychain-profile "Chat2DB"

# macos arm64
- name: Build/release Electron app for MacOS arm64
if: ${{ runner.os == 'macOS' && matrix.arch == 'arm64' }}
Expand Down Expand Up @@ -346,4 +347,4 @@ jobs:
{
"title": "Linux-test-打包完成通知",
"text": "# Linux-test-打包完成通知 \n ![bang](https://oss.sqlgpt.cn/static/happy100.jpg) \n ### 任务id:[${{ github.run_id }}](https://github.com/chat2db/Chat2DB/actions/runs/${{ github.run_id }}) \n ### Linux下载地址:[https://oss.sqlgpt.cn/release/${{ steps.chat2db_version.outputs.substring }}/Chat2DB-${{ steps.chat2db_version.outputs.substring }}.AppImage](https://oss.sqlgpt.cn/release/${{ steps.chat2db_version.outputs.substring }}/Chat2DB-${{ steps.chat2db_version.outputs.substring }}.AppImage)"
}
}
6 changes: 3 additions & 3 deletions chat2db-client/src/blocks/Setting/UpdateDetection/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@ const UpdateDetection = memo(
const [notificationApi, notificationDom] = notification.useNotification();
const timesRef = React.useRef(0);

useEffect(() => {
checkUpdate();
}, []);
// useEffect(() => {
// checkUpdate();
// }, []);

const close = () => {};

Expand Down
2 changes: 1 addition & 1 deletion chat2db-client/src/typings/ai.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export enum AIType {
// CHAT2DBAI = 'CHAT2DBAI',
CHAT2DBAI = 'CHAT2DBAI',
ZHIPUAI = 'ZHIPUAI',
BAICHUANAI='BAICHUANAI',
WENXINAI='WENXINAI',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
import ai.chat2db.spi.model.TableIndex;
import org.apache.commons.lang3.StringUtils;

import java.util.List;


public class ClickHouseSqlBuilder extends DefaultSqlBuilder {
@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
import java.sql.SQLException;
import java.util.*;
import java.util.stream.Collectors;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,15 @@

import ai.chat2db.plugin.hive.type.HiveColumnTypeEnum;
import ai.chat2db.plugin.hive.type.HiveIndexTypeEnum;
import ai.chat2db.spi.SqlBuilder;
import ai.chat2db.spi.jdbc.DefaultSqlBuilder;
import ai.chat2db.spi.model.Database;
import ai.chat2db.spi.model.Table;
import ai.chat2db.spi.model.TableColumn;
import ai.chat2db.spi.model.TableIndex;
import org.apache.commons.lang3.StringUtils;

import java.util.List;


public class HiveSqlBuilder extends DefaultSqlBuilder implements SqlBuilder<Table> {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
delete from DATA_SOURCE where ALIAS ='DEMO@db.sqlgpt.cn';

delete from DASHBOARD where id =ID;

delete from CHART where id<=3;

delete from DASHBOARD_CHART_RELATION where CHART_ID<=3;
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@

import java.io.IOException;
import java.util.Objects;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
* description:OpenAIEventSourceListener
Expand Down Expand Up @@ -52,26 +54,27 @@ public void onOpen(EventSource eventSource, Response response) {
@Override
public void onEvent(EventSource eventSource, String id, String type, String data) {
log.info("Tongyi Chat AI response data:{}", data);
if (data.equals("[DONE]")) {
log.info("Tongyi Chat AI closed");
if (data.contains("\"finish_reason\":\"stop\"")) {
TongyiChatCompletions chatCompletions = mapper.readValue(data, TongyiChatCompletions.class);
String text = chatCompletions.getOutput().getText();
log.info("id: {}, text: {}", chatCompletions.getId(), text);
String sqlContent = "";
if (text.indexOf("```sql") == -1) {
sqlContent = text;
} else {
Pattern pattern = Pattern.compile("```sql(.*?)```", Pattern.DOTALL);
Matcher matcher = pattern.matcher(text);
if (matcher.find()) {
sqlContent = matcher.group(1).trim();
}
}
Message message = new Message();
message.setContent(sqlContent);
sseEmitter.send(SseEmitter.event()
.id("[DONE]")
.data("[DONE]")
.reconnectTime(3000));
sseEmitter.complete();
return;
.id(null)
.data(message)
.reconnectTime(3000));
}

TongyiChatCompletions chatCompletions = mapper.readValue(data, TongyiChatCompletions.class);
String text = chatCompletions.getOutput().getText();
log.info("id: {}, text: {}", chatCompletions.getId(), text);

Message message = new Message();
message.setContent(text);
sseEmitter.send(SseEmitter.event()
.id(null)
.data(message)
.reconnectTime(3000));
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ public abstract class RdbWebConverter {
public abstract DlExecuteParam request2param(DmlRequest request);



public abstract GroupByParam request2param(GroupByRequest request);
/**
* Parameter conversion
*
Expand Down