Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 16 additions & 13 deletions refact-agent/gui/src/features/AgentUsage/AgentUsage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,13 @@ export const AgentUsage: React.FC = () => {
return `You have reached your usage limit of ${maxAgentUsageAmount} messages a day.
You can ${
toolUse === "agent" ? "use agent" : "send messages"
} again tomorrow, or upgrade to PRO.`;
} again tomorrow${plan === "FREE" ? ", or upgrade to PRO." : "."}`;
}

if (agentUsageAmount <= 5) {
return `You have left only ${agentUsageAmount} messages left today. To remove
the limit upgrade to PRO.`;
return `You have left only ${agentUsageAmount} messages left today.${
plan === "FREE" ? " To remove the limit upgrade to PRO." : ""
}`;
}

return `You have ${agentUsageAmount} ${
Expand All @@ -58,16 +59,18 @@ export const AgentUsage: React.FC = () => {
>
<ReloadIcon />
</IconButton>
<LinkButton
size="2"
variant="outline"
href="https://refact.smallcloud.ai/pro"
target="_blank"
onClick={startPollingForUser}
className={styles.upgrade_button}
>
Upgrade now
</LinkButton>
{plan === "FREE" && (
<LinkButton
size="2"
variant="outline"
href="https://refact.smallcloud.ai/pro"
target="_blank"
onClick={startPollingForUser}
className={styles.upgrade_button}
>
Upgrade now
</LinkButton>
)}
</Flex>
</Flex>
</Card>
Expand Down
5 changes: 1 addition & 4 deletions refact-agent/gui/src/hooks/useCapsForToolUse.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { selectThreadToolUse } from "../features/Chat/Thread/selectors";
import {
useAppSelector,
useGetCapsQuery,
useGetUser,
useAgentUsage,
useAppDispatch,
} from ".";
Expand All @@ -23,7 +22,6 @@ export function useCapsForToolUse() {
const caps = useGetCapsQuery();
const toolUse = useAppSelector(selectThreadToolUse);
const usage = useAgentUsage();
const user = useGetUser();
const dispatch = useAppDispatch();

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

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

useEffect(() => {
if (
Expand Down