(page)
| 568 | } |
| 569 | |
| 570 | async function k1(page) { |
| 571 | await galaxyWithJsonb(page); |
| 572 | await explanationDone(page); |
| 573 | await setOutputLimit(page, 48); |
| 574 | await ask(page, 'Explain this class in detail, line by line.'); |
| 575 | const note = page.locator('.cbm-chat-turn').last().locator('details.cbm-chat-limit-note'); |
| 576 | const summary = await note.locator('summary').innerText().catch(() => ''); |
| 577 | await shot(page, 'K1', 'note-collapsed', 'Under the cut answer: "Token limit reached: the answer was cut short".'); |
| 578 | await note.locator('summary').click(); |
| 579 | await wait(400); |
| 580 | const expanded = await note.innerText().catch(() => ''); |
| 581 | await shot(page, 'K1', 'note-expanded', 'The expanded note: the limits the answer ran into, Change the output limit, the larger models with download size.'); |
| 582 | await note.getByRole('button', { name: 'Change the output limit' }).click(); |
| 583 | await wait(700); |
| 584 | const focus = await page.evaluate(() => ({ id: document.activeElement?.id ?? '', dialog: Boolean(document.querySelector('dialog.cbm-agent-settings[open]')) })); |
| 585 | await shot(page, 'K1', 'config-output-focused', 'The button opens the agent configuration with the Output field focused.'); |
| 586 | await page.locator('#cbm-chat-output-tokens').fill('512'); |
| 587 | await page.locator('#cbm-chat-output-tokens').press('Enter'); |
| 588 | await closeConfig(page); |
| 589 | check('K1', 'Cut answer explains the token limit, opens the configuration at Output and lists larger models', summary === 'Token limit reached: the answer was cut short' |
| 590 | && /all 48 output tokens/.test(expanded) && /2,048 tokens/.test(expanded) && /Qwen3 0\.6B · 579 MB download/.test(expanded) && /LFM2\.5 1\.2B · 764 MB download/.test(expanded) |
| 591 | && /Qwen3\.5 2B · 1\.40 GB download/.test(expanded) && focus.dialog && focus.id === 'cbm-chat-output-tokens', { summary, expanded, focus }); |
| 592 | // The automatic variant names both limits as well (completeness check of 2026-10-04). A code file in Explore |
| 593 | // gets up to two model sentences; with 32 output tokens the explanation runs into the limit. |
| 594 | await setOutputLimit(page, 32); |
| 595 | await tab(page, 'explore'); |
| 596 | await openTreeFile(page, 'django/contrib/postgres/aggregates/general.py'); |
| 597 | await explanationDone(page); |
| 598 | let automatic = ''; |
| 599 | for (let run = 0; run < RUNS + 3 && !automatic; run++) { |
| 600 | const cut = page.locator('.cbm-chat-explanation details.cbm-chat-limit-note'); |
| 601 | if (await cut.count()) { |
| 602 | await cut.locator('summary').click(); |
| 603 | await wait(400); |
| 604 | automatic = await cut.innerText().catch(() => ''); |
| 605 | } else await clickExplainAgain(page); |
| 606 | } |
| 607 | await shot(page, 'K1', 'automatic-note-expanded', 'An automatic explanation cut at 32 output tokens: the note names the output limit and the input limit of automatic explanations and of a chat question.'); |
| 608 | const box = await page.locator('.cbm-chat-explanation details.cbm-chat-limit-note').boundingBox().catch(() => null); |
| 609 | if (box) await shot(page, 'K1', 'automatic-note-crop', 'Crop of the expanded note under the automatic explanation.', { clip: { x: box.x - 8, y: Math.max(0, box.y - 8), width: box.width + 16, height: Math.min(box.height + 16, 420) } }); |
| 610 | await setOutputLimit(page, 512); |
| 611 | check('K1', 'The note under a cut automatic explanation names its input limit and its output limit, and those of a question', /Automatic explanations stop after 32 output tokens/.test(automatic) |
| 612 | && /read at most 1,536 input tokens/.test(automatic) && /may read up to 2,048 input tokens/.test(automatic), { automatic }); |
| 613 | } |
| 614 | |
| 615 | /** Opens a file of the project root (or below) in Explore by clicking its tree row. */ |
| 616 | async function openTreeFile(page, path) { |
nothing calls this directly
no test coverage detected