#!/bin/bash

# LM Studio和Claude Code环境配置脚本
echo "配置LM Studio和Claude Code环境..."

# 检查LM Studio是否安装
if [ -d "/Applications/LM Studio.app" ]; then
    echo "LM Studio已安装"
    
    # 检查LM Studio是否运行
    if ! pgrep -f "LM Studio" > /dev/null; then
        echo "启动LM Studio..."
        open -a "LM Studio"
    else
        echo "LM Studio已在运行"
    fi
else
    echo "LM Studio未安装，请先安装LM Studio"
fi

# 检查Claude Code是否已安装
if command -v claude &> /dev/null; then
    echo "Claude Code已安装"
else
    echo "Claude Code未安装，请先安装Claude Code"
fi

# 创建必要的目录
mkdir -p /tmp/ccr-logs

# 配置环境变量
export LM_STUDIO_URL="http://localhost:1234"
export CLAUDE_CODE_ROUTER_PORT="3456"

echo "环境配置完成"
echo "LM Studio: http://localhost:1234"
echo "Claude Code Router: http://localhost:3456"