Compare commits
No commits in common. "6ecb0d70e323d5c861ce7e44be30cc40ce27000f" and "5f1808f108a85a7cfd609e1f00a36971d65776b2" have entirely different histories.
6ecb0d70e3
...
5f1808f108
@ -786,13 +786,8 @@ async def remove_skill(
|
||||
|
||||
# 使用线程池删除目录(避免阻塞事件循环)
|
||||
await asyncio.to_thread(shutil.rmtree, skill_dir_real)
|
||||
logger.info(f"Successfully removed skill directory: {skill_dir_real}")
|
||||
|
||||
# 同步删除 robot 目录下的 skill 副本
|
||||
robot_skill_dir = os.path.join(base_dir, "projects", "robot", bot_id, "skills", skill_name)
|
||||
if os.path.exists(robot_skill_dir):
|
||||
await asyncio.to_thread(shutil.rmtree, robot_skill_dir)
|
||||
logger.info(f"Also removed robot skill directory: {robot_skill_dir}")
|
||||
logger.info(f"Successfully removed skill directory: {skill_dir_real}")
|
||||
|
||||
return {
|
||||
"success": True,
|
||||
|
||||
@ -392,17 +392,16 @@ def _extract_skills_to_robot(bot_id: str, skills: List[str], project_path: Path)
|
||||
Path("skills"),
|
||||
]
|
||||
skills_target_dir = project_path / "robot" / bot_id / "skills"
|
||||
|
||||
# 先清空 skills_target_dir,然后重新复制
|
||||
if skills_target_dir.exists():
|
||||
logger.info(f" Removing existing skills directory: {skills_target_dir}")
|
||||
shutil.rmtree(skills_target_dir)
|
||||
|
||||
skills_target_dir.mkdir(parents=True, exist_ok=True)
|
||||
logger.info(f"Copying skills to {skills_target_dir}")
|
||||
|
||||
for skill in skills:
|
||||
target_dir = skills_target_dir / os.path.basename(skill)
|
||||
|
||||
# 如果目标目录已存在,跳过复制
|
||||
if target_dir.exists():
|
||||
logger.info(f" Skill '{skill}' already exists in {target_dir}, skipping")
|
||||
continue
|
||||
|
||||
source_dir = None
|
||||
|
||||
# 简单名称:按优先级顺序在多个目录中查找
|
||||
@ -417,6 +416,10 @@ def _extract_skills_to_robot(bot_id: str, skills: List[str], project_path: Path)
|
||||
logger.warning(f" Skill directory '{skill}' not found in any source directory: {[str(d) for d in skills_source_dirs]}")
|
||||
continue
|
||||
|
||||
if not source_dir.exists():
|
||||
logger.warning(f" Skill directory not found: {source_dir}")
|
||||
continue
|
||||
|
||||
target_dir = skills_target_dir / os.path.basename(skill)
|
||||
|
||||
try:
|
||||
|
||||
Loading…
Reference in New Issue
Block a user