Skip to content

Commit d1d9ad5

Browse files
authored
Merge pull request #1272 from chat2db/dev
Dev
2 parents 093c9ed + adabb89 commit d1d9ad5

File tree

18 files changed

+180
-170
lines changed

18 files changed

+180
-170
lines changed

.github/workflows/release.yml

+6-1
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,12 @@ jobs:
8686
- name: Enable tls1
8787
if: ${{ runner.os == 'Windows' }}
8888
run: |
89-
sed -i '' "s/\(^jdk.tls.disabledAlgorithms=\)\(.*\)\( TLSv1, TLSv1.1,\)\(.*\)/\1\2\4/" "${{ env.JAVA_HOME }}/conf/security/java.security"
89+
# sed -i '' "s/\(^jdk.tls.disabledAlgorithms=\)\(.*\)\( TLSv1, TLSv1.1,\)\(.*\)/\1\2\4/" "${{ env.JAVA_HOME }}/conf/security/java.security"
90+
$filePath = "${{ env.JAVA_HOME }}\conf\security\java.security"
91+
$content = Get-Content $filePath -Raw
92+
$updatedContent = $content -replace '^(jdk.tls.disabledAlgorithms=)(.*)( TLSv1, TLSv1.1,)(.*)', '$1$2$4'
93+
$updatedContent | Set-Content $filePath
94+
shell: pwsh
9095

9196
# java.security open tls1 macOS
9297
- name: Enable tls1

chat2db-client/package.json

+1
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
"event-source-polyfill": "^1.0.31",
3737
"highlight.js": "^11.9.0",
3838
"lodash": "^4.17.21",
39+
"lucide-react": "^0.365.0",
3940
"markdown-it-link-attributes": "^4.0.1",
4041
"monaco-editor": "^0.44.0",
4142
"monaco-editor-esm-webpack-plugin": "^2.1.0",

chat2db-client/src/blocks/Setting/AiSetting/index.tsx

+59-36
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
import React, { useEffect, useState } from 'react';
22
import configService from '@/service/config';
33
import { AIType } from '@/typings/ai';
4-
import { Alert, Button, Form, Input, Radio, RadioChangeEvent } from 'antd';
4+
import { Alert, Button, Flex, Form, Input, Radio, RadioChangeEvent } from 'antd';
55
import i18n from '@/i18n';
66
import { IAiConfig } from '@/typings/setting';
77
import { IRole } from '@/typings/user';
88
import { AIFormConfig, AITypeName } from './aiTypeConfig';
99
import styles from './index.less';
10-
import { useUserStore } from '@/store/user'
10+
import { useUserStore } from '@/store/user';
11+
import { getLinkBasedOnTimezone } from '@/utils/timezone';
1112

1213
interface IProps {
1314
handleApplyAiConfig: (aiConfig: IAiConfig) => void;
@@ -21,11 +22,11 @@ function capitalizeFirstLetter(string) {
2122
// openAI 的设置项
2223
export default function SettingAI(props: IProps) {
2324
const [aiConfig, setAiConfig] = useState<IAiConfig>();
24-
const { userInfo } = useUserStore(state => {
25+
const { userInfo } = useUserStore((state) => {
2526
return {
26-
userInfo: state.curUser
27-
}
28-
})
27+
userInfo: state.curUser,
28+
};
29+
});
2930

3031
useEffect(() => {
3132
setAiConfig(props.aiConfig);
@@ -65,6 +66,57 @@ export default function SettingAI(props: IProps) {
6566
}
6667
};
6768

69+
const renderAIConfig = () => {
70+
if (aiConfig?.aiSqlSource === AIType.CHAT2DBAI) {
71+
return (
72+
<Flex justify="center">
73+
<Button
74+
type="primary"
75+
onClick={() => {
76+
const link = getLinkBasedOnTimezone();
77+
window.open(link, '_blank');
78+
}}
79+
>
80+
{i18n('setting.chat2db.ai.button')}
81+
</Button>
82+
</Flex>
83+
);
84+
}
85+
return (
86+
<>
87+
<Form layout="vertical">
88+
{Object.keys(AIFormConfig[aiConfig?.aiSqlSource]).map((key: string) => (
89+
<Form.Item
90+
key={key}
91+
required={key === 'apiKey' || key === 'secretKey'}
92+
label={capitalizeFirstLetter(key)}
93+
className={styles.title}
94+
>
95+
<Input
96+
autoComplete="off"
97+
value={aiConfig[key]}
98+
placeholder={AIFormConfig[aiConfig?.aiSqlSource]?.[key]}
99+
onChange={(e) => {
100+
setAiConfig({ ...aiConfig, [key]: e.target.value });
101+
}}
102+
/>
103+
</Form.Item>
104+
))}
105+
</Form>
106+
{aiConfig.aiSqlSource === AIType.RESTAI && (
107+
<div style={{ margin: '32px 0 ', fontSize: '12px', opacity: '0.5' }}>{`Tips: ${i18n(
108+
'setting.tab.aiType.custom.tips',
109+
)}`}</div>
110+
)}
111+
<div className={styles.bottomButton}>
112+
<Button type="primary" onClick={handleApplyAiConfig}>
113+
{i18n('setting.button.apply')}
114+
</Button>
115+
</div>
116+
</>
117+
);
118+
};
119+
68120
return (
69121
<>
70122
<div className={styles.aiSqlSource}>
@@ -78,36 +130,7 @@ export default function SettingAI(props: IProps) {
78130
</Radio.Group>
79131
</div>
80132

81-
<Form layout="vertical">
82-
{Object.keys(AIFormConfig[aiConfig?.aiSqlSource]).map((key: string) => (
83-
<Form.Item
84-
key={key}
85-
required={key === 'apiKey' || key === 'secretKey'}
86-
label={capitalizeFirstLetter(key)}
87-
className={styles.title}
88-
>
89-
<Input
90-
autoComplete="off"
91-
value={aiConfig[key]}
92-
placeholder={AIFormConfig[aiConfig?.aiSqlSource]?.[key]}
93-
onChange={(e) => {
94-
setAiConfig({ ...aiConfig, [key]: e.target.value });
95-
}}
96-
/>
97-
</Form.Item>
98-
))}
99-
</Form>
100-
101-
{aiConfig.aiSqlSource === AIType.RESTAI && (
102-
<div style={{ margin: '32px 0 ', fontSize: '12px', opacity: '0.5' }}>{`Tips: ${i18n(
103-
'setting.tab.aiType.custom.tips',
104-
)}`}</div>
105-
)}
106-
<div className={styles.bottomButton}>
107-
<Button type="primary" onClick={handleApplyAiConfig}>
108-
{i18n('setting.button.apply')}
109-
</Button>
110-
</div>
133+
{renderAIConfig()}
111134

112135
{/* {aiConfig?.aiSqlSource === AIType.CHAT2DBAI && !aiConfig.apiKey && <Popularize source="setting" />} */}
113136
</>

chat2db-client/src/blocks/Tree/index.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -394,7 +394,7 @@ const TreeNode = memo((props: TreeNodeIProps) => {
394394
zIndex: 1080,
395395
}}
396396
>
397-
<Tooltip placement="right" color={window._AppThemePack.colorPrimary} title={treeNodeData.comment}>
397+
<Tooltip placement="right" color={window._AppThemePack?.colorPrimary} title={treeNodeData.comment}>
398398
<div
399399
className={classnames(styles.treeNode, { [styles.treeNodeFocus]: isFocus })}
400400
onClick={handelClickTreeNode}

chat2db-client/src/components/MonacoEditor/useMonacoTheme.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ function useMonacoTheme() {
88
const [appTheme] = useTheme();
99
// 监听主题色变化切换编辑器主题色
1010
useEffect(() => {
11-
const { colorPrimary, colorBgBase, colorTextBase } = window._AppThemePack;
11+
const { colorPrimary, colorBgBase, colorTextBase } = window._AppThemePack || {};
1212

1313
const colors = {
1414
'editor.lineHighlightBackground': colorPrimary + '14', // 当前行背景色

chat2db-client/src/components/OpenScreenAnimation/index.less

-48
This file was deleted.

chat2db-client/src/components/OpenScreenAnimation/index.tsx

-20
This file was deleted.

chat2db-client/src/i18n/en-us/setting.ts

+5-2
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export default {
2121
'setting.tab.aiType.baichuan': 'BaiChuan AI',
2222
'setting.tab.aiType.wenxin': 'WenXin AI',
2323
'setting.tab.aiType.tongyiqianwen': 'TongYiQianWen AI',
24-
'setting.tab.aiType.custom.tips': "The API format is consistent with the OpenAI API format",
24+
'setting.tab.aiType.custom.tips': 'The API format is consistent with the OpenAI API format',
2525
'setting.label.serviceAddress': 'Service Address',
2626
'setting.button.apply': 'Apply',
2727
'setting.text.currentEnv': 'Current Env',
@@ -51,9 +51,12 @@ export default {
5151
'setting.text.autoUpdate': 'The new version automatically downloads and installs updates',
5252
'setting.text.manualUpdate': 'Only alert me when a new version is released',
5353
'setting.button.iSee': 'I see',
54-
'setting.text.newEditionIsReady': 'New version to download completed, restart the software will install the new version',
54+
'setting.text.newEditionIsReady':
55+
'New version to download completed, restart the software will install the new version',
5556
'setting.button.goToUpdate': 'Go to update',
5657
'setting.text.UpdatedLatestVersion': 'Updated to the latest version {1}',
5758
'setting.title.holdingService': 'Holding Service',
5859
'setting.text.holdingService': 'Keep the service when exiting the application to speed up startup',
60+
'setting.chat2db.ai.button': 'Please visit Chat2DB Pro for more powerful AI features',
61+
'setting.title.goto.chat2db.pro': 'Go to Chat2DB Pro',
5962
};

chat2db-client/src/i18n/ja-jp/setting.ts

+11-5
Original file line numberDiff line numberDiff line change
@@ -21,18 +21,21 @@ export default {
2121
'setting.tab.aiType.baichuan': '百川',
2222
'setting.tab.aiType.wenxin': '文心一言',
2323
'setting.tab.aiType.tongyiqianwen': '通義千問',
24-
'setting.tab.aiType.custom.tips': "インターフェース形式はOpenAIのものと互換性があります",
24+
'setting.tab.aiType.custom.tips': 'インターフェース形式はOpenAIのものと互換性があります',
2525
'setting.label.serviceAddress': 'サービスアドレス',
2626
'setting.button.apply': '適用',
2727
'setting.text.currentEnv': '現在の環境',
2828
'setting.text.currentVersion': '現在のバージョン',
2929
'setting.text.viewingUpdateLogs': '更新ログを見る',
3030
'setting.label.isStreamOutput': 'ストリーム出力を行うか',
3131
'setting.label.customAiUrl': 'カスタムAIのURL',
32-
'setting.placeholder.httpsProxy': '任意項目、OpenAIインターフェースをリクエストする際のHTTPプロキシを設定するためのもの{1}',
33-
'setting.placeholder.apiKey': 'OpenAIインターフェースを使用する場合は必須です。APIキーはOpenAI公式サイトで確認できます',
32+
'setting.placeholder.httpsProxy':
33+
'任意項目、OpenAIインターフェースをリクエストする際のHTTPプロキシを設定するためのもの{1}',
34+
'setting.placeholder.apiKey':
35+
'OpenAIインターフェースを使用する場合は必須です。APIキーはOpenAI公式サイトで確認できます',
3436
'setting.placeholder.chat2dbApiKey': 'Chat2DBが提供するAPIキーを使用します',
35-
'setting.placeholder.customUrl': 'カスタムAIを選択する場合は必須で、カスタムAIのRESTインターフェースのURLを設定します',
37+
'setting.placeholder.customUrl':
38+
'カスタムAIを選択する場合は必須で、カスタムAIのRESTインターフェースのURLを設定します',
3639
'setting.placeholder.apiHost': '任意項目、デフォルト値はhttps://api.openai.com/',
3740
'setting.message.urlTestError': 'インターフェースのテストに合格しません',
3841
'setting.placeholder.azureOpenAIKey': 'AzureポータルからAzure OpenAIキーを取得します',
@@ -51,9 +54,12 @@ export default {
5154
'setting.text.autoUpdate': '新しいバージョンを自動でダウンロードしてインストールする',
5255
'setting.text.manualUpdate': '新しいバージョンがリリースされたときにのみ通知する',
5356
'setting.button.iSee': '了解しました',
54-
'setting.text.newEditionIsReady': '新しいバージョンがダウンロードされました。ソフトウェアを再起動すると新しいバージョンがインストールされます',
57+
'setting.text.newEditionIsReady':
58+
'新しいバージョンがダウンロードされました。ソフトウェアを再起動すると新しいバージョンがインストールされます',
5559
'setting.button.goToUpdate': '更新に進む',
5660
'setting.text.UpdatedLatestVersion': '最新バージョン {1} に更新しました',
5761
'setting.title.holdingService': 'サービスを維持',
5862
'setting.text.holdingService': 'アプリケーションを終了してもサービスを維持し、起動速度を向上させます',
63+
'setting.chat2db.ai.button': 'より強力なAI機能を体験するために、Chat2DB Proをご利用ください',
64+
'setting.title.goto.chat2db.pro': 'Chat2DB Proへ行く',
5965
};

chat2db-client/src/i18n/tr-tr/setting.ts

+11-8
Original file line numberDiff line numberDiff line change
@@ -21,22 +21,22 @@ export default {
2121
'setting.tab.aiType.baichuan': 'BaiChuan AI',
2222
'setting.tab.aiType.wenxin': 'WenXin AI',
2323
'setting.tab.aiType.tongyiqianwen': 'TongYiQianWen AI',
24-
'setting.tab.aiType.custom.tips': "API formatı OpenAI API formatıyla uyumludur",
24+
'setting.tab.aiType.custom.tips': 'API formatı OpenAI API formatıyla uyumludur',
2525
'setting.label.serviceAddress': 'Hizmet Adresi',
2626
'setting.button.apply': 'Uygula',
2727
'setting.text.currentEnv': 'Geçerli Ortam',
2828
'setting.text.currentVersion': 'Geçerli Sürüm',
2929
'setting.text.viewingUpdateLogs': 'Güncelleme Günlüklerini Görüntüleme',
3030
'setting.label.isStreamOutput': 'Arayüzün çıktıyı akıtıp akıtmadığı',
31-
'setting.label.customAiUrl': 'Kullanıcı tanımlı arayüz URL\'si',
31+
'setting.label.customAiUrl': "Kullanıcı tanımlı arayüz URL'si",
3232
'setting.placeholder.httpsProxy': 'Gerekli değil. OPENAI arayüzünü istemek için HTTP proxy {1} ayarlayın.',
33-
'setting.placeholder.apiKey': 'APIKEY\'i görüntülemek için OpenAI resmi web sitesine gidin',
34-
'setting.placeholder.chat2dbApiKey': 'Chat2DB tarafından sağlanan APIKEY\'i kullanın',
35-
'setting.placeholder.customUrl': 'AI REST arayüzünün URL\'si',
33+
'setting.placeholder.apiKey': "APIKEY'i görüntülemek için OpenAI resmi web sitesine gidin",
34+
'setting.placeholder.chat2dbApiKey': "Chat2DB tarafından sağlanan APIKEY'i kullanın",
35+
'setting.placeholder.customUrl': "AI REST arayüzünün URL'si",
3636
'setting.placeholder.apiHost': 'Bu parametre zorunludur. Varsayılan değer https://api.openai.com/',
3737
'setting.message.urlTestError': 'Arayüz testi başarısız oldu. İşlem',
38-
'setting.placeholder.azureOpenAIKey': 'Azure Portal\'dan Azure OpenAI anahtar kimlik bilgilerini alın',
39-
'setting.placeholder.azureEndpoint': 'Azure Portal\'dan Azure OpenAI uç noktasını alın',
38+
'setting.placeholder.azureOpenAIKey': "Azure Portal'dan Azure OpenAI anahtar kimlik bilgilerini alın",
39+
'setting.placeholder.azureEndpoint': "Azure Portal'dan Azure OpenAI uç noktasını alın",
4040
'setting.placeholder.azureDeployment': 'Dağıtılan modelin dağıtım kimliği',
4141
'setting.ai.tips': 'Lütfen oturum açın ve AI yapılandırmasını seçin',
4242
'setting.ai.user.hidden': '"Ayarlar -> Özel AI" içinde ApiKey\'i ayarlamak için lütfen yönetici ile iletişime geçin',
@@ -51,9 +51,12 @@ export default {
5151
'setting.text.autoUpdate': 'Yeni sürüm otomatik olarak indirilir ve yükler',
5252
'setting.text.manualUpdate': 'Yalnızca yeni bir sürüm yayınlandığında beni uyar',
5353
'setting.button.iSee': 'Görüyorum',
54-
'setting.text.newEditionIsReady': 'Yeni sürüm indirme tamamlandı, yazılımı yeniden başlatarak yeni sürümü kurabilirsiniz',
54+
'setting.text.newEditionIsReady':
55+
'Yeni sürüm indirme tamamlandı, yazılımı yeniden başlatarak yeni sürümü kurabilirsiniz',
5556
'setting.button.goToUpdate': 'Güncellemeye Git',
5657
'setting.text.UpdatedLatestVersion': 'En son sürüme güncellendi {1}',
5758
'setting.title.holdingService': 'Hizmeti Tutma',
5859
'setting.text.holdingService': 'Uygulamadan çıkarken hizmeti tutarak başlangıcı hızlandırın',
60+
'setting.chat2db.ai.button': `Daha güçlü AI özellikleri için lütfen Chat2DB Pro'yu ziyaret edin`,
61+
'setting.title.goto.chat2db.pro': `Chat2DB Pro'ya Git`,
5962
};

chat2db-client/src/i18n/zh-cn/setting.ts

+3-2
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export default {
2121
'setting.tab.aiType.baichuan': '百川',
2222
'setting.tab.aiType.wenxin': '文心一言',
2323
'setting.tab.aiType.tongyiqianwen': '通义千问',
24-
'setting.tab.aiType.custom.tips': "接口格式与OpenAI接口格式一致",
24+
'setting.tab.aiType.custom.tips': '接口格式与OpenAI接口格式一致',
2525
'setting.label.serviceAddress': '服务地址',
2626
'setting.button.apply': '应用',
2727
'setting.text.currentEnv': '当前环境',
@@ -56,5 +56,6 @@ export default {
5656
'setting.text.UpdatedLatestVersion': '已更新到最新版本 {1}',
5757
'setting.title.holdingService': '保持服务',
5858
'setting.text.holdingService': '退出应用时保持服务,加快启动速度',
59-
59+
'setting.chat2db.ai.button': '请前往 Chat2DB Pro 体验更为强大的AI功能',
60+
'setting.title.goto.chat2db.pro': '前往Chat2DB Pro',
6061
};

0 commit comments

Comments
 (0)