Repository navigation
fix(gbc): trim a training caption, and run one parse at a time - #101
Merged
Merged
Conversation
…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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What and why
Two small follow-ups to #99.
trainingCaption(picture)(inshared/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.startGbcJobrefuses 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 asmain(install/probe, and the pre-existingtraining/run.test.tsscript-quoting assertion that also fails onmain).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 abovepnpm test:e2e— unchanged behaviour for itpnpm test:install— not neededDocs: none (the reference already says the caption is the short one)
Platforms affected
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.