HEL-748: implement S1 frontend with explicit local demo
Co-authored-by: multica-agent <github@multica.ai>
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
import { defaultSettings, type DemoState, type Identity } from '../domain/model';
|
||||
export function freshState(identity: Identity): DemoState {
|
||||
return { version: 1, identity, settings: structuredClone(defaultSettings), events: [], memories: [], messages: [], lastVisit: Date.now() };
|
||||
}
|
||||
// Loaded only through an explicit demo action; never a fabricated background life loop.
|
||||
export function sampleDays(state: DemoState, long = false): DemoState {
|
||||
const events: DemoState['events'] = [
|
||||
{ id: 'book', title: '读到了书里的那片海', text: '翻到讲海的那一页,忽然想起你说过喜欢安静的地方。', time: '10月21日 19:40', place: '卧室 · 窗边', kind: 'now', shared: true, memoryIds: ['habit'] },
|
||||
{ id: 'tea', title: '给自己泡了一杯热茶', text: '杯子捧在手里,夜晚就慢了下来。', time: '10月21日 16:20', place: '卧室', kind: 'done', shared: true, memoryIds: [] },
|
||||
{ id: 'rain', title: '听了一下午的雨', text: '雨滴在玻璃上跑得一快一慢,很像一段没有歌词的曲子。', time: '10月20日 15:30', place: '卧室 · 窗边', kind: 'done', shared: true, memoryIds: ['rain-memory'] },
|
||||
{ id: 'secret', title: '未分享的秘密散步', text: '这段未分享的生活不能出现在任何视图里。', time: '10月21日 13:00', place: '私密地点', kind: 'done', shared: false, memoryIds: ['secret-memory'] },
|
||||
{ id: 'plan', title: '明天想读完这一章', text: '如果精神好,就再读一会儿。计划也可能会变。', time: '10月22日 20:00', place: '卧室', kind: 'plan', shared: true, memoryIds: [] }
|
||||
];
|
||||
if (long)
|
||||
for (let i = 0; i < 40; i++)
|
||||
events.push({ ...events[1], id: `old-${i}`, title: `更早的一杯茶 · ${i + 1}`, time: `10月${19 - Math.floor(i / 4)}日 16:20` });
|
||||
const memories: DemoState['memories'] = [
|
||||
{ id: 'habit', title: '留一盏小灯', text: '安静也可以是一起待着的一种方式。', group: '你们的小习惯', source: '演示 · 10月18日的聊天', lifeIds: ['book'] },
|
||||
{ id: 'rain-memory', title: '第一次聊起雨声', text: '你说雨声让你觉得安心。', group: '我们一起的', source: '演示 · 10月20日的聊天', lifeIds: ['rain'] },
|
||||
{ id: 'know', title: '你喜欢安静的地方', text: '是你亲口讲给她听的。', group: '她知道的你', source: '演示 · 10月18日你说的', lifeIds: [] },
|
||||
{ id: 'growth', title: '慢慢学会留白', text: '后来她开始喜欢,在一句话之后留一点安静。', group: '她的成长', source: '演示 · 共同经历', lifeIds: ['book'] },
|
||||
{ id: 'secret-memory', title: '秘密散步的回忆', text: '隐私测试内容', group: '我们一起的', source: '私密', lifeIds: ['secret'] }
|
||||
];
|
||||
const messages: DemoState['messages'] = [
|
||||
{ id: 'hello', role: 'companion', text: '外面下了一阵雨,现在安静下来了。', lifeIds: ['rain'] },
|
||||
{ id: 'u1', role: 'user', text: '你在看什么?', lifeIds: [] },
|
||||
{ id: 'c1', role: 'companion', text: events[0].text, lifeIds: ['book'] },
|
||||
{ id: 'hidden-message', role: 'companion', text: '秘密散步的间接引用', lifeIds: ['secret'] }
|
||||
];
|
||||
return { ...state, events, memories, messages: [...messages, ...state.messages.filter(m => m.turnId)] };
|
||||
}
|
||||
Reference in New Issue
Block a user