fix(web): 四个页面共用一份会话列表,空会话不入列
对话、星盘、星历、报告进同一 (app) 外壳,列表只拉一次。服务端不再列出空咨询;新建复用已有空会话。新标题改成「生时校正 · M月D日」,侧栏副标题用创建时间。
This commit is contained in:
@@ -6,7 +6,7 @@ import {
|
||||
chartLibraryOnCloudFailure,
|
||||
chartLibrarySessionBranch,
|
||||
} from "../src/lib/chart-library-session.ts";
|
||||
import { sessionSidebarSubtitle, sessionSidebarTitle } from "../src/lib/home-profile.ts";
|
||||
import { sessionSidebarSubtitle, sessionSidebarTitle, toSidebarSessionRow } from "../src/lib/session-sidebar-row.ts";
|
||||
import { emptyProfile, type ChartLibraryRecord, type ChatSession } from "../src/lib/home-types.ts";
|
||||
|
||||
type RecordShape = { id: string; role: "self" | "other" };
|
||||
@@ -57,6 +57,10 @@ test("a failed cloud read keeps only the profile-derived self chart", () => {
|
||||
});
|
||||
|
||||
test("sidebar titles drop the chart-name prefix and only subtitle others", () => {
|
||||
// 原值:本人盘副标题 null;他人盘只有资料名
|
||||
// 新值:一律「M月D日 HH:MM」,他人盘再加「 · 盘主」
|
||||
// 原因:任务书 T4 副标题规则
|
||||
const createdAt = Date.parse("2026-09-14T04:14:00.000Z");
|
||||
const selfRecord: ChartLibraryRecord = {
|
||||
id: "self",
|
||||
role: "self",
|
||||
@@ -71,7 +75,8 @@ test("sidebar titles drop the chart-name prefix and only subtitle others", () =>
|
||||
theme: "career",
|
||||
modelId: "m",
|
||||
messages: [],
|
||||
updatedAt: 1,
|
||||
createdAt,
|
||||
updatedAt: createdAt,
|
||||
sessionType: "consultation",
|
||||
rectificationCaseId: null,
|
||||
chartProfileId: "self",
|
||||
@@ -82,9 +87,9 @@ test("sidebar titles drop the chart-name prefix and only subtitle others", () =>
|
||||
messagesHydrated: true,
|
||||
};
|
||||
assert.equal(sessionSidebarTitle(base, library), "半年内换工作时机");
|
||||
assert.equal(sessionSidebarSubtitle(base, library), null);
|
||||
assert.equal(sessionSidebarSubtitle(base, library), "9月14日 12:14");
|
||||
const other = { ...base, chartProfileId: "other-1", chartProfileName: "对方", chartProfileRole: "other" as const };
|
||||
assert.equal(sessionSidebarSubtitle(other, library), "资料已删除 · 对方");
|
||||
assert.equal(sessionSidebarSubtitle(other, library), "9月14日 12:14 · 资料已删除 · 对方");
|
||||
const liveOtherLibrary: ChartLibraryRecord[] = [{
|
||||
...selfRecord,
|
||||
id: "other-1",
|
||||
@@ -92,5 +97,13 @@ test("sidebar titles drop the chart-name prefix and only subtitle others", () =>
|
||||
relationship: "partner",
|
||||
profile: { ...emptyProfile, name: "对方" },
|
||||
}];
|
||||
assert.equal(sessionSidebarSubtitle(other, liveOtherLibrary), "对方");
|
||||
assert.equal(sessionSidebarSubtitle(other, liveOtherLibrary), "9月14日 12:14 · 对方");
|
||||
assert.deepEqual(toSidebarSessionRow(other, liveOtherLibrary), {
|
||||
id: other.id,
|
||||
title: "半年内换工作时机",
|
||||
subtitle: "9月14日 12:14 · 对方",
|
||||
pinned: false,
|
||||
archived: false,
|
||||
updatedAt: createdAt,
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user