day-card 0.2.3: the receipt credits nowdex, whose share card its design follows
randyloop on X pointed out the card looks just like nowdex's share card. Its foot now has a small muted line under the magpie footer, in every language the card speaks: "Design inspired by nowdex.app" (设计灵感来自 / 設計靈感來自 / デザインは…に着想を得ています / Design inspiriert von). The README says so too. Run: bun test packages/day-card on mote (HOME=$(mktemp -d)): 16 pass; the new check is red without the credit field. Rendered the page in Playwright Chromium and WebKit with a stub bridge in en, zh, zh-TW, ja and de and looked at the PNGs: the line sits centred under the footer, inside the paper, no page errors. Not tried: the page inside the real magpie window.
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
# @magpie-community/page-day-card
|
||||
|
||||
A page in [magpie](https://usemagpie.ai)'s window that prints a day of your AI usage as a receipt, a "Daily AI statement" on paper over a backdrop of your choice. It has the day's API-equivalent cost, your streak, requests, errors and the day against your average day before it, then each agent and its models with their logos and costs, and the day's tokens: input, output and the cache hit rate. **Background** picks what the paper lies on: nothing (the paper alone, a transparent PNG), teal, fifteen patterns (gingham, graph paper, kraft, cyanotype, seigaiha waves, xuan paper and more), four landscape photos, or a picture of your own (pick one, drop it on the page or paste it). A slider sets the margin around the paper; a photo also has blur and dim. The choice is kept in the plugin's options. **Copy image** puts the card on the clipboard; **Save PNG** saves it in Downloads.
|
||||
A page in [magpie](https://usemagpie.ai)'s window that prints a day of your AI usage as a receipt, a "Daily AI statement" on paper over a backdrop of your choice. It has the day's API-equivalent cost, your streak, requests, errors and the day against your average day before it, then each agent and its models with their logos and costs, and the day's tokens: input, output and the cache hit rate. Its foot credits [nowdex](https://nowdex.app), whose share card the receipt's design follows. **Background** picks what the paper lies on: nothing (the paper alone, a transparent PNG), teal, fifteen patterns (gingham, graph paper, kraft, cyanotype, seigaiha waves, xuan paper and more), four landscape photos, or a picture of your own (pick one, drop it on the page or paste it). A slider sets the margin around the paper; a photo also has blur and dim. The choice is kept in the plugin's options. **Copy image** puts the card on the clipboard; **Save PNG** saves it in Downloads.
|
||||
|
||||
Install it from magpie's **Plugins › Discover**, or with `magpie plugin add @magpie-community/page-day-card`. It then has a tab, **Day card** (titled in the window's language: 每日用量卡, 1日の使用量カード, Tageskarte), under Plugins in the sidebar, in the app and in `magpie web`. Pick an earlier day with the arrows or the date's menu. The card is shown as large as fits under the toolbar, so a whole day is on one screen; the picture you copy or save is full size.
|
||||
|
||||
@@ -27,4 +27,4 @@ Like every plugin page, it runs in a sandboxed frame with no network (`connect-s
|
||||
bun test packages/day-card
|
||||
```
|
||||
|
||||
中文:在 magpie 窗口里加一个「每日用量卡」页面,把某一天的用量打印成一张小票(Daily AI Statement):当天按 API 价计的费用、连续使用天数、请求数、错误数、与此前日均的倍数,每个 Agent 及其模型(带图标和费用),以及输入、输出 token 和缓存命中率。「背景」可以换成 15 种图案、4 张风景照片或自己的图片(选择、拖入或粘贴),边距可调,照片还可调模糊和压暗。可以「复制图片」到剪贴板,或「保存 PNG」到下载文件夹。只读取声明过的 `usage:day`,运行在无网络的沙盒 frame 里。
|
||||
中文:在 magpie 窗口里加一个「每日用量卡」页面,把某一天的用量打印成一张小票(Daily AI Statement):当天按 API 价计的费用、连续使用天数、请求数、错误数、与此前日均的倍数,每个 Agent 及其模型(带图标和费用),以及输入、输出 token 和缓存命中率。小票底部注明设计灵感来自 [nowdex](https://nowdex.app)。「背景」可以换成 15 种图案、4 张风景照片或自己的图片(选择、拖入或粘贴),边距可调,照片还可调模糊和压暗。可以「复制图片」到剪贴板,或「保存 PNG」到下载文件夹。只读取声明过的 `usage:day`,运行在无网络的沙盒 frame 里。
|
||||
|
||||
@@ -115,6 +115,8 @@ test("the receipt: title, the day, its cost, then its parts", () => {
|
||||
expect(V.card({ ...day, errors: 0 }, "en", {}, now).stats.map((s) => s.label)).toEqual(["STREAK", "REQUESTS", "VS AVERAGE DAY"])
|
||||
// the footer is magpie's, one word of each line bold
|
||||
for (const t of Object.values(V.TEXT)) expect(t.footer[0][1]).toBe("magpie")
|
||||
// and the receipt credits nowdex, whose design it follows, in every language
|
||||
for (const lang of Object.keys(V.TEXT)) expect(V.card(day, lang, {}, now).credit).toContain("nowdex.app")
|
||||
})
|
||||
|
||||
test("agents and their models by cost, each with what was left out", () => {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@magpie-community/page-day-card",
|
||||
"version": "0.2.2",
|
||||
"version": "0.2.3",
|
||||
"description": "A page in magpie's window that draws a day of your AI usage as a card: tokens, cost, each agent and its models, your streak and your average day. Copy it as a picture or save it as a PNG",
|
||||
"files": ["page", "README.md"],
|
||||
"keywords": ["magpie", "magpie-page", "usage", "tokens", "cost", "card"],
|
||||
|
||||
@@ -313,6 +313,15 @@
|
||||
}
|
||||
y += 20;
|
||||
}
|
||||
|
||||
// whose design the receipt follows
|
||||
if (c.credit) {
|
||||
ctx.font = f(400, 9.5);
|
||||
ctx.fillStyle = MUTED;
|
||||
ctx.textAlign = "center";
|
||||
ctx.fillText(c.credit, PW / 2, y);
|
||||
y += 18;
|
||||
}
|
||||
return Math.ceil(y + 4);
|
||||
}
|
||||
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
agentModel: "AGENT / MODEL", cost: "COST",
|
||||
totalTokens: "TOTAL TOKENS", input: "INPUT", output: "OUTPUT", hit: "CACHE HIT RATE",
|
||||
footer: [["Get ", "magpie", " at usemagpie.ai"], ["Every agent's AI usage, on Mac, Windows and Linux"]],
|
||||
credit: "Design inspired by nowdex.app",
|
||||
noCalls: "No calls on this day.", more: (n) => `+${n} MORE`, unpriced: (n) => (n === 1 ? "1 request without a price" : `${n} requests without a price`),
|
||||
noAgent: "NO AGENT NAMED",
|
||||
today: "Today", prev: "Previous day", next: "Next day", copy: "Copy image", copied: "Copied", save: "Save PNG", saved: "Saved to",
|
||||
@@ -29,6 +30,7 @@
|
||||
agentModel: "AGENT / 模型", cost: "费用",
|
||||
totalTokens: "TOKEN 总量", input: "输入", output: "输出", hit: "缓存命中率",
|
||||
footer: [["在 usemagpie.ai 下载 ", "magpie", ""], ["在 Mac、Windows、Linux 上统计每个 Agent 的 AI 用量"]],
|
||||
credit: "设计灵感来自 nowdex.app",
|
||||
noCalls: "这一天没有调用。", more: (n) => `还有 ${n} 个`, unpriced: (n) => `${n} 次请求没有价格`,
|
||||
noAgent: "未标明 AGENT",
|
||||
today: "今天", prev: "前一天", next: "后一天", copy: "复制图片", copied: "已复制", save: "保存 PNG", saved: "已保存到",
|
||||
@@ -44,6 +46,7 @@
|
||||
agentModel: "AGENT / 模型", cost: "費用",
|
||||
totalTokens: "TOKEN 總量", input: "輸入", output: "輸出", hit: "快取命中率",
|
||||
footer: [["在 usemagpie.ai 下載 ", "magpie", ""], ["在 Mac、Windows、Linux 上統計每個 Agent 的 AI 用量"]],
|
||||
credit: "設計靈感來自 nowdex.app",
|
||||
noCalls: "這一天沒有呼叫。", more: (n) => `還有 ${n} 個`, unpriced: (n) => `${n} 次請求沒有價格`,
|
||||
noAgent: "未標明 AGENT",
|
||||
today: "今天", prev: "前一天", next: "後一天", copy: "複製圖片", copied: "已複製", save: "儲存 PNG", saved: "已儲存到",
|
||||
@@ -59,6 +62,7 @@
|
||||
agentModel: "エージェント / モデル", cost: "コスト",
|
||||
totalTokens: "合計トークン", input: "入力", output: "出力", hit: "キャッシュヒット率",
|
||||
footer: [["usemagpie.ai で ", "magpie", " を入手"], ["Mac・Windows・Linux で全エージェントの AI 使用量を"]],
|
||||
credit: "デザインは nowdex.app に着想を得ています",
|
||||
noCalls: "この日の呼び出しはありません。", more: (n) => `ほか ${n} 件`, unpriced: (n) => `価格のないリクエスト ${n} 件`,
|
||||
noAgent: "エージェント名なし",
|
||||
today: "今日", prev: "前の日", next: "次の日", copy: "画像をコピー", copied: "コピーしました", save: "PNG を保存", saved: "保存先",
|
||||
@@ -74,6 +78,7 @@
|
||||
agentModel: "AGENT / MODELL", cost: "KOSTEN",
|
||||
totalTokens: "TOKENS GESAMT", input: "EINGABE", output: "AUSGABE", hit: "CACHE-TREFFERQUOTE",
|
||||
footer: [["Hol dir ", "magpie", " auf usemagpie.ai"], ["Die KI-Nutzung jedes Agents, auf Mac, Windows und Linux"]],
|
||||
credit: "Design inspiriert von nowdex.app",
|
||||
noCalls: "An diesem Tag keine Aufrufe.", more: (n) => `+${n} WEITERE`, unpriced: (n) => (n === 1 ? "1 Anfrage ohne Preis" : `${n} Anfragen ohne Preis`),
|
||||
noAgent: "OHNE AGENT",
|
||||
today: "Heute", prev: "Vorheriger Tag", next: "Nächster Tag", copy: "Bild kopieren", copied: "Kopiert", save: "PNG sichern", saved: "Gesichert in",
|
||||
@@ -214,7 +219,7 @@
|
||||
// The receipt, as the drawing lays it out:
|
||||
// { title, tagline, head[{label, value}], totalLabel, total, totalNote,
|
||||
// stats[], agentHead[2], agents[{name, icon, value, models[{name, icon,
|
||||
// value}], more}], moreAgents, tokens[], note, empty, footer[[a, b, c]] }
|
||||
// value}], more}], moreAgents, tokens[], note, empty, footer[[a, b, c]], credit }
|
||||
// An agent shows its first `models` models by cost, and the card its
|
||||
// first `agents` agents.
|
||||
function card(day, lang, limits = {}, now = new Date()) {
|
||||
@@ -267,6 +272,7 @@
|
||||
note: Number(day.unpriced) > 0 ? t.unpriced(Number(day.unpriced)) : "",
|
||||
empty: calls === 0 ? t.noCalls : "",
|
||||
footer: t.footer,
|
||||
credit: t.credit,
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user