chatpilot

ChatPilot: Chat Agent Web UI,实现Chat对话前端,支持Google搜索、文件网址对话(RAG)、代码解释器功能,复现了Kimi Chat(文件,拖进来;网址,发出来)。

https://github.com/shibing624/chatpilot

Science Score: 44.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
    Found CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
  • Committers with academic emails
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (10.2%) to scientific vocabulary

Keywords

agent agentica agents chat chatbot chatgpt chatpdf chatpilot kimi langchain llm
Last synced: 6 months ago · JSON representation ·

Repository

ChatPilot: Chat Agent Web UI,实现Chat对话前端,支持Google搜索、文件网址对话(RAG)、代码解释器功能,复现了Kimi Chat(文件,拖进来;网址,发出来)。

Basic Info
  • Host: GitHub
  • Owner: shibing624
  • License: apache-2.0
  • Language: Svelte
  • Default Branch: main
  • Homepage: https://chat.mulanai.com
  • Size: 10 MB
Statistics
  • Stars: 578
  • Watchers: 5
  • Forks: 57
  • Open Issues: 8
  • Releases: 3
Topics
agent agentica agents chat chatbot chatgpt chatpdf chatpilot kimi langchain llm
Created almost 2 years ago · Last pushed 8 months ago
Metadata Files
Readme Contributing License Citation Security

README.md

🇨🇳中文 | 🌐English

Logo

ChatPilot: Chat Agent Web UI

PyPI version Downloads Contributions welcome License Apache 2.0 python_version GitHub issues Wechat Group

ChatPilot: Chat Agent WebUI, 实现了AgentChat对话,支持Google搜索、文件网址对话(RAG)、代码解释器功能,复现Kimi Chat(文件,拖进来;网址,发出来),支持OpenAI/Azure API。

Features

  • 本项目基于Agentica实现了Agent Assistant调用,支持如下功能:
    • 工具调用:支持Agent调用外部工具
    • 联网搜索工具:Google Search API(Serper/DuckDuckGo)
    • URL自动解析工具:复现了Kimi Chat网址发出来功能
    • Python代码解释器:支持E2B虚拟环境和本地python编译器环境运行代码
    • 多种LLM接入:支持多种LLM模型以多方式接入,包括使用Ollama Api接入各种本地开源模型;使用litellm Api接入各云服务部署模型;使用OpenAI Api接入GPT系列模型
    • RAG:支持Agent调用RAG文件问答
  • 支持前后端服务分离,前端使用Svelte,后端使用FastAPI
  • 支持语音输入输出,支持图像生成
  • 支持用户管理,权限控制,支持聊天记录导入导出

Demo

Official Demo: https://chat.mulanai.com

Getting Started

Run ChatPilot in Docker

```shell export OPENAIAPIKEY=sk-xxx export OPENAIBASEURL=https://xxx/v1

docker run -it \ -e OPENAIAPIKEY=$WORKSPACEBASE \ -e OPENAIBASEURL=$OPENAIBASEURL \ -e RAGEMBEDDING_MODEL="text-embedding-ada-002" \ -p 8080:8080 --name chatpilot-$(date +%Y%m%d%H%M%S) shibing624/chatpilot:0.0.1 ``` You'll find ChatPilot running at http://0.0.0.0:8080 Enjoy! 😄

本地启动服务

```shell git clone https://github.com/shibing624/ChatPilot.git cd ChatPilot pip install -r requirements.txt

Copying required .env file, and fill in the LLM api key

cp .env.example .env

bash start.sh ``` 好了,现在你的应用正在运行:http://0.0.0.0:8080 Enjoy! 😄

构建前端web

两种方法构建前端: 1. 解压打包并编译好的前端 web/build.zip,解压到项目web目录下。 2. 如果修改了web前端代码,需要自己使用npm重新构建前端: ```sh git clone https://github.com/shibing624/ChatPilot.git cd ChatPilot/

# Building Frontend Using Node.js >= 20.10 cd web npm install npm run build `` 输出:项目web目录产出build`文件夹,包含了前端编译输出文件。

多种LLM接入

使用OpenAI Api接入GPT系列模型

  • 使用OpenAI API,配置环境变量: shell export OPENAI_API_KEY=xxx export OPENAI_BASE_URL=https://api.openai.com/v1 export MODEL_TYPE="openai"

  • 如果使用Azure OpenAI API,需要配置如下环境变量: shell export AZURE_OPENAI_API_KEY= export AZURE_OPENAI_API_VERSION= export AZURE_OPENAI_ENDPOINT= export MODEL_TYPE="azure"

使用Ollama Api接入各种本地开源模型

ollama serve启动ollama服务,然后配置OLLAMA_API_URLexport OLLAMA_API_URL=http://localhost:11413

使用litellm Api接入各云服务部署模型

  1. 安装litellm包:

shell pip install litellm -U

  1. 修改配置文件

chatpilot默认的litellm config文件在~/.cache/chatpilot/data/litellm/config.yaml

修改其内容如下: ```yaml model_list:

- model_name: moonshot-v1-auto # show model name in the UI

litellm_params: # all params accepted by litellm.completion() - https://docs.litellm.ai/docs/completion/input

model: openai/moonshot-v1-auto # MODEL NAME sent to litellm.completion()

api_base: https://api.moonshot.cn/v1

api_key: sk-xx

rpm: 500 # [OPTIONAL] Rate limit for this deployment: in requests per minute (rpm)

  • modelname: deepseek-ai/DeepSeek-Coder # show model name in the UI litellmparams: # all params accepted by litellm.completion() - https://docs.litellm.ai/docs/completion/input model: openai/deepseek-coder # MODEL NAME sent to litellm.completion() # apibase: https://api.deepseek.com/v1 apikey: sk-xx rpm: 500
  • modelname: openai/o1-mini # show model name in the UI litellmparams: # all params accepted by litellm.completion() - https://docs.litellm.ai/docs/completion/input model: o1-mini # MODEL NAME sent to litellm.completion() # apibase: https://api.61798.cn/v1 apikey: sk-xxx rpm: 500 litellmsettings: # module level litellm settings - https://github.com/BerriAI/litellm/blob/main/litellm/init.py dropparams: True set_verbose: False ```

Contact

  • Issue(建议):GitHub issues
  • 邮件我:xuming: xuming624@qq.com
  • 微信我:加我微信号:xuming624, 备注:姓名-公司-NLP 进NLP交流群。

Citation

如果你在研究中使用了ChatPilot,请按如下格式引用:

APA: latex Xu, M. ChatPilot: LLM agent toolkit (Version 0.0.2) [Computer software]. https://github.com/shibing624/ChatPilot

BibTeX: latex @misc{ChatPilot, author = {Ming Xu}, title = {ChatPilot: llm agent}, year = {2024}, publisher = {GitHub}, journal = {GitHub repository}, howpublished = {\url{https://github.com/shibing624/ChatPilot}}, }

License

授权协议为 The Apache License 2.0,可免费用做商业用途。请在产品说明中附加ChatPilot的链接和授权协议。

Contribute

项目代码还很粗糙,如果大家对代码有所改进,欢迎提交回本项目,在提交之前,注意以下两点:

  • tests添加相应的单元测试
  • 使用python -m pytest -v来运行所有单元测试,确保所有单测都是通过的

之后即可提交PR。

Reference

Owner

  • Name: xuming
  • Login: shibing624
  • Kind: user
  • Location: Beijing, China
  • Company: @tencent

Senior Researcher, Machine Learning Developer, Advertising Risk Control.

Citation (CITATION.cff)

cff-version: 1.2.0
message: "If you use this software, please cite it as below."
authors:
  - family-names: Xu
    given-names: Ming
    orcid: https://orcid.org/0000-0003-3402-7159
title: "ChatPilot: build agent toolkit"
version: 0.0.1
date-released: 2024-03-10
url: "https://github.com/shibing624/ChatPilot"

GitHub Events

Total
  • Issues event: 2
  • Watch event: 89
  • Delete event: 1
  • Issue comment event: 2
  • Push event: 16
  • Pull request event: 3
  • Fork event: 8
  • Create event: 1
Last Year
  • Issues event: 2
  • Watch event: 89
  • Delete event: 1
  • Issue comment event: 2
  • Push event: 16
  • Pull request event: 3
  • Fork event: 8
  • Create event: 1

Committers

Last synced: over 1 year ago

All Time
  • Total Commits: 136
  • Total Committers: 1
  • Avg Commits per committer: 136.0
  • Development Distribution Score (DDS): 0.0
Past Year
  • Commits: 136
  • Committers: 1
  • Avg Commits per committer: 136.0
  • Development Distribution Score (DDS): 0.0
Top Committers
Name Email Commits
shibing624 s****4@1****m 136
Committer Domains (Top 20 + Academic)
126.com: 1

Issues and Pull Requests

Last synced: 6 months ago

All Time
  • Total issues: 16
  • Total pull requests: 4
  • Average time to close issues: 2 days
  • Average time to close pull requests: about 1 hour
  • Total issue authors: 12
  • Total pull request authors: 2
  • Average comments per issue: 1.69
  • Average comments per pull request: 0.0
  • Merged pull requests: 3
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 4
  • Pull requests: 4
  • Average time to close issues: N/A
  • Average time to close pull requests: about 1 hour
  • Issue authors: 4
  • Pull request authors: 2
  • Average comments per issue: 0.75
  • Average comments per pull request: 0.0
  • Merged pull requests: 3
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • dongteng (2)
  • BoFan-tunning (2)
  • GodsDusk (2)
  • Hwongyohong (2)
  • lijiajun1997 (1)
  • WALLE-AI (1)
  • wwfcnu (1)
  • lonngxiang (1)
  • guocong231 (1)
  • he-jiahao (1)
  • zhaofangtao (1)
  • ikexue (1)
  • Ruiruiz30 (1)
Pull Request Authors
  • shibing624 (5)
  • eatYmz (2)
Top Labels
Issue Labels
question (9) bug (5) enhancement (3)
Pull Request Labels

Packages

  • Total packages: 1
  • Total downloads:
    • pypi 11 last-month
  • Total dependent packages: 0
  • Total dependent repositories: 0
  • Total versions: 6
  • Total maintainers: 1
pypi.org: chatpilot

Chat Agent toolkit.

  • Versions: 6
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Downloads: 11 Last month
Rankings
Dependent packages count: 9.7%
Average: 37.0%
Dependent repos count: 64.2%
Maintainers (1)
Last synced: 6 months ago

Dependencies

Dockerfile docker
  • base latest build
  • python 3.10-slim-bookworm build
requirements.txt pypi
  • datasets *
  • jieba >=0.39
  • loguru *
  • pandas *
  • scikit-learn *
  • tqdm *
  • transformers >=4.6.0
setup.py pypi
  • datasets *
  • jieba *
  • loguru *
  • pandas *
  • scikit-learn *
  • tqdm *
.github/workflows/macos.yml actions
  • actions/cache v2 composite
  • actions/checkout v2 composite
  • actions/setup-python v2 composite
.github/workflows/ubuntu.yml actions
  • actions/cache v2 composite
  • actions/checkout v2 composite
  • actions/setup-python v2 composite
.github/workflows/windows.yml actions
  • actions/cache v2 composite
  • actions/checkout v2 composite
  • conda-incubator/setup-miniconda v2 composite
web/package-lock.json npm
  • 297 dependencies
web/package.json npm
  • @sveltejs/adapter-auto ^2.0.0 development
  • @sveltejs/adapter-static ^2.0.3 development
  • @sveltejs/kit ^1.30.0 development
  • @tailwindcss/typography ^0.5.10 development
  • @types/bun latest development
  • @typescript-eslint/eslint-plugin ^6.17.0 development
  • @typescript-eslint/parser ^6.17.0 development
  • autoprefixer ^10.4.16 development
  • eslint ^8.56.0 development
  • eslint-config-prettier ^8.5.0 development
  • eslint-plugin-svelte ^2.30.0 development
  • postcss ^8.4.31 development
  • prettier ^2.8.0 development
  • prettier-plugin-svelte ^2.10.1 development
  • svelte ^4.0.5 development
  • svelte-check ^3.4.3 development
  • svelte-confetti ^1.3.2 development
  • tailwindcss ^3.3.3 development
  • tslib ^2.4.1 development
  • typescript ^5.0.0 development
  • vite ^4.4.2 development
  • @sveltejs/adapter-node ^1.3.1
  • async ^3.2.5
  • dayjs ^1.11.10
  • file-saver ^2.0.5
  • highlight.js ^11.9.0
  • idb ^7.1.1
  • js-sha256 ^0.10.1
  • katex ^0.16.9
  • marked ^9.1.0
  • svelte-sonner ^0.3.19
  • tippy.js ^6.3.7
  • uuid ^9.0.1