30 lines
755 B
Python
30 lines
755 B
Python
#!/usr/bin/env python
|
|
"""
|
|
启动 Facebook Agent API 服务的脚本
|
|
解决相对导入问题
|
|
"""
|
|
import sys
|
|
import os
|
|
from pathlib import Path
|
|
|
|
# 将当前目录添加到 Python 路径
|
|
current_dir = Path(__file__).parent
|
|
sys.path.insert(0, str(current_dir))
|
|
|
|
# 切换到当前目录,使绝对导入能够工作
|
|
os.chdir(current_dir)
|
|
|
|
# 直接导入 api 模块
|
|
from api import app
|
|
import uvicorn
|
|
|
|
if __name__ == "__main__":
|
|
host = os.getenv("API_HOST", "0.0.0.0")
|
|
port = int(os.getenv("API_PORT", "8000"))
|
|
|
|
print(f"🚀 启动 Facebook 搜索智能 Agent API")
|
|
print(f"📡 监听地址: http://{host}:{port}")
|
|
print(f"📚 API 文档: http://{host}:{port}/docs")
|
|
|
|
uvicorn.run(app, host=host, port=port, log_level="info")
|