Revert CLI cost display changes
This commit is contained in:
parent
1c4c0f5525
commit
2bb5e73d51
@ -8,14 +8,7 @@ export type ModelCatalogEntry = {
|
|||||||
provider: string;
|
provider: string;
|
||||||
contextWindow?: number;
|
contextWindow?: number;
|
||||||
reasoning?: boolean;
|
reasoning?: boolean;
|
||||||
confidentialCompute?: boolean;
|
|
||||||
input?: Array<"text" | "image">;
|
input?: Array<"text" | "image">;
|
||||||
cost?: {
|
|
||||||
input: number;
|
|
||||||
output: number;
|
|
||||||
cacheRead: number;
|
|
||||||
cacheWrite: number;
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
type DiscoveredModel = {
|
type DiscoveredModel = {
|
||||||
@ -25,12 +18,6 @@ type DiscoveredModel = {
|
|||||||
contextWindow?: number;
|
contextWindow?: number;
|
||||||
reasoning?: boolean;
|
reasoning?: boolean;
|
||||||
input?: Array<"text" | "image">;
|
input?: Array<"text" | "image">;
|
||||||
cost?: {
|
|
||||||
input: number;
|
|
||||||
output: number;
|
|
||||||
cacheRead: number;
|
|
||||||
cacheWrite: number;
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
type PiSdkModule = typeof import("@mariozechner/pi-coding-agent");
|
type PiSdkModule = typeof import("@mariozechner/pi-coding-agent");
|
||||||
@ -95,24 +82,10 @@ export async function loadModelCatalog(params?: {
|
|||||||
? entry.contextWindow
|
? entry.contextWindow
|
||||||
: undefined;
|
: undefined;
|
||||||
const reasoning = typeof entry?.reasoning === "boolean" ? entry.reasoning : undefined;
|
const reasoning = typeof entry?.reasoning === "boolean" ? entry.reasoning : undefined;
|
||||||
const confidentialCompute =
|
|
||||||
typeof (entry as any)?.confidentialCompute === "boolean"
|
|
||||||
? (entry as any).confidentialCompute
|
|
||||||
: undefined;
|
|
||||||
const input = Array.isArray(entry?.input)
|
const input = Array.isArray(entry?.input)
|
||||||
? (entry.input as Array<"text" | "image">)
|
? (entry.input as Array<"text" | "image">)
|
||||||
: undefined;
|
: undefined;
|
||||||
const cost = entry?.cost ? { ...entry.cost } : undefined;
|
models.push({ id, name, provider, contextWindow, reasoning, input });
|
||||||
models.push({
|
|
||||||
id,
|
|
||||||
name,
|
|
||||||
provider,
|
|
||||||
contextWindow,
|
|
||||||
reasoning,
|
|
||||||
confidentialCompute,
|
|
||||||
input,
|
|
||||||
cost,
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (models.length === 0) {
|
if (models.length === 0) {
|
||||||
|
|||||||
@ -78,19 +78,8 @@ export function toModelRow(params: {
|
|||||||
cfg && authStore
|
cfg && authStore
|
||||||
? hasAuthForProvider(model.provider, cfg, authStore)
|
? hasAuthForProvider(model.provider, cfg, authStore)
|
||||||
: (availableKeys?.has(modelKey(model.provider, model.id)) ?? false);
|
: (availableKeys?.has(modelKey(model.provider, model.id)) ?? false);
|
||||||
|
|
||||||
const mergedTags = new Set(tags);
|
|
||||||
|
|
||||||
const cost = (model as any).cost;
|
|
||||||
if (cost && (cost.input > 0 || cost.output > 0)) {
|
|
||||||
mergedTags.add(`cost:${cost.input}/${cost.output}`);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((model as any).confidentialCompute) {
|
|
||||||
mergedTags.add("TEE");
|
|
||||||
}
|
|
||||||
|
|
||||||
const aliasTags = aliases.length > 0 ? [`alias:${aliases.join(",")}`] : [];
|
const aliasTags = aliases.length > 0 ? [`alias:${aliases.join(",")}`] : [];
|
||||||
|
const mergedTags = new Set(tags);
|
||||||
if (aliasTags.length > 0) {
|
if (aliasTags.length > 0) {
|
||||||
for (const tag of mergedTags) {
|
for (const tag of mergedTags) {
|
||||||
if (tag === "alias" || tag.startsWith("alias:")) mergedTags.delete(tag);
|
if (tag === "alias" || tag.startsWith("alias:")) mergedTags.delete(tag);
|
||||||
|
|||||||
@ -9,7 +9,6 @@ const INPUT_PAD = 10;
|
|||||||
const CTX_PAD = 8;
|
const CTX_PAD = 8;
|
||||||
const LOCAL_PAD = 5;
|
const LOCAL_PAD = 5;
|
||||||
const AUTH_PAD = 5;
|
const AUTH_PAD = 5;
|
||||||
const COST_PAD = 12;
|
|
||||||
|
|
||||||
export function printModelTable(
|
export function printModelTable(
|
||||||
rows: ModelRow[],
|
rows: ModelRow[],
|
||||||
|
|||||||
@ -12,10 +12,6 @@ export type ModelRow = {
|
|||||||
contextWindow: number | null;
|
contextWindow: number | null;
|
||||||
local: boolean | null;
|
local: boolean | null;
|
||||||
available: boolean | null;
|
available: boolean | null;
|
||||||
cost?: {
|
|
||||||
input: number;
|
|
||||||
output: number;
|
|
||||||
};
|
|
||||||
tags: string[];
|
tags: string[];
|
||||||
missing: boolean;
|
missing: boolean;
|
||||||
};
|
};
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user