-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup_dev.py
More file actions
50 lines (41 loc) · 1.53 KB
/
Copy pathsetup_dev.py
File metadata and controls
50 lines (41 loc) · 1.53 KB
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
49
50
#!/usr/bin/env python3
"""快速启动脚本"""
import subprocess
import sys
import os
def run(cmd, cwd=None):
print(f" > {cmd}")
result = subprocess.run(cmd, shell=True, cwd=cwd)
if result.returncode != 0:
print(f" 命令执行失败: {cmd}")
sys.exit(1)
def main():
project_root = os.path.dirname(os.path.abspath(__file__))
print("=" * 50)
print("AI Hub 开发环境初始化")
print("=" * 50)
# 后端
print("\n[1/4] 安装后端依赖...")
backend_dir = os.path.join(project_root, "backend")
run(f"{sys.executable} -m pip install -r requirements.txt", cwd=backend_dir)
# 前端
print("\n[2/4] 安装前端依赖...")
frontend_dir = os.path.join(project_root, "frontend")
run("npm install", cwd=frontend_dir)
# CLI
print("\n[3/4] 安装 CLI...")
cli_dir = os.path.join(project_root, "cli")
run(f"{sys.executable} -m pip install -e .", cwd=cli_dir)
# 初始化数据
print("\n[4/4] 导入真实技能数据...")
print(" 请先启动后端服务,然后运行:")
print(f" cd {backend_dir} && {sys.executable} import_real_skills.py")
print("\n" + "=" * 50)
print("初始化完成!启动方式:")
print(f" 后端: cd {backend_dir} && {sys.executable} run.py")
print(f" 前端: cd {frontend_dir} && npm run dev")
print(f" CLI: aihub search gitlab")
print(f" Docker: cd {project_root} && docker-compose up -d")
print("=" * 50)
if __name__ == "__main__":
main()