Show persistent timestamps for operation and teacher messages
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import { messageTimestamp } from '../../../shared/message-timestamp';
|
||||
import type {
|
||||
ConversationContentBlock,
|
||||
ConversationMessageNode,
|
||||
@@ -529,6 +530,7 @@ export class PiEventProjector {
|
||||
? { clientRequestId: optimistic.clientRequestId }
|
||||
: {}),
|
||||
role: 'user',
|
||||
timestamp: messageTimestamp(message.timestamp) ?? optimistic?.timestamp ?? this.now(),
|
||||
status: 'complete',
|
||||
blocks: await liveContentBlocks(
|
||||
id,
|
||||
@@ -723,6 +725,8 @@ export class PiEventProjector {
|
||||
kind: 'message',
|
||||
id,
|
||||
role: 'assistant',
|
||||
// Live observation; settlement hydration replaces it with Pi's durable entry time.
|
||||
timestamp: this.now(),
|
||||
status: message.stopReason === 'aborted'
|
||||
? 'aborted'
|
||||
: message.stopReason === 'error' ? 'error' : 'complete',
|
||||
|
||||
@@ -814,6 +814,7 @@ export class PiConversationRuntime implements CodingConversationRuntime {
|
||||
id: messageId,
|
||||
clientRequestId: input.clientRequestId,
|
||||
role: 'user',
|
||||
timestamp: this.now(),
|
||||
status: 'optimistic',
|
||||
blocks: [
|
||||
...(input.text.length > 0
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { messageTimestamp } from '../../../shared/message-timestamp';
|
||||
import type {
|
||||
CodingRuntimeErrorCode,
|
||||
ConversationContentBlock,
|
||||
@@ -235,6 +236,10 @@ async function projectEntries(
|
||||
id: messageId,
|
||||
sourceEntryId: entry.id,
|
||||
role: message.role,
|
||||
// Pi appends the entry on message_end; assistant.message.timestamp is its start time.
|
||||
timestamp: message.role === 'user'
|
||||
? messageTimestamp(message.timestamp) ?? messageTimestamp(entry.timestamp)
|
||||
: messageTimestamp(entry.timestamp),
|
||||
status: message.stopReason === 'aborted'
|
||||
? 'aborted'
|
||||
: message.stopReason === 'error' ? 'error' : 'complete',
|
||||
|
||||
@@ -671,7 +671,8 @@ export class CodingTeacherService {
|
||||
current.response = '';
|
||||
delete current.suggestedQuestions;
|
||||
}
|
||||
topic.updatedAt = new Date().toISOString();
|
||||
current.finishedAt = new Date().toISOString();
|
||||
topic.updatedAt = current.finishedAt;
|
||||
topic.revision++;
|
||||
try {
|
||||
await store.save(topic, current.id);
|
||||
|
||||
Reference in New Issue
Block a user