#!/bin/bash
set -e
echo "🚀 ContextEngine 部署脚本"
echo "=========================="
if ! command -v uv &> /dev/null; then
echo "❌ uv 未安装,正在安装..."
curl -LsSf https://astral.sh/uv/install.sh | sh
export PATH="$HOME/.local/bin:$PATH"
fi
echo "✅ uv 版本: $(uv --version)"
echo ""
echo "📦 安装依赖..."
uv sync
echo ""
echo "🔍 检查环境变量..."
if [ -z "$OGMEM_API_KEY" ]; then
echo "⚠️ 警告: OGMEM_API_KEY 未设置"
echo " export OGMEM_API_KEY='sk-...'"
fi
if [ -z "$AGFS_BASE_URL" ]; then
echo "📝 AGFS_BASE_URL 未设置,使用默认值: http://localhost:1833"
export AGFS_BASE_URL="http://localhost:1833"
fi
echo "✅ OGMEM_API_KEY: ${OGMEM_API_KEY:+已设置}"
echo "✅ AGFS_BASE_URL: $AGFS_BASE_URL"
echo ""
echo "🧪 运行测试..."
uv run pytest tests/contract/ -v --tb=short
echo ""
echo "✨ 部署完成!"
echo ""
echo "使用方式:"
echo " uv run python examples/basic_usage.py"
echo " uv run python -m pytest tests/ -v"