
import sys
from pathlib import Path

# Add project root to sys.path
root = Path(__file__).resolve().parent.parent
sys.path.append(str(root))

from web.api_server import ApiServer
from config import get_config

class MockCore:
    def __init__(self):
        self.config_mgr = get_config()
        self.llm = None
        self.executor = None

def main():
    print("[*] 正在手动创建/更新系统配置助手...")
    core = MockCore()
    # ApiServer needs core, and it calls _setup_routes which we don't really need but it's fine
    server = ApiServer(core)
    
    # Manually call the ensure methods
    server._ensure_default_agent()
    server._ensure_config_helper()
    
    print("[+] 配置助手创建/更新完成！")
    print(f"[i] 数据目录: {core.config_mgr.data_dir}")
    print(f"[i] Agent 目录: {core.config_mgr.data_dir / 'agents'}")

if __name__ == "__main__":
    main()
