goose2 distribution bundling (#8911)
This commit is contained in:
@@ -0,0 +1,6 @@
|
||||
import { invoke } from "@tauri-apps/api/core";
|
||||
import type { DistroBundleInfo } from "@/shared/types/distro";
|
||||
|
||||
export async function getDistroBundle(): Promise<DistroBundleInfo> {
|
||||
return invoke("get_distro_bundle");
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
export * from "./agents";
|
||||
export * from "./acp";
|
||||
export * from "./distro";
|
||||
export * from "./git";
|
||||
export * from "./pathResolver";
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
export interface DistroBundleInfo {
|
||||
present: boolean;
|
||||
appVersion?: string;
|
||||
featureToggles?: Record<string, boolean>;
|
||||
extensionAllowlist?: string;
|
||||
providerAllowlist?: string;
|
||||
}
|
||||
@@ -1,3 +1,4 @@
|
||||
export * from "./distro";
|
||||
export * from "./messages";
|
||||
export * from "./agents";
|
||||
export * from "./chat";
|
||||
|
||||
@@ -12,6 +12,7 @@ import type { ComponentProps } from "react";
|
||||
import { createContext, useContext, useMemo } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { getUsage } from "tokenlens";
|
||||
import { useDistroStore } from "@/features/settings/stores/distroStore";
|
||||
|
||||
const PERCENT_MAX = 100;
|
||||
const ICON_RADIUS = 10;
|
||||
@@ -61,6 +62,13 @@ export const Context = ({
|
||||
);
|
||||
};
|
||||
|
||||
function useCostTrackingEnabled() {
|
||||
const featureToggles = useDistroStore(
|
||||
(state) => state.manifest.featureToggles,
|
||||
);
|
||||
return featureToggles?.costTracking !== false;
|
||||
}
|
||||
|
||||
const ContextIcon = () => {
|
||||
const { t } = useTranslation("common");
|
||||
const { usedTokens, maxTokens } = useContextValue();
|
||||
@@ -199,6 +207,7 @@ export const ContextContentFooter = ({
|
||||
className,
|
||||
...props
|
||||
}: ContextContentFooterProps) => {
|
||||
const costTrackingEnabled = useCostTrackingEnabled();
|
||||
const { t } = useTranslation("common");
|
||||
const { formatNumber } = useLocaleFormatting();
|
||||
const { modelId, usage } = useContextValue();
|
||||
@@ -216,6 +225,10 @@ export const ContextContentFooter = ({
|
||||
style: "currency",
|
||||
});
|
||||
|
||||
if (!costTrackingEnabled) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return (
|
||||
<div
|
||||
className={cn(
|
||||
@@ -241,6 +254,7 @@ const TokensWithCost = ({
|
||||
tokens?: number;
|
||||
costText?: string;
|
||||
}) => {
|
||||
const costTrackingEnabled = useCostTrackingEnabled();
|
||||
const { formatNumber } = useLocaleFormatting();
|
||||
|
||||
return (
|
||||
@@ -250,7 +264,7 @@ const TokensWithCost = ({
|
||||
: formatNumber(tokens, {
|
||||
notation: "compact",
|
||||
})}
|
||||
{costText ? (
|
||||
{costTrackingEnabled && costText ? (
|
||||
<span className="ml-2 text-muted-foreground">• {costText}</span>
|
||||
) : null}
|
||||
</span>
|
||||
|
||||
Reference in New Issue
Block a user