Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion sampleshr-frontend/src/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,8 @@ export const hrApi = {
reject(new Error(`HTTP ${response.status}`));
},
onmessage(ev: EventSourceMessage) {
if (ev.event === 'final') {
if (ev.event === 'final' || ev.event === 'error') {
ctrl.abort();
resolve(JSON.parse(ev.data));
} else {
onChunk(ev.data);
Expand Down
5 changes: 4 additions & 1 deletion sampleshr-frontend/src/components/ChatInterface.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,10 @@ Hello, **${employee.name}**, how can I help you today?`,
return await hrApi.chat(
requestBody,
(chunk: string) => {
botText += JSON.parse(chunk);
const parsed = JSON.parse(chunk);
botText = (parsed !== null && typeof parsed === 'object')
? (parsed.answer ?? botText)
: botText + String(parsed);
setMessages(prev => prev.map(m =>
m.id === botMessageId ? { ...m, text: botText } : m
));
Expand Down
5 changes: 3 additions & 2 deletions sampleshr-frontend/src/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@

body {
margin: 0;
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Segoe UI Emoji', 'Segoe UI Symbol',
'Apple Color Emoji', 'Noto Color Emoji',
'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
Expand Down
Loading