Skip to content

Commit

Permalink
fix: input chat input wrong padding (langgenius#8207)
Browse files Browse the repository at this point in the history
  • Loading branch information
iamjoel authored and cuiks committed Sep 26, 2024
1 parent 5620c3d commit bd235b0
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ const ChatItem: FC<ChatItemProps> = ({
questionIcon={<Avatar name={userProfile.name} size={40} />}
allToolIcons={allToolIcons}
hideLogModal
noSpacing
/>
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ const DebugWithMultipleModel = () => {
onSend={handleSend}
speechToTextConfig={speechToTextConfig}
visionConfig={visionConfig}
noSpacing
/>
</div>
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ const DebugWithSingleModel = forwardRef<DebugWithSingleModelRefType, DebugWithSi
onAnnotationEdited={handleAnnotationEdited}
onAnnotationAdded={handleAnnotationAdded}
onAnnotationRemoved={handleAnnotationRemoved}
noSpacing
/>
)
})
Expand Down
7 changes: 5 additions & 2 deletions web/app/components/base/chat/chat/chat-input.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,18 +32,21 @@ import {
useDraggableUploader,
useImageFiles,
} from '@/app/components/base/image-uploader/hooks'
import cn from '@/utils/classnames'

type ChatInputProps = {
visionConfig?: VisionConfig
speechToTextConfig?: EnableType
onSend?: OnSend
theme?: Theme | null
noSpacing?: boolean
}
const ChatInput: FC<ChatInputProps> = ({
visionConfig,
speechToTextConfig,
onSend,
theme,
noSpacing,
}) => {
const { appData } = useChatWithHistoryContext()
const { t } = useTranslation()
Expand Down Expand Up @@ -146,7 +149,7 @@ const ChatInput: FC<ChatInputProps> = ({

return (
<>
<div className='relative'>
<div className={cn('relative', !noSpacing && 'px-8')}>
<div
className={`
p-[5.5px] max-h-[150px] bg-white border-[1.5px] border-gray-200 rounded-xl overflow-y-auto
Expand Down Expand Up @@ -193,7 +196,7 @@ const ChatInput: FC<ChatInputProps> = ({
onDrop={onDrop}
autoSize
/>
<div className='absolute bottom-[7px] right-2 flex items-center h-8'>
<div className={cn('absolute bottom-[7px] flex items-center h-8', noSpacing ? 'right-2' : 'right-10')}>
<div className='flex items-center px-1 h-5 rounded-md bg-gray-100 text-xs font-medium text-gray-500'>
{query.trim().length}
</div>
Expand Down
5 changes: 4 additions & 1 deletion web/app/components/base/chat/chat/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ export type ChatProps = {
hideProcessDetail?: boolean
hideLogModal?: boolean
themeBuilder?: ThemeBuilder
noSpacing?: boolean
}

const Chat: FC<ChatProps> = ({
Expand Down Expand Up @@ -89,6 +90,7 @@ const Chat: FC<ChatProps> = ({
hideProcessDetail,
hideLogModal,
themeBuilder,
noSpacing,
}) => {
const { t } = useTranslation()
const { currentLogItem, setCurrentLogItem, showPromptLogModal, setShowPromptLogModal, showAgentLogModal, setShowAgentLogModal } = useAppStore(useShallow(state => ({
Expand Down Expand Up @@ -197,7 +199,7 @@ const Chat: FC<ChatProps> = ({
{chatNode}
<div
ref={chatContainerInnerRef}
className={`w-full ${chatContainerInnerClassName}`}
className={classNames('w-full', !noSpacing && 'px-8', chatContainerInnerClassName)}
>
{
chatList.map((item, index) => {
Expand Down Expand Up @@ -268,6 +270,7 @@ const Chat: FC<ChatProps> = ({
speechToTextConfig={config?.speech_to_text}
onSend={onSend}
theme={themeBuilder?.theme}
noSpacing={noSpacing}
/>
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ const ChatWrapper = forwardRef<ChatWrapperRefType, ChatWrapperProps>(({ showConv
}
</>
)}
noSpacing
suggestedQuestions={suggestedQuestions}
showPromptLog
chatAnswerContainerInner='!pr-2'
Expand Down

0 comments on commit bd235b0

Please sign in to comment.