Skip to content
Navigation Menu
Sign in
Products
Platform
GitHub
Repository hosting, code review, and collaboration
Copilot
AI coding agent for tasks, projects and automated work
Build & Ship
Actions
CI/CD and automation
Code Quality
Quality analysis, fixes, and enforcement
Codespaces
Cloud development environments
Secure
Code Security
Vulnerability detection and remediation
Secret Protection
Secret scanning and leak prevention
All Features
Developers
Learn
Documentation
Training
Certifications
Build
Build with Copilot
Customize Copilot
Integrations
Explore
Trending repos
GitHub Sponsors
Events
Changelog
Changelog
Your source for the latest features, improvements, and fixes across GitHub products, all in one place.
Businesses
By Stage
Enterprises
Team
Startups
Nonprofits
By Industry
Healthcare
Financial services
Manufacturing
Government
See all industries
Evaluate GitHub
Why GitHub
Customer Stories
Business insights
Trust Center
Add-ons
GitHub Advanced Security
Enterprise-grade code security
Copilot for business
Enterprise-grade AI features
Premium Support
Enterprise-grade 24/7 support
Resources
Learn & Connect
Documentation
Resource center
Blog
Events & webinars
Community Forum
Customer Stories
Integrations
Support
Customer support
Training
GitHub Status
Company
About
Partners
Changelog
GitHub Universe
GitHub Universe
The event for developers, by developers — talks, workshops, and what’s next for GitHub.
Pricing
Search
/
Sign in
Sign up
Appearance settings
You signed in with another tab or window.
Reload
to refresh your session.
You signed out in another tab or window.
Reload
to refresh your session.
You switched accounts on another tab or window.
Reload
to refresh your session.
Dismiss alert
{{ message }}
OpenDataBox
ST-Raptor
Repository navigation
Code
Issues
5
(5)
Pull requests
Actions
Projects
Security and quality
Insights
More
items
Files
Expand file tree
master
Breadcrumbs
ST-Raptor
/
start_web.py
Copy path
Blame
More file actions
Blame
More file actions
Latest commit
History
History
History
48 lines (38 loc) · 1.42 KB
master
Breadcrumbs
ST-Raptor
/
start_web.py
Copy path
Top
File metadata and controls
Code
Blame
48 lines (38 loc) · 1.42 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
ST-Raptor Web应用启动脚本
使用HTML/CSS/JavaScript前端,不依赖Gradio
"""
import os
import sys
# 确保可以导入项目模块
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
from clean_cache import clear_cache_folder
from utils.constants import CACHE_DIR
# 启动前清理 cache,避免残留旧中间文件
clear_cache_folder(CACHE_DIR)
from web_app import app
import uvicorn
def main():
# 注意:导入app时会初始化日志系统,所以不要在导入前清理日志
# 如果需要清理旧日志,应该在日志系统初始化之后进行
print("🚀 启动 ST-Raptor Web 界面...")
print("📋 访问地址: http://localhost:7860")
print("⏹️ 按 Ctrl+C 停止服务")
print("✨ 使用现代化的暗色主题HTML前端")
# 导入app后,日志系统已经初始化,现在可以记录启动信息
from loguru import logger
logger.info("=" * 60)
logger.info("ST-Raptor Web应用启动")
logger.info("=" * 60)
try:
uvicorn.run(app, host="0.0.0.0", port=7860, log_level="info")
except (KeyboardInterrupt, Exception) as e:
if not isinstance(e, KeyboardInterrupt):
print(f"服务运行出错: {e}")
finally:
print("\n🛑 正在关闭界面并清理环境...")
print("✅ 服务已安全停止。")
if __name__ == "__main__":
main()
You can’t perform that action at this time.