Show persistent timestamps for operation and teacher messages
This commit is contained in:
1 parent
3a175101c9
commit
ead3407890
24 files changed
+355
-9
No files matched your search
@@ -226,6 +226,7 @@ async function installCodingFirstChatHost(
|
||||
kind: 'message',
|
||||
id: 'message-user-e2e',
|
||||
sourceEntryId: 'entry-user-e2e',
|
||||
timestamp: Date.parse(now),
|
||||
role: 'user',
|
||||
status: 'complete',
|
||||
blocks: [{ kind: 'text', id: 'message-user-e2e:content:0', text: 'Durable user fork source', status: 'complete' }],
|
||||
@@ -582,7 +583,7 @@ async function installCodingFirstChatHost(
|
||||
if (action === 'messages' && method === 'POST') {
|
||||
const suggestions = body!.intent === 'suggestions';
|
||||
const response = suggestions ? '我们可以从你最近试过的地方聊起。' : body!.intent === 'guided-help' ? '你最近做的哪一步,让你停下来想了一会儿?' : '先理解状态如何随点击变化,再修改代码。';
|
||||
consultationTopics[agentId] = {...current,revision:Number(current.revision)+1,requests:[...(current.requests as unknown[]),{id:body!.requestId,projectId:body!.projectId,sourceConversationId:body!.sourceConversationId,text:body!.text,intent:body!.intent,references:body!.references??[],createdAt:new Date().toISOString(),sourceCursor:{workerGeneration:1,seq:1},sourceCapturedAt:now,includedSourceMessageIds:[],omittedMessages:0,truncatedMessages:1,status:'completed',response,...(suggestions?{suggestedQuestions:['怎样观察别人玩游戏?','我该先试哪个想法?']}:{})}]};
|
||||
consultationTopics[agentId] = {...current,revision:Number(current.revision)+1,requests:[...(current.requests as unknown[]),{id:body!.requestId,projectId:body!.projectId,sourceConversationId:body!.sourceConversationId,text:body!.text,intent:body!.intent,references:body!.references??[],createdAt:now,finishedAt:new Date(Date.parse(now)+40000).toISOString(),sourceCursor:{workerGeneration:1,seq:1},sourceCapturedAt:now,includedSourceMessageIds:[],omittedMessages:0,truncatedMessages:1,status:'completed',response,...(suggestions?{suggestedQuestions:['怎样观察别人玩游戏?','我该先试哪个想法?']}:{})}]};
|
||||
const last = (consultationTopics[agentId].requests as Record<string, unknown>[]).at(-1)!;
|
||||
Object.assign(last, consultationReply);
|
||||
if (state.nextTeacherReplyIncomplete) {
|
||||
@@ -1914,6 +1915,11 @@ test('project consultations preserve student drafts and switch between work and
|
||||
await teacher.getByRole('textbox',{name:'向智能体提问'}).fill('');
|
||||
await teacher.locator('form .consultation-hint').click();
|
||||
await expect(teacher.getByText('我们可以从你最近试过的地方聊起。')).toBeVisible();
|
||||
const sentTime = teacher.locator('time').nth(0), replyTime = teacher.locator('time').nth(1);
|
||||
await expect(sentTime).toHaveAttribute('aria-label', /^发送时间:/);
|
||||
await expect(replyTime).toHaveAttribute('aria-label', /^回复完成时间:/);
|
||||
const originalReplyTime = await replyTime.getAttribute('datetime');
|
||||
expect(Date.parse(originalReplyTime!) - Date.parse((await sentTime.getAttribute('datetime'))!)).toBe(40000);
|
||||
await expect(teacher.getByTestId('teacher-discussion')).toHaveCount(0);
|
||||
await teacher.getByRole('textbox',{name:'向智能体提问'}).fill('还没说完的困惑');
|
||||
await expect(teacher.locator('form .consultation-hint')).toHaveCount(0);
|
||||
@@ -1965,6 +1971,7 @@ test('project consultations preserve student drafts and switch between work and
|
||||
await page.getByRole('button',{name:'与朋友聊天',exact:true}).click();await expect(teacher).toHaveCount(0);
|
||||
await page.getByRole('button',{name:'与朋友聊天',exact:true}).click();
|
||||
await expect(page.getByText('先理解状态如何随点击变化,再修改代码。',{exact:true})).toBeVisible();
|
||||
await expect(teacher.locator('time').nth(1)).toHaveAttribute('datetime', originalReplyTime!);
|
||||
await expect(teacher.getByRole('textbox',{name:'向智能体提问'})).toHaveValue('还没说完的困惑');
|
||||
} finally {await releaseSnapshot(electronApp);}
|
||||
});
|
||||
|
||||
Reference in new issue
Block a user