2023-10-29 22:56:57 +00:00
|
|
|
'use client'
|
2023-10-26 00:48:18 +00:00
|
|
|
|
2023-12-08 16:15:26 +00:00
|
|
|
import useSWR, { SWRResponse } from 'swr'
|
2023-12-08 04:40:45 +00:00
|
|
|
|
2023-12-07 05:52:59 +00:00
|
|
|
import fetcher from '@/lib/tabby/fetcher'
|
2023-10-26 00:48:18 +00:00
|
|
|
|
2023-12-08 16:15:26 +00:00
|
|
|
import { useSession } from '../tabby/auth'
|
|
|
|
|
|
2023-10-26 00:48:18 +00:00
|
|
|
export interface HealthInfo {
|
2023-10-30 21:47:38 +00:00
|
|
|
device: 'metal' | 'cpu' | 'cuda'
|
2023-11-17 22:35:58 +00:00
|
|
|
model?: string
|
2023-10-29 22:56:57 +00:00
|
|
|
chat_model?: string
|
2023-10-30 07:29:50 +00:00
|
|
|
cpu_info: string
|
|
|
|
|
cpu_count: number
|
|
|
|
|
cuda_devices: string[]
|
2023-10-29 22:56:57 +00:00
|
|
|
version: {
|
|
|
|
|
build_date: string
|
|
|
|
|
git_describe: string
|
|
|
|
|
}
|
2023-10-26 00:48:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function useHealth(): SWRResponse<HealthInfo> {
|
2023-12-08 16:15:26 +00:00
|
|
|
const { data } = useSession()
|
|
|
|
|
return useSWR(['/v1/health', data?.accessToken], fetcher)
|
2023-10-29 22:56:57 +00:00
|
|
|
}
|