MCPcopy Index your code
hub / github.com/PierXuY/ChatGPT-Assistant

github.com/PierXuY/ChatGPT-Assistant @main

Chat with this repo
repository ↗ · DeepWiki ↗ · + Follow
49 symbols 122 edges 9 files 0 documented · 0%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

🤖 ChatGPT-Assistant

基于Streamlit搭建的ChatGPT对话助手,简单易用,不易断连,支持以下功能: - 多聊天窗口 - 历史对话留存 - 预设聊天上下文 - 模型参数调节 - 对话导出为Markdown文件 - ChatGPT语音交流(推荐电脑端Edge浏览器)

🤩 已部署项目

  • 直接使用已部署项目,可在网页的设置选项中配置Openai Key,此时不会留存历史对话,仅在用户当前会话有效,他人不会共享。
  • 自行部署项目,在Secrets中配置Openai Key后,将留存历史对话记录,此时需设置为私人应用,打造为个人GPT助理。

使用技巧:

  • 双击页面或按下/键可直接定位输入栏
  • Ctrl + Enter 可快捷提交问题

注意事项:

  • 请勿使用streamlit==1.28.0版本,存在无限rerun的bug

部署

Streamlit Cloud部署(推荐)

轻松免费部署,且无须科学上网即可使用,注意设置为私人应用。
可参考由@Hannah11111提供的详细步骤。 1. Fork本项目到个人Github仓库。 2. 注册Streamlit Cloud账号,并连接到Github。 3. 开始部署应用,具体可参考官方教程
4. 在应用的Secrets中配置Openai Key,具体格式参考下图:

advanced-setting.png set-apikey.png

也可以在部署完成后再进行配置。

本地部署

  1. 建立虚拟环境(建议)

  2. 克隆项目(也可以手动下载到本地)

git clone https://github.com/PierXuY/ChatGPT-Assistant.git
  1. 安装依赖
pip install -r requirements.txt
  1. 设置API Key;设置API Base(可选)

  2. .streamlit/secrets.toml文件中写入apikey = "Openai Key"

  3. .streamlit/secrets.toml文件中写入代理接口即可实现免科学使用,格式为apibase = "代理接口地址",说明如下:
  4. 可以直接使用项目openai-forward已搭建的代理接口,即apibase = "https://api.openai-forward.com/v1"
  5. 可参考openai-forward项目自行搭建代理接口并进行设置。

  6. 启动应用

streamlit run app.py

桌面应用

基于项目package-url打包 - 下载Releases中的程序并安装 - 安装完成后打开即可使用,默认指向的是已部署示例项目 - 打开config文件夹中的conf.json文件,修改url即可指向个人的已部署项目,首次打开需要进行登录,速度较慢

说明

  • custom.py文件中可自定义用户名和SVG格式头像(来源)
  • 在部署的项目源码中编辑set_context.py,即可增加预设定的上下文选项,会自动同步到应用中。
  • 有条件的可以考虑把helper.py中的文件读写逻辑改为云数据库操作,防止历史记录丢失。

致谢

Core symbols most depended-on inside this repo

write_data
called by 5
app.py
show_each_message
called by 4
libs/helper.py
sendMessageToStreamlitClient
called by 3
voice_toolkit/voice_toolkit.js
showPlayBtn
called by 3
voice_toolkit/voice_toolkit.js
sendMessageToStreamlitClient
called by 3
text_toolkit/text_toolkit.js
btnDisplay
called by 3
text_toolkit/text_toolkit.js
btnClass
called by 3
text_toolkit/text_toolkit.js
reset_chat_name_fun
called by 2
app.py

Shape

Function 49

Languages

TypeScript57%
Python43%

Modules by API surface

voice_toolkit/voice_toolkit.js14 symbols
text_toolkit/text_toolkit.js12 symbols
libs/helper.py11 symbols
app.py10 symbols
libs/scripts/inject.js2 symbols

For agents

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

⬇ download graph artifact