update parse_skill_frontmatter
This commit is contained in:
parent
3dc119bca8
commit
44b4295a87
@ -4,6 +4,7 @@ import shutil
|
||||
import zipfile
|
||||
import logging
|
||||
import asyncio
|
||||
import yaml
|
||||
from typing import List, Optional
|
||||
from fastapi import APIRouter, HTTPException, Query, UploadFile, File, Form
|
||||
from pydantic import BaseModel
|
||||
@ -294,14 +295,12 @@ def parse_skill_frontmatter(skill_md_path: str) -> Optional[dict]:
|
||||
return None
|
||||
|
||||
frontmatter = frontmatter_match.group(1)
|
||||
metadata = {}
|
||||
|
||||
# Parse key: value pairs from frontmatter
|
||||
for line in frontmatter.split('\n'):
|
||||
line = line.strip()
|
||||
if ':' in line:
|
||||
key, value = line.split(':', 1)
|
||||
metadata[key.strip()] = value.strip()
|
||||
# Parse YAML using yaml.safe_load
|
||||
metadata = yaml.safe_load(frontmatter)
|
||||
if not isinstance(metadata, dict):
|
||||
logger.warning(f"Invalid frontmatter format in {skill_md_path}")
|
||||
return None
|
||||
|
||||
# Return name and description if both exist
|
||||
if 'name' in metadata and 'description' in metadata:
|
||||
|
||||
Loading…
Reference in New Issue
Block a user