5
5
useGetCapsQuery ,
6
6
useAgentUsage ,
7
7
useAppDispatch ,
8
+ useGetUser ,
8
9
} from "." ;
9
10
10
11
import { getSelectedChatModel , setChatModel } from "../features/Chat" ;
@@ -22,6 +23,7 @@ export function useCapsForToolUse() {
22
23
const caps = useGetCapsQuery ( ) ;
23
24
const toolUse = useAppSelector ( selectThreadToolUse ) ;
24
25
const usage = useAgentUsage ( ) ;
26
+ const user = useGetUser ( ) ;
25
27
const dispatch = useAppDispatch ( ) ;
26
28
27
29
const defaultCap = caps . data ?. code_chat_default_model ?? "" ;
@@ -63,6 +65,7 @@ export function useCapsForToolUse() {
63
65
} , [ caps . data ?. code_chat_models , toolUse ] ) ;
64
66
65
67
const usableModelsForPlan = useMemo ( ( ) => {
68
+ if ( user . data ?. inference !== "FREE" ) return usableModels ;
66
69
if ( ! usage . aboveUsageLimit && toolUse === "agent" ) return usableModels ;
67
70
return usableModels . map ( ( model ) => {
68
71
if ( ! PAID_AGENT_LIST . includes ( model ) ) return model ;
@@ -74,7 +77,7 @@ export function useCapsForToolUse() {
74
77
toolUse !== "agent" ? `${ model } (Available in agent)` : undefined ,
75
78
} ;
76
79
} ) ;
77
- } , [ usableModels , usage . aboveUsageLimit , toolUse ] ) ;
80
+ } , [ user . data ?. inference , usableModels , usage . aboveUsageLimit , toolUse ] ) ;
78
81
79
82
useEffect ( ( ) => {
80
83
if (
0 commit comments