Skip to content

Commit

Permalink
chore: Update project dependencies and Windows quickstart workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
lss233 committed Feb 22, 2025
1 parent b8c1934 commit 75d6fa2
Show file tree
Hide file tree
Showing 5 changed files with 59 additions and 106 deletions.
69 changes: 0 additions & 69 deletions .github/quickstarts/windows/scripts/初始化.cmd

This file was deleted.

2 changes: 1 addition & 1 deletion .github/quickstarts/windows/scripts/启动.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ TITLE [Kirara AI] AI 系统正在运行...

SET PATH=%cd%\python3.11;%cd%\ffmpeg\bin;%PATH%

cd kirara_ai && python main.py
python -m kirara_ai

TITLE [Kirara AI] AI 系统已停止运行

Expand Down
67 changes: 35 additions & 32 deletions .github/workflows/quickstart-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,23 +28,16 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Generate files

- name: Generate folders
shell: pwsh
run: |
mkdir C:/generated_files
mkdir C:/tmp_files
echo "Creating folders..."
cd C:/generated_files
mkdir kirara_ai
mkdir ffmpeg
cp -r D:\a\chatgpt-mirai-qq-bot\chatgpt-mirai-qq-bot\* C:\generated_files\kirara_ai\
echo "Downloading ffmpeg ..."
Invoke-WebRequest https://www.gyan.dev/ffmpeg/builds/packages/ffmpeg-7.0.2-essentials_build.7z -OutFile C:/tmp_files/ffmpeg.7z
echo "Appreciate the contribution of gyan.dev"
7z x C:/tmp_files/ffmpeg.7z -r -oC:/generated_files/ffmpeg
- name: Download and extract Python
shell: pwsh
run: |
echo "Downloading Python3.11 ..."
Invoke-WebRequest https://www.python.org/ftp/python/3.11.2/python-3.11.2-embed-amd64.zip -OutFile C:/tmp_files/python.zip
7z x C:/tmp_files/python.zip -r -oC:/generated_files/python3.11
Expand All @@ -53,52 +46,62 @@ jobs:
Invoke-WebRequest -URI https://bootstrap.pypa.io/get-pip.py -OutFile C:/generated_files/python3.11/get-pip.py
echo "import site" >> C:/generated_files/python3.11/python311._pth
echo "Moving files..."
mv D:\a\chatgpt-mirai-qq-bot\chatgpt-mirai-qq-bot\.github\quickstarts\windows\ C:/generated_files/files/
- name: Install pip and build tools
shell: pwsh
run: |
C:/generated_files/python3.11/python.exe C:/generated_files/python3.11/get-pip.py
C:/generated_files/python3.11/python.exe -m pip install build
echo "Replacing..."
dir C:/generated_files/files/scripts/
- name: Build wheel package
shell: pwsh
run: |
C:/generated_files/python3.11/python.exe -m build --wheel
cp .github/quickstarts/windows/scripts/启动.cmd C:/generated_files/
cp C:/generated_files/files/scripts/初始化.cmd C:/generated_files/
- name: Install wheel package
shell: pwsh
run: |
C:/generated_files/python3.11/python.exe -m pip install kirara_ai.whl
- name: Download and extract ffmpeg
shell: pwsh
run: |
echo "Downloading ffmpeg ..."
Invoke-WebRequest https://www.gyan.dev/ffmpeg/builds/packages/ffmpeg-7.0.2-essentials_build.7z -OutFile C:/tmp_files/ffmpeg.7z
echo "Appreciate the contribution of gyan.dev"
7z x C:/tmp_files/ffmpeg.7z -r -oC:/generated_files/ffmpeg
- name: Download vc_redist
shell: pwsh
run: |
echo "Downloading vc_redist.exe..."
Invoke-WebRequest -URI https://aka.ms/vs/17/release/vc_redist.x64.exe -OutFile "C:\generated_files\【语音功能依赖】vc_redist.x64.exe"
echo "Downloading packages..."
cd C:/generated_files/kirara_ai
..\python3.11\python.exe C:/generated_files/python3.11/get-pip.py
..\python3.11\python.exe -m pip install -r requirements.txt
..\python3.11\python.exe -c exec("""from pycloudflared import try_cloudflare \ntry: try_cloudflare(-1)\nexcept:... """)
cd C:/generated_files
- name: Download and extract web dist.zip
shell: pwsh
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
# 获取最新的 release 信息
$latestRelease = Invoke-RestMethod -Uri "https://api.github.com/repos/DarkSkyTeam/chatgpt-for-bot-webui/releases" -Headers @{ Authorization = "Bearer $($env:GH_TOKEN)" }
$zipUrl = $latestRelease[0].assets[0].browser_download_url
# 下载 dist.zip 文件
Invoke-WebRequest -Uri $zipUrl -OutFile "C:\generated_files\dist.zip"
# 解压 dist.zip 文件到 C:/generated_files 目录
Expand-Archive -Path "C:\generated_files\dist.zip" -DestinationPath "C:\generated_files\kirara_ai\web"
Expand-Archive -Path "C:\generated_files\dist.zip" -DestinationPath "C:\generated_files\web"
rm C:\generated_files\dist.zip
- name: Archive production artifacts
uses: actions/upload-artifact@v4
with:
name: quickstart-windows-kirara-ai-amd64
path: |
C:\generated_files\
- name: Create Release Archive
if: startsWith(github.ref, 'refs/tags/')
shell: pwsh
run: |
Write-Host "Creating archive for release..."
Compress-Archive -Path C:\generated_files\* -DestinationPath C:\generated_files\quickstart-windows-kirara-ai-amd64.zip
- name: Upload compressed files to release
if: startsWith(github.ref, 'refs/tags/')
uses: svenstaro/upload-release-action@v2
Expand Down
4 changes: 0 additions & 4 deletions kirara_ai/entry.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
# For embedded python
import sys

sys.path.insert(0, ".")

import asyncio
import os
import signal
Expand Down
23 changes: 23 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,29 @@ classifiers = [
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
]
dependencies = [
"pydantic>=2.0.0",
"ruamel.yaml",
"pytest",
"pytest-asyncio",
"python-telegram-bot",
"telegramify-markdown",
"loguru",
"aiohttp",
"requests",
"quart>=0.18.4",
"quart-cors>=0.7.0",
"wechatpy",
"pycryptodome",
"redis[hiredis]",
"bcrypt>=4.0.1",
"PyJWT>=2.8.0",
"hypercorn>=0.15.0",
"psutil>=5.9.0",
"setuptools",
"tomli>=2.0.0",
"pre-commit",
]

[project.urls]
"Homepage" = "https://github.com/lss233/chatgpt-mirai-qq-bot"
Expand Down

0 comments on commit 75d6fa2

Please sign in to comment.