chore: remove tokenlens and token usage tracking (#1357)

This commit is contained in:
josh 2025-12-15 16:56:10 +00:00 committed by GitHub
parent 5f9e231788
commit 7942e97095
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
17 changed files with 60 additions and 773 deletions

View file

@ -23,7 +23,6 @@ import { useChatVisibility } from "@/hooks/use-chat-visibility";
import type { Vote } from "@/lib/db/schema";
import { ChatSDKError } from "@/lib/errors";
import type { Attachment, ChatMessage } from "@/lib/types";
import type { AppUsage } from "@/lib/usage";
import { fetcher, fetchWithErrorHandlers, generateUUID } from "@/lib/utils";
import { Artifact } from "./artifact";
import { useDataStream } from "./data-stream-provider";
@ -40,7 +39,6 @@ export function Chat({
initialVisibilityType,
isReadonly,
autoResume,
initialLastContext,
}: {
id: string;
initialMessages: ChatMessage[];
@ -48,7 +46,6 @@ export function Chat({
initialVisibilityType: VisibilityType;
isReadonly: boolean;
autoResume: boolean;
initialLastContext?: AppUsage;
}) {
const router = useRouter();
@ -72,7 +69,6 @@ export function Chat({
const { setDataStream } = useDataStream();
const [input, setInput] = useState<string>("");
const [usage, setUsage] = useState<AppUsage | undefined>(initialLastContext);
const [showCreditCardAlert, setShowCreditCardAlert] = useState(false);
const [currentModelId, setCurrentModelId] = useState(initialChatModel);
const currentModelIdRef = useRef(currentModelId);
@ -111,9 +107,6 @@ export function Chat({
}),
onData: (dataPart) => {
setDataStream((ds) => (ds ? [...ds, dataPart] : []));
if (dataPart.type === "data-usage") {
setUsage(dataPart.data);
}
},
onFinish: () => {
mutate(unstable_serialize(getChatHistoryPaginationKey));
@ -204,7 +197,6 @@ export function Chat({
setMessages={setMessages}
status={status}
stop={stop}
usage={usage}
/>
)}
</div>