Skip to content

Commit

Permalink
Merge pull request #904 from RockChinQ/version/3.4.0
Browse files Browse the repository at this point in the history
Version/3.4.0
  • Loading branch information
RockChinQ authored Nov 17, 2024
2 parents 3cb3562 + 93ee8d5 commit 11db8d8
Show file tree
Hide file tree
Showing 157 changed files with 13,293 additions and 2,074 deletions.
6 changes: 3 additions & 3 deletions .github/ISSUE_TEMPLATE/bug-report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ body:
label: 消息平台适配器
description: "连接QQ使用的框架"
options:
- yiri-mirai(Mirai)
- Nakuru(go-cqhttp)
- aiocqhttp(使用 OneBot 协议接入的)
- qq-botpy(QQ官方API)
- yiri-mirai(Mirai)
validations:
required: false
- type: input
Expand All @@ -23,8 +23,8 @@ body:
required: true
- type: input
attributes:
label: QChatGPT版本
description: QChatGPT版本号
label: LangBot 版本
description: LangBot (QChatGPT) 版本号
placeholder: 例如:v3.3.0,可以使用`!version`命令查看,或者到 pkg/utils/constants.py 查看
validations:
required: true
Expand Down
1 change: 0 additions & 1 deletion .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,4 @@ updates:
schedule:
interval: "weekly"
allow:
- dependency-name: "yiri-mirai-rc"
- dependency-name: "openai"
5 changes: 4 additions & 1 deletion .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,11 @@

### PR 作者完成

- [ ] 阅读仓库[贡献指引](https://github.com/RockChinQ/QChatGPT/blob/master/CONTRIBUTING.md)了吗?
*请在方括号间写`x`以打勾

- [ ] 阅读仓库[贡献指引](https://github.com/RockChinQ/LangBot/blob/master/CONTRIBUTING.md)了吗?
- [ ] 与项目所有者沟通过了吗?
- [ ] 我确定已自行测试所作的更改,确保功能符合预期。

### 项目所有者完成

Expand Down
24 changes: 24 additions & 0 deletions .github/workflows/build-dev-image.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Build Dev Image

on:
push:
workflow_dispatch:

jobs:
build-dev-image:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Generate Tag
id: generate_tag
run: |
# 获取分支名称,把/替换为-
echo ${{ github.ref }} | sed 's/refs\/heads\///g' | sed 's/\//-/g'
echo ::set-output name=tag::$(echo ${{ github.ref }} | sed 's/refs\/heads\///g' | sed 's/\//-/g')
- name: Login to Registry
run: docker login --username=${{ secrets.DOCKER_USERNAME }} --password ${{ secrets.DOCKER_PASSWORD }}
- name: Build Docker Image
run: |
docker buildx create --name mybuilder --use
docker build -t rockchin/langbot:${{ steps.generate_tag.outputs.tag }} . --push
10 changes: 2 additions & 8 deletions .github/workflows/build-docker-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,6 @@ jobs:
export GITHUB_REF=${{ github.ref }}
echo $GITHUB_REF
fi
# - name: Check GITHUB_REF env
# run: echo $GITHUB_REF
# - name: Get version # 在 GitHub Actions 运行环境
# id: get_version
# if: (startsWith(env.GITHUB_REF, 'refs/tags/')||startsWith(github.ref, 'refs/tags/')) && startsWith(github.repository, 'RockChinQ/QChatGPT')
# run: export GITHUB_REF=${GITHUB_REF/refs\/tags\//}
- name: Check version
id: check_version
run: |
Expand All @@ -44,5 +38,5 @@ jobs:
run: docker login --username=${{ secrets.DOCKER_USERNAME }} --password ${{ secrets.DOCKER_PASSWORD }}
- name: Create Buildx
run: docker buildx create --name mybuilder --use
- name: Build # image name: rockchin/qchatgpt:<VERSION>
run: docker buildx build --platform linux/arm64,linux/amd64 -t rockchin/qchatgpt:${{ steps.check_version.outputs.version }} -t rockchin/qchatgpt:latest . --push
- name: Build # image name: rockchin/langbot:<VERSION>
run: docker buildx build --platform linux/arm64,linux/amd64 -t rockchin/langbot:${{ steps.check_version.outputs.version }} -t rockchin/langbot:latest . --push
52 changes: 52 additions & 0 deletions .github/workflows/build-release-artifacts.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Build Release Artifacts

on:
workflow_dispatch:
## 发布release的时候会自动构建
release:
types: [published]

jobs:
build-artifacts:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Check version
id: check_version
run: |
echo $GITHUB_REF
# 如果是tag,则去掉refs/tags/前缀
if [[ $GITHUB_REF == refs/tags/* ]]; then
echo "It's a tag"
echo $GITHUB_REF
echo $GITHUB_REF | awk -F '/' '{print $3}'
echo ::set-output name=version::$(echo $GITHUB_REF | awk -F '/' '{print $3}')
else
echo "It's not a tag"
echo $GITHUB_REF
echo ::set-output name=version::${GITHUB_REF}
fi
- name: Make Temp Directory
run: |
mkdir -p /tmp/langbot_build_web
cp -r . /tmp/langbot_build_web
- name: Setup Node
uses: actions/setup-node@v2
with:
node-version: '22'
- name: Build Web
run: |
cd /tmp/langbot_build_web/web
npm install
npm run build
- name: Package Output
run: |
cp -r /tmp/langbot_build_web/web/dist ./web
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: langbot-${{ steps.check_version.outputs.version }}-all
path: .
43 changes: 0 additions & 43 deletions .github/workflows/sync-wiki.yml

This file was deleted.

8 changes: 5 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@
__pycache__/
database.db
qchatgpt.log
langbot.log
/banlist.py
plugins/
!plugins/__init__.py
/plugins/
!/plugins/__init__.py
/revcfg.py
prompts/
logs/
Expand Down Expand Up @@ -34,4 +35,5 @@ bard.json
res/instance_id.json
.DS_Store
/data
botpy.log*
botpy.log*
/poc
11 changes: 11 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,19 @@
FROM node:22-alpine AS node

WORKDIR /app

COPY web ./web

RUN cd web && npm install && npm run build

FROM python:3.10.13-slim

WORKDIR /app

COPY . .

COPY --from=node /app/web/dist ./web/dist

RUN apt update \
&& apt install gcc -y \
&& python -m pip install -r requirements.txt \
Expand Down
35 changes: 13 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@

<p align="center">
<img src="https://qchatgpt.rockchin.top/langbot-logo.png" alt="LangBot" width="160" />
<img src="https://docs.langbot.app/chrome-512.png" alt="QChatGPT" width="180" />
</p>
<div align="center">

# QChatGPT
# LangBot

<a href="https://trendshift.io/repositories/6187" target="_blank"><img src="https://trendshift.io/api/badge/repositories/6187" alt="RockChinQ%2FQChatGPT | Trendshift" style="width: 250px; height: 55px;" width="250" height="55"/></a>

[![GitHub release (latest by date)](https://img.shields.io/github/v/release/RockChinQ/QChatGPT)](https://github.com/RockChinQ/QChatGPT/releases/latest)
<a href="https://hub.docker.com/repository/docker/rockchin/qchatgpt">
<img src="https://img.shields.io/docker/pulls/rockchin/qchatgpt?color=blue" alt="docker pull">
[![GitHub release (latest by date)](https://img.shields.io/github/v/release/RockChinQ/LangBot)](https://github.com/RockChinQ/LangBot/releases/latest)
<a href="https://hub.docker.com/repository/docker/rockchin/langbot">
<img src="https://img.shields.io/docker/pulls/rockchin/langbot?color=blue" alt="docker pull">
</a>
![Dynamic JSON Badge](https://img.shields.io/badge/dynamic/json?url=https%3A%2F%2Fapi.qchatgpt.rockchin.top%2Fapi%2Fv2%2Fview%2Frealtime%2Fcount_query%3Fminute%3D10080&query=%24.data.count&label=%E4%BD%BF%E7%94%A8%E9%87%8F%EF%BC%887%E6%97%A5%EF%BC%89)
![Dynamic JSON Badge](https://img.shields.io/badge/dynamic/json?url=https%3A%2F%2Fapi.docs.langbot.app%2Fapi%2Fv2%2Fview%2Frealtime%2Fcount_query%3Fminute%3D10080&query=%24.data.count&label=%E4%BD%BF%E7%94%A8%E9%87%8F%EF%BC%887%E6%97%A5%EF%BC%89)
![Wakapi Count](https://wakapi.rockchin.top/api/badge/RockChinQ/interval:any/project:QChatGPT)
<br/>
<img src="https://img.shields.io/badge/python-3.10 | 3.11 | 3.12-blue.svg" alt="python">
Expand All @@ -28,12 +28,12 @@

## 使用文档

<a href="https://qchatgpt.rockchin.top">项目主页</a> |
<a href="https://qchatgpt.rockchin.top/insight/intro.html">功能介绍</a> |
<a href="https://qchatgpt.rockchin.top/insight/guide.html">部署文档</a> |
<a href="https://qchatgpt.rockchin.top/usage/faq.html">常见问题</a> |
<a href="https://qchatgpt.rockchin.top/plugin/plugin-intro.html">插件介绍</a> |
<a href="https://github.com/RockChinQ/QChatGPT/issues/new?assignees=&labels=%E7%8B%AC%E7%AB%8B%E6%8F%92%E4%BB%B6&projects=&template=submit-plugin.yml&title=%5BPlugin%5D%3A+%E8%AF%B7%E6%B1%82%E7%99%BB%E8%AE%B0%E6%96%B0%E6%8F%92%E4%BB%B6">提交插件</a>
<a href="https://docs.langbot.app">项目主页</a> |
<a href="https://docs.langbot.app/insight/intro.htmll">功能介绍</a> |
<a href="https://docs.langbot.app/insight/guide.html">部署文档</a> |
<a href="https://docs.langbot.app/usage/faq.html">常见问题</a> |
<a href="https://docs.langbot.app/plugin/plugin-intro.html">插件介绍</a> |
<a href="https://github.com/RockChinQ/LangBot/issues/new?assignees=&labels=%E7%8B%AC%E7%AB%8B%E6%8F%92%E4%BB%B6&projects=&template=submit-plugin.yml&title=%5BPlugin%5D%3A+%E8%AF%B7%E6%B1%82%E7%99%BB%E8%AE%B0%E6%96%B0%E6%8F%92%E4%BB%B6">提交插件</a>

## 相关链接

Expand All @@ -42,14 +42,5 @@
<a href="https://github.com/RockChinQ/qcg-center">遥测服务端源码</a> |
<a href="https://github.com/the-lazy-me/QChatGPT-Wiki">官方文档储存库</a>


<!--<div align="center">
<hr/>
京东云 4090 单卡 15C90G 实例 <br/>
仅需1.89/小时,包月1225元起 <br/>
可选预装Stable Diffusion等应用,随用随停,计费透明,欢迎首选支持 <br/>
https://3.cn/24A-2NXd
</div>-->

<img alt="回复效果(带有联网插件)" src="https://qchatgpt.rockchin.top/QChatGPT-0516.png" width="500px"/>
<img alt="回复效果(带有联网插件)" src="https://docs.langbot.top/QChatGPT-0516.png" width="500px"/>
</div>
9 changes: 6 additions & 3 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
version: "3"

services:
qchatgpt:
image: rockchin/qchatgpt:latest
langbot:
image: rockchin/langbot:latest
volumes:
- ./data:/app/data
- ./plugins:/app/plugins
restart: on-failure
# 根据具体环境配置网络
ports:
- 5300:5300 # 供 WebUI 使用
- 2280-2290:2280-2290 # 供消息平台适配器方向连接
# 根据具体环境配置网络
45 changes: 28 additions & 17 deletions main.py
Original file line number Diff line number Diff line change
@@ -1,19 +1,23 @@
# QChatGPT 终端启动入口
# LangBot 终端启动入口
# 在此层级解决依赖项检查。
# QChatGPT/main.py
# LangBot/main.py

asciiart = r"""
___ ___ _ _ ___ ___ _____
/ _ \ / __| |_ __ _| |_ / __| _ \_ _|
| (_) | (__| ' \/ _` | _| (_ | _/ | |
\__\_\\___|_||_\__,_|\__|\___|_| |_|
⭐️开源地址: https://github.com/RockChinQ/QChatGPT
📖文档地址: https://q.rkcn.top
_ ___ _
| | __ _ _ _ __ _| _ ) ___| |_
| |__/ _` | ' \/ _` | _ \/ _ \ _|
|____\__,_|_||_\__, |___/\___/\__|
|___/
⭐️开源地址: https://github.com/RockChinQ/LangBot
📖文档地址: https://docs.langbot.app
"""


async def main_entry():
import asyncio


async def main_entry(loop: asyncio.AbstractEventLoop):
print(asciiart)

import sys
Expand Down Expand Up @@ -46,27 +50,34 @@ async def main_entry():
sys.exit(0)

from pkg.core import boot
await boot.main()
await boot.main(loop)


if __name__ == '__main__':
import os
import sys

# 必须大于 3.10.1
if sys.version_info < (3, 10, 1):
print("需要 Python 3.10.1 及以上版本,当前 Python 版本为:", sys.version)
input("按任意键退出...")
exit(1)

# 检查本目录是否有main.py,且包含QChatGPT字符串
# 检查本目录是否有main.py,且包含LangBot字符串
invalid_pwd = False

if not os.path.exists('main.py'):
invalid_pwd = True
else:
with open('main.py', 'r', encoding='utf-8') as f:
content = f.read()
if "QChatGPT/main.py" not in content:
if "LangBot/main.py" not in content:
invalid_pwd = True
if invalid_pwd:
print("请在QChatGPT项目根目录下以命令形式运行此程序。")
print("请在 LangBot 项目根目录下以命令形式运行此程序。")
input("按任意键退出...")
exit(0)
exit(1)

import asyncio
loop = asyncio.new_event_loop()

asyncio.run(main_entry())
loop.run_until_complete(main_entry(loop))
File renamed without changes.
Empty file added pkg/api/http/__init__.py
Empty file.
Empty file.
Loading

0 comments on commit 11db8d8

Please sign in to comment.