Skip to content

Commit e6e37ba

Browse files
authored
fix: showing usable models if user's plan is not FREE (#522)
1 parent e02d3dd commit e6e37ba

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

refact-agent/gui/src/hooks/useCapsForToolUse.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import {
55
useGetCapsQuery,
66
useAgentUsage,
77
useAppDispatch,
8+
useGetUser,
89
} from ".";
910

1011
import { getSelectedChatModel, setChatModel } from "../features/Chat";
@@ -22,6 +23,7 @@ export function useCapsForToolUse() {
2223
const caps = useGetCapsQuery();
2324
const toolUse = useAppSelector(selectThreadToolUse);
2425
const usage = useAgentUsage();
26+
const user = useGetUser();
2527
const dispatch = useAppDispatch();
2628

2729
const defaultCap = caps.data?.code_chat_default_model ?? "";
@@ -63,6 +65,7 @@ export function useCapsForToolUse() {
6365
}, [caps.data?.code_chat_models, toolUse]);
6466

6567
const usableModelsForPlan = useMemo(() => {
68+
if (user.data?.inference !== "FREE") return usableModels;
6669
if (!usage.aboveUsageLimit && toolUse === "agent") return usableModels;
6770
return usableModels.map((model) => {
6871
if (!PAID_AGENT_LIST.includes(model)) return model;
@@ -74,7 +77,7 @@ export function useCapsForToolUse() {
7477
toolUse !== "agent" ? `${model} (Available in agent)` : undefined,
7578
};
7679
});
77-
}, [usableModels, usage.aboveUsageLimit, toolUse]);
80+
}, [user.data?.inference, usableModels, usage.aboveUsageLimit, toolUse]);
7881

7982
useEffect(() => {
8083
if (

0 commit comments

Comments
 (0)