Skip to content

Commit bc44ae9

Browse files
Merge pull request #59 from DeepInsight-AI/new_pre
1.2.1 version
2 parents 59b505c + 42bc632 commit bc44ae9

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+547
-598
lines changed

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ https://github.com/DeepInsight-AI/DeepBI/assets/151519374/d1effbe1-5c11-4c77-86e
3838
3 Dashboard : Assemble persistent visualizations into dashboards.\
3939
4 Automated data analysis reports (to be developed) : Complete data analysis reports automatically according to user instructions.\
4040
5 Support multiple data sources, including MySQL, PostgreSQL, Doris, StarRocks, CSV/Excel, etc.\
41-
6 Multi-platform support, support Windows-WSL, Linux, Mac. \
41+
6 Multi-platform support, support Windows-WSL,Windows, Linux, Mac. \
4242
7 International, support Chinese, English.
4343

4444

@@ -104,13 +104,14 @@ git clone http://github.com/DeepInsight-AI/DeepBI.git
104104

105105

106106
## Contact Us
107-
<a><img src="https://github.com/DeepInsight-AI/DeepBI/assets/151519374/b0ba1fc3-8c71-4bf7-bd53-ecf17050581a" width="40%"/></a>
107+
<a><img src="https://github.com/DeepInsight-AI/DeepBI/assets/151519915/1b7d9848-49fb-4f06-bad7-86d751841a6b" width="40%"/></a>
108108

109109

110110

111111
## 📑 Other
112112
- We have tested on Mac OS 12.7/13.X /14.1.1, Ubuntu 20.04/22.04, and Windows11 WSL 22.04.
113113
- Windows 10 requires version 22H2 or higher to install WSL
114+
- The minimum memory requirement for server operation is 1 core 2G memory, and 2 core 4G memory is recommended
114115
- If you have any question, please contact us at dev@deep-insight.co
115116
- <a href="https://github.com/DeepInsight-AI/DeepBI/issues">Issue</a>
116117

README_CN.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
<div align="center">
44

5-
DeepBi是一款AI原生的数据分析平台。DeepBI充分利用大语言模型的能力来探索、查询、可视化和共享来自任何数据源的数据。用户可以使用DeepBI洞察数据并做出数据驱动的决策。
5+
DeepBI是一款AI原生的数据分析平台。DeepBI充分利用大语言模型的能力来探索、查询、可视化和共享来自任何数据源的数据。用户可以使用DeepBI洞察数据并做出数据驱动的决策。
66

77

88
</div>
@@ -44,7 +44,7 @@ https://github.com/DeepInsight-AI/DeepBI/assets/151519374/f0d2fcd4-32b0-4095-a89
4444
3 仪表板大屏:将持久化的可视化图组装为仪表板。\
4545
4 自动化数据分析报告(待开发):根据用户指令自动完成完整的数据分析报告。\
4646
5 多数据源支持,支持 MySQL、PostgreSQL、Doris,Starrocks, CSV/Excel等。\
47-
6 多平台支持,支持 Windows-WSL、Linux、Mac。\
47+
6 多平台支持,支持 Windows-WSL、Windows、Linux、Mac。\
4848
7 国际化,支持中文、英文。
4949

5050

@@ -101,6 +101,7 @@ git clone http://github.com/DeepInsight-AI/DeepBI.git
101101
## 📑 文档
102102
- 我们已经在 Mac OS 12.7/13.X /14.1.1 , Ubuntu 20.04/22.04 和 Windows11 WSL 22.04 系统测试。
103103
- Windows 10 安装WSL需要 22H2版本,详见 [使用 Docker 安装](Docker_install_CN.md)
104+
- 服务器运行需求 最低 1核心 2G内存,建议2核心 4G内存 以上
104105
- 如果有什么问题,可以联系我们 dev@deep-insight.co
105106
- <a href="https://github.com/DeepInsight-AI/DeepBI/issues">Issue</a>
106107

README_window_cn.md

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,55 @@
2525
![docker_err.jpg](user_manual/cn/exe/12.jpg)
2626

2727
- 以上就是 DeepBI安装过程,使用说明,请点击 [DeepBI 在线使用说明](client/app/assets/images/cn/user_manual_cn.md)
28+
29+
## Exe安装遇到问题解决方案
30+
31+
1. 安装过程提示没有权限 见下图::
32+
![docker err.jpg](user_manual/en/exe/13.png)
33+
- Appear:
34+
```
35+
The files belonging to this database system will be owned by user "00767127".
36+
This user must also own the server process. The database cluster will be initialized with locale "Chinese (Simplified)_China.936".
37+
initdb: could not find suitable text search configuration for locale "Chinese (Simplified)_China.936"
38+
The default text search configuration will be set to "simple".
39+
Data page checksums are disabled. fixing permissions on existing directory C:/DeepBI/pgsqldata ...
40+
initdb: error: could not change permissions of directory "C:/DeepBI/pgsqldata": Permission denied pg_ctl: directory "C:/DeepBI/pgsqldata" is not a database
41+
cluster directory createdb: error: connection to server at "localhost" (::1), port 5432 failed: Connection refused (0x0000274D/10061) Is the server running on that host and accepting TCP/IP connections?
42+
```
43+
- solution:
44+
45+
(1)(1)停止服务,打开命令行,以管理员身份打开,点击window 窗口,直接输入cmd 如下图:
46+
47+
![docker err.jpg](user_manual/cn/exe/14.png)
48+
49+
(2)上面命令命令一般再C:\WINDOWS\system32,转到C:DeepBI 文件夹下,运行 stop.bat
50+
51+
运行: ``` cd ../../DeepBI```
52+
运行: ```stop.bat``` ,等待运行完毕
53+
54+
![docker err.jpg](user_manual/cn/exe/15.png)
55+
56+
(3)删除历史无权限文件
57+
58+
打开 C:\DeepBI 然后删除 .init文件 和 pgsqldata 文件夹
59+
60+
(4)给文件夹权限
61+
62+
![docker err.jpg](user_manual/cn/exe/16.png)
63+
64+
(5)重新打开管理员命令行,到DeepBI下 命令行运行start.bat 等待启动即可
65+
66+
2. 安装完毕设置网页账号登录后一直处于加载中。
67+
68+
![docker err.jpg](user_manual/cn/exe/17.png)
69+
70+
右击页面,选择检查,选择
71+
72+
![docker err.jpg](user_manual/cn/exe/18.png)
73+
74+
如果出现js无法加载
75+
76+
解决方法:
77+
78+
![docker err.jpg](user_manual/cn/exe/18-1.png)
79+

README_window_en.md

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,56 @@
2525
![docker err.jpg](user_manual/en/exe/12.jpg)
2626
- Above is DeepBI installation process, use instructions, [DeepBI user manual](client/app/assets/images/en/user_manual_en.md)
2727

28+
## An error occurred during installation and the solution
29+
30+
1. Promblem: A message indicating no permission is displayed during installation, as fellows:
31+
![docker err.jpg](user_manual/en/exe/13.png)
32+
- Appear:
33+
```
34+
The files belonging to this database system will be owned by user "00767127".
35+
This user must also own the server process. The database cluster will be initialized with locale "Chinese (Simplified)_China.936".
36+
initdb: could not find suitable text search configuration for locale "Chinese (Simplified)_China.936"
37+
The default text search configuration will be set to "simple".
38+
Data page checksums are disabled. fixing permissions on existing directory C:/DeepBI/pgsqldata ...
39+
initdb: error: could not change permissions of directory "C:/DeepBI/pgsqldata": Permission denied pg_ctl: directory "C:/DeepBI/pgsqldata" is not a database
40+
cluster directory createdb: error: connection to server at "localhost" (::1), port 5432 failed: Connection refused (0x0000274D/10061) Is the server running on that host and accepting TCP/IP connections?
41+
```
42+
- solution:
43+
44+
(1)Stop the service and open the command line as an administrator
45+
Click the Window window and enter cmd as shown below:
46+
47+
![docker err.jpg](user_manual/en/exe/14.png)
48+
49+
(2)The command after the above command is generally in the directory C:\WINDOWS\system32,Go to the C:DeepBI folder and run stop.bat
50+
run command: ``` cd ../../DeepBI```
51+
run command: ```stop.bat``` ,then wait for the run to finish
52+
53+
![docker err.jpg](user_manual/en/exe/15.png)
54+
55+
(3) Delete historical files without permission
56+
Open folder C:\DeepBI and delete the “.init” file and the “pgsqldata” folder
57+
58+
(4)Give folder permission
59+
60+
![docker err.jpg](user_manual/en/exe/16.png)
61+
62+
(5)Reopen the administrator command line cmd and go to C:\DeepBI
63+
Run start.bat on the CLI and wait until the command is complete
64+
65+
2. Promblem: After the installation is complete, the web account is keeping loading after login.
66+
67+
![docker err.jpg](user_manual/en/exe/17.png)
68+
69+
Right-click the page, select Check, and select Console
70+
71+
![docker err.jpg](user_manual/en/exe/18.png)
72+
73+
If the js files can not load
74+
75+
Solution:
76+
77+
(1)WIN+R Open the CMD command box and enter "regedit" to enter the registry
78+
79+
(2)In the "Computer /HKEY_CLASSES_ROOT/.js" directory, locate the Content Type key and change its value "text/plain" to "text/javascript"
80+

ai/agents/agent_instance_util.py

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,22 @@
44
from ai.backend.util.write_log import logger
55
import traceback
66
from ai.backend.util.token_util import num_tokens_from_messages
7-
from ai.backend.base_config import request_timeout, max_retry_times, language_chinese, \
8-
language_english, \
9-
local_base_postgresql_info, local_base_mysql_info, local_base_xls_info, \
10-
csv_file_path, python_base_dependency, default_language_mode
117
from ai.agents.prompt import CSV_ECHART_TIPS_MESS, \
128
MYSQL_ECHART_TIPS_MESS, MYSQL_MATPLOTLIB_TIPS_MESS, POSTGRESQL_ECHART_TIPS_MESS
139
from ai.agents.agentchat import (UserProxyAgent, GroupChat, AssistantAgent, GroupChatManager,
1410
PythonProxyAgent, BIProxyAgent, TaskPlannerAgent, TaskSelectorAgent, CheckAgent,
1511
ChartPresenterAgent)
16-
12+
from ai.backend.base_config import CONFIG
13+
14+
max_retry_times = CONFIG.max_retry_times
15+
language_chinese = CONFIG.language_chinese
16+
language_english = CONFIG.language_chinese
17+
default_language_mode = CONFIG.default_language_mode
18+
local_base_postgresql_info = CONFIG.local_base_postgresql_info
19+
local_base_xls_info = CONFIG.local_base_xls_info
20+
local_base_mysql_info = CONFIG.local_base_mysql_info
21+
python_base_dependency = CONFIG.python_base_dependency
22+
request_timeout = CONFIG.request_timeout
1723

1824
class AgentInstanceUtil:
1925
def __init__(
@@ -72,7 +78,7 @@ def set_api_key(self, api_key, api_host=None):
7278
'model': 'gpt-4-1106-preview',
7379
'api_key': self.api_key,
7480
'api_base': api_host,
75-
'api_type': 'azure',
81+
7682
},
7783
]
7884

@@ -1072,7 +1078,7 @@ def set_base_csv_info(self, db_info):
10721078

10731079
tb_desc = {
10741080
"file_comment": table_comment,
1075-
"file_path": csv_file_path + table_name,
1081+
"file_path": CONFIG.csv_file_path + table_name,
10761082
}
10771083
print('tb_desc : ', tb_desc)
10781084
csv_content.append(tb_desc)

ai/agents/agentchat/bi_proxy_agent.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
from ai.backend.util.write_log import logger
1818
from ai.backend.util.token_util import num_tokens_from_messages
1919
import traceback
20-
from ai.backend.base_config import if_hide_sensitive
2120

2221
try:
2322
from termcolor import colored

ai/agents/code_utils.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,10 @@
1111
from ai.agents import oai
1212
import json
1313
import traceback
14-
from ai.backend.base_config import if_hide_sensitive
14+
from ai.backend.base_config import CONFIG
1515

16+
17+
if_hide_sensitive = CONFIG.if_hide_sensitive
1618
try:
1719
import docker
1820
except ImportError:

ai/backend/aidb/aidb.py

Lines changed: 55 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010
import time
1111
from ai.backend.util import base_util
1212
import asyncio
13+
from requests.exceptions import HTTPError
14+
from ai.backend.language_info import LanguageInfo
1315

1416

1517
class AIDB:
@@ -59,6 +61,11 @@ async def get_data_desc(self, q_str):
5961
)
6062
answer_message = planner_user.last_message()["content"]
6163
# print("answer_message: ", answer_message)
64+
except HTTPError as http_err:
65+
traceback.print_exc()
66+
error_message = self.generate_error_message(http_err)
67+
return await self.put_message(500, CONFIG.talker_bi, CONFIG.type_comment_first, error_message)
68+
6269
except Exception as e:
6370
traceback.print_exc()
6471
logger.error("from user:[{}".format(self.user_name) + "] , " + "error: " + str(e))
@@ -132,8 +139,8 @@ async def check_data_base(self, q_str):
132139

133140
qustion_message = """Help me check that the following data comments are complete and correct."""
134141

135-
if self.language_mode == CONFIG.language_chinese:
136-
qustion_message = "帮助我检查下列数据注释是否完整且正确: "
142+
# if self.language_mode == CONFIG.language_chinese:
143+
# qustion_message = "帮助我检查下列数据注释是否完整且正确: "
137144

138145
await asyncio.wait_for(planner_user.initiate_chat(
139146
database_describer,
@@ -225,9 +232,12 @@ async def put_message(self, state=200, receiver='log', data_type=None, content=N
225232
# await self.ws.send(consume_output)
226233
if self.websocket is not None:
227234
await asyncio.wait_for(self.websocket.send(consume_output), timeout=CONFIG.request_timeout)
228-
print(str(time.strftime("%Y-%m-%d %H:%M:%S",
229-
time.localtime())) + ' ---- ' + "from user:[{}".format(
230-
self.user_name) + "], reply a message:{}".format(consume_output))
235+
236+
send_mess = str(time.strftime("%Y-%m-%d %H:%M:%S",
237+
time.localtime())) + ' ---- ' + "from user:[{}".format(
238+
self.user_name) + "], reply a message:{}".format(consume_output)
239+
print(send_mess)
240+
logger.info(send_mess)
231241

232242
async def check_api_key(self):
233243
# self.agent_instance_util.api_key_use = True
@@ -259,6 +269,12 @@ async def check_api_key(self):
259269
self.agent_instance_util.api_key_use = True
260270

261271
return True
272+
except HTTPError as http_err:
273+
traceback.print_exc()
274+
275+
error_miss_key = self.generate_error_message(http_err, error_message=LanguageInfo.api_key_fail)
276+
await self.put_message(500, CONFIG.talker_log, CONFIG.type_log_data, error_miss_key)
277+
return False
262278
except Exception as e:
263279
traceback.print_exc()
264280
logger.error("from user:[{}".format(self.user_name) + "] , " + "error: " + str(e))
@@ -281,8 +297,7 @@ async def test_api_key(self):
281297
try:
282298
ApiKey, HttpProxyHost, HttpProxyPort, ApiHost = self.load_api_key(token_path)
283299
if ApiKey is None or len(ApiKey) == 0:
284-
await self.put_message(500, CONFIG.talker_log, CONFIG.type_log_data, self.error_miss_key)
285-
return False
300+
return await self.put_message(200, CONFIG.talker_api, CONFIG.type_test, LanguageInfo.no_api_key)
286301

287302
self.agent_instance_util.set_api_key(ApiKey, ApiHost)
288303

@@ -301,28 +316,21 @@ async def test_api_key(self):
301316

302317
self.agent_instance_util.api_key_use = True
303318

304-
if self.language_mode == CONFIG.language_chinese:
305-
return await self.put_message(200, CONFIG.talker_api, CONFIG.type_test, '检测通过')
306-
else:
307-
return await self.put_message(200, CONFIG.talker_api, CONFIG.type_test, 'test success')
319+
return await self.put_message(200, CONFIG.talker_api, CONFIG.type_test, LanguageInfo.api_key_success)
308320

321+
except HTTPError as http_err:
322+
traceback.print_exc()
309323

324+
error_miss_key = self.generate_error_message(http_err, error_message=LanguageInfo.api_key_fail)
325+
return await self.put_message(200, CONFIG.talker_api, CONFIG.type_test, error_miss_key)
310326

311327
except Exception as e:
312328
traceback.print_exc()
313329
logger.error("from user:[{}".format(self.user_name) + "] , " + "error: " + str(e))
314-
315-
if self.language_mode == CONFIG.language_chinese:
316-
return await self.put_message(200, CONFIG.talker_api, CONFIG.type_test, '检测未通过...')
317-
else:
318-
return await self.put_message(200, CONFIG.talker_api, CONFIG.type_test, 'test fail')
330+
return await self.put_message(200, CONFIG.talker_api, CONFIG.type_test, LanguageInfo.api_key_fail)
319331

320332
else:
321-
if self.language_mode == CONFIG.language_chinese:
322-
return await self.put_message(200, CONFIG.talker_api, CONFIG.type_test, '未检测到apikey,请先保存')
323-
else:
324-
return await self.put_message(200, CONFIG.talker_api, CONFIG.type_test,
325-
'apikey not detected, please save first')
333+
return await self.put_message(200, CONFIG.talker_api, CONFIG.type_test, LanguageInfo.no_api_key)
326334

327335
def load_api_key(self, token_path):
328336
ApiKey = None
@@ -349,7 +357,8 @@ def load_api_key(self, token_path):
349357
elif in_use == 'DeepInsight':
350358
ApiKey = data[in_use]['ApiKey']
351359
print('DeepBIApiKey : ', ApiKey)
352-
ApiHost = "https://apiserver.deep-thought.io/proxy"
360+
# ApiHost = "https://apiserver.deep-thought.io/proxy"
361+
ApiHost = CONFIG.ApiHost
353362
else:
354363
ApiKey = data['OpenaiApiKey']
355364
print('OpenaiApiKey : ', ApiKey)
@@ -359,3 +368,27 @@ def load_api_key(self, token_path):
359368
print('HttpProxyPort : ', HttpProxyPort)
360369

361370
return ApiKey, HttpProxyHost, HttpProxyPort, ApiHost
371+
372+
def generate_error_message(self, http_err, error_message=' API ERROR '):
373+
# print(f'HTTP error occurred: {http_err}')
374+
# print(f'Response status code: {http_err.response.status_code}')
375+
# print(f'Response text: {http_err.response.text}')
376+
377+
# error_message = self.error_miss_key
378+
status_code = http_err.response.status_code
379+
if str(http_err.response.text).__contains__('deep-thought'):
380+
if status_code == 401:
381+
error_message = error_message + str(status_code) + ' , APIKEY Empty Error'
382+
elif status_code == 402:
383+
error_message = error_message + str(status_code) + ' , Data Empty Error'
384+
elif status_code == 403:
385+
error_message = error_message + str(status_code) + ' , APIKEY Error'
386+
elif status_code == 404:
387+
error_message = error_message + str(status_code) + ' , Unsupported Ai Engine Error'
388+
elif status_code == 405:
389+
error_message = error_message + str(status_code) + ' , Insufficient Token Error'
390+
elif status_code == 500:
391+
error_message = error_message + str(status_code) + ' , OpenAI API Error, ' + str(http_err.response.text)
392+
else:
393+
error_message = error_message + ' ' + str(status_code) + ' ' + str(http_err.response.text)
394+
return error_message

0 commit comments

Comments
 (0)