wip: zen
This commit is contained in:
parent
f7c2ef876f
commit
62ac45a9c9
1 changed files with 63 additions and 87 deletions
|
|
@ -18,8 +18,9 @@ import { ModelTable } from "../src/schema/model.sql.js"
|
||||||
|
|
||||||
// get input from command line
|
// get input from command line
|
||||||
const identifier = process.argv[2]
|
const identifier = process.argv[2]
|
||||||
|
const verbose = process.argv[process.argv.length - 1] === "-v"
|
||||||
if (!identifier) {
|
if (!identifier) {
|
||||||
console.error("Usage: bun lookup-user.ts <email|workspaceID|apiKey>")
|
console.error("Usage: bun lookup-user.ts <email|workspaceID|apiKey> [-v]")
|
||||||
process.exit(1)
|
process.exit(1)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -223,6 +224,7 @@ async function printWorkspace(workspaceID: string) {
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if (verbose) {
|
||||||
await printTable("28-Day Usage", (tx) =>
|
await printTable("28-Day Usage", (tx) =>
|
||||||
tx
|
tx
|
||||||
.select({
|
.select({
|
||||||
|
|
@ -267,32 +269,6 @@ async function printWorkspace(workspaceID: string) {
|
||||||
return mapped
|
return mapped
|
||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
/*
|
|
||||||
await printTable("Usage", (tx) =>
|
|
||||||
tx
|
|
||||||
.select({
|
|
||||||
model: UsageTable.model,
|
|
||||||
provider: UsageTable.provider,
|
|
||||||
inputTokens: UsageTable.inputTokens,
|
|
||||||
outputTokens: UsageTable.outputTokens,
|
|
||||||
reasoningTokens: UsageTable.reasoningTokens,
|
|
||||||
cacheReadTokens: UsageTable.cacheReadTokens,
|
|
||||||
cacheWrite5mTokens: UsageTable.cacheWrite5mTokens,
|
|
||||||
cacheWrite1hTokens: UsageTable.cacheWrite1hTokens,
|
|
||||||
cost: UsageTable.cost,
|
|
||||||
timeCreated: UsageTable.timeCreated,
|
|
||||||
})
|
|
||||||
.from(UsageTable)
|
|
||||||
.where(eq(UsageTable.workspaceID, workspace.id))
|
|
||||||
.orderBy(sql`${UsageTable.timeCreated} DESC`)
|
|
||||||
.limit(10)
|
|
||||||
.then((rows) =>
|
|
||||||
rows.map((row) => ({
|
|
||||||
...row,
|
|
||||||
cost: `$${(row.cost / 100000000).toFixed(2)}`,
|
|
||||||
})),
|
|
||||||
),
|
|
||||||
)
|
|
||||||
await printTable("Disabled Models", (tx) =>
|
await printTable("Disabled Models", (tx) =>
|
||||||
tx
|
tx
|
||||||
.select({
|
.select({
|
||||||
|
|
@ -309,7 +285,7 @@ async function printWorkspace(workspaceID: string) {
|
||||||
})),
|
})),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
*/
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function formatMicroCents(value: number | null | undefined) {
|
function formatMicroCents(value: number | null | undefined) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue