workspace out of cache; welcome.md
This commit is contained in:
@@ -257,7 +257,8 @@ export class WebSocketHandler {
|
||||
})
|
||||
);
|
||||
|
||||
// Replay conversation history so the UI pre-populates on reconnect
|
||||
// Replay conversation history so the UI pre-populates on reconnect;
|
||||
// greet new users on their first conversation
|
||||
if (this.config.conversationService) {
|
||||
const history = await this.config.conversationService.getHistory(
|
||||
authContext.userId,
|
||||
@@ -265,6 +266,29 @@ export class WebSocketHandler {
|
||||
);
|
||||
if (history.length > 0) {
|
||||
socket.send(JSON.stringify({ type: 'conversation_history', messages: history }));
|
||||
} else {
|
||||
// First conversation — auto-send greeting prompt and stream the response
|
||||
socket.send(JSON.stringify({ type: 'agent_chunk', content: '', done: false }));
|
||||
for await (const event of harness!.streamGreeting()) {
|
||||
const e = event as HarnessEvent;
|
||||
switch (e.type) {
|
||||
case 'chunk':
|
||||
socket.send(JSON.stringify({ type: 'agent_chunk', content: e.content, done: false }));
|
||||
break;
|
||||
case 'tool_call':
|
||||
socket.send(JSON.stringify({ type: 'agent_tool_call', toolName: e.toolName, label: e.label }));
|
||||
break;
|
||||
case 'image':
|
||||
socket.send(JSON.stringify({ type: 'image', data: e.data, mimeType: e.mimeType, caption: e.caption }));
|
||||
break;
|
||||
case 'error':
|
||||
socket.send(JSON.stringify({ type: 'text', text: `An error occurred during greeting.` }));
|
||||
break;
|
||||
case 'done':
|
||||
break;
|
||||
}
|
||||
}
|
||||
socket.send(JSON.stringify({ type: 'agent_chunk', content: '', done: true }));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user