MCPcopy Index your code
hub / github.com/chatbi/chatbi

github.com/chatbi/chatbi @main

Chat with this repo
repository ↗ · DeepWiki ↗ · + Follow
1,181 symbols 4,467 edges 193 files 799 documented · 68%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

ChatBI

中文 | English

ChatBI 是一个通过跟 AI 聊天来进行 BI 分析的系统。

原理分析参考文章:ChatGPT助力可视化方案探索

演示

ava vega

准备

1. 注册 OpenAI 账号

注册 OpenAI 账号,获取 API Key

2. 安装 Node.js 环境

参考:https://nodejs.org/en/learn/getting-started/how-to-install-nodejs

项目使用了 Node.js 中原生 fetch 方法,所以需要 Node.js >= 18,参考:https://nodejs.org/dist/latest-v18.x/docs/api/globals.html#fetch

安装好 Node.js 之后,安装 pnpm:

npm install -g pnpm

3. 服务端配置

进入 server 目录,复制 .env.example.env 并填写环境变量,如下:

# GPT 配置
OPENAI_API_BASE_URL=https://api.openai.com
OPENAI_API_KEY=xxx
OPENAI_MODEL=xxx

# database type
DB_TYPE=mysql
# MySQL
DB_CONNECTION=mysql://test:test@127.0.0.1:3306/test

3.1 服务端配置 - 阿里云灵积

如果你使用阿里云灵积,可以参考以下配置:

# GPT 配置
OPENAI_API_BASE_URL=https://dashscope.aliyuncs.com/compatible-mode
OPENAI_API_KEY=sk-xxx
OPENAI_MODEL=qwen-max

# database type
DB_TYPE=mysql
# MySQL
DB_CONNECTION=mysql://test:test@127.0.0.1:3306/test

更多关于阿里云灵积的信息,参考:阿里云灵积

4. 安装依赖

在项目根目录执行:

pnpm install

5. 启动数据库 (可选)

为了本地开发演示,可以通过 docker 启动 MySQL:

cd ./docker && docker compose up -d

6. 运行

  1. 启动服务端:
$ pnpm run dev:server
  1. 启动客户端:
$ pnpm run dev:client

赞助

如果你觉得这个项目对你有帮助,欢迎赞助我:

微信扫码支持

License

GPL-3.0 license

Extension points exported contracts — how you extend this code

TableProps (Interface)
(no doc)
web/src/components/Table/Table.tsx
ChartConfig (Interface)
(no doc)
chatbi/agent/presets/chart_schema.ts
Props (Interface)
(no doc)
web/src/components/Guide/Guide.tsx
ChartViewProps (Interface)
(no doc)
web/src/components/G2Chart/G2Chart.tsx
VegaProps (Interface)
(no doc)
web/src/components/Vega/index.tsx
MarkdownViewProps (Interface)
(no doc)
web/src/components/MarkdownView/MarkdownBase.tsx

Core symbols most depended-on inside this repo

get
called by 134
chatbi/cache/base.py
execute
called by 48
chatbi/domain/common/repository.py
execute
called by 38
chatbi/database/drivers/base.py
flush
called by 36
chatbi/observability/langfuse_observer.py
to_domain
called by 21
chatbi/domain/mdl/entities.py
get_config
called by 16
chatbi/config.py
set
called by 14
chatbi/cache/base.py
to_domain
called by 14
chatbi/domain/auth/entities.py

Shape

Method 525
Class 287
Function 286
Route 45
Interface 38

Languages

Python88%
TypeScript12%

Modules by API surface

chatbi/domain/datasource/dtos.py50 symbols
chatbi/domain/common/repository.py37 symbols
chatbi/domain/mdl/repository.py32 symbols
chatbi/observability/metrics.py31 symbols
chatbi/middleware/error_handler.py28 symbols
chatbi/domain/auth/repository.py28 symbols
chatbi/database/database.py28 symbols
chatbi/exceptions.py27 symbols
chatbi/exceptions/__init__.py26 symbols
chatbi/domain/mdl/router.py23 symbols
chatbi/database/qdrant.py23 symbols
chatbi/domain/datasource/models.py22 symbols

Datastores touched

(mysql)Database · 1 repos
postgresDatabase · 1 repos

For agents

$ claude mcp add chatbi \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact