mirror of
https://github.com/voideditor/void
synced 2026-05-24 09:58:23 +00:00
don't display empty assistant messages (these are only used for LLMMessage)
This commit is contained in:
parent
7558d4dc1c
commit
db7ec0272a
1 changed files with 9 additions and 5 deletions
|
|
@ -727,8 +727,6 @@ const DropdownComponent = ({
|
|||
|
||||
const UserMessageComponent = ({ chatMessage, messageIdx, isLoading }: ChatBubbleProps & { chatMessage: ChatMessage & { role: 'user' } }) => {
|
||||
|
||||
const role = chatMessage.role
|
||||
|
||||
const accessor = useAccessor()
|
||||
const chatThreadsService = accessor.get('IChatThreadService')
|
||||
|
||||
|
|
@ -758,7 +756,7 @@ const UserMessageComponent = ({ chatMessage, messageIdx, isLoading }: ChatBubble
|
|||
const _mustInitialize = useRef(true)
|
||||
const _justEnabledEdit = useRef(false)
|
||||
useEffect(() => {
|
||||
const canInitialize = role === 'user' && mode === 'edit' && textAreaRefState
|
||||
const canInitialize = mode === 'edit' && textAreaRefState
|
||||
const shouldInitialize = _justEnabledEdit.current || _mustInitialize.current
|
||||
if (canInitialize && shouldInitialize) {
|
||||
setStagingSelections(chatMessage.selections || [])
|
||||
|
|
@ -771,7 +769,7 @@ const UserMessageComponent = ({ chatMessage, messageIdx, isLoading }: ChatBubble
|
|||
_mustInitialize.current = false
|
||||
}
|
||||
|
||||
}, [chatMessage, role, mode, _justEnabledEdit, textAreaRefState, textAreaFnsRef.current, _justEnabledEdit.current, _mustInitialize.current])
|
||||
}, [chatMessage, mode, _justEnabledEdit, textAreaRefState, textAreaFnsRef.current, _justEnabledEdit.current, _mustInitialize.current])
|
||||
|
||||
const onOpenEdit = () => {
|
||||
setIsBeingEdited(true)
|
||||
|
|
@ -893,7 +891,7 @@ const UserMessageComponent = ({ chatMessage, messageIdx, isLoading }: ChatBubble
|
|||
</div>
|
||||
|
||||
|
||||
{role === 'user' && <EditSymbol
|
||||
{<EditSymbol
|
||||
size={18}
|
||||
className={`
|
||||
absolute -top-1 -right-1
|
||||
|
|
@ -931,11 +929,15 @@ const AssistantMessageComponent = ({ chatMessage, isLoading, messageIdx }: ChatB
|
|||
const hasReasoning = !!reasoningStr
|
||||
const thread = chatThreadsService.getCurrentThread()
|
||||
|
||||
|
||||
const chatMessageLocation: ChatMessageLocation = {
|
||||
threadId: thread.id,
|
||||
messageIdx: messageIdx,
|
||||
}
|
||||
|
||||
const isEmpty = !chatMessage.content && !chatMessage.reasoning
|
||||
if (isEmpty) return null
|
||||
|
||||
return <>
|
||||
|
||||
{/* reasoning token */}
|
||||
|
|
@ -1293,6 +1295,8 @@ const ChatBubble = ({ chatMessage, isLoading, messageIdx }: ChatBubbleProps) =>
|
|||
|
||||
const role = chatMessage.role
|
||||
|
||||
console.log('ROLE', role)
|
||||
|
||||
if (role === 'user') {
|
||||
return <UserMessageComponent
|
||||
chatMessage={chatMessage}
|
||||
|
|
|
|||
Loading…
Reference in a new issue