mirror of
https://github.com/chriswritescode-dev/opencode-manager.git
synced 2026-12-05 20:34:18 +01:00
16 lines
532 B
TypeScript
16 lines
532 B
TypeScript
import { useProviders } from '@/hooks/useProviders'
|
|
import type { ModelInfo } from '@opencode-manager/shared/opencode'
|
|
|
|
export function useScheduleModels(enabled: boolean, directory?: string, serverId?: string) {
|
|
const providersQuery = useProviders(directory, { enabled, serverId })
|
|
const availableModels: ModelInfo[] | null =
|
|
providersQuery.isSuccess && !providersQuery.isPlaceholderData
|
|
? providersQuery.data?.models ?? []
|
|
: null
|
|
|
|
return {
|
|
availableModels,
|
|
isLoading: providersQuery.isLoading,
|
|
}
|
|
}
|