qoder 0.2.60: the business record names the model (plugins#692, #638)
Qoder and Qoder CN booked every call as Auto whatever model_config named (chansee97, #692; square-235 on #638 after 0.2.54's model_config change did not help). The reference PR shuishuipingan/qoder2api-hub#119 says the official CLI's business block carries model_key. Checked in the client itself: @qoder-ai/qodercli 1.1.82 (npm pack, read only) builds the record in qoder-worker-runtime (v3 -> snn, then {..., model_key: <chosen model>}) and keeps it for the prompt. Qoder.app 0.4.3 and QwenWorkCN.app 1.0.46 on this Mac build theirs without it, so QwenWork's site says businessModelKey: false and is unchanged. qoderBody now adds business.model_key = the call's model key for qoder and qoder-cn. Run (mote): bun test packages/qoder, 388 pass. With the old index.mjs put back, the 6 new tests fail (business.model_key missing). bun scripts/check.mjs qoder. Not tried: a real Qoder or Qoder CN account, so the billing change is not confirmed; the attribution claim rests on the client's code and the PR's capture.
This commit is contained in:
@@ -2889,7 +2889,14 @@ function parseUsage(env) {
|
||||
const used = turn.reduce((a, p) => a + p.used, 0)
|
||||
const total = turn.reduce((a, p) => a + p.total, 0)
|
||||
for (const p of turn) p.w.aside = true
|
||||
out.windows.unshift({ name: "Total credits", used: Math.min(100, (100 * used) / total), display: `${gfmt(used)} / ${gfmt(total)} ${turn[0].unit}`, amount: used, limit: total, unit: turn[0].unit })
|
||||
const sum = { name: "Total credits", used: Math.min(100, (100 * used) / total), display: `${gfmt(used)} / ${gfmt(total)} ${turn[0].unit}`, amount: used, limit: total, unit: turn[0].unit }
|
||||
// the plan's credits renew when the plan says, and what is left of them
|
||||
// is lost then: routing reads no window set aside, so the whole renews
|
||||
// with the plan's, as WorkBuddy's does (a Teams account renewing
|
||||
// tomorrow was ranked as one that never renews, behind an account
|
||||
// renewing in 18 days: @tnt12231 on X)
|
||||
if (until && turn.some((p) => p.w.resetsAt)) sum.resetsAt = until
|
||||
out.windows.unshift(sum)
|
||||
}
|
||||
const dedicated = field("dedicatedResourcePackages", "dedicated_resource_packages")
|
||||
for (const b of Array.isArray(dedicated) ? dedicated : []) add(b, "Dedicated credits")
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@magpie-community/opencode-qoder-auth",
|
||||
"version": "0.2.66",
|
||||
"version": "0.2.67",
|
||||
"description": "Qoder and QwenWork (千问办公) subscriptions in OpenCode and magpie: qoder.com, qoder.cn, gateway.qwenwork.cn and the enterprise flagship, VPC and dedicated domains",
|
||||
"type": "module",
|
||||
"main": "./opencode.mjs",
|
||||
|
||||
@@ -170,7 +170,7 @@ test("the plan and the resource pack read as Qoder's own panel does, with counts
|
||||
expect(u.plan).toBe("personal_professional")
|
||||
expect(u.until).toBe("2026-11-21T16:00:00.000Z")
|
||||
expect(u.windows).toEqual([
|
||||
{ name: "Total credits", used: (100 * 4217) / 5400, display: "4217 / 5400 credits", amount: 4217, limit: 5400, unit: "credits" },
|
||||
{ name: "Total credits", used: (100 * 4217) / 5400, display: "4217 / 5400 credits", amount: 4217, limit: 5400, unit: "credits", resetsAt: "2026-11-21T16:00:00.000Z" },
|
||||
{ name: "Credits", used: (100 * 1817) / 2000, display: "1817 / 2000 credits", amount: 1817, limit: 2000, unit: "credits", aside: true, resetsAt: "2026-11-21T16:00:00.000Z" },
|
||||
{ name: "Add-on credits", used: (100 * 2400) / 3400, display: "2400 / 3400 credits", amount: 2400, limit: 3400, unit: "credits", aside: true },
|
||||
])
|
||||
@@ -610,3 +610,18 @@ test("usage's user is the card's name, and the accountId stays the identity (rev
|
||||
expect(u.user).toBe("138****8000")
|
||||
expect(auth.accountId).toBe("one@x")
|
||||
})
|
||||
|
||||
test("the total renews with the plan's credits, so routing sees the reset (@tnt12231 on X)", () => {
|
||||
// a Teams account: plan credits 2,336 / 3,000 renewing tomorrow, shared 0 / 1,000
|
||||
const u = _internal.parseUsage({
|
||||
displayMode: "qoder",
|
||||
qoderUsage: {
|
||||
userType: "teams",
|
||||
expiresAt: "2026-11-13T05:04:00.000Z",
|
||||
userQuota: { total: 3000, used: 2336, remaining: 664, unit: "credits" },
|
||||
orgResourcePackage: { total: 1000, used: 0, remaining: 1000, unit: "credits" },
|
||||
},
|
||||
})
|
||||
const counted = u.windows.filter((w) => !w.aside)
|
||||
expect(counted.map((w) => [w.name, w.resetsAt])).toEqual([["Total credits", "2026-11-13T05:04:00.000Z"]])
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user