-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathinit.py
More file actions
87 lines (73 loc) · 2.19 KB
/
Copy pathinit.py
File metadata and controls
87 lines (73 loc) · 2.19 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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
造梦.skill 项目初始化脚本
"""
import sys
from pathlib import Path
def init_project():
"""初始化项目结构"""
# 项目根目录
root = Path.cwd()
print("=== 造梦.skill 项目初始化 ===")
# 创建目录结构
dirs_to_create = [
"data/characters",
"data/relations",
"data/sessions",
"data/corrections",
"src/core",
"src/modules",
"src/utils",
"tests",
"logs"
]
for dir_path in dirs_to_create:
full_path = root / dir_path
full_path.mkdir(parents=True, exist_ok=True)
print(f"创建目录: {dir_path}")
# 创建 __init__.py 文件
init_files = [
"src/__init__.py",
"src/core/__init__.py",
"src/modules/__init__.py",
"src/utils/__init__.py",
"tests/__init__.py"
]
for init_file in init_files:
full_path = root / init_file
if not full_path.exists():
with open(full_path, 'w') as f:
f.write('')
print(f"创建文件: {init_file}")
# 检查配置文件
config_example = root / "config.yaml.example"
if not config_example.exists():
print("错误: config.yaml.example 不存在")
print("请确保项目包含配置文件模板")
return False
# 提示用户配置
print("\n=== 下一步操作 ===")
print("1. 复制配置文件:")
print(" cp config.yaml.example config.yaml")
print("\n2. 编辑 config.yaml,设置:")
print(" - OpenAI 兼容 API 端点")
print(" - API Key")
print(" - 模型名称 (如 gpt-5.3-codex)")
print("\n3. 安装依赖:")
print(" pip install -r requirements.txt")
print("\n4. 运行测试:")
print(" python -m pytest tests/")
return True
if __name__ == "__main__":
try:
success = init_project()
if success:
print("\n✅ 项目初始化完成!")
sys.exit(0)
else:
print("\n❌ 项目初始化失败")
sys.exit(1)
except Exception as e:
print(f"\n错误: {e}")
sys.exit(1)