#!/usr/bin/env python3 """ 配置加载工具 - 简化版本 从 skill config/settings.json 读取配置 """ import os import json from pathlib import Path def load_config(config_path=None): """从配置文件加载配置""" if config_path is None: config_path = Path(__file__).parent.parent / "config" / "settings.json" if config_path.exists(): with open(config_path, "r", encoding="utf-8") as f: config = json.load(f) return config print(f"Config file not found: {config_path}") return None def get_api_key(config_path=None): """获取API Key""" config = load_config(config_path) if config: return config.get("image_api", {}).get("key") return None if __name__ == "__main__": import sys config_path = sys.argv[1] if len(sys.argv) > 1 else None key = get_api_key(config_path) if key: print(f"API Key: {key[:10]}...{key[-10:]}") else: print("No API Key found")