Skip to content

fix(gbc): trim a training caption, and run one parse at a time - #101

Merged
CloverIris merged 2 commits into
mainfrom
feat/gbc-caption-polish
Nov 18, 2026
Merged

CloverIris merged 2 commits into
mainfrom
feat/gbc-caption-polish

Conversation

@CloverIris

@CloverIris CloverIris commented Nov 18, 2026 •

Copy link
Copy Markdown
Member

What and why

Two small follow-ups to #99.

  • Training captions are cleaned before review. trainingCaption(picture) (in shared/gbc.ts) takes the graph's short caption, strips a "This image shows" / "The picture depicts" opener, keeps the first sentence, squeezes whitespace, caps at 200 characters, falls back to the detailed caption, and returns nothing when the graph gave no words. The labeller's draft and 全部接受 both use it, so a suggestion reads like a caption a person would type.
  • One parse job at a time. startGbcJob refuses a second job while one is starting or running (已经有一个解析在跑,先等它完成或停止); two runs would fight over the same models and the same card.

How it was verified

  • pnpm typecheck: all five projects pass.

  • pnpm --filter @clover/desktop exec vitest run --project renderer --project main: 2558 passed, the same 6 Windows-environment failures as main (install/probe, and the pre-existing training/run.test.ts script-quoting assertion that also fails on main).

  • pnpm --filter @clover/desktop exec vitest run --project shared test/shared/gbc.test.ts: 14 passed; the new cases cover opener stripping, the first sentence, Chinese text left alone, whitespace, the summary fallback, empty words and the 200-character cap.

  • ESLint and Prettier clean on the changed files.

  • No new UI, so no e2e change.

  • pnpm typecheck, lint and Prettier, the unit suites above

  • pnpm test:e2e — unchanged behaviour for it

  • pnpm test:install — not needed

  • Docs: none (the reference already says the caption is the short one)

Platforms affected

  • Windows
  • Platform-independent

Notes for the reviewer

The single-job rule is enforced in the main process, so both the Studio panel and the training batch see the same refusal. A queued job that was refused never appears in Events.gbcJob.

…parse at a time

A training caption is now trainingCaption(picture): the graph's short caption, the
'This image shows' opener removed, the first sentence only, at most 200 characters,
falling back to the detailed caption and to nothing. The labeller's draft and 全部接受
both use it.

startGbcJob refuses a second job while one is starting or running: two runs would
fight over the same models and the same card.
The fixture has six pictures without a description; the test reads the first suggestion
(no opener, the short caption), accepts it and checks the caption channel, then skips
the second and checks nothing else was written.
@CloverIris
CloverIris added this pull request to the merge queue Nov 18, 2026
Merged via the queue into main with commit 0200cf0 Nov 18, 2026
7 checks passed
@CloverIris
CloverIris deleted the feat/gbc-caption-polish branch November 18, 2026 15:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant