更新skill manager

This commit is contained in:
朱潮 2026-02-28 11:47:21 +08:00
parent c3d2018a56
commit 4295860f7d

View File

@ -112,6 +112,9 @@ def detect_zip_has_top_level_dirs(zip_path: str) -> bool:
# 跳过空目录项(以 / 结尾的空路径)
if not name or name == '/':
continue
# 跳过 macOS 系统文件夹
if name.startswith('__MACOSX') or name.startswith('.'):
continue
# 提取顶级路径(第一层)
parts = name.split('/')
if parts[0]: # 忽略空字符串
@ -231,6 +234,9 @@ async def validate_and_rename_skill_folder(
if has_top_level_dirs:
# zip 包含目录,检查每个目录
for folder_name in os.listdir(extract_dir):
# 跳过 macOS 系统文件夹和隐藏文件夹
if folder_name.startswith('__MACOSX') or folder_name.startswith('.'):
continue
folder_path = os.path.join(extract_dir, folder_name)
if os.path.isdir(folder_path):
result = await asyncio.to_thread(
@ -678,6 +684,9 @@ async def upload_skill(file: UploadFile = File(...), bot_id: Optional[str] = For
if has_top_level_dirs:
# 获取所有解压后的 skill 目录
for item in os.listdir(final_extract_path):
# 跳过 macOS 系统文件夹和隐藏文件夹
if item.startswith('__MACOSX') or item.startswith('.'):
continue
item_path = os.path.join(final_extract_path, item)
if os.path.isdir(item_path):
skill_dirs_to_validate.append(item_path)