Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion .github/workflows/quickstart-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,17 @@ jobs:
..\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:... """)

echo "Packing..."
cd C:/generated_files

- name: Download and extract web dist.zip
shell: pwsh
run: |
# 下载 dist.zip 文件
Invoke-WebRequest -Uri "https://github.com/DarkSkyTeam/chatgpt-for-bot-webui/releases/download/v0.0.1/dist.zip" -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"

- name: Archive production artifacts
uses: actions/upload-artifact@v4
with:
Expand Down
9 changes: 8 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,22 @@ RUN apt-get update && \
RUN export DBUS_SESSION_BUS_ADDRESS=`dbus-daemon --fork --config-file=/usr/share/dbus-1/session.conf --print-address`

RUN mkdir -p /app

WORKDIR /app

COPY requirements.txt /app
RUN pip install --no-cache-dir -r requirements.txt && \

RUN wget https://github.com/DarkSkyTeam/chatgpt-for-bot-webui/releases/download/v0.0.1/dist.zip -O dist.zip \
&& unzip dist.zip -d web \
&& rm dist.zip && \
pip install --no-cache-dir -r requirements.txt && \
pip cache purge && \
python -c "from pycloudflared import try_cloudflare; try_cloudflare(-1)" || true

RUN apt-get remove --purge -yq binutils

COPY . /app

EXPOSE 8080

CMD ["/bin/bash", "/app/docker/start.sh"]
4 changes: 2 additions & 2 deletions framework/web/api/dispatch/routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ async def create_rule():
return jsonify({"error": "Rule ID already exists"}), 400

# 检查工作流是否存在
if not workflow_registry.get_workflow(rule_config.workflow_id):
if not workflow_registry.get(rule_config.workflow_id):
return jsonify({"error": "Workflow not found"}), 400

# 检查规则类型是否存在
Expand Down Expand Up @@ -139,7 +139,7 @@ async def update_rule(rule_id: str):
return jsonify({"error": "Rule not found"}), 404

# 检查工作流是否存在
if not workflow_registry.get_workflow(rule_config.workflow_id):
if not workflow_registry.get(rule_config.workflow_id):
return jsonify({"error": "Workflow not found"}), 400

# 检查规则类型是否存在
Expand Down
23 changes: 21 additions & 2 deletions framework/web/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@
from quart_cors import cors
from hypercorn.config import Config
from hypercorn.asyncio import serve
from werkzeug.exceptions import NotFound
from pathlib import Path

import os
from framework.logger import get_logger, HypercornLoggerWrapper
from framework.ioc.container import DependencyContainer
from .auth.routes import auth_bp
Expand All @@ -21,7 +22,24 @@
from framework.web.auth.services import AuthService, FileBasedAuthService

def create_app(container: DependencyContainer) -> Quart:
app = Quart(__name__, static_folder='web', static_url_path='')
app = Quart(__name__)
app.static_folder = '../../web'

@app.route('/')
async def index():
print("Serving index.html")
return await app.send_static_file('index.html')
@app.route('/<path:path>')
async def serve_static(path):
if path.startswith('backend-api'):
raise NotFound()
try:
return await app.send_static_file(path)
except Exception as e:
return await app.send_static_file('index.html')



app = cors(app) # 启用CORS支持

# 注册蓝图
Expand All @@ -40,6 +58,7 @@ async def inject_container():
g.container = container

app.container = container

return app

class WebServer:
Expand Down