ac4af582301a4e8a29245dbba767eba31334ddf9
2
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
640825b09a |
usage: the Requests card's traffic line reads whole, and a row says how many images went by file
matrix0487 on Discord:
- The Requests card's line "↑ 13 GB · ↓ 13 MB · 图片文件省下 44…" was cut
with an ellipsis. It was one nowrap span.
- A row's details say "图片文件省下 10 MB" and should say "10 MB(3 张)".
The card line is now made of whole parts (usageParts, the pattern the
token line has since #2378). A card too narrow for all three puts the
saving on a line of its own. A part that is wider than the card by
itself (German at 420 wide) wraps inside itself; it is never cut.
The count:
- withDeepSeekFiles counts the image blocks it puts a file id in place
of, on each try, and upBytes keeps the most of any one try (a retry
sends the same images again, as the saved bytes are counted).
- It goes into usage.Record as `image_files` (omitempty) beside
image_files_saved.
- packedRow keeps Tries and ImageFiles in int16 each (clamped to
MaxInt16), so the row stays 152 bytes. request_snapshot carries the
new field, and heat_disk hashes Tries as before.
- The detail row says "{size} ({n} image|images)": zh "10 MB(3 张)",
zh-TW 張, ja 枚, de "Bild/Bilder", en "image/images".
- A row from before the count was kept has no image_files and shows
the size alone, with no parentheses. The card's period total gets no
count.
Run on mote, at this tree:
- gofmt -l (clean), go vet ./..., GOOS=linux go vet -tags nogui ./...,
GOOS=windows go vet ./..., go build ./...: ok.
- go test -run 'TestRowImageFilesKept|TestRowBytesKept|TestRowsOfOneSession|
TestDeepSeek|Snapshot|Heat' ./internal/usage ./internal/gateway: ok.
- TestRowImageFilesKept: the count survives pack/unpack beside Tries,
100000 clamps to 32767, an old row reads 0, the JSON has
"image_files":3 and leaves out 0, and packedRow is 152 bytes.
- TestDeepSeekImageFilesCountedInRow: two images in one message and
one again in a later message make 3 in the stored row, twice, and a
request with no image makes 0.
- GUI, BROWSER=chromium and webkit: usage-ledger-bytes runs every
language at 1180 and 420. The 3-image and 1-image rows read in each
language's unit, singular in en and de, and the old row stays bare.
The reporter's period (13 GB, 13 MB, 44 MB) at 1180, 760 and 420 has
every part whole and inside its card.
- The 79 usage-*/led* GUI files (concurrency 2): 641 of 659 pass in
chromium and 637 of 654 in webkit. Every red is filed and red on
origin/main
|
||
|
|
8b70b7d976 |
usage: a request's bytes up and down, and what DeepSeek's image files saved, in Requests
Suggested by @faithleysath (matrix0487 on Discord): the usage ledger now keeps what each request received back (down_bytes) beside what it sent up (up_bytes, #4456), and what DeepSeek's image files (#5407) kept out of the upload (image_files_saved). Shown in Usage → Requests: - a row's details: "Sent upstream", "Received" and "Saved by image files", each only when it is above 0. A row from before has none of them, not 0; - under the Requests card, the period's "↑ up · ↓ down", with "{n} saved by image files" when there is a saving. Its title gives the exact bytes. A period with no counted bytes shows no line. What is counted: - Down bytes are counted as the reply body is read, after Go's transport has undone gzip, so a gzipped reply counts its plain size, not wire bytes. A plugin's row counts the local hop to the plugin host. A 101 body is not wrapped. Every try counts, so a refused try plus the answering one add up (TestLedgerKeepsDownBytes). - Image files saved, per try: the body before the swap minus the body sent, minus the upload bytes this request itself paid (len(b64)/4*3). It can be negative on the turn that uploads; the GUI shows only a saving above 0. Gaps: an upload that finishes after the wait timeout or ctx-done is not subtracted (as with up_bytes); a joined upload flight is paid by the request that started it; multipart overhead is approximate. - packedRow grows by three int32 (152 bytes, still within the test's bound), clamped to the int32 range. Totals sum all three. - settledCountVersion goes 1 → 2, because Totals now count bytes. The settled page, heat and effort caches recount once, on the first start after the update. The heat key hash includes the new fields. Run on mote at |