refactor(usage): centralize responseUsage mode
This commit is contained in:
@@ -1,5 +1,9 @@
|
||||
import type { Component, TUI } from "@mariozechner/pi-tui";
|
||||
import { formatThinkingLevels, normalizeUsageDisplay } from "../auto-reply/thinking.js";
|
||||
import {
|
||||
formatThinkingLevels,
|
||||
normalizeUsageDisplay,
|
||||
resolveResponseUsageMode,
|
||||
} from "../auto-reply/thinking.js";
|
||||
import { normalizeAgentId } from "../routing/session-key.js";
|
||||
import { helpText, parseCommand } from "./commands.js";
|
||||
import type { ChatLog } from "./components/chat-log.js";
|
||||
@@ -324,12 +328,7 @@ export function createCommandHandlers(context: CommandHandlerContext) {
|
||||
break;
|
||||
}
|
||||
const currentRaw = state.sessionInfo.responseUsage;
|
||||
const current =
|
||||
currentRaw === "full"
|
||||
? "full"
|
||||
: currentRaw === "tokens" || currentRaw === "on"
|
||||
? "tokens"
|
||||
: "off";
|
||||
const current = resolveResponseUsageMode(currentRaw);
|
||||
const next =
|
||||
normalized ?? (current === "off" ? "tokens" : current === "tokens" ? "full" : "off");
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user