mirror of
https://github.com/wu736139669/hapi.git
synced 2026-08-08 07:17:39 +00:00
fix(hub,web): query Codex models via machine RPC instead of session cwd (#1186)
SessionChat fetched Codex models through the session-scoped endpoint, so the CLI listed models in the session process cwd, where a missing directory or project-level Codex config could skew or break the result. Use the machine-scoped endpoint (already used by NewSession) and drop the now-unused session route and RPC plumbing. Fixes #1072
This commit is contained in:
@@ -5,7 +5,6 @@ import { queryKeys } from '@/lib/query-keys'
|
||||
|
||||
export function useCodexModels(args: {
|
||||
api: ApiClient | null
|
||||
sessionId?: string | null
|
||||
machineId?: string | null
|
||||
enabled?: boolean
|
||||
}): {
|
||||
@@ -13,11 +12,9 @@ export function useCodexModels(args: {
|
||||
isLoading: boolean
|
||||
error: string | null
|
||||
} {
|
||||
const { api, sessionId, machineId } = args
|
||||
const enabled = Boolean(args.enabled && api && (sessionId || machineId))
|
||||
const queryKey = sessionId
|
||||
? queryKeys.sessionCodexModels(sessionId)
|
||||
: queryKeys.machineCodexModels(machineId ?? 'unknown')
|
||||
const { api, machineId } = args
|
||||
const enabled = Boolean(args.enabled && api && machineId)
|
||||
const queryKey = queryKeys.machineCodexModels(machineId ?? 'unknown')
|
||||
|
||||
const query = useQuery({
|
||||
queryKey,
|
||||
@@ -25,9 +22,6 @@ export function useCodexModels(args: {
|
||||
if (!api) {
|
||||
throw new Error('API unavailable')
|
||||
}
|
||||
if (sessionId) {
|
||||
return await api.getSessionCodexModels(sessionId)
|
||||
}
|
||||
if (machineId) {
|
||||
return await api.getMachineCodexModels(machineId)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user