Skip to content

Commit

Permalink
fix: Message wrapper not re-rendering when a new message chunk comes
Browse files Browse the repository at this point in the history
  • Loading branch information
rjborba committed Jul 11, 2024
1 parent eb17391 commit f3b8208
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import type { TChatMessage } from '../../../../context/chatContext'
@Component({
tag: 'orama-chat-assistent-message',
styleUrl: 'orama-chat-assistent-message.scss',
shadow: true
shadow: true,
})
export class OramaChatAssistentMessage {
@Prop() message: TChatMessage
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,21 @@ import { chatContext } from '../../../context/chatContext'
@Component({
tag: 'orama-chat-messages-container',
styleUrl: 'orama-chat-messages-container.scss',
shadow: true
shadow: true,
})
export class OramaChatMessagesContainer {
render() {
console.log()
return (
<Host>
<div class="messages-container">
{chatContext.messages.map((message, index) =>
message.role === 'user' ? (
// biome-ignore lint/suspicious/noArrayIndexKey: There is not other key available form SDK right now
<orama-chat-user-message key={index} message={message} />
<orama-chat-user-message key={index} message={{ ...message }} />
) : (
// biome-ignore lint/suspicious/noArrayIndexKey: There is not other key available form SDK right now
<orama-chat-assistent-message key={index} message={message} />
)
<orama-chat-assistent-message key={index} message={{ ...message }} />
),
)}
</div>
</Host>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import type { TChatMessage } from '../../../../context/chatContext'
@Component({
tag: 'orama-chat-user-message',
styleUrl: 'orama-chat-user-message.scss',
shadow: true
shadow: true,
})
export class OramaChatUserMessage {
@Prop() message: TChatMessage
Expand Down
4 changes: 2 additions & 2 deletions packages/ui-stencil/src/services/ChatService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ export class ChatService {
onMessageLoading: (loading) => (chatContext.isLoading = loading),
onSourceChange: (sources) => {
console.log(sources)
}
}
},
},
})
}

Expand Down

0 comments on commit f3b8208

Please sign in to comment.