Add flag for showing cost tracking (#3090)
This commit is contained in:
@@ -10,6 +10,7 @@ import { useModelAndProvider } from '../ModelAndProviderContext';
|
|||||||
import { Message } from '../../types/message';
|
import { Message } from '../../types/message';
|
||||||
import { ManualSummarizeButton } from '../context_management/ManualSummaryButton';
|
import { ManualSummarizeButton } from '../context_management/ManualSummaryButton';
|
||||||
import { CostTracker } from './CostTracker';
|
import { CostTracker } from './CostTracker';
|
||||||
|
import { COST_TRACKING_ENABLED } from '../../updates';
|
||||||
|
|
||||||
const TOKEN_LIMIT_DEFAULT = 128000; // fallback for custom models that the backend doesn't know about
|
const TOKEN_LIMIT_DEFAULT = 128000; // fallback for custom models that the backend doesn't know about
|
||||||
const TOKEN_WARNING_THRESHOLD = 0.8; // warning shows at 80% of the token limit
|
const TOKEN_WARNING_THRESHOLD = 0.8; // warning shows at 80% of the token limit
|
||||||
@@ -223,12 +224,18 @@ export default function BottomMenu({
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* Cost Tracker - no separator before it */}
|
{/* Cost Tracker - no separator before it */}
|
||||||
<div className="flex items-center h-full ml-1">
|
{COST_TRACKING_ENABLED && (
|
||||||
<CostTracker inputTokens={inputTokens} outputTokens={outputTokens} sessionCosts={sessionCosts} />
|
<>
|
||||||
</div>
|
<div className="flex items-center h-full ml-1">
|
||||||
|
<CostTracker
|
||||||
{/* Separator between cost and model */}
|
inputTokens={inputTokens}
|
||||||
<div className="w-[1px] h-4 bg-borderSubtle mx-1.5" />
|
outputTokens={outputTokens}
|
||||||
|
sessionCosts={sessionCosts}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<div className="w-[1px] h-4 bg-borderSubtle mx-1.5" />
|
||||||
|
</>
|
||||||
|
)}
|
||||||
|
|
||||||
{/* Model Selector Dropdown */}
|
{/* Model Selector Dropdown */}
|
||||||
<div className="flex items-center h-full">
|
<div className="flex items-center h-full">
|
||||||
|
|||||||
@@ -358,7 +358,7 @@ export default function MoreMenu({
|
|||||||
subtitle="Browse your saved recipes"
|
subtitle="Browse your saved recipes"
|
||||||
icon={<FileText className="w-4 h-4" />}
|
icon={<FileText className="w-4 h-4" />}
|
||||||
>
|
>
|
||||||
Go to Recipe Library
|
Recipe Library
|
||||||
</MenuButton>
|
</MenuButton>
|
||||||
<MenuButton
|
<MenuButton
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import { Button } from '../../ui/button';
|
|||||||
import { Settings, RefreshCw, ExternalLink } from 'lucide-react';
|
import { Settings, RefreshCw, ExternalLink } from 'lucide-react';
|
||||||
import Modal from '../../Modal';
|
import Modal from '../../Modal';
|
||||||
import UpdateSection from './UpdateSection';
|
import UpdateSection from './UpdateSection';
|
||||||
import { UPDATES_ENABLED } from '../../../updates';
|
import { COST_TRACKING_ENABLED, UPDATES_ENABLED } from '../../../updates';
|
||||||
import { getApiUrl, getSecretKey } from '../../../config';
|
import { getApiUrl, getSecretKey } from '../../../config';
|
||||||
|
|
||||||
interface AppSettingsSectionProps {
|
interface AppSettingsSectionProps {
|
||||||
@@ -274,24 +274,26 @@ export default function AppSettingsSection({ scrollToSection }: AppSettingsSecti
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* Cost Tracking */}
|
{/* Cost Tracking */}
|
||||||
<div className="flex items-center justify-between mb-4">
|
{COST_TRACKING_ENABLED && (
|
||||||
<div>
|
<div className="flex items-center justify-between mb-4">
|
||||||
<h3 className="text-textStandard">Cost Tracking</h3>
|
<div>
|
||||||
<p className="text-xs text-textSubtle max-w-md mt-[2px]">
|
<h3 className="text-textStandard">Cost Tracking</h3>
|
||||||
Show model pricing and usage costs
|
<p className="text-xs text-textSubtle max-w-md mt-[2px]">
|
||||||
</p>
|
Show model pricing and usage costs
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
<div className="flex items-center">
|
||||||
|
<Switch
|
||||||
|
checked={showPricing}
|
||||||
|
onCheckedChange={handleShowPricingToggle}
|
||||||
|
variant="mono"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div className="flex items-center">
|
)}
|
||||||
<Switch
|
|
||||||
checked={showPricing}
|
|
||||||
onCheckedChange={handleShowPricingToggle}
|
|
||||||
variant="mono"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{/* Pricing Status - only show if cost tracking is enabled */}
|
{/* Pricing Status - only show if cost tracking is enabled */}
|
||||||
{showPricing && (
|
{COST_TRACKING_ENABLED && showPricing && (
|
||||||
<>
|
<>
|
||||||
<div className="flex items-center justify-between text-xs mb-2 px-4">
|
<div className="flex items-center justify-between text-xs mb-2 px-4">
|
||||||
<span className="text-textSubtle">Pricing Source:</span>
|
<span className="text-textSubtle">Pricing Source:</span>
|
||||||
|
|||||||
@@ -1 +1,2 @@
|
|||||||
export const UPDATES_ENABLED = true;
|
export const UPDATES_ENABLED = true;
|
||||||
|
export const COST_TRACKING_ENABLED = true;
|
||||||
|
|||||||
Reference in New Issue
Block a user