mirror of
https://github.com/aljazceru/goose.git
synced 2026-02-05 22:54:33 +01:00
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 { ManualSummarizeButton } from '../context_management/ManualSummaryButton';
|
||||
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_WARNING_THRESHOLD = 0.8; // warning shows at 80% of the token limit
|
||||
@@ -223,12 +224,18 @@ export default function BottomMenu({
|
||||
</div>
|
||||
|
||||
{/* Cost Tracker - no separator before it */}
|
||||
<div className="flex items-center h-full ml-1">
|
||||
<CostTracker inputTokens={inputTokens} outputTokens={outputTokens} sessionCosts={sessionCosts} />
|
||||
</div>
|
||||
|
||||
{/* Separator between cost and model */}
|
||||
<div className="w-[1px] h-4 bg-borderSubtle mx-1.5" />
|
||||
{COST_TRACKING_ENABLED && (
|
||||
<>
|
||||
<div className="flex items-center h-full ml-1">
|
||||
<CostTracker
|
||||
inputTokens={inputTokens}
|
||||
outputTokens={outputTokens}
|
||||
sessionCosts={sessionCosts}
|
||||
/>
|
||||
</div>
|
||||
<div className="w-[1px] h-4 bg-borderSubtle mx-1.5" />
|
||||
</>
|
||||
)}
|
||||
|
||||
{/* Model Selector Dropdown */}
|
||||
<div className="flex items-center h-full">
|
||||
|
||||
@@ -358,7 +358,7 @@ export default function MoreMenu({
|
||||
subtitle="Browse your saved recipes"
|
||||
icon={<FileText className="w-4 h-4" />}
|
||||
>
|
||||
Go to Recipe Library
|
||||
Recipe Library
|
||||
</MenuButton>
|
||||
<MenuButton
|
||||
onClick={() => {
|
||||
|
||||
@@ -4,7 +4,7 @@ import { Button } from '../../ui/button';
|
||||
import { Settings, RefreshCw, ExternalLink } from 'lucide-react';
|
||||
import Modal from '../../Modal';
|
||||
import UpdateSection from './UpdateSection';
|
||||
import { UPDATES_ENABLED } from '../../../updates';
|
||||
import { COST_TRACKING_ENABLED, UPDATES_ENABLED } from '../../../updates';
|
||||
import { getApiUrl, getSecretKey } from '../../../config';
|
||||
|
||||
interface AppSettingsSectionProps {
|
||||
@@ -274,24 +274,26 @@ export default function AppSettingsSection({ scrollToSection }: AppSettingsSecti
|
||||
</div>
|
||||
|
||||
{/* Cost Tracking */}
|
||||
<div className="flex items-center justify-between mb-4">
|
||||
<div>
|
||||
<h3 className="text-textStandard">Cost Tracking</h3>
|
||||
<p className="text-xs text-textSubtle max-w-md mt-[2px]">
|
||||
Show model pricing and usage costs
|
||||
</p>
|
||||
{COST_TRACKING_ENABLED && (
|
||||
<div className="flex items-center justify-between mb-4">
|
||||
<div>
|
||||
<h3 className="text-textStandard">Cost Tracking</h3>
|
||||
<p className="text-xs text-textSubtle max-w-md mt-[2px]">
|
||||
Show model pricing and usage costs
|
||||
</p>
|
||||
</div>
|
||||
<div className="flex items-center">
|
||||
<Switch
|
||||
checked={showPricing}
|
||||
onCheckedChange={handleShowPricingToggle}
|
||||
variant="mono"
|
||||
/>
|
||||
</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 */}
|
||||
{showPricing && (
|
||||
{COST_TRACKING_ENABLED && showPricing && (
|
||||
<>
|
||||
<div className="flex items-center justify-between text-xs mb-2 px-4">
|
||||
<span className="text-textSubtle">Pricing Source:</span>
|
||||
|
||||
@@ -1 +1,2 @@
|
||||
export const UPDATES_ENABLED = true;
|
||||
export const COST_TRACKING_ENABLED = true;
|
||||
|
||||
Reference in New Issue
Block a user