mirror of
https://github.com/voideditor/void
synced 2026-05-24 09:58:23 +00:00
state simplify
This commit is contained in:
parent
7aecbe25cd
commit
6b897a6f71
1 changed files with 6 additions and 8 deletions
|
|
@ -1654,9 +1654,9 @@ const toolNameToComponent: { [T in ToolName]: {
|
|||
|
||||
|
||||
type ChatBubbleMode = 'display' | 'edit'
|
||||
type ChatBubbleProps = { chatMessage: ChatMessage, messageIdx: number, isCommitted: boolean, isLast: boolean, showApproveRejectButtons: boolean }
|
||||
type ChatBubbleProps = { chatMessage: ChatMessage, messageIdx: number, isCommitted: boolean, isLast: boolean }
|
||||
|
||||
const ChatBubble = ({ chatMessage, isCommitted, messageIdx, isLast, showApproveRejectButtons }: ChatBubbleProps) => {
|
||||
const ChatBubble = ({ chatMessage, isCommitted, messageIdx, isLast }: ChatBubbleProps) => {
|
||||
const role = chatMessage.role
|
||||
|
||||
if (role === 'user') {
|
||||
|
|
@ -1677,10 +1677,10 @@ const ChatBubble = ({ chatMessage, isCommitted, messageIdx, isLast, showApproveR
|
|||
else if (role === 'tool_request') {
|
||||
const ToolRequestWrapper = toolNameToComponent[chatMessage.name].requestWrapper as React.FC<{ toolRequest: any }> // ts isnt smart enough...
|
||||
if (ToolRequestWrapper) {
|
||||
return <>
|
||||
{isLast && <ToolRequestWrapper toolRequest={chatMessage} />}
|
||||
{showApproveRejectButtons && <ToolRequestAcceptRejectButtons />}
|
||||
</>
|
||||
return isLast ? <>
|
||||
<ToolRequestWrapper toolRequest={chatMessage} />
|
||||
<ToolRequestAcceptRejectButtons />
|
||||
</> : null
|
||||
|
||||
}
|
||||
return null
|
||||
|
|
@ -1978,7 +1978,6 @@ export const SidebarChat = () => {
|
|||
messageIdx={i}
|
||||
isLast={isLast}
|
||||
isCommitted={true}
|
||||
showApproveRejectButtons={isLast}
|
||||
/>
|
||||
}
|
||||
)
|
||||
|
|
@ -1996,7 +1995,6 @@ export const SidebarChat = () => {
|
|||
messageIdx={streamingChatIdx}
|
||||
isCommitted={!isRunning}
|
||||
isLast={true}
|
||||
showApproveRejectButtons={false}
|
||||
/> : null
|
||||
|
||||
const allMessagesHTML = [...previousMessagesHTML, currStreamingMessageHTML]
|
||||
|
|
|
|||
Loading…
Reference in a new issue