fix(chat): tidy answer layout — strip in one fixed slot reserved from the first frame, dates only in the strip, one footer line, legend on the heading row, round jump button, title checks, dark strip tones (BUG-2320)
Independent Staging Quality Gate / validate-frontend (push) Successful in 5m56s
Independent Staging Quality Gate / validate-python (push) Successful in 7m56s
Independent Staging Quality Gate / publish (push) Successful in 3m40s

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DbBXp2Vp62Ur3C7yRWQdSq
This commit is contained in:
2026-11-24 16:00:23 +08:00
co-authored by Claude Opus 5.5
parent f5aa7a52f4
commit 9133e58e57
18 changed files with 627 additions and 103 deletions
+30
View File
@@ -31354,3 +31354,33 @@
- 防复发:上述测试与体积上限。
- 关联记录:BUG-2315、BUG-2317、BUG-2223(三年年度系列)。
- 修复版本:`claude/density-b4`。
## BUG-2320 | 问答回答版面乱:时间条有时在正文后面、有时在上面,出来时把正文顶开;「要留意的」重复时间条的日期,还有一条和时间条说反;转折点和出生时间两行散在时间条下面;图例单占一行;「跳到最新」压在正文上;深色下时间条发棕
- 状态:fixed-pending-verify(本地提交,未推送;待负责人在 staging 看过)。
- 首次发现 / 最近更新:2026-11-24(负责人 staging 手机截图三张,认可整理原型 `/workspace/eval-read-1116/chat-ux-prototype/tidy-answer/`,深色选方案 C)/ 2026-11-24。
- 现象:钱的问题首轮:时间条画在「要留意的」后面(另一次在正文上面);「要留意的」三条各写了一段年月(「2026 年 11 月到 2027 年 5 月……心里压力比平时重」),其中一段时间条上是「有机会」;时间条下面先是图例一行,再是正文大小的「12 个月之后,下一个真正的转折点……」,再是一行出生时间的小字;「有机会」的一段小标题叫「紧着」;居中的「跳到最新」胶囊压在正文上;深色下时间条和小星盘点亮的格子偏棕。
- 触发条件:问答页本命问答(新形状,`## 结论` 开头);时间一节写在正文后面、或程序在正文写完后补上时间条时;深色模式。
- 根因:
1. 版面:BUG-2305 / 2308 为了「不把已显示的正文往下推」,把写在正文后面的时间一节、以及程序事后补上的时间条画在正文后面(`chat-message-content.tsx` 的 `timelineAfterBody` / `bodyBeforeStrip`),所以时间条的位置跟着写手的顺序和补写时机变。是否需要时间条按结构其实在写正文之前就能定(BUG-2308:首轮除性格题都要,追问结论卡有时间标签就要),但页面没有用它预留位置。
2. 日期重复:写法要求「要留意的」每条写什么时候,日期和说法照时间条那几段(BUG-2308),等于让正文再写一遍时间条的起止;写手照抄时有时写错方向,没有程序记录。
3. 页脚:转折点那句被解析成时间条的 note,用正文字号单独一段;出生时间那句是另一段(BUG-2281 复审)。
4. 小标题:BUG-2310 的说法检查把小标题和那句话合起来查,词表里没有「紧」「守住」「收着」这类两三个字就定了方向的词。
5. 深色:时间条的颜色是 `.chat-answer-strip` 上用 color-mix 从浅色主题的 action / success 色混出来的,深色主题里没有另定值。
- 修复:
1. 固定顺序:结论卡 → 「这是从你的星盘里看出来的」→ 时间条 → 年度那一句(结论下面的那段)→ 正文 → 依据框 → 图标 → 三个问题。解析器照旧把时间一节从任何位置提出来,页面一律放在星盘那一行下面的 `AnswerStripSlot` 里;删除「程序补上的时间条画在正文后面」的例外。流式时按结构(`stripSlotRequired`:首轮除性格题,追问结论卡有时间标签;首轮从等待状态的 `firstTurn` 读)从第一帧就留出最终时间条的固定高度(手机 408px,641px 以上 300px;按写法允许的最长文字在 Chromium 量出 407 / 297px),先放标签和一条中性底色,时间一节写完画进同一个位置,面板占掉多出的高度;不需要时不留。性格题首轮的标签一出现(在正文之前)就去掉预留。
2. 写法:时间一节紧跟结论写(首轮和追问);日期只在时间条里,正文各块不再写时间条的年月和起止,要指哪一段就说「时间轴里最后那一段」「时间轴里『谈成』那一段」,对读者只说「时间轴」;土星那几年只写年份;那一句 36 字以内、该做 / 别做各 24 字以内(时间条高度固定)。写完后检查(`bodyStripDateFlags`):正文句子里的年月范围与时间条某段重叠一周以上记为重复,句子用词(STRIP_* 词表)和那段的说法相反记为冲突,写进 `answerChecks.timeline` 和一步 `answer-body-strip-dates`;不改写正文。
3. 页脚:转折点那句和出生时间那句合成时间条下面一行小字(`stripFooterLine`:「12 个月之后,下一个转折点在 2028 年 4 月,……」改成「2028 年 4 月是下一个转折点,……」,后接「时间按出生时间推,差几分钟会移动几天。」);写手把转折点那句写进正文时从正文提出来。
4. 图例和「接下来一年」同一行、靠右,只列用到的说法,很窄时折到下一行。
5. 「跳到最新」:右下角、输入框上方的小圆按钮(36px 圆,44px 点击区),只有向下箭头,读屏名字不变,显示和隐藏的逻辑不变。
6. 小标题:`stripTitleMismatch`——「有机会」的小标题不得有吃力类词和紧、守住、收着;「较费力」的小标题不得有轻松类词。不一致的照旧走时间条补写(只改那一条的小标题和那一句),补写和补时间条调用的回复也按它拒收。
7. 深色(方案 C):`--strip-chance` oklch(0.46 0.03 165)、`--strip-strain` oklch(0.46 0.035 20)、`--strip-chance-costly` oklch(0.46 0.015 90)、星盘点亮格 `--chart-area-lit` oklch(0.50 0.035 20),写在两个深色块里;浅色值移到 `:root`,不变。
- 验证:
- 新增 `frontend/tests/chat-answer-tidy-2320.test.tsx`(8 条):两种写法顺序(时间一节在前 / 在最后)页面顺序相同;预留位置第一帧就在、同一节点、同一类名到完成,性格题和没有时间标签的追问不留;正文日期重复和说反的记录(指「时间轴里最后那一段」的不记)及写法文字;页脚一行;图例同一行;跳到最新的位置类名和点击区;小标题检查进补写和补时间条拒收;两个深色块的四个值。钉住的断言按 原值 / 新值 / 原因 改了:`chat-answer-end-2305`(正文后写的时间一节画在正文后 → 画在固定位置)、`chat-answer-strip-2308`(时间条在预留位置里;程序补上的时间条在正文后 → 落进预留位置,正文不动)、`chat-answer-shape-2281`(出生时间行的写法和所在行)、`chat-navigation-a11y-contract`(跳到最新不再有可见文字)、`chat-voice-2229`(写法长度 9,000 → 9,200,实测 9,093)、`chat-notice-and-scroll-contract`(阴影令牌从按钮移到 36px 的圆上)。读改动文件的前端测试和守护测试(no-middle-dot、sentence-split、results-as-toasts、consult-dasha-horizon)共 226 个文件逐个跑:两处失败(上面的阴影断言;正文日期检查用了后行断言,改成不用)修后重跑通过;tsc、改动文件 ESLint 0 错误;quick gate 通过。
- 真实路由一次(同 BUG-2281 的桩,DeepSeek flash,本地引擎,公开盘,「我适合靠什么挣钱?接下来一年钱上该怎么安排?」):第一版写法跑一次,正文仍有 5 句重复时间条的年月(其中 1 句说反),据此把写法改成「不写年月和起止」并让土星那几年只写年份;第二次 8,877 字、175.4k / 8.2k token、63 秒:时间一节紧跟结论,7 段,页脚「2027 年 12 月是下一个转折点,……时间按出生时间推,差几分钟会移动几天。」,正文重复 0、冲突 0。
- 截图(组件渲染:真实组件 + 本分支编译的产品样式表,不是登录后的真实页面):`/workspace/eval-read-1116/chat-ux-prototype/build/tidy-answer/`。预留位置在 Chromium 里量:空位、写到一半、完成三种状态手机 408 / 408 / 408px,1280 宽 300 / 300 / 300px。
- 已知不足:只有「正文写了两段以上带日期」才需要时间条的追问,写之前不知道,时间条完成时仍会插在正文上面;需要时间条但补写失败时,预留位置在完成时收起;跳到最新按钮在右下角,读到底部右侧一两个字时仍可能被盖住;第二次真实回答「要留意的」有一条写「那段时间前后」,没有指明时间轴哪一段。
- 防复发:上面的测试;时间条位置只由 `AnswerStripSlot` 决定,是否预留只由 `stripSlotRequired` 决定(与服务端 `timelineRequirement` 共用 `verdictDomain`、`TIME_WINDOW_LABELS`)。
- 关联记录:BUG-2281(回答形状)、BUG-2305(流式不顶开正文、依据框,本次去掉「时间一节画在正文后」)、BUG-2308(时间条必写的结构规则、程序补写,本次去掉「补上的时间条画在正文后」)、BUG-2310(说法和检查词表,本次加小标题检查)、BUG-2319(一条渐变,颜色改为全局令牌并加深色值)。
- 修复版本:分支 `claude/tidy-answer`(本地提交,未推送)。
+53 -18
View File
@@ -354,6 +354,13 @@
--ring: var(--color-focus);
--radius: 12px;
--sidebar: var(--color-sidebar);
/* BUG-2320: the chat answer's one-year strip and the chart row's lit areas (moved from .chat-answer-strip so the dark
blocks below can redefine them). */
--strip-chance: color-mix(in srgb, var(--color-success) 22%, var(--color-canvas));
--strip-strain: color-mix(in srgb, var(--color-action) 26%, var(--color-canvas));
--strip-chance-costly: color-mix(in srgb, var(--color-success) 11%, color-mix(in srgb, var(--color-action) 13%, var(--color-canvas)));
--strip-none: var(--color-canvas-strong);
--chart-area-lit: color-mix(in srgb, var(--color-action) 30%, var(--color-canvas));
}
/* ── Dark theme ──────────────────────────────────────────────────────────────
@@ -461,6 +468,11 @@
--color-element-earth: #4a4636;
--color-element-air: #2e3c4e;
--color-element-water: #2a4448;
/* BUG-2320 (owner picked option C, 2026-11-24): lighter, cooler strip tones and lit areas on the dark ground. */
--strip-chance: oklch(0.46 0.03 165);
--strip-strain: oklch(0.46 0.035 20);
--strip-chance-costly: oklch(0.46 0.015 90);
--chart-area-lit: oklch(0.50 0.035 20);
}
}
@@ -564,6 +576,11 @@
--color-element-earth: #4a4636;
--color-element-air: #2e3c4e;
--color-element-water: #2a4448;
/* BUG-2320 (owner picked option C, 2026-11-24): lighter, cooler strip tones and lit areas on the dark ground. */
--strip-chance: oklch(0.46 0.03 165);
--strip-strain: oklch(0.46 0.035 20);
--strip-chance-costly: oklch(0.46 0.015 90);
--chart-area-lit: oklch(0.50 0.035 20);
}
* { box-sizing: border-box; }
@@ -2083,18 +2100,33 @@ button.chat-chart-resize-handle:active { position: absolute; top: 0; left: -3px;
.chat-answer-areas:focus-visible { outline: 2px solid var(--color-focus); outline-offset: 2px; }
.chat-answer-areas-chart { flex: none; width: 56px; height: 56px; }
.chat-answer-areas-chart polygon, .chat-answer-areas-chart rect { fill: var(--color-canvas); stroke: var(--color-canvas-strong); stroke-width: 8; stroke-linejoin: round; }
.chat-answer-areas-chart .is-lit { fill: color-mix(in srgb, var(--color-action) 30%, var(--color-canvas)); }
.chat-answer-areas-chart .is-lit { fill: var(--chart-area-lit); }
.chat-answer-areas-text { display: flex; flex: 1; min-width: 0; flex-direction: column; gap: 2px; }
.chat-answer-areas-title { overflow: hidden; font-size: var(--type-body-md); font-weight: 600; line-height: 1.4; text-overflow: ellipsis; white-space: nowrap; }
.chat-answer-areas-names { overflow: hidden; color: var(--color-ink-secondary); font-size: var(--type-caption); line-height: 1.5; text-overflow: ellipsis; white-space: nowrap; }
.chat-answer-areas-chevron { flex: none; width: 16px; height: 16px; color: var(--color-ink-tertiary); }
.chat-answer-strip { display: flex; flex-direction: column; gap: var(--space-2); }
.chat-answer-strip .chat-answer-label { margin: 0; }
/* BUG-2320: 「接下来一年」 and the legend share one row, the legend right-aligned; on a very narrow width it wraps under
the heading (no overlap). */
.chat-answer-strip-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 2px var(--space-3); }
/* BUG-2320: the strip's fixed place. A row that streams here reserves the final strip's height from the first frame
(the panel takes the spare height, so the strip is one fixed-size card whatever its words); history rows do not. */
/* Measured in Chromium with the longest words the writing rules allow (when line, a 36-character sentence, 该做 / 别做 24
characters each, a three-line footer on a phone / two lines wider): 407px at 360–390px wide, 297px from 641px on (a little room is kept). */
.chat-answer-strip-slot { display: flex; flex-direction: column; --chat-strip-slot-height: 408px; }
@media (min-width: 641px) { .chat-answer-strip-slot { --chat-strip-slot-height: 300px; } }
.chat-answer-strip-slot.is-reserved { min-height: var(--chat-strip-slot-height); }
.chat-answer-strip-slot > .chat-answer-strip { flex: 1; }
.chat-answer-strip-slot.is-reserved .chat-answer-strip-detail { flex: 1; }
.chat-answer-strip-placeholder { display: flex; flex-direction: column; gap: var(--space-2); }
.chat-answer-strip-placeholder .chat-answer-label { margin: 0; }
.chat-answer-strip-placeholder-bar { display: block; height: 44px; border-radius: 8px; background: var(--strip-none); }
.chat-answer-strip-bar, .chat-answer-strip-ticks { display: grid; gap: 3px; }
.chat-answer-strip-segment[data-slot="button"] { display: grid; min-width: 0; height: 44px; place-items: center; padding: 0 2px; border: 0; border-radius: 8px; color: var(--color-ink); font-size: var(--type-caption); font-weight: 400; line-height: 1.2; white-space: normal; cursor: pointer; overflow-wrap: anywhere; }
/* BUG-2310: 有机会 / 有机会,但费力 / 较费力; no tag (and receipts stored with the old tones) stays the neutral fill. */
/* BUG-2319: colours are inline slices of one gradient across the bar (chat-answer-shape.tsx stripSliceStyles); a bar with no tones (still streaming) stays neutral. */
.chat-answer-strip { --strip-chance: color-mix(in srgb, var(--color-success) 22%, var(--color-canvas)); --strip-strain: color-mix(in srgb, var(--color-action) 26%, var(--color-canvas)); --strip-chance-costly: color-mix(in srgb, var(--color-success) 11%, color-mix(in srgb, var(--color-action) 13%, var(--color-canvas))); --strip-none: var(--color-canvas-strong); }
/* BUG-2320: the four strip tokens live on :root (light) and in both dark blocks (option C). */
.chat-answer-strip-segment.is-pending[data-slot="button"] { background: var(--strip-none); }
.chat-answer-strip-segment[aria-pressed="true"] { box-shadow: inset 0 0 0 2px var(--color-ink); }
/* BUG-2308: the program's tones arrive when the answer completes: the colour eases in instead of flipping. */
@@ -2113,10 +2145,12 @@ button.chat-chart-resize-handle:active { position: absolute; top: 0; left: -3px;
.chat-answer-strip-panel dt { color: var(--color-ink-secondary); white-space: nowrap; }
.chat-answer-strip-panel dd { margin: 0; }
/* BUG-2305: the legend and the birth-time line keep a one-line slot while the answer streams (filled at completion). */
.chat-answer-strip-legend { display: flex; flex-wrap: wrap; gap: var(--space-3); min-height: 1.5em; color: var(--color-ink-secondary); font-size: var(--type-caption); line-height: 1.5; }
.chat-answer-strip-legend { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 0 var(--space-3); min-height: 1.5em; margin-left: auto; color: var(--color-ink-secondary); font-size: var(--type-caption); line-height: 1.5; white-space: nowrap; }
.chat-answer-strip-legend i { display: inline-block; width: 10px; height: 10px; margin-right: 5px; border-radius: 3px; vertical-align: -1px; }
.chat-answer-shaped .chat-answer-strip-note { margin: 0; color: var(--color-ink); font-size: var(--type-body-md); line-height: 1.6; }
.chat-answer-shaped .chat-answer-strip-caveat { min-height: 1.5em; margin: 0; overflow: hidden; color: var(--color-ink-tertiary); font-size: var(--type-caption); line-height: 1.5; text-overflow: ellipsis; white-space: nowrap; }
/* BUG-2320: one small muted footer line (the next turning point, then the birth-time note); a live row keeps two lines'
room for it from the first frame. */
.chat-answer-shaped .chat-answer-strip-caveat { margin: 0; color: var(--color-ink-tertiary); font-size: var(--type-caption); line-height: 1.5; }
.chat-answer-strip-slot.is-reserved .chat-answer-strip-caveat { min-height: 3em; }
/* BUG-2305 (owner picked prototype style 3): 判断依据 and 盘面数据 in one muted rounded box, the verdict card's family; a
hairline between the rows only, none above or below the box. Each row is the existing fold; it opens inside the box. */
.chat-answer-evidence { padding: 2px var(--space-4); border-radius: 14px; background: var(--color-canvas-muted); }
@@ -2429,30 +2463,31 @@ button.chat-chart-resize-handle:active { position: absolute; top: 0; left: -3px;
bottom: 100%;
z-index: 3;
display: flex;
justify-content: center;
padding-bottom: var(--space-3);
justify-content: flex-end;
padding: 0 var(--space-4) var(--space-2);
pointer-events: none;
}
/* BUG-2320 (owner-approved tidy prototype): icon only, round, bottom-right. 原值:centred pill 「↓ 跳到最新」 over the text;
新值:36px visual circle, the 44px hit area kept by the button box, the circle drawn by ::before; 原因:the pill sat on the reading line. */
.jump-to-latest__button {
pointer-events: auto;
position: relative;
min-height: 44px;
min-width: 44px;
display: inline-flex;
align-items: center;
gap: var(--space-2);
padding: 0 var(--space-4);
border: 1px solid var(--color-border);
display: inline-grid;
place-items: center;
padding: 0;
border: 0;
border-radius: 999px;
background: var(--color-canvas);
background: transparent;
box-shadow: none;
color: var(--color-ink);
box-shadow: var(--shadow-elevated);
font: inherit;
font-size: var(--type-body-sm);
cursor: pointer;
transition: background-color 120ms ease-out;
}
.jump-to-latest__button svg { width: 16px; height: 16px; flex: 0 0 auto; }
.jump-to-latest__button:hover { background: var(--color-canvas-muted); }
.jump-to-latest__button::before { content: ""; position: absolute; inset: 4px; border: 1px solid var(--color-border); border-radius: 999px; background: var(--color-canvas); box-shadow: var(--shadow-elevated); transition: background-color 120ms ease-out; }
.jump-to-latest__button svg { position: relative; width: 16px; height: 16px; flex: 0 0 auto; }
.jump-to-latest__button:hover::before { background: var(--color-canvas-muted); }
.jump-to-latest__button:focus-visible {
outline: 3px solid color-mix(in srgb, var(--color-focus) 56%, transparent);
outline-offset: 3px;
+37 -12
View File
@@ -9,9 +9,9 @@ import type { ChartBoardStyle } from "@/lib/chart-board-style";
import { chartAreaHouses, chartAreaNames } from "@/lib/chat-chart-areas";
import {
ANSWER_TONE_LABELS,
BIRTH_TIME_STRIP_LINE,
currentMonthIndex,
FOLLOW_UP_HEADING,
stripFooterLine,
type AnswerShape,
type AnswerTone,
type TimelineSegment,
@@ -176,8 +176,11 @@ export function segmentWeights(segments: readonly TimelineSegment[]): number[] {
* without them (still streaming, or an answer without evidence keys) the segments are neutral and no legend shows.
*/
/*
* BUG-2305 `reserve` (the answer streamed in this row): the legend line and the birth-time line keep their one-line
* slots while streaming and after, filled at completion, so the body under the strip does not move when they appear.
* BUG-2305 `reserve` (the answer streamed in this row): the legend line and the footer line keep their slots while
* streaming and after, filled at completion, so the body under the strip does not move when they appear.
* BUG-2320 (owner-approved tidy prototype): the legend sits on the heading's row, right-aligned (only the labels in use;
* it wraps under the heading on very narrow widths); the turning-point sentence and the birth-time note are ONE small
* muted footer line under the panel (`stripFooterLine`).
*/
export function AnswerYearStrip({ timeline, tones, timeSensitive = false, reserve = false }: Readonly<{ timeline: NonNullable<AnswerShape["timeline"]>; tones?: readonly AnswerTone[]; timeSensitive?: boolean; reserve?: boolean }>) {
const [picked, setPicked] = useState(0);
@@ -195,10 +198,18 @@ export function AnswerYearStrip({ timeline, tones, timeSensitive = false, reserv
return typeof label === "string" && label ? `,${label}` : "";
};
const slices = stripSliceStyles(weights, known);
const footer = stripFooterLine(timeline.note, timeSensitive);
return (
// BUG-2308: a strip that arrives in a live row (`reserve`) enters once, as a whole (opacity and transform only).
<section className={`chat-answer-strip${reserve ? " is-arriving" : ""}`} aria-label={timeline.heading}>
<p className="chat-answer-label">{timeline.heading}</p>
<div className="chat-answer-strip-head">
<p className="chat-answer-label">{timeline.heading}</p>
{used.length || reserve ? (
<div className="chat-answer-strip-legend" aria-hidden="true">
{used.map((tone) => <span key={tone}><i style={{ background: stripToneColor(tone) }} />{ANSWER_TONE_LABELS[tone]}</span>)}
</div>
) : null}
</div>
<div className="chat-answer-strip-bar" style={{ gridTemplateColumns: columns }}>
{segments.map((segment, index) => (
<Button
@@ -232,18 +243,32 @@ export function AnswerYearStrip({ timeline, tones, timeSensitive = false, reserv
</div>
))}
</div>
{used.length || reserve ? (
<div className="chat-answer-strip-legend" aria-hidden="true">
{used.map((tone) => <span key={tone}><i style={{ background: stripToneColor(tone) }} />{ANSWER_TONE_LABELS[tone]}</span>)}
</div>
) : null}
{timeline.note ? <p className="chat-answer-strip-note">{timeline.note}</p> : null}
{/* BUG-2281 review: once, quietly, under the strip, only when the card marks the boundaries as time-sensitive. */}
{timeSensitive || reserve ? <p className="chat-answer-strip-caveat" aria-hidden={timeSensitive ? undefined : true}>{timeSensitive ? BIRTH_TIME_STRIP_LINE : ""}</p> : null}
{/* BUG-2320: one quiet line — the next turning point, then (only when the card marks the boundaries as moving with
the birth time) the birth-time note. */}
{footer || reserve ? <p className="chat-answer-strip-caveat" aria-hidden={footer ? undefined : true}>{footer}</p> : null}
</section>
);
}
/**
* BUG-2320: the strip's fixed place — under the chart row, above the year sentence and the body — whatever order the
* writer used (the parser lifts the time section). In a row that streams here (`reserved`) the slot has the final strip's
* fixed height from the first frame (the label and a neutral bar stand in until the section is complete), so nothing
* moves when the strip is drawn into it. Rows read from history use the wrapper without a reserved height.
*/
export function AnswerStripSlot({ reserved, heading, children }: Readonly<{ reserved: boolean; heading: string; children: ReactNode }>) {
return (
<div className={`chat-answer-strip-slot${reserved ? " is-reserved" : ""}`}>
{children ?? (
<div className="chat-answer-strip-placeholder" aria-hidden="true">
<p className="chat-answer-label">{heading}</p>
<span className="chat-answer-strip-placeholder-bar" />
</div>
)}
</div>
);
}
/**
* 「接着问」: the answer's own three questions, each sends itself (the existing follow-up buttons). BUG-2305 (owner
* 2026-11-24): no visible 「接着问」 label; the group keeps it as its accessible name. The transcript places it after the
@@ -3,9 +3,9 @@
import { memo, useCallback, useEffect, useRef, useState, useSyncExternalStore, type ReactNode } from "react";
import { prefetchOnIdle } from "@/components/chat-chunk-prefetch";
import { AnswerAreas, AnswerEvidenceGroup, AnswerVerdict, AnswerYearStrip } from "@/components/chat-answer-shape";
import { AnswerAreas, AnswerEvidenceGroup, AnswerStripSlot, AnswerVerdict, AnswerYearStrip } from "@/components/chat-answer-shape";
import { ConsultAnswerBasis } from "@/components/consult-answer-basis";
import { isAnswerTone, parseAnswerShape, withoutAskUserHeading, type AnswerShapeData, type AnswerTone, type TimelineSegment } from "@/lib/chat-answer-shape";
import { DEFAULT_TIMELINE_HEADING, isAnswerTone, parseAnswerShape, stripSlotRequired, withoutAskUserHeading, type AnswerShapeData, type AnswerTone, type TimelineSegment } from "@/lib/chat-answer-shape";
import { waitAnswerAreas } from "@/lib/chat-wait-progress";
import { readChatWait, subscribeChatWait } from "@/lib/chat-wait-store";
import { ConsultChartDataFold } from "@/components/consult-chart-data";
@@ -42,6 +42,11 @@ function liveAreasKey(): string {
return waitAnswerAreas(readChatWait()?.state).join(",");
}
const NO_LIVE_AREAS = () => "";
/** BUG-2320: whether the live run is a first turn ("first" / "follow"; "" when no run is on this page). */
function liveTurnKey(): string {
const state = readChatWait()?.state;
return state ? (state.firstTurn ? "first" : "follow") : "";
}
const areasFromKey = (key: string) => (key ? key.split(",").map(Number) : []);
/**
@@ -196,11 +201,13 @@ export function ChatMessageContent({
const liveKey = useSyncExternalStore(subscribeChatWait, shape && streaming ? liveAreasKey : NO_LIVE_AREAS, NO_LIVE_AREAS);
const [streamed, setStreamed] = useState<{ key: string } | null>(null);
if (shape && streaming && streamed === null) setStreamed({ key: liveKey });
// BUG-2308: a strip that was not there while the body was already on screen (the program added the missing section
// after the answer was written) is drawn after the body in this row, so it never pushes text already read; a stored
// answer draws it in its place. Decided once per row, like the areas above.
const [bodyBeforeStrip, setBodyBeforeStrip] = useState(false);
if (shape && streaming && !bodyBeforeStrip && !shape.timeline && splitSpokenAnswerAndTechniqueAudit(shape.body).spoken.trim()) setBodyBeforeStrip(true);
// BUG-2320 (owner-approved tidy prototype): the strip has one fixed place, under the chart row. 原值 (BUG-2305 / 2308):
// a time section written after the body, or added by the program once the body was on screen, was drawn after the
// body; 新值: it always lands in its slot, reserved at the final strip's height from the first streamed frame when the
// structure requires a strip (stripSlotRequired), so nothing moves when it is drawn; 原因: the owner's live answer had
// the strip under 「要留意的」 one time and above the body another.
const liveTurn = useSyncExternalStore(subscribeChatWait, shape && streaming ? liveTurnKey : NO_LIVE_AREAS, NO_LIVE_AREAS);
const slotWanted = Boolean(shape && streaming && stripSlotRequired(shape.verdict.facts.map((fact) => fact.label), liveTurn === "first"));
const liveAreas = areasFromKey(streamed?.key ?? "");
const areas = streaming
? liveAreas
@@ -238,19 +245,18 @@ export function ChatMessageContent({
reserve={streaming || streamed !== null}
/>
) : null;
const stripAfterBody = shape.timelineAfterBody || bodyBeforeStrip;
const reserved = streamed !== null;
const slot = strip || slotWanted ? <AnswerStripSlot reserved={reserved} heading={shape.timeline?.heading ?? DEFAULT_TIMELINE_HEADING}>{strip}</AnswerStripSlot> : null;
return (
<div className="message-answer chat-answer-shaped" ref={answerRef}>
<AnswerVerdict verdict={shape.verdict} />
{areas.length ? <AnswerAreas houses={areas} ascendantSign={ascendant} onOpen={openBasis} /> : null}
{!stripAfterBody ? strip : null}
{slot}
{shapedBody ? (
<div className="message-markdown">
<StreamingMarkdown text={shapedBody} renderMarkdown={renderMarkdown} streaming={streaming} />
</div>
) : null}
{/* BUG-2305: a time section written after the body (follow-ups) is drawn where it was written. */}
{stripAfterBody ? strip : null}
{evidence}
{/* BUG-2305 (owner 2026-11-24): 接着问 is no longer inside the answer. The transcript puts the answer's own questions
after the action icons (chat-transcript.tsx), so the order is body → evidence → icons → questions → composer. */}
@@ -9,6 +9,10 @@ import { Button } from "@/components/ui/button";
* reader has scrolled away from the bottom. It hangs off the composer's top
* edge (the composer wrap is its containing block) so it never reflows the
* transcript or the composer, and it is a real button in document order.
* BUG-2320 (owner-approved tidy prototype): a small round icon-only button
* (36px visual, 44px hit area) at the bottom-right just above the composer,
* instead of the centred 「跳到最新」 pill over the text; the name stays for
* screen readers.
*/
export function JumpToLatestButton({ onClick }: Readonly<{ onClick: () => void }>) {
return (
@@ -21,7 +25,6 @@ export function JumpToLatestButton({ onClick }: Readonly<{ onClick: () => void }
onClick={onClick}
>
<ArrowDown aria-hidden="true" />
跳到最新
</Button>
</div>
);
+81 -2
View File
@@ -85,6 +85,33 @@ export const DOMAIN_NAMES: Readonly<Record<AnswerShapeDomain, string>> = {
export const EASIEST_TIME_LABEL = "最省力的时候";
const KNOWN_LABELS = new Set([...Object.values(VERDICT_LABELS).flat(), EASIEST_TIME_LABEL]);
/** Verdict labels that name a time window. */
export const TIME_WINDOW_LABELS: ReadonlySet<string> = new Set(["最好的时候", "最难的时候", EASIEST_TIME_LABEL]);
/** The domain whose fixed trio the verdict's labels belong to (the trio the writer picked); null when none fits. */
export function verdictDomain(labels: readonly string[]): AnswerShapeDomain | null {
if (!labels.length) return null;
const domains = Object.entries(VERDICT_LABELS) as Array<[AnswerShapeDomain, readonly string[]]>;
// BUG-2310: 「最省力的时候」 stands in for 「最好的时候」.
const known = labels.map((label) => (label === EASIEST_TIME_LABEL ? "最好的时候" : label));
const all = domains.filter(([, trio]) => known.every((label) => trio.includes(label)));
if (!all.length) return null;
// 「先别碰」「最好的时候」 are shared: the first label (the domain's own) decides when several trios fit.
return all.find(([, trio]) => trio[0] === known[0])?.[0] ?? all[0]![0];
}
/**
* BUG-2320: whether the strip's slot is reserved while an answer streams — the BUG-2308 structure rule as far as it is
* known before the time section is written: a first turn carries the strip unless its labels are personality's (known
* from the first frame, dropped the moment personality's labels show, before any body text); any other turn carries it
* when its verdict has a time-window label (the label lines stream before the body). The dated-body reason is only known
* after the body is written; such a strip still lands in the slot's place.
*/
export function stripSlotRequired(labels: readonly string[], firstTurn: boolean): boolean {
if (firstTurn) return verdictDomain(labels) !== "personality";
return labels.some((label) => TIME_WINDOW_LABELS.has(label));
}
/**
* Strip labels per stretch (BUG-2310, the program's own direction rules, chat-strip-status.ts): support only, support
* and resistance, resistance only, neither (no tag, neutral fill). 原值 (BUG-2281): steady 「平稳」 / heavy 「偏吃力」 from
@@ -113,8 +140,31 @@ export type AnswerShapeData = {
timeSensitive?: boolean;
};
/** The line under the strip when the card marks the boundaries as time-sensitive (the card's own words). */
export const BIRTH_TIME_STRIP_LINE = "这些时间按出生时间推,出生时间差几分钟会移动几天。";
/**
* The birth-time note under the strip when the card marks the boundaries as time-sensitive. BUG-2320 原值:「这些时间按出生
* 时间推,出生时间差几分钟会移动几天。」 on a line of its own; 新值:the shorter wording of the approved prototype, joined to
* the turning-point sentence in one muted footer line; 原因:owner 2026-11-24 (two lines under the strip read as clutter).
*/
export const BIRTH_TIME_STRIP_LINE = "时间按出生时间推,差几分钟会移动几天。";
/** BUG-2320: the writer's 「12 个月之后,下一个真正的转折点在……」 sentence (in the time section or, misplaced, in the body). */
const TURNING_POINT_RE = /(?:\d+\s*个月|一年|这一年)(?:之后|以后|过后)[^。!?\n]{0,8}转折|下一个(?:真正的)?转折点?(?:会)?(?:在|是|落在)/u;
export function isTurningPointSentence(text: string): boolean {
return TURNING_POINT_RE.test(text.replace(/\*\*/gu, ""));
}
/**
* BUG-2320 (owner-approved prototype): the strip's footer — ONE small muted line under the panel, composed by the program:
* the turning-point sentence turned to 「2028 年 4 月是下一个转折点,……」, then the birth-time note when the card marks the
* boundaries as time-sensitive. Empty when there is neither.
*/
export function stripFooterLine(note: string, timeSensitive: boolean): string {
let turning = plain(note).replace(/〔[^〕]*〕/gu, "").trim();
const hit = /^(?:\d+\s*个月|一年|这一年)(?:之后|以后|过后)[,,]?\s*下一个(?:真正的)?转折点?(?:会)?(?:在|是|落在)\s*([^,,。;;]+?)\s*(?:[,,;;]\s*(.+))?$/u.exec(turning.replace(/[。.]$/u, ""));
if (hit) turning = `${hit[1]!.trim()}是下一个转折点${hit[2] ? `,${hit[2].trim()}` : ""}`;
if (turning && !/[。!?]$/u.test(turning)) turning += "。";
return `${turning}${timeSensitive ? BIRTH_TIME_STRIP_LINE : ""}`;
}
/** A sentence in a segment or the strip note that says the same (it is shown once under the strip instead). */
const BIRTH_TIME_SENTENCE = /[^。!?;]*出生时间[^。!?;]{0,16}(?:差|早|晚|偏|误差|不准)[^。!?;]{0,20}(?:天|日期|时间|挪|移)[^。!?;]*[。!?;]?/gu;
export function withoutBirthTimeSentence(text: string): string {
@@ -285,6 +335,18 @@ function chanceSaid(text: string): boolean {
}
return false;
}
/**
* BUG-2320 (owner's live strip: a 有机会 stretch titled 「紧着」): a title is read on its own too. A 有机会 title carries no
* strain word, these short ones included (a title is two to four characters, so 「紧」「守住」「收着」 set its direction);
* a 较费力 title carries no easing word.
*/
export const STRIP_TITLE_STRAIN = /紧|守住|收着/u;
export function stripTitleMismatch(title: string, label: AnswerTone): boolean {
const text = title.replace(/〔[^〕]*〕/gu, "").replace(/\*\*/gu, "");
if (label === "chance") return STRIP_STRAIN_SAID.test(text) || STRIP_TITLE_STRAIN.test(text);
if (label === "strain") return STRIP_EASING_SAID.test(text);
return false;
}
export function stripLabelMismatch(titleAndSentence: string, label: AnswerTone): boolean {
const text = titleAndSentence.replace(/〔[^〕]*〕/gu, "").replace(/\*\*/gu, "");
const strain = STRIP_STRAIN_SAID.test(text);
@@ -533,6 +595,23 @@ export function parseAnswerShape(text: string, options: { streaming?: boolean; n
}
body.push(sectionMarkdown(section));
});
// BUG-2320: the turning-point sentence belongs to the strip's footer; written in the body (a line of its own), it is
// lifted out of it — kept as the footer when the time section has none, dropped as a repeat when it has one.
if (timeline) {
let note = (timeline as NonNullable<AnswerShape["timeline"]>).note;
for (const [index, part] of body.entries()) {
const kept = part.split("\n").filter((line) => {
const text = line.trim();
if (!text || text.startsWith("#") || /^(?:[-*+]|\d{1,2}[.、)])\s/u.test(text) || text.startsWith("**")) return true;
if (!isTurningPointSentence(text)) return true;
if (!note) note = withoutBirthTimeSentence(plain(text));
return false;
});
if (kept.length !== part.split("\n").length) body[index] = kept.join("\n").trim();
}
for (let index = body.length - 1; index >= 0; index -= 1) if (!body[index]!.trim()) body.splice(index, 1);
timeline = { ...(timeline as NonNullable<AnswerShape["timeline"]>), note };
}
if (askUser) body.push(askUser);
return {
verdict: verdict ?? { sentence: "", facts: [] },
+53 -18
View File
@@ -18,25 +18,13 @@ import { normalizeEvidenceTags } from "./chat-evidence-tags.ts";
import { splitJudgmentBasis } from "./consult-judgment-basis.ts";
import {
currentMonthIndex, DEFAULT_TIMELINE_HEADING, EASIEST_TIME_LABEL, rangeDays, type AnswerTone, isTimelineHeading, MAX_TIMELINE_SEGMENTS, parseAnswerShape, rangeMonths,
STRIP_ENGINEERING_WORDS, STRIP_HEDGE_WORDS, STRIP_LATIN, STRIP_STRAIN_SAID, stripLabelMismatch, VERDICT_HEADING, VERDICT_LABELS, type AnswerShape, type AnswerShapeDomain,
STRIP_ENGINEERING_WORDS, STRIP_HEDGE_WORDS, STRIP_LATIN, STRIP_STRAIN_SAID, stripLabelMismatch, stripTitleMismatch, TIME_WINDOW_LABELS, VERDICT_HEADING, verdictDomain, type AnswerShape, type AnswerShapeDomain,
} from "./chat-answer-shape.ts";
/** Verdict labels that name a time window. */
export const TIME_WINDOW_LABELS: ReadonlySet<string> = new Set(["最好的时候", "最难的时候", EASIEST_TIME_LABEL]);
export const BEST_TIME_LABEL = "最好的时候";
export { EASIEST_TIME_LABEL };
/** The domain whose fixed trio the verdict's labels belong to (the trio the writer picked); null when none fits. */
export function verdictDomain(labels: readonly string[]): AnswerShapeDomain | null {
if (!labels.length) return null;
const domains = Object.entries(VERDICT_LABELS) as Array<[AnswerShapeDomain, readonly string[]]>;
// BUG-2310: 「最省力的时候」 stands in for 「最好的时候」.
const known = labels.map((label) => (label === EASIEST_TIME_LABEL ? BEST_TIME_LABEL : label));
const all = domains.filter(([, trio]) => known.every((label) => trio.includes(label)));
if (!all.length) return null;
// 「先别碰」「最好的时候」 are shared: the first label (the domain's own) decides when several trios fit.
return all.find(([, trio]) => trio[0] === known[0])?.[0] ?? all[0]![0];
}
// BUG-2320: the time-window labels and the trio's domain moved to chat-answer-shape.ts (the page reserves the strip's slot
// from them while the answer streams, without this module's card code).
export { EASIEST_TIME_LABEL, TIME_WINDOW_LABELS, verdictDomain };
const DATED_LEAD = /(?:现在|眼下|目前|\d{4}\s*年\s*\d{1,2}\s*月|\d{1,2}\s*月)[^。!?\n]{0,24}?(?:到|至|—|–|~)[^。!?\n]{0,12}?\d{1,2}\s*月/u;
@@ -226,7 +214,7 @@ export function stripStretchLines(stretches: readonly ProgramStretch[]): string[
}
export const STRIP_STRETCHES_READING =
"strip_stretches 是程序按这道题的领域切好的接下来 12 个月:每一段写了起止、这一段的说法(有机会 / 有机会,但费力 / 较费力;「不标」就是不加说法)和为什么(有利、费力、其中某几天)。首轮「## 接下来一年」就照这几段写,一段一条,段数照它(不凑数、不合并),起止和〔编号〕照抄;小标题和那句话照这一段的说法和为什么写:有机会的写清是什么机会;有机会,但费力的写清机会是什么、费力在哪;较费力的写清哪里费力;不标的写这一段最适合做什么。「其中……」那几天写进这一段的那句话里。best_time 是结论卡时间那一行的标签和值,照写;没有 best_time 就不写时间那一行。year_background 是这一整年都在的底色(整年都有的帮助和要花的力气):在结论那一句里用平常话说一次(这一年适合做什么、要付出什么),句末不写编号,「判断依据」里写一条带〔YR〕;不挂在每一段上,每段只写这一段自己的说法和为什么。saturn_background 是土星绕月亮那几年的背景:全篇最多说一次,放在「要留意的」,说清是哪几年、日子里是什么样子;year_background 已经说到同样的话时不再重复;不挂在每一段上,也不用它给哪一段定说法。用户说了别的范围时,按 period_coverage 照他的范围写,说法只写 strip_stretches 里有的。";
"strip_stretches 是程序按这道题的领域切好的接下来 12 个月:每一段写了起止、这一段的说法(有机会 / 有机会,但费力 / 较费力;「不标」就是不加说法)和为什么(有利、费力、其中某几天)。首轮「## 接下来一年」就照这几段写,一段一条,段数照它(不凑数、不合并),起止和〔编号〕照抄;小标题和那句话照这一段的说法和为什么写:有机会的写清是什么机会;有机会,但费力的写清机会是什么、费力在哪;较费力的写清哪里费力;不标的写这一段最适合做什么。「其中……」那几天写进这一段的那句话里。best_time 是结论卡时间那一行的标签和值,照写;没有 best_time 就不写时间那一行。year_background 是这一整年都在的底色(整年都有的帮助和要花的力气):在结论那一句里用平常话说一次(这一年适合做什么、要付出什么),句末不写编号,「判断依据」里写一条带〔YR〕;不挂在每一段上,每段只写这一段自己的说法和为什么。saturn_background 是土星绕月亮那几年的背景:全篇最多说一次,放在「要留意的」,说清从哪一年到哪一年(只写年份)、日子里是什么样子;year_background 已经说到同样的话时不再重复;不挂在每一段上,也不用它给哪一段定说法。用户说了别的范围时,按 period_coverage 照他的范围写,说法只写 strip_stretches 里有的。";
/** The fact for the verdict's time label (timing.best_time). */
export function bestTimeFact(stretches: readonly ProgramStretch[]): string | null {
@@ -338,6 +326,53 @@ export function bodyStripDisagreements(shapeBody: string, stretches: readonly Pr
});
}
const BODY_RANGE_RE = new RegExp(DATED_LEAD.source, "gu");
/**
* A body range as the reader means it: 「明年 2 月」「今年 12 月」 get their year, and a range that opens with a bare month
* (「时间轴里 5 月下旬到 6 月中旬那一段」) gets the year in which that month next comes (this month counts).
*/
function withYears(range: string, now: number): string {
const year = Math.floor(now / 12);
let text = range.replace(/今年\s*/gu, `${year} 年 `).replace(/明年\s*/gu, `${year + 1} 年 `).replace(/后年\s*/gu, `${year + 2} 年 `);
const lead = /^(?:现在|眼下|目前)?[^\d]*?(\d{1,2})\s*月/u.exec(text);
if (!/\d{4}\s*年/u.test(text.slice(0, lead ? lead.index + lead[0].length : 0)) && lead) {
const month = Number(lead[1]);
const at = lead.index + lead[0].indexOf(lead[1]!);
text = `${text.slice(0, at)}${month - 1 >= now % 12 ? year : year + 1} 年 ${text.slice(at)}`;
}
return text;
}
/**
* BUG-2320 (owner 2026-11-24: 「要留意的」 repeated the strip's dates, and one of them said the opposite of the strip): dates
* live only in the strip; the body gives cautions and what to do and may point at 「时间轴里最后那一段」. After writing,
* every body sentence that states a date range meeting a strip stretch (more than a week) is recorded as `repeats`; one
* whose wording says the opposite of a stretch it meets (strip label vs the STRIP_* word lists; a stretch with no tag has
* no direction) is recorded as `conflicts`. Recorded only — body sentences are never rewritten (owner history: rewrites
* made answers worse).
*/
export function bodyStripDateFlags(shapeBody: string, stretches: readonly ProgramStretch[]): { repeats: string[]; conflicts: string[] } {
const repeats: string[] = [];
const conflicts: string[] = [];
if (!stretches.length) return { repeats, conflicts };
const now = currentMonthIndex();
for (const raw of shapeBody.split(/\n+/u)) {
const line = raw.replace(/^[ \t]*(?:[-*+]|\d{1,2}[.、)])[ \t]+/u, "").replace(/\*\*/gu, "").replace(/〔[^〕]*〕/gu, "").trim();
if (!line || line.startsWith("#")) continue;
for (const sentence of line.match(/[^。!?]+[。!?]?/gu) ?? []) {
const ranges = [...sentence.matchAll(BODY_RANGE_RE)].map((hit) => rangeDays(withYears(hit[0], now), now)).filter((days): days is readonly [string, string] => days !== null);
if (!ranges.length) continue;
const met = stretches.filter((stretch) => ranges.some((days) => Math.min(Date.parse(days[1]), Date.parse(stretch.toDay)) - Math.max(Date.parse(days[0]), Date.parse(stretch.fromDay)) > 7 * 86_400_000));
if (!met.length) continue;
const short = sentence.trim().slice(0, 40);
repeats.push(short);
if (met.some((stretch) => stretch.label !== "none" && stripLabelMismatch(sentence, stretch.label))) conflicts.push(short);
}
}
return { repeats, conflicts };
}
// ---- the one targeted call that adds a missing section ------------------------------------------------------------
export const TIMELINE_SECTION_TOKENS = 1_200;
@@ -390,7 +425,7 @@ export function timelineSectionFromReply(reply: string, stretches: readonly Prog
if (!title || Array.from(title).length > 6 || !sentence || !doThis || !avoid) return null;
if ([title, sentence, doThis, avoid].some((part) => TERM_OR_DETAIL.test(part) || /[(())〔〕::]/u.test(part))) return null;
if ([title, sentence, doThis, avoid].some((part) => STRIP_ENGINEERING_WORDS.test(part) || STRIP_HEDGE_WORDS.test(part) || STRIP_LATIN.test(part))) return null;
if (stripLabelMismatch(`${title} ${sentence}`, stretch.label)) return null;
if (stripLabelMismatch(`${title} ${sentence}`, stretch.label) || stripTitleMismatch(title, stretch.label)) return null;
lines.push(`- **${title}**(${stretch.range}):${sentence}。该做:${doThis}。别做:${avoid}。〔${stretch.keys.join(" ")}〕`);
}
return lines.length <= MAX_TIMELINE_SEGMENTS ? lines.join("\n") : null;
+7 -5
View File
@@ -25,7 +25,7 @@ import { argalaTable, sahamTable, savOrder } from "./chat-point-checks.ts";
import { periodCoverageRows, pressureRangeTable, transitWindow } from "./chat-period-coverage.ts";
import { programStretches, programYear, segmentLabel } from "./chat-answer-timeline.ts";
import { splitJudgmentBasis } from "./consult-judgment-basis.ts";
import { ANSWER_TONE_LABELS, FOLLOW_UP_HEADING, isTimelineHeading, STRIP_ENGINEERING_WORDS, STRIP_HEDGE_WORDS, stripLabelMismatch, VERDICT_HEADING, type AnswerTone } from "./chat-answer-shape.ts";
import { ANSWER_TONE_LABELS, FOLLOW_UP_HEADING, isTimelineHeading, STRIP_ENGINEERING_WORDS, STRIP_HEDGE_WORDS, stripLabelMismatch, stripTitleMismatch, VERDICT_HEADING, type AnswerTone } from "./chat-answer-shape.ts";
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- card JSON is read loosely; every value is checked where used
type J = Record<string, any>;
@@ -592,13 +592,15 @@ const STRIP_ITEM = /^[ \t]{0,3}[-*+][ \t]+(\*\*([^*]{1,12}?)\*\*[ \t]*[((]([^
* True when a segment's title-and-sentence text says the opposite of its label, or (BUG-2310, owner: each stretch says one
* definite thing, no engineering words) carries a two-way hedge or an engineering word.
*/
export function stripToneMismatch(titleAndSentence: string, label: AnswerTone): boolean {
export function stripToneMismatch(titleAndSentence: string, label: AnswerTone, title?: string): boolean {
const plain = withoutEvidenceTags(titleAndSentence).replace(/\*\*/gu, "");
return stripLabelMismatch(plain, label) || STRIP_HEDGE_WORDS.test(plain) || STRIP_ENGINEERING_WORDS.test(plain);
// BUG-2320: the title alone too (a 有机会 stretch titled 「紧着」, a 较费力 one titled with an easing word).
const ownTitle = title ?? /^\s*\*\*([^*]{1,12})\*\*/u.exec(titleAndSentence)?.[1];
return stripLabelMismatch(plain, label) || (ownTitle !== undefined && stripTitleMismatch(ownTitle, label)) || STRIP_HEDGE_WORDS.test(plain) || STRIP_ENGINEERING_WORDS.test(plain);
}
const LABEL_FIX: Readonly<Record<AnswerTone, string>> = {
chance: "这一段在时间条上是「有机会」:改小标题和这一句,写清是什么机会,不写吃力、费力、压力大",
chance: "这一段在时间条上是「有机会」:改小标题和这一句,写清是什么机会,不写吃力、费力、压力大,小标题也不用紧、守住、收着这类字",
chance_costly: "这一段在时间条上是「有机会,但费力」:改小标题和这一句,写清机会是什么、费力在哪,不写轻松、平稳、顺",
strain: "这一段在时间条上是「较费力」:改小标题(2 到 4 个字,例如守住、收着、慢一点)和这一句,写清哪里费力,不写机会、轻松、平稳、顺",
none: "这一段在时间条上不加说法:改小标题和这一句,写这一段最适合做什么,不写吃力、压力大,也不写轻松、平稳、顺",
@@ -636,7 +638,7 @@ export function checkStripTone(text: string, card: EvidenceCard | null): PlainFl
const rest = hit[4]!;
const cut = rest.search(/该做[::]|别做[::]|〔/u);
const sentence = (cut >= 0 ? rest.slice(0, cut) : rest).replace(/\s+$/u, "");
if (!stripToneMismatch(`${hit[2]} ${sentence}`, label)) continue;
if (!stripToneMismatch(`${hit[2]} ${sentence}`, label, hit[2])) continue;
out.push({ kind: `strip_${label}`, sentence: `${hit[1]}${sentence}`.trim(), card: `${LABEL_FIX[label]};只说一件确定的事,不写可能、或许、也许、不排除、视情况这类两头的话。保留「**小标题**(起止):」的写法和括号里的起止年月,不写术语` });
}
return out;
@@ -662,7 +662,9 @@ export function followUpAnswerShapeInstruction(mode: ConsultationAnswerMode = DE
// 原因:负责人 2026-11-24,同首轮。
// BUG-2308 原值:「问的是时间才写时间那一节」;新值:问一段时间、什么时候,或回答要分几段日期给建议时写;原因:同一答案里
// 带日期的几段写在正文、没有时间条(负责人 11-24)。
? "这是追问轮:本会话前面已经写过完整解读。先写「## 结论」,第一句就回答用户这句话;再只写和这句话直接相关的几条(每条先一句加粗的结论,再两三句短句,段末写〔编号〕),讲清楚为准,不限字数,不重讲上一轮;正文的写法和首轮一样:写给没接触过占星的人,句子短,一句盘面上的理由都不写(不写星、宫、运期、分盘、方法名,也不写两种方法对没对上),这些都放进「判断依据」;只有用户问依据、为什么,或者自己用了专业词时,才照他的问法用这些词并解释。写法按系统提示里的 VISIBLE VOICE(追问轮写法)。问的是一段时间或什么时候、或者要分几段日期给建议时,写时间那一节(格式同首轮,每条末尾写〔编号〕);只有答案要看一件用户在对话里还没说过的事、按它分成明显不同的几条路时,才写「## 问你一句」(写法同首轮,用户说过的不再问);然后「## 接着问」三条;最后写「## 判断依据」,只列这一轮的判断,每条末尾写〔编号〕。用户明确换了领域或要求完整看一下时,按首轮写。"
// BUG-2320 原值:时间那一节写在相关几条后面;新值:紧跟在「## 结论」后面;原因:页面把时间条固定放在结论卡下面,先写它
// 才能早点画出来(负责人认可的整理原型,11-24)。
? "这是追问轮:本会话前面已经写过完整解读。先写「## 结论」,第一句就回答用户这句话;再只写和这句话直接相关的几条(每条先一句加粗的结论,再两三句短句,段末写〔编号〕),讲清楚为准,不限字数,不重讲上一轮;正文的写法和首轮一样:写给没接触过占星的人,句子短,一句盘面上的理由都不写(不写星、宫、运期、分盘、方法名,也不写两种方法对没对上),这些都放进「判断依据」;只有用户问依据、为什么,或者自己用了专业词时,才照他的问法用这些词并解释。写法按系统提示里的 VISIBLE VOICE(追问轮写法)。问的是一段时间或什么时候、或者要分几段日期给建议时,写时间那一节(紧跟在「## 结论」后面,格式同首轮,每条末尾写〔编号〕);只有答案要看一件用户在对话里还没说过的事、按它分成明显不同的几条路时,才写「## 问你一句」(写法同首轮,用户说过的不再问);然后「## 接着问」三条;最后写「## 判断依据」,只列这一轮的判断,每条末尾写〔编号〕。用户明确换了领域或要求完整看一下时,按首轮写。"
: "这是追问轮:本会话前面已经写过完整解读。先用一两句回答用户这句话,讲清楚为准,不限字数;再只写和这句话相关的技法路由、原始数据、Dasha 与证据等级,不重讲上一轮;冲突与阻塞项和 Technique Audit Table(列本轮用到的技法,加 Functional Benefic/Malefic、MEVG / Global Web Evidence、Real Case Calibration 三行)保留;写法按系统提示里的 VISIBLE VOICE。用户明确换了领域或要求完整看一下时,按首轮写。",
CAREER_FOLLOW_UP_RULE,
// BUG-2229: a follow-up about time or a period names both timing methods; the card's main cause comes first.
+7 -1
View File
@@ -29,7 +29,7 @@ import { consultationRunFailureMessage } from "./consultation-workflow-retry.ts"
import { logTruncatedReasoning } from "./consultation-budget.ts";
import { basisSourcesFromCard, withCompletedBasis } from "./chat-basis-completeness.ts";
import { answerShapeData } from "./chat-answer-shape-data.ts";
import { bodyStripDisagreements, datedWindow, programStretches, serverAnswerShape, timelineRequirement, timelineSectionFromReply, timelineSectionPrompt, withProgramBestTime, withTimelineSection } from "./chat-answer-timeline.ts";
import { bodyStripDateFlags, bodyStripDisagreements, datedWindow, programStretches, serverAnswerShape, timelineRequirement, timelineSectionFromReply, timelineSectionPrompt, withProgramBestTime, withTimelineSection } from "./chat-answer-timeline.ts";
import { addImpliedKeys, bodyMechanismSentences, bodyTerms, checkBodyDirection, checkDirection, checkStripTone, checkTimelineEntries, expandEvidenceKeys, hasEvidenceTags, unkeyedConclusions } from "./chat-evidence-keys.ts";
import { chineseNamesAndTerms, cleanChatAnswer } from "./chat-answer-checks.ts";
import { isProtectedRemoval, keepDirectReply } from "./chat-answer-direct-reply.ts";
@@ -1296,6 +1296,12 @@ export function streamAgentResponse(options: StreamAgentResponseOptions) {
record.segments = after.timeline.segments.length;
const disagree = bodyStripDisagreements(after.body, stretches);
if (disagree.length) record.bodyDisagrees = disagree;
// BUG-2320: dates live only in the strip — body sentences that repeat a strip range, and those that say the
// opposite of the stretch they name, are recorded (never rewritten).
const dates = bodyStripDateFlags(after.body, stretches);
if (dates.repeats.length) record.bodyRepeatsStripDates = dates.repeats;
if (dates.conflicts.length) record.bodyContradictsStrip = dates.conflicts;
if (dates.repeats.length) appendConsultationRuntimeStep(options.state, { kind: "validation", name: "answer-body-strip-dates", status: dates.conflicts.length ? "failed" : "completed", failureCode: `repeats:${dates.repeats.length};conflicts:${dates.conflicts.length}` });
}
options.state.answerChecks = { ...options.state.answerChecks, timeline: record };
if (output !== fullOutput) {
+11 -5
View File
@@ -256,6 +256,12 @@ const NO_BLAME_LINE = plainVoiceLine("- 不推责");
* once; the time label and value come from best_time (「最好的时候」, up to two stretches, else 「最省力的时候」, else none);
* 该做 / 别做 kept; 原因 — the old rule had no source and coloured every domain the same; the owner wants a glanceable,
* committed status built from classical practice.
* BUG-2320 (owner-approved tidy prototype 2026-11-24): 原值 — 「要留意的」 wrote each caution with its dates (「写到的日期和
* 说法照时间条那几段」), the time section had no place rule, the turning-point line was free-form; 新值 — the time section
* right after the verdict; dates only in the strip (the body points at 「时间轴里最后那一段」); a 有机会 title carries no 紧 /
* 守住 / 收着; the panel words have a length (the strip's slot has a fixed height); the turning point as 「12 个月之后,下一个
* 转折点在……」 inside the time section only (the page composes the strip's footer from it); 原因 — the owner's live answer
* repeated the strip's dates in the body, one of them contradicting it, and the page moved the strip around.
*/
/**
* BUG-2284 (owner 2026-11-24): the chat no longer splits the user's message or answers feedback with a short
@@ -286,11 +292,11 @@ export const chatConversationVoice = `VISIBLE VOICE
## ${VERDICT_HEADING}
第一行一句话回答这个问题,先给结论;用户问能不能、会不会、是不是的时候,第一句先答能或不能、会或不会(拿不准就说多半能、多半不会),再说条件。接着三行,按问题的领域选一组标签,标签一字不改,冒号后面写你的判断,每行 15 字以内:
${verdictLabelLines()}
## ${DEFAULT_TIMELINE_HEADING}(首轮除了性格题(只问「我是什么样的人」「我的性格」,结论卡用性格那组标签)都写这一节,「我适合做什么」「幕后还是台前」这类事业题也写:读的人会想知道什么时候动。用户说了范围就照他的范围写,标题改成「接下来两年」「2027 到 2028 年」这样)
每条一行,写成「- **小标题**(2026 年 11 月到 12 月):一句话说这一段是什么样子。该做:……。别做:……。〔W1 T3 T4〕」。小标题 2 到 4 个字(收尾、起步、最好用、守住);括号里只写起止,第一段从「现在」写起(「现在到 2026 年 12 月」),月中换段的写「5 月中旬」,照 strip_stretches 的写法。一般问题照 strip_stretches 的几段写(程序按这道题的领域切好的接下来 12 个月,段数照它,不凑数、不合并;起止、说法和〔编号〕照抄);用户说了范围就照他的范围按 period_coverage 写,最多 8 条,末尾〔〕写合并的 period_coverage 行的编号,起止从这些行来。每段的小标题和那句话照这一段的说法和为什么写:「有机会」写清是什么机会、怎么抓,不写吃力、费力;「有机会,但费力」写清机会是什么、费力在哪,两样都写,不写轻松、平稳、顺;「较费力」写清哪里费力、怎么省力,不写机会、轻松、平稳、顺;「不标」写这一段最适合做什么,不写吃力,也不写平稳、顺。为什么只照 strip_stretches 写到的那几条,不自己另加好坏;没写到帮助或阻力不等于平稳,「平稳」这个词不用。「其中……」那几天写进这一段的那句话里(「其中 1 月上旬事情会多一些」)。每段只说一件确定的事和怎么做,不写可能、或许、也许、不排除、视情况、有好有坏这类两头的话。出生时间会让日期移动几天这句不写进任何一段(页面在时间条下面统一写一次)。最后可以另起一行(不加「-」)用一句话说 12 个月之后下一个真正的转折点。
## ${DEFAULT_TIMELINE_HEADING}(紧跟在结论后面写;首轮除了性格题(只问「我是什么样的人」「我的性格」,结论卡用性格那组标签)都写这一节,「我适合做什么」「幕后还是台前」这类事业题也写:读的人会想知道什么时候动。用户说了范围就照他的范围写,标题改成「接下来两年」「2027 到 2028 年」这样)
每条一行,写成「- **小标题**(2026 年 11 月到 12 月):一句话说这一段是什么样子。该做:……。别做:……。〔W1 T3 T4〕」。小标题 2 到 4 个字(收尾、起步、最好用、守住);括号里只写起止,第一段从「现在」写起(「现在到 2026 年 12 月」),月中换段的写「5 月中旬」,照 strip_stretches 的写法。一般问题照 strip_stretches 的几段写(程序按这道题的领域切好的接下来 12 个月,段数照它,不凑数、不合并;起止、说法和〔编号〕照抄);用户说了范围就照他的范围按 period_coverage 写,最多 8 条,末尾〔〕写合并的 period_coverage 行的编号,起止从这些行来。每段的小标题和那句话照这一段的说法和为什么写:「有机会」写清是什么机会、怎么抓,不写吃力、费力,小标题也不用紧、守住、收着;「有机会,但费力」写清机会是什么、费力在哪,两样都写,不写轻松、平稳、顺;「较费力」写清哪里费力、怎么省力,不写机会、轻松、平稳、顺;「不标」写这一段最适合做什么,不写吃力,也不写平稳、顺。为什么只照 strip_stretches 写到的那几条,不自己另加好坏;没写到帮助或阻力不等于平稳,「平稳」这个词不用。「其中……」那几天写进这一段的那句话里(「其中 1 月上旬事情会多一些」)。那一句 36 字以内,该做、别做各 24 字以内。每段只说一件确定的事和怎么做,不写可能、或许、也许、不排除、视情况、有好有坏这类两头的话。出生时间会让日期移动几天这句不写进任何一段(页面在时间条下面统一写一次)。最后可以另起一行(不加「-」)写「12 个月之后,下一个转折点在某年某月,……」一句,只写在这一节。
接下来五块,标题按领域照写:
${bodyHeadingLines()}
每块两到四条。每条单独一段:先一句 **加粗** 的话,它本身就是一个结论;后面两三句短句,说它在日子里是什么样子、具体怎么做。段末写〔〕和这条判断用到的表行编号(程序会去掉,用来核对)。第二块的各条按合适程度排,加粗句开头写「一、」「二、」「三、」。「要留意的」每条写什么时候、会是什么样子、怎么应对;写到的日期和说法照时间条那几段(同样的起止,同样的说法)。
每块两到四条。每条单独一段:先一句 **加粗** 的话,它本身就是一个结论;后面两三句短句,说它在日子里是什么样子、具体怎么做。段末写〔〕和这条判断用到的表行编号(程序会去掉,用来核对)。第二块的各条按合适程度排,加粗句开头写「一、」「二、」「三、」。「要留意的」每条写会是什么样子、怎么应对。日期只在时间条里:正文各块(「现在就可以试的」「要留意的」也一样)不写时间条里的年月和起止,要指哪一段就说「时间轴里最后那一段」「时间轴里『谈成』那一段」,说法和那一段一致;对读者只说「时间轴」。
正文(从「${VERDICT_HEADING}」到「要留意的」)大约 1,200 到 1,600 字。这是读的人能读完的长度,但不为凑短删掉判断:卡上和这件事有关的判断都要写到,写不下就把句子写短。
## ${ASK_USER_HEADING}(多数回答没有这一节)
只有一种情况写这一节:这个问题的答案要看一件只有用户自己知道的事,按这件事会分成明显不同的几条路(比如感情题里他现在是单身、在暧昧还是已经在一起,判断和时间点都不一样;事业题里他是上班还是自己做;他在两个打算里选哪一个),而这件事他在这次对话里还没说过。这时在这里问那一件事:一句问句,对着「你」问,平常话,30 字以内,只问一件。答案不靠这样一件事分路时,正文已经把话说完整,不写这一节,读完想接着问的交给「${FOLLOW_UP_HEADING}」。用户在对话里已经说过的事不再问,也不问过去的经历。页面把这句放在正文最后一行。
@@ -319,8 +325,8 @@ ${bodyHeadingLines()}
- 结论卡时间那一行照 best_time 写(标签和值都照它:有明确帮助的段写「最好的时候」,可以是两段、各说用处;没有的写「最省力的时候」);卡上没有 best_time 就不写这一行,换成这组标签里别的两行也行。这一行的值后面不加吃力、费力。
- 卡上有 year_background(这一整年都在的帮助和要花的力气)时,结论那一句用平常话把它说一次:这一年适合做什么、要付出什么,说成确定的话,不写有好有坏;时间条各段不再重复它。
- 一段时间好不好,只照 strip_stretches 写的说法和为什么;正文别处说到某一段好走或费力,也要是那里写到的那几条,不自己凭运期主星、落陷、功能凶星或土星单独定好坏。
- 土星绕月亮那几年(saturn_background)是背景:全篇最多说一次,放在「要留意的」,用平常话说是哪几年、日子里是什么样子(心里压力大、精力要省着用这一类),不挂在每一段上,也不说它让事业、钱、感情全都变差。
- 正文的日期写到年月。「出生时间差几分钟会移动几天」这句不写:页面在时间条下面统一显示一次。
- 土星绕月亮那几年(saturn_background)是背景:全篇最多说一次,放在「要留意的」,用平常话说从哪一年到哪一年(只写年份)、日子里是什么样子(心里压力大、精力要省着用这一类),不挂在每一段上,也不说它让事业、钱、感情全都变差。
- 正文写到时间条以外的日期时写到年月。「出生时间差几分钟会移动几天」这句不写:页面在时间条下面统一显示一次。
- 建议要具体:每段时间写做什么、不做什么。不给医疗、法律、投资指令:不推荐具体投资品,不开药,不列化验单;健康只写作息、减负、什么情况该去看医生。
- 用户说过的事实照用。要问用户的只写在「## ${ASK_USER_HEADING}」那一节,别处(正文末尾、「接着问」、「判断依据」前后)不问用户问题;不请用户回想过去的事来帮着推将来。
${LIFE_REPORT_RULE}
+6 -18
View File
@@ -175,28 +175,16 @@ test("BUG-2305: nothing above the body moves between the last streaming frame an
}
});
test("BUG-2305: a time section written after the body is drawn after it, so it never lands above streamed text", async () => {
// 原值:正文后面写的时间一节画在正文后面(timelineAfterBody),流式时正文节点和位置不变;新值:时间条一律在结论卡、星盘那一行下面的
// 固定位置(解析器把它提上来),正文在它下面;原因:BUG-2320 负责人认可的整理原型,时间条有时在「要留意的」下面、有时在正文上面。
// 结构上需要时间条时,这一位置从第一帧就按时间条的高度留好(见 chat-answer-tidy-2320),所以正文不会被顶开。
test("BUG-2305 → BUG-2320: a time section written after the body is drawn in the strip's slot, above the body", async () => {
await loadChatMarkdown();
// The owner's follow-up order: verdict, body, then 「## 时间」.
// The parser still records where it was written (logs only).
assert.equal(parseAnswerShape(ANSWER, { now: NOW })!.timelineAfterBody, true);
assert.equal(parseAnswerShape([VERDICT, OWNER_TIME, BODY].join("\n\n"), { now: NOW })!.timelineAfterBody, false);
const after = renderToStaticMarkup(<ChatMessageContent text={`${ANSWER}\n\n${BASIS}`} structured />);
assert.ok(after.indexOf("chat-answer-strip") > after.indexOf('class="message-markdown"'));
assert.ok(after.indexOf("chat-answer-strip") < after.indexOf('class="message-markdown"'));
const first = renderToStaticMarkup(<ChatMessageContent text={`${[VERDICT, OWNER_TIME, `## 你在感情里的长处和短处\n${BODY}`, NEXT].join("\n\n")}\n\n${BASIS}`} structured />);
assert.ok(first.indexOf("chat-answer-strip") < first.indexOf('class="message-markdown"'));
// Streaming: the body is on screen before the time section; when the strip appears, the body keeps its node and place.
resetChatWaitForTests();
const h = createClientLifecycleHarness();
try {
const bodyNode = () => h.elements().find((node) => (node.getAttribute("class") ?? "") === "message-markdown");
const index = (node: unknown) => h.elements().find((el) => (el.getAttribute("class") ?? "").includes("chat-answer-shaped"))!.childNodes.indexOf(node as never);
await h.render(<ChatMessageContent text={[VERDICT, BODY].join("\n\n")} structured streaming />);
const before = bodyNode()!;
const at = index(before);
await h.render(<ChatMessageContent text={[VERDICT, BODY, OWNER_TIME].join("\n\n")} structured streaming />);
assert.equal(bodyNode(), before);
assert.equal(index(before), at);
} finally {
await h.close();
}
});
@@ -329,10 +329,12 @@ test("BUG-2281 review: the birth-time sentence is never inside a segment panel;
assert.equal(shape.timeline!.segments[0]!.sentence, "把手上的事收干净。");
const text = `${[VERDICT, withCaveat, BODY, NEXT].join("\n\n")}\n\n${BASIS}`;
const marked = renderToStaticMarkup(<ChatMessageContent text={text} structured answerShape={{ areas: [10], tones: ["none", "none", "strain"], timeSensitive: true }} />);
assert.equal((marked.match(/出生时间差几分钟/gu) ?? []).length, 1);
assert.match(marked, new RegExp(`<p class="chat-answer-strip-caveat">${BIRTH_TIME_STRIP_LINE}</p></section>`, "u"));
// 原值:/出生时间差几分钟/ 出现一次,整行就是 BIRTH_TIME_STRIP_LINE;新值:「差几分钟」出现一次,在页脚那一行的末尾(前面可有转折点那一句);
// 原因:BUG-2320 转折点和出生时间并成时间条下面的一行小字,出生时间那句换成原型的短写法。
assert.equal((marked.match(/差几分钟/gu) ?? []).length, 1);
assert.match(marked, new RegExp(`<p class="chat-answer-strip-caveat">[^<]*${BIRTH_TIME_STRIP_LINE}</p></section>`, "u"));
const unmarked = renderToStaticMarkup(<ChatMessageContent text={text} structured answerShape={{ areas: [10], tones: ["none", "none", "strain"] }} />);
assert.doesNotMatch(unmarked, /出生时间差几分钟/u);
assert.doesNotMatch(unmarked, /差几分钟/u);
// The card's sub-period table is what marks it.
const marking = card();
(marking.base.timing as unknown as Record<string, Record<string, unknown>>).sub_periods!.columns = "[大运主星, 小运主星, 细运主星, 起, 止];名义计算边界,出生时间差几分钟会移动几天";
+13 -5
View File
@@ -272,7 +272,11 @@ test("BUG-2308 motion: the strip is not drawn while its section is written; it m
assert.match(strip.getAttribute("class")!, /is-arriving/u);
assert.equal(h.elements().filter((node) => (node.getAttribute("class") ?? "").includes("chat-answer-strip-segment")).length, 3);
above.forEach((node, index) => assert.equal(shaped().childNodes[index], node, "the blocks above keep their nodes and places"));
assert.ok(shaped().childNodes.indexOf(strip) > shaped().childNodes.indexOf(above[0]!), "the strip under the verdict");
// 原值:strip is a direct child of the answer; 新值:it sits in the slot (BUG-2320), the slot is the child under the verdict;
// 原因:the slot keeps the strip's place and height from the first frame.
const slotNode = shaped().childNodes.find((node) => (node.getAttribute("class") ?? "").includes("chat-answer-strip-slot"))!;
assert.ok(slotNode.childNodes.includes(strip), "the strip is drawn into its slot");
assert.ok(shaped().childNodes.indexOf(slotNode) > shaped().childNodes.indexOf(above[0]!), "the strip under the verdict");
const bodyNode = shaped().childNodes.find((node) => node.getAttribute("class") === "message-markdown")!;
const bodyAt = shaped().childNodes.indexOf(bodyNode);
// Completion (tones arrive): the same strip node, the same body node and place.
@@ -287,7 +291,9 @@ test("BUG-2308 motion: the strip is not drawn while its section is written; it m
assert.doesNotMatch(stored, /is-arriving/u);
});
test("BUG-2308 motion: a strip the program added after the body was on screen is drawn after the body in that row", async () => {
// 原值:程序在正文写完后补上的时间条画在正文后面;新值:落在结论下面的固定位置(结论卡有「最好的时候」,位置从第一帧就留好,
// 正文的节点和位置不变);原因:BUG-2320 负责人认可的整理原型,时间条位置固定。
test("BUG-2308 → BUG-2320: a strip the program added after the body was on screen lands in the reserved slot; the body does not move", async () => {
await loadChatMarkdown();
const stretches = programStretches(card(), { now: NOW });
const written = OWNER_FIRST.replace(",偏吃力", "");
@@ -296,17 +302,19 @@ test("BUG-2308 motion: a strip the program added after the body was on screen is
try {
await h.render(<ChatMessageContent text={written} structured streaming />);
const shaped = () => h.elements().find((node) => (node.getAttribute("class") ?? "").includes("chat-answer-shaped"))!;
const slot = () => shaped().childNodes.find((node) => (node.getAttribute("class") ?? "").includes("chat-answer-strip-slot"));
const bodyNode = shaped().childNodes.find((node) => node.getAttribute("class") === "message-markdown")!;
const bodyAt = shaped().childNodes.indexOf(bodyNode);
const reserved = slot()!;
assert.ok(shaped().childNodes.indexOf(reserved) < bodyAt, "the slot is reserved above the body");
await h.render(<ChatMessageContent text={added} structured streaming />);
const children = shaped().childNodes;
const stripAt = children.findIndex((node) => /(?:^| )chat-answer-strip(?: |$)/u.test(node.getAttribute("class") ?? ""));
assert.equal(slot(), reserved, "the same slot");
assert.ok(reserved.childNodes.some((node) => /(?:^| )chat-answer-strip(?: |$)/u.test(node.getAttribute("class") ?? "")), "the strip is drawn into it");
assert.equal(children.indexOf(bodyNode), bodyAt, "the body keeps its place");
assert.ok(stripAt > bodyAt, "the strip comes after the body");
} finally {
await h.close();
}
// Stored: in its place after the verdict.
const stored = renderToStaticMarkup(<ChatMessageContent text={added} structured />);
assert.ok(stored.indexOf("chat-answer-strip") < stored.indexOf('class="message-markdown"'));
});
@@ -0,0 +1,291 @@
// BUG-2320 (owner-approved tidy prototype, 2026-11-24): the answer's fixed order (verdict → chart row → strip → year
// sentence → body → evidence box → icons → questions) whatever order the writer used; the strip's slot reserved at its
// final height from the first streamed frame when the structure requires one; dates only in the strip (body repeats and
// contradictions recorded, never rewritten); one footer line under the panel; the legend on the heading's row; the
// round jump button; titles that agree with their label; the dark strip tones (option C).
import "./install-test-document";
import assert from "node:assert/strict";
import { readFileSync } from "node:fs";
import test from "node:test";
import React from "react";
import { renderToStaticMarkup } from "react-dom/server";
import { ChatMessageContent } from "../src/components/chat-message-content.tsx";
import { AnswerYearStrip } from "../src/components/chat-answer-shape.tsx";
import { BIRTH_TIME_STRIP_LINE, parseAnswerShape, stripFooterLine, stripSlotRequired, stripTitleMismatch } from "../src/lib/chat-answer-shape.ts";
import { bodyStripDateFlags, timelineSectionFromReply, type ProgramStretch } from "../src/lib/chat-answer-timeline.ts";
import { checkStripTone, stripToneMismatch } from "../src/lib/chat-evidence-keys.ts";
import { loadChatMarkdown } from "../src/lib/chat-markdown-loader.ts";
import { beginChatWait, resetChatWaitForTests } from "../src/lib/chat-wait-store.ts";
import type { EvidenceCard } from "../src/lib/consultation-evidence-card.ts";
import { followUpAnswerShapeInstruction } from "../src/lib/consultation-thinking-plan.ts";
import { chatConversationVoice } from "../src/mastra/product-voice.ts";
import { createClientLifecycleHarness } from "./react-client-lifecycle-test-support";
const css = readFileSync(new URL("../src/app/globals.css", import.meta.url), "utf8");
const jumpSource = readFileSync(new URL("../src/components/jump-to-latest-button.tsx", import.meta.url), "utf8");
const NOW = 2026 * 12 + 10; // 2026-11
const VERDICT = [
"## 结论",
"你最适合靠一门说得清的专业本事收钱。",
"- **钱从哪来**:专业本事换客户结算",
"- **先别碰**:借钱做资产、替人垫资",
"- **最好的时候**:2027 年 1 月到 5 月中旬",
"",
"这一年整体对你是帮忙的,代价是支出一直跟着你走。",
].join("\n");
const TIME = [
"## 接下来一年",
"- **收进**(现在到 2026 年 12 月):进钱的门路是开的。该做:每笔活先写清价格。别做:别接要你先垫钱的项目。",
"- **好谈**(2027 年 1 月到 5 月中旬):谈下来的钱落得到手里。该做:主动开价。别做:别压价。",
"- **守住**(2027 年 5 月中旬到 10 月):支出多,心里紧。该做:两笔账分开记。别做:别签长期的大额承诺。",
"",
"12 个月之后,下一个真正的转折点在 2028 年 4 月,钱上的节奏从那之后换一套。",
].join("\n");
const BODY = [
"## 你在钱上的长处和短处",
"**你挣钱的路子比存钱的路子宽。** 活是你自己干的。",
"",
"## 要留意的",
"**年底有一笔额外支出。** 就是时间轴里最后那一段。提前把这一笔算进预算。",
].join("\n");
const NEXT = "## 接着问\n- 我该怎么定价?\n- 年底那笔钱怎么留?\n- 我要不要合伙?";
const BASIS = "## 判断依据\n\n- **进钱的门路是开的**:几种方法一致。(几种方法一致)";
const shapedChildren = (h: ReturnType<typeof createClientLifecycleHarness>) =>
h.elements().find((node) => (node.getAttribute("class") ?? "").includes("chat-answer-shaped"))!.childNodes;
const classOf = (node: { getAttribute(name: string): string | null }) => node.getAttribute("class") ?? "";
test("BUG-2320 order: verdict → chart row → strip → year sentence → body → evidence, also when the writer puts the time section last", async () => {
await loadChatMarkdown();
for (const text of [[VERDICT, TIME, BODY, NEXT], [VERDICT, BODY, TIME, NEXT]].map((parts) => `${parts.join("\n\n")}\n\n${BASIS}`)) {
const html = renderToStaticMarkup(<ChatMessageContent text={text} structured answerShape={{ areas: [2, 11], tones: ["chance_costly", "chance", "strain"], timeSensitive: true }} />);
const at = (needle: string) => { const index = html.indexOf(needle); assert.ok(index >= 0, needle); return index; };
const order = [at('class="chat-answer-verdict"'), at('class="chat-answer-areas'), at('class="chat-answer-strip-slot'), at("这一年整体对你是帮忙的"), at("你挣钱的路子比存钱的路子宽"), at('class="chat-answer-evidence"')];
assert.deepEqual([...order].sort((a, b) => a - b), order, "fixed order");
assert.equal((html.match(/class="chat-answer-strip"/gu) ?? []).length, 1, "one strip");
// The turning point is the footer, not a body paragraph; the year sentence stays the body's first paragraph.
assert.doesNotMatch(html.slice(at('class="message-markdown"')), /转折点/u);
}
});
test("BUG-2320 slot: reserved at the final strip's height from the first frame, the same node until completion; none when not required", async () => {
await loadChatMarkdown();
resetChatWaitForTests();
beginChatWait("req-1", "s", true, true);
const h = createClientLifecycleHarness();
const full = [VERDICT, TIME, BODY, NEXT].join("\n\n");
try {
const slot = () => shapedChildren(h).find((node) => classOf(node).includes("chat-answer-strip-slot"));
// First frame: only the verdict sentence — a first turn reserves the slot already.
await h.render(<ChatMessageContent text={"## 结论\n你最适合靠一门说得清的专业本事收钱。\n"} structured streaming />);
const first = slot()!;
assert.ok(first, "slot from the first frame");
assert.equal(classOf(first), "chat-answer-strip-slot is-reserved");
assert.ok(first.childNodes.some((node) => classOf(node) === "chat-answer-strip-placeholder"), "label and a neutral bar stand in");
// The time section is being written: still the placeholder, same node.
await h.render(<ChatMessageContent text={`${VERDICT}\n\n${TIME.split("\n").slice(0, 3).join("\n")}\n`} structured streaming />);
assert.equal(slot(), first);
// Body streaming: the strip is drawn into the same slot; the body sits under it.
await h.render(<ChatMessageContent text={`${VERDICT}\n\n${TIME}\n\n${BODY}`} structured streaming />);
assert.equal(slot(), first);
assert.ok(first.childNodes.some((node) => /(?:^| )chat-answer-strip(?: |$)/u.test(classOf(node))));
const bodyNode = shapedChildren(h).find((node) => classOf(node) === "message-markdown")!;
const bodyAt = shapedChildren(h).indexOf(bodyNode);
assert.ok(shapedChildren(h).indexOf(first) < bodyAt);
// Completion: same slot node, same class (same reserved height), same body place.
await h.render(<ChatMessageContent text={`${full}\n\n${BASIS}`} structured answerShape={{ areas: [2], tones: ["chance_costly", "chance", "strain"], timeSensitive: true }} />);
assert.equal(slot(), first);
assert.equal(classOf(first), "chat-answer-strip-slot is-reserved");
assert.equal(shapedChildren(h).indexOf(bodyNode), bodyAt);
} finally {
await h.close();
resetChatWaitForTests();
}
// The height is one fixed value per width band; the panel takes the spare height; the footer keeps two lines' room.
assert.match(css, /\.chat-answer-strip-slot\.is-reserved \{ min-height: var\(--chat-strip-slot-height\); \}/u);
assert.match(css, /\.chat-answer-strip-slot \{[^}]*--chat-strip-slot-height: \d+px;/u);
assert.match(css, /@media \(min-width: 641px\) \{ \.chat-answer-strip-slot \{ --chat-strip-slot-height: \d+px; \} \}/u);
assert.match(css, /\.chat-answer-strip-slot\.is-reserved \.chat-answer-strip-detail \{ flex: 1; \}/u);
assert.match(css, /\.chat-answer-strip-slot\.is-reserved \.chat-answer-strip-caveat \{ min-height: 3em; \}/u);
// Not required: a personality first turn drops the slot the moment its labels show (before any body text); a
// follow-up without a time label never reserves one.
assert.equal(stripSlotRequired([], true), true);
assert.equal(stripSlotRequired(["长处", "短处"], true), false);
assert.equal(stripSlotRequired(["钱从哪来"], true), true);
assert.equal(stripSlotRequired([], false), false);
assert.equal(stripSlotRequired(["最好的时候"], false), true);
const h2 = createClientLifecycleHarness();
try {
await h2.render(<ChatMessageContent text={"## 结论\n先稳住。\n\n**多出门。** 多见人。"} structured streaming />);
assert.equal(shapedChildren(h2).some((node) => classOf(node).includes("chat-answer-strip-slot")), false);
} finally {
await h2.close();
}
});
function stretch(range: string, fromDay: string, toDay: string, label: ProgramStretch["label"]): ProgramStretch {
return { keys: ["W1"], from: 0, to: 0, fromDay, toDay, label, reasons: "", basis: "", rules: [], range };
}
const STRETCHES = [
stretch("现在到 2026 年 12 月", "2026-11-01", "2027-01-01", "chance_costly"),
stretch("2027 年 1 月到 5 月中旬", "2027-01-01", "2027-05-15", "chance"),
stretch("2027 年 5 月中旬到 10 月", "2027-05-15", "2027-11-01", "strain"),
];
test("BUG-2320 dates only in the strip: body sentences repeating a strip range, or saying the opposite, are recorded — never rewritten", () => {
const clean = bodyStripDateFlags("**年底有一笔额外支出。** 就是时间轴里最后那一段。提前算进预算。", STRETCHES);
assert.deepEqual(clean, { repeats: [], conflicts: [] }, "no flag on a body that points at the strip");
const repeated = bodyStripDateFlags([
"**精力省着用。** 2027 年 1 月到 3 月,心里压力大,也容易累。",
"**收入和支出容易错开。** 时间轴里 5 月中旬到 7 月那一段,到月底差一截。",
"**明年 2 月到 4 月,主动开口要介绍。** 找三个老客户。",
"**更远的事。** 2029 年 3 月到 5 月再说。",
].join("\n\n"), STRETCHES);
assert.equal(repeated.repeats.length, 3, "three body ranges meet the strip (the 2029 one does not)");
// 「压力大」 on a 有机会 stretch: the opposite direction.
assert.deepEqual(repeated.conflicts, ["2027 年 1 月到 3 月,心里压力大,也容易累。"]);
// The writing rules: dates only in the strip, point at 「时间轴里……那一段」, the user word is 时间轴.
assert.match(chatConversationVoice, /日期只在时间条里/u);
assert.match(chatConversationVoice, /时间轴里最后那一段/u);
assert.match(chatConversationVoice, /对读者只说「时间轴」/u);
assert.doesNotMatch(chatConversationVoice, /写到的日期和说法照时间条那几段/u);
// The time section right after the verdict (first turns and follow-ups).
assert.match(chatConversationVoice, /## 接下来一年(紧跟在结论后面写/u);
assert.match(followUpAnswerShapeInstruction(), /写时间那一节(紧跟在「## 结论」后面/u);
});
test("BUG-2320 footer: the turning point and the birth-time note as ONE small muted line under the panel; the body drops the sentence", async () => {
assert.equal(stripFooterLine("12 个月之后,下一个真正的转折点在 2028 年 4 月,钱上的节奏从那之后换一套。", true), `2028 年 4 月是下一个转折点,钱上的节奏从那之后换一套。${BIRTH_TIME_STRIP_LINE}`);
assert.equal(stripFooterLine("12 个月之后,下一个转折点在 2027 年 12 月。〔V4 T2〕", false), "2027 年 12 月是下一个转折点。");
assert.equal(stripFooterLine("", true), BIRTH_TIME_STRIP_LINE);
assert.equal(stripFooterLine("", false), "");
assert.equal(BIRTH_TIME_STRIP_LINE, "时间按出生时间推,差几分钟会移动几天。");
// Written in the body instead of the time section: lifted into the footer.
const misplaced = parseAnswerShape([VERDICT, TIME.split("\n\n")[0], `${BODY}\n\n12 个月之后,下一个转折点在 2028 年 4 月,节奏换一套。`].join("\n\n"), { now: NOW })!;
assert.match(misplaced.timeline!.note, /2028 年 4 月/u);
assert.doesNotMatch(misplaced.body, /转折点/u);
await loadChatMarkdown();
const shape = parseAnswerShape([VERDICT, TIME, BODY].join("\n\n"), { now: NOW })!;
const html = renderToStaticMarkup(<AnswerYearStrip timeline={shape.timeline!} tones={["chance_costly", "chance", "strain"]} timeSensitive />);
assert.equal((html.match(/<p class="chat-answer-strip-caveat"/gu) ?? []).length, 1);
assert.match(html, /<div class="chat-answer-strip-detail"[\s\S]*<\/div><p class="chat-answer-strip-caveat">2028 年 4 月是下一个转折点,钱上的节奏从那之后换一套。时间按出生时间推,差几分钟会移动几天。<\/p><\/section>$/u);
assert.doesNotMatch(html, /chat-answer-strip-note/u);
assert.match(css, /\.chat-answer-shaped \.chat-answer-strip-caveat \{ margin: 0; color: var\(--color-ink-tertiary\); font-size: var\(--type-caption\); line-height: 1\.5; \}/u);
});
test("BUG-2320 legend: on the heading's row, right-aligned, only labels in use, wrapping under on narrow widths", async () => {
await loadChatMarkdown();
const shape = parseAnswerShape([VERDICT, TIME, BODY].join("\n\n"), { now: NOW })!;
const html = renderToStaticMarkup(<AnswerYearStrip timeline={shape.timeline!} tones={["chance_costly", "chance_costly", "strain"]} />);
assert.match(html, /<div class="chat-answer-strip-head"><p class="chat-answer-label">接下来一年<\/p><div class="chat-answer-strip-legend" aria-hidden="true"><span>[^<]*<i[^>]*><\/i>有机会,但费力<\/span><span><i[^>]*><\/i>较费力<\/span><\/div><\/div>/u);
assert.doesNotMatch(html, />有机会<\/span>/u, "only labels in use");
assert.match(css, /\.chat-answer-strip-head \{ display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between;/u);
assert.match(css, /\.chat-answer-strip-legend \{[^}]*justify-content: flex-end;[^}]*margin-left: auto;/u);
});
test("BUG-2320 jump to latest: a small round icon-only button at the bottom-right above the composer, 44px hit area", () => {
assert.match(jumpSource, /aria-label="跳到最新"/u);
assert.doesNotMatch(jumpSource, /\n\s*跳到最新\n/u, "no visible label");
assert.match(jumpSource, /<ArrowDown aria-hidden="true" \/>/u);
const wrap = css.match(/\.jump-to-latest \{[^}]*\}/u)![0];
assert.match(wrap, /justify-content: flex-end;/u);
assert.match(wrap, /bottom: 100%;/u);
const button = css.match(/\.jump-to-latest__button \{[^}]*\}/u)![0];
assert.match(button, /min-height: 44px;/u);
assert.match(button, /min-width: 44px;/u);
// The visible circle is 36px (44 minus 4px on each side), drawn by ::before.
assert.match(css, /\.jump-to-latest__button::before \{ content: ""; position: absolute; inset: 4px;[^}]*border-radius: 999px;/u);
});
const SIGNS = ["Capricorn", "Aquarius", "Pisces", "Aries", "Taurus", "Gemini", "Cancer", "Leo", "Virgo", "Libra", "Scorpio", "Sagittarius"];
// The public test chart of chat-answer-shape-2281 (same cut): W1 is 有机会.
function card(): EvidenceCard {
return {
domains: ["career"],
base: {
natal: {
ascendant: { sign: "Capricorn" },
houses: Object.fromEntries(SIGNS.map((sign, index) => [String(index + 1), sign])),
functional_benefic_malefic: {
functional_benefics: ["Mercury", "Saturn", "Venus"], functional_malefics: ["Jupiter", "Mars"], functional_neutrals: ["Moon", "Sun"], yogakarakas: ["Venus"],
owned_houses: { Jupiter: [3, 12], Mars: [4, 11], Mercury: [6, 9], Moon: [7], Saturn: [1, 2], Sun: [8], Venus: [5, 10] },
},
planets: {
Moon: { sign: "Taurus", house: 5, degree_in_sign: 11.49, nakshatra: "Rohini", status: "入旺(Exalted)" },
Saturn: { sign: "Capricorn", house: 1, degree_in_sign: 3.46, nakshatra: "Uttara Ashadha", status: "入庙(Own)", retrograde: true },
Jupiter: { sign: "Capricorn", house: 1, degree_in_sign: 8.99, nakshatra: "Uttara Ashadha", status: "落陷(Debilitated)" },
Venus: { sign: "Gemini", house: 6, degree_in_sign: 9.92, nakshatra: "Ardra", status: "极友(Great Friend)" },
},
more: {
sav_all_houses: { rows: { 1: ["Capricorn", 23, "挑战"], 2: ["Aquarius", 24, "挑战"], 3: ["Pisces", 32, "极吉"], 4: ["Aries", 32, "极吉"], 5: ["Taurus", 31, "极吉"], 6: ["Gemini", 29, "吉利"], 7: ["Cancer", 27, "中等"], 8: ["Leo", 21, "挑战"], 9: ["Virgo", 25, "中等"], 10: ["Libra", 33, "极吉"], 11: ["Scorpio", 37, "极吉"], 12: ["Sagittarius", 23, "挑战"] } },
argala_all_houses: { rows: { 10: { verdict: "待定", helpers: [{ natal_house: 6, planets: "Venus", state: "待定" }], blockers: [] } } },
},
},
timing: {
vimshottari: {
mahadasha: { lord: "Saturn", start: "2011-06-24", end: "2030-06-24" },
antardasha: { lord: "Rahu", start: "2025-02-04", end: "2027-12-12" },
antardashas_in_mahadasha: [["Rahu", "2025-02-04", "2027-12-12"], ["Jupiter", "2027-12-12", "2030-06-24"]],
},
sub_periods: { rows: [["Saturn", "Rahu", "Ketu", "2026-10-04", "2026-12-04"], ["Saturn", "Rahu", "Venus", "2026-12-04", "2027-05-26"], ["Saturn", "Rahu", "Sun", "2027-05-26", "2027-07-17"]] },
transits_detail: {
reference_date: "2026-11-23",
bodies: { Jupiter: { sign: "Leo" }, Saturn: { sign: "Pisces" }, Rahu: { sign: "Aquarius" }, Ketu: { sign: "Leo" } },
key_dates_window: { start: "2026-11-23", end: "2030-11-23" },
key_dates: [{ kind: "ingress", date: "2027-05-20", body: "saturn", to_sign: "Aries" }],
},
},
},
domain_sections: {
career: { double_transit: { houses_checked: [9, 10], by_house: { rows: { 9: [["2026-11-23", "2027-02-05"]], 10: [["2026-11-23", "2027-02-05"], ["2027-05-20", "2030-11-23"]] } } } },
},
} as unknown as EvidenceCard;
}
test("BUG-2320 titles agree with the label: no 紧 / 紧着 / 守住 / 收着 on 有机会, no easing word on 较费力; failing titles go to the strip repair", () => {
for (const title of ["紧着", "守住", "收着", "收紧", "吃力"]) assert.equal(stripTitleMismatch(title, "chance"), true, title);
assert.equal(stripTitleMismatch("谈成", "chance"), false);
assert.equal(stripTitleMismatch("回稳", "strain"), true);
assert.equal(stripTitleMismatch("守住", "strain"), false);
assert.equal(stripTitleMismatch("守住", "chance_costly"), false);
// The sentence alone is fine; the title fails — the segment is flagged for the existing strip repair (title and that line only).
const text = [
"## 结论", "好。", "",
"## 接下来一年",
"- **紧着**(现在到 2027 年 1 月):有人找你谈新活。该做:谈。别做:拖。〔W1〕",
"", "## 你的长处和短处", "**紧着点花钱。** 没问题。",
"", "## 判断依据", "", "- **x**:说明。〔Sa〕",
].join("\n");
const flags = checkStripTone(text, card());
assert.deepEqual(flags.map((flag) => flag.kind), ["strip_chance"]);
assert.equal(flags[0]!.sentence, "**紧着**(现在到 2027 年 1 月):有人找你谈新活。");
assert.match(flags[0]!.card, /小标题也不用紧、守住、收着/u);
// The repair's rewrite is refused while its title still fails.
assert.equal(stripToneMismatch("**守住**(现在到 2027 年 1 月):有人找你谈新活。", "chance"), true);
assert.equal(stripToneMismatch("**谈成**(现在到 2027 年 1 月):有人找你谈新活。", "chance"), false);
// The fill call's reply is refused the same way.
const only = [stretch("现在到 2026 年 12 月", "2026-11-01", "2027-01-01", "chance")];
assert.equal(timelineSectionFromReply(JSON.stringify({ stretches: [{ title: "收着", sentence: "有人找你谈新活", do: "多见客户", avoid: "别拖着" }] }), only), null);
assert.ok(timelineSectionFromReply(JSON.stringify({ stretches: [{ title: "谈成", sentence: "有人找你谈新活", do: "多见客户", avoid: "别拖着" }] }), only));
assert.match(chatConversationVoice, /小标题也不用紧、守住、收着/u);
});
test("BUG-2320 dark mode: option C strip tones and lit areas in both dark blocks; light mode unchanged", () => {
const block = (opener: string) => { const start = css.indexOf(opener); return css.slice(start, css.indexOf("\n}", start)); };
const light = block(":root {\n color-scheme: light;");
for (const dark of [block(':root:not([data-theme="light"]) {'), block(':root[data-theme="dark"] {')]) {
assert.match(dark, /--strip-chance: oklch\(0\.46 0\.03 165\);/u);
assert.match(dark, /--strip-strain: oklch\(0\.46 0\.035 20\);/u);
assert.match(dark, /--strip-chance-costly: oklch\(0\.46 0\.015 90\);/u);
assert.match(dark, /--chart-area-lit: oklch\(0\.50 0\.035 20\);/u);
}
assert.match(light, /--strip-chance: color-mix\(in srgb, var\(--color-success\) 22%, var\(--color-canvas\)\);/u);
assert.match(light, /--strip-strain: color-mix\(in srgb, var\(--color-action\) 26%, var\(--color-canvas\)\);/u);
assert.match(light, /--strip-chance-costly: color-mix\(in srgb, var\(--color-success\) 11%, color-mix\(in srgb, var\(--color-action\) 13%, var\(--color-canvas\)\)\);/u);
assert.match(light, /--chart-area-lit: color-mix\(in srgb, var\(--color-action\) 30%, var\(--color-canvas\)\);/u);
assert.match(css, /\.chat-answer-areas-chart \.is-lit \{ fill: var\(--chart-area-lit\); \}/u);
// The strip no longer redefines the tokens on itself (that would override the dark values).
assert.doesNotMatch(css, /\.chat-answer-strip \{ --strip-chance/u);
});
@@ -317,7 +317,9 @@ test("the jump-to-latest control stays keyboard reachable and labelled", () => {
// And: a visible label, a matching accessible name, a focus ring and a 44px target.
assert.match(jumpSource, /aria-label="跳到最新"/);
assert.match(jumpSource, /\n\s*跳到最新\n/);
// 原值:按钮里有可见的「跳到最新」字;新值:只有向下箭头,名字留在 aria-label;原因:BUG-2320 负责人认可的整理原型,
// 居中的胶囊压在正文上,换成右下角的小圆按钮。
assert.doesNotMatch(jumpSource, /\n\s*跳到最新\n/);
assert.match(styles, /\.jump-to-latest__button:focus-visible \{[^}]*outline: 3px solid/);
assert.match(buttonRule, /min-height: 44px/);
assert.match(buttonRule, /min-width: 44px/);
@@ -136,7 +136,9 @@ test("offers an accessible jump-to-latest control while reading history", () =>
assert.match(globalsSource, /\.jump-to-latest__button:focus-visible \{[^}]*outline: 3px solid/);
assert.match(buttonRule, /min-height: 44px/);
assert.match(buttonRule, /min-width: 44px/);
assert.match(buttonRule, /box-shadow: var\(--shadow-elevated\)/);
// 原值:按钮本身 box-shadow: var(--shadow-elevated);新值:44px 的按钮框透明,36px 的圆(::before)带同一个阴影令牌;
// 原因:BUG-2320 改成右下角的小圆按钮,点击区仍是 44px。
assert.match(globalsSource, /\.jump-to-latest__button::before \{[^}]*box-shadow: var\(--shadow-elevated\)/);
});
test("rests the jump-to-latest control on the composer instead of the padded scroller", () => {
+3 -1
View File
@@ -65,7 +65,9 @@ test("BUG-2229: the plain chat voice is the sectioned voice; the old plain voice
// 「要留意的」日期和语气跟时间条一致,「最好的时候」照 best_time 写、不加「偏吃力」。
// 原值:8_600;新值:9_000(实测 8,855);原因:BUG-2310 时间条每段照程序的说法和为什么写(四种说法各写什么、不另加好坏、
// 不写两头的话),结论卡时间那一行照 best_time(最好的时候 / 最省力的时候),土星绕月亮只当背景说一次。
assert.ok([...voice].length <= 9_000, String([...voice].length));
// 原值:9_000;新值:9_200(实测 9,093);原因:BUG-2320 时间那一节紧跟结论写、那一句和该做别做的字数、有机会的小标题不用紧 / 守住 /
// 收着、转折点那一句的写法,正文不再重复时间条的起止(指「时间轴里某一段」)。
assert.ok([...voice].length <= 9_200, String([...voice].length));
// A stable prefix for provider-side caching: nothing per request (no dates, no ids) in the voice.
assert.doesNotMatch(voice, /\d{4}-\d{2}-\d{2}|requestId|\$\{/u);
});