import { type NextRequest, NextResponse } from "next/server"
import { getMindsDBConnector } from "@/lib/mindsdb-connector"
import { getIntelligentSearchService } from "@/services/intelligent-search-service"

export async function GET(request: NextRequest) {
  try {
    const mindsDB = getMindsDBConnector()
    const searchService = getIntelligentSearchService()

    // 获取系统状态
    const systemStatus = await mindsDB.getSystemStatus()
    const searchStats = searchService.getSearchStats()

    return NextResponse.json({
      system: systemStatus,
      search: searchStats,
      timestamp: new Date().toISOString(),
      version: process.env.APP_VERSION || "1.0.0",
    })
  } catch (error) {
    console.error("系统状态API错误:", error)
    return NextResponse.json({ error: "获取系统状态失败" }, { status: 500 })
  }
}
