Skip to content

Commit f40be5c

Browse files
committed
delete models
2 parents 6cf6262 + b7a95cc commit f40be5c

18 files changed

Lines changed: 278 additions & 754 deletions

File tree

README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,8 +104,7 @@ Redis and MongoDB are partially supported , Hbase、Elasticsearch、openGauss、
104104

105105
### CONFIGURE CUSTOM AI
106106

107-
* [Refer here to deploy your ChatGLM-6B model](https://github.com/chat2db/chat2db-chatglm-6b-deploy)
108-
* [Refer here to deploy your sqlcoder model](https://github.com/chat2db/chat2db-sqlcoder-deploy)
107+
* The rest api format for Custom AI is same as ChatGPT.
109108

110109
## 📦 Docker installation
111110

README_CN.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,7 @@ Redis和MongoDB得到部分支持,Hbase、Elasticsearch、openGauss、TiDB、I
100100
### 使用Chat2DB AI 上手即用
101101

102102
### 使用自定义大模型
103-
- [参考这里部署本地ChatGLM-6B模型](https://github.com/chat2db/chat2db-chatglm-6b-deploy/blob/main/README_CN.md)
104-
- [参考这里部署本地sqlcoder模型](https://github.com/chat2db/chat2db-sqlcoder-deploy/blob/main/README_CN.md)
103+
- 使用自定义大模型,接口格式需要和open ai的接口格式保持一致
105104

106105
## 📦 Docker 部署
107106

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

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,6 @@ const SQLExecute = memo<IProps>((props) => {
3737
}
3838
}, []);
3939

40-
// useUpdateEffect(() => {
41-
// consoleRef.current?.editorRef?.setValue(initDDL, 'cover');
42-
// }, [initDDL]);
43-
4440
return (
4541
<div className={classnames(styles.sqlExecute)}>
4642
<DraggableContainer layout="column" className={styles.boxRightCenter}>
@@ -56,9 +52,6 @@ const SQLExecute = memo<IProps>((props) => {
5652
onExecuteSQL={(sql) => {
5753
searchResultRef.current?.handleExecuteSQL(sql);
5854
}}
59-
// isActive={isActive}
60-
// tables={curTableList || []}
61-
// remainingUse={aiModel.remainingUse}
6255
/>
6356
</div>
6457
<div className={styles.boxRightResult}>

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

Lines changed: 12 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,14 @@ import BaseSetting from './BaseSetting';
77
import AISetting from './AiSetting';
88
import ProxySetting from './ProxySetting';
99
import About from './About';
10-
import { connect } from 'umi';
11-
import { IAIState } from '@/models/ai';
1210
import { IAiConfig } from '@/typings';
1311
import styles from './index.less';
1412
import { ILatestVersion } from '@/service/config';
1513
import UpdateDetection, { IUpdateDetectionRef, UpdatedStatusEnum } from '@/blocks/Setting/UpdateDetection';
1614

15+
// ---- store -----
16+
import { useSettingStore, getAiSystemConfig, setAiSystemConfig } from '@/store/setting'
17+
1718
interface IProps {
1819
aiConfig: IAiConfig;
1920
className?: string;
@@ -29,11 +30,12 @@ export interface IUpdateDetectionData extends ILatestVersion {
2930
}
3031

3132
function Setting(props: IProps) {
32-
const { className, dispatch, noLogin = false, defaultArouse, defaultMenu = 0 } = props;
33+
const { className, noLogin = false, defaultArouse, defaultMenu = 0 } = props;
3334
const [isModalVisible, setIsModalVisible] = useState(false);
3435
const [currentMenu, setCurrentMenu] = useState<number>(defaultMenu);
3536
const [updateDetectionData, setUpdateDetectionData] = useState<IUpdateDetectionData | null>(null);
3637
const updateDetectionRef = React.useRef<IUpdateDetectionRef>(null);
38+
const aiConfig = useSettingStore(state => state.aiConfig);
3739

3840
useEffect(() => {
3941
if (defaultArouse) {
@@ -53,13 +55,6 @@ function Setting(props: IProps) {
5355
}
5456
}, []);
5557

56-
const getAiSystemConfig = () => {
57-
/** 获取ai相关配置 */
58-
dispatch({
59-
type: 'ai/getAiSystemConfig',
60-
});
61-
};
62-
6358
const showModal = (_currentMenu: number = 0) => {
6459
setCurrentMenu(_currentMenu);
6560
setIsModalVisible(true);
@@ -77,13 +72,6 @@ function Setting(props: IProps) {
7772
setCurrentMenu(t);
7873
}
7974

80-
const handleApplyAiConfig = (aiConfig: IAiConfig) => {
81-
dispatch({
82-
type: 'ai/setAiSystemConfig',
83-
payload: aiConfig,
84-
});
85-
};
86-
8775
const menusList = [
8876
{
8977
label: i18n('setting.nav.basic'),
@@ -94,7 +82,7 @@ function Setting(props: IProps) {
9482
{
9583
label: i18n('setting.nav.customAi'),
9684
icon: '\ue646',
97-
body: <AISetting aiConfig={props.aiConfig} handleApplyAiConfig={handleApplyAiConfig} />,
85+
body: <AISetting aiConfig={aiConfig} handleApplyAiConfig={setAiSystemConfig} />,
9886
code: 'ai',
9987
},
10088
{
@@ -178,6 +166,9 @@ function Setting(props: IProps) {
178166
);
179167
}
180168

181-
export default connect(({ ai }: { ai: IAIState }) => ({
182-
aiConfig: ai.aiConfig,
183-
}))(Setting);
169+
// export default connect(({ ai }: { ai: IAIState }) => ({
170+
// aiConfig: ai.aiConfig,
171+
// }))();
172+
173+
export default Setting;
174+

chat2db-client/src/components/ConsoleEditor/components/ChatInput/index.tsx

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
1-
import React, { ChangeEvent, useEffect, useState } from 'react';
1+
import React, { useState } from 'react';
22
import styles from './index.less';
33
import AIImg from '@/assets/img/ai.svg';
4-
import { Button, Checkbox, Dropdown, Input, Modal, Popover, Select, Spin, Tooltip, Radio, Space } from 'antd';
4+
import { Button, Input, Popover, Select, Radio, Space } from 'antd';
55
import i18n from '@/i18n/';
66
import Iconfont from '@/components/Iconfont';
7-
import { WarningOutlined } from '@ant-design/icons';
8-
import { AIType, IRemainingUse } from '@/typings/ai';
7+
import { AIType } from '@/typings/ai';
98

109
export const enum SyncModelType {
1110
AUTO = 0,
@@ -18,15 +17,14 @@ interface IProps {
1817
tables?: string[];
1918
syncTableModel: number;
2019
selectedTables?: string[];
21-
remainingUse?: IRemainingUse;
2220
aiType: AIType;
2321
remainingBtnLoading: boolean;
2422
disabled?: boolean;
2523
isStream?: boolean;
2624
onPressEnter: (value: string) => void;
2725
onSelectTableSyncModel: (model: number) => void;
2826
onSelectTables?: (tables: string[]) => void;
29-
onClickRemainBtn: Function;
27+
// onClickRemainBtn: Function;
3028
onCancelStream: () => void;
3129
}
3230

@@ -45,7 +43,7 @@ const ChatInput = (props: IProps) => {
4543
};
4644

4745
const renderSelectTable = () => {
48-
const { tables, syncTableModel, onSelectTableSyncModel, selectedTables, onSelectTables } = props;
46+
const { tables, onSelectTableSyncModel, selectedTables, onSelectTables } = props;
4947
const options = (tables || []).map((t) => ({ value: t, label: t }));
5048
return (
5149
<div className={styles.aiSelectedTable}>
@@ -83,8 +81,6 @@ const ChatInput = (props: IProps) => {
8381
};
8482

8583
const renderSuffix = () => {
86-
// const remainCnt = props?.remainingUse?.remainingUses ?? '-';
87-
const hasBubble = localStorage.getItem('syncTableBubble');
8884
return (
8985
<div className={styles.suffixBlock}>
9086
{props.isStream ? (

chat2db-client/src/components/ConsoleEditor/components/NewMonacoEditor/index.less

Lines changed: 0 additions & 5 deletions
This file was deleted.

chat2db-client/src/components/ConsoleEditor/components/NewMonacoEditor/index.tsx

Lines changed: 0 additions & 156 deletions
This file was deleted.

chat2db-client/src/components/ConsoleEditor/components/SelectBoundInfo/index.tsx

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import Iconfont from '@/components/Iconfont';
88
import { databaseMap } from '@/constants/database';
99
import styles from './index.less';
1010
import { setRegisterProvider } from '@/store/monaco'
11+
import sqlService from '@/service/sql';
1112

1213
import {
1314
// registerIntelliSenseField,
@@ -59,6 +60,26 @@ const SelectBoundInfo = memo(
5960
getSchemaList();
6061
}, [boundInfo.databaseName]);
6162

63+
const getAllTableNameList = ({
64+
dataSourceId,
65+
databaseName,
66+
schemaName,
67+
}) => {
68+
sqlService
69+
.getAllTableList({
70+
dataSourceId,
71+
databaseName,
72+
schemaName,
73+
})
74+
.then((data) => {
75+
const tableNameListTemp = data.map((t) => t.name);
76+
// setTableNameList(tableNameListTemp);
77+
// if (selectedTables.length === 0) {
78+
// setSelectedTables(tableNameListTemp.slice(0, 1));
79+
// }
80+
});
81+
}
82+
6283
// 获取数据库列表
6384
const getDatabaseList = () => {
6485
connectionService
@@ -92,6 +113,11 @@ const SelectBoundInfo = memo(
92113
if (boundInfo.databaseName === null || boundInfo.databaseName === undefined) {
93114
return;
94115
}
116+
getAllTableNameList({
117+
dataSourceId: boundInfo.dataSourceId,
118+
databaseName: boundInfo.databaseName,
119+
schemaName: boundInfo.schemaName,
120+
});
95121
connectionService
96122
.getSchemaList({
97123
dataSourceId: boundInfo.dataSourceId!,
@@ -136,6 +162,7 @@ const SelectBoundInfo = memo(
136162
databaseName: _databaseName,
137163
schemaName: void 0,
138164
});
165+
139166
historyService.updateSavedConsole({
140167
id: boundInfo.consoleId,
141168
databaseName: _databaseName,

0 commit comments

Comments
 (0)