Skip to content

Commit ff0a121

Browse files
Sg312waleedlatif1
authored andcommitted
fix(copilot): fix sent message width (#1904)
1 parent 69f5a35 commit ff0a121

File tree

3 files changed

+10
-8
lines changed

3 files changed

+10
-8
lines changed

apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel-new/components/copilot/components/copilot-message/copilot-message.tsx

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ const CopilotMessage: FC<CopilotMessageProps> = memo(
188188
return (
189189
<div
190190
key={`text-${index}-${block.timestamp || index}`}
191-
className={`w-full max-w-full overflow-hidden pl-[2px] transition-opacity duration-200 ease-in-out ${
191+
className={`w-full max-w-full overflow-hidden transition-opacity duration-200 ease-in-out ${
192192
cleanBlockContent.length > 0 ? 'opacity-100' : 'opacity-70'
193193
} ${shouldUseSmoothing ? 'translate-y-0 transition-transform duration-100 ease-out' : ''}`}
194194
>
@@ -235,7 +235,8 @@ const CopilotMessage: FC<CopilotMessageProps> = memo(
235235
if (isUser) {
236236
return (
237237
<div
238-
className={`w-full max-w-full overflow-hidden transition-opacity duration-200 ${isDimmed ? 'opacity-40' : 'opacity-100'}`}
238+
className={`w-full max-w-full overflow-hidden transition-opacity duration-200 [max-width:var(--panel-max-width)] ${isDimmed ? 'opacity-40' : 'opacity-100'}`}
239+
style={{ '--panel-max-width': `${panelWidth - 16}px` } as React.CSSProperties}
239240
>
240241
{isEditMode ? (
241242
<div
@@ -313,7 +314,7 @@ const CopilotMessage: FC<CopilotMessageProps> = memo(
313314
onClick={handleMessageClick}
314315
onMouseEnter={() => setIsHoveringMessage(true)}
315316
onMouseLeave={() => setIsHoveringMessage(false)}
316-
className='group relative cursor-pointer rounded-[4px] border border-[#3D3D3D] bg-[#282828] px-[6px] py-[6px] transition-all duration-200 hover:border-[#4A4A4A] hover:bg-[#363636] dark:border-[#3D3D3D] dark:bg-[#363636] dark:hover:border-[#454545] dark:hover:bg-[#3D3D3D]'
317+
className='group relative w-full cursor-pointer rounded-[4px] border border-[#3D3D3D] bg-[#282828] px-[6px] py-[6px] transition-all duration-200 hover:border-[#4A4A4A] hover:bg-[#363636] dark:border-[#3D3D3D] dark:bg-[#363636] dark:hover:border-[#454545] dark:hover:bg-[#3D3D3D]'
317318
>
318319
<div
319320
ref={messageContentRef}
@@ -439,9 +440,10 @@ const CopilotMessage: FC<CopilotMessageProps> = memo(
439440
if (isAssistant) {
440441
return (
441442
<div
442-
className={`w-full max-w-full overflow-hidden pl-[2px] transition-opacity duration-200 ${isDimmed ? 'opacity-40' : 'opacity-100'}`}
443+
className={`w-full max-w-full overflow-hidden transition-opacity duration-200 [max-width:var(--panel-max-width)] ${isDimmed ? 'opacity-40' : 'opacity-100'}`}
444+
style={{ '--panel-max-width': `${panelWidth - 16}px` } as React.CSSProperties}
443445
>
444-
<div className='max-w-full space-y-1.5 transition-all duration-200 ease-in-out'>
446+
<div className='max-w-full space-y-1.5 px-[2px] transition-all duration-200 ease-in-out'>
445447
{/* Content blocks in chronological order */}
446448
{memoizedContentBlocks}
447449

apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel-new/components/copilot/components/user-input/user-input.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -563,12 +563,12 @@ const UserInput = forwardRef<UserInputRef, UserInputProps>(
563563
ref={setContainerRef}
564564
data-user-input
565565
className={cn('relative w-full flex-none [max-width:var(--panel-max-width)]', className)}
566-
style={{ '--panel-max-width': `${panelWidth - 17}px` } as React.CSSProperties}
566+
style={{ '--panel-max-width': `${panelWidth - 16}px` } as React.CSSProperties}
567567
>
568568
<div
569569
ref={setInputContainerRef}
570570
className={cn(
571-
'relative rounded-[4px] border border-[#3D3D3D] bg-[#282828] px-[6px] py-[6px] transition-colors dark:bg-[#363636]',
571+
'relative w-full rounded-[4px] border border-[#3D3D3D] bg-[#282828] px-[6px] py-[6px] transition-colors dark:bg-[#363636]',
572572
fileAttachments.isDragging && 'ring-[#33B4FF] ring-[1.75px]'
573573
)}
574574
onDragEnter={fileAttachments.handleDragEnter}

apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel-new/components/copilot/copilot.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -441,7 +441,7 @@ export const Copilot = forwardRef<CopilotRef, CopilotProps>(({ panelWidth }, ref
441441
<div className='relative flex-1 overflow-hidden'>
442442
<div
443443
ref={scrollAreaRef}
444-
className='copilot-scrollable h-full overflow-y-auto overflow-x-hidden px-[8px]'
444+
className='h-full overflow-y-auto overflow-x-hidden px-[8px]'
445445
>
446446
<div
447447
className={`w-full max-w-full space-y-4 overflow-hidden py-[8px] ${

0 commit comments

Comments
 (0)