Commit 9b439533 by liimin

refactor(chat): 优化聊天组件功能和样式

- 修改预设问题发送类型为 SYSTEM
- 移除重置对话功能,改为重启对话
- 优化输入框组件,增加重启对话按钮
- 调整消息列表渲染逻辑
- 统一操作按钮样式
1 parent fad5869e
{
"printWidth": 80,
"printWidth": 120,
"tabWidth": 2,
"singleQuote": true,
"trailingComma": "all",
"semi": false,
"wrap_line_length": 80,
"wrap_line_length": 120,
"wrap_attributes": "auto",
"proseWrap": "always",
"arrowParens": "avoid",
......
......@@ -2,7 +2,7 @@
* @Author: yangming@didihu.com.cn yangming@didihu.com.cn
* @Date: 2025-04-22 09:29:17
* @LastEditors: limin
* @LastEditTime: 2025-06-26 16:34:29
* @LastEditTime: 2025-06-29 00:05:04
* @FilePath: \ai-assistant\app\components\base\chat\chat-with-history\chat-wrapper.tsx
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
*/
......@@ -26,10 +26,9 @@ import { InputMessageType } from '../types'
type Props = {
avatar: string
aiAvatar: string
doClear?: () => void
presuppositionQuestion?: string
}
const ChatWrapper: FC<Props> = ({ avatar, aiAvatar, doClear, presuppositionQuestion }) => {
const ChatWrapper: FC<Props> = ({ avatar, aiAvatar, presuppositionQuestion }) => {
const { appParams, appPrevChatTree, currentConversationId, currentConversationItem, currentConversationInputs, newConversationInputs, newConversationInputsRef, handleNewConversationCompleted, isMobile, isInstalledApp, appId, appMeta, handleFeedback, currentChatInstanceRef, appData, themeBuilder, clearChatList, setClearChatList, setIsResponding, isShowPracticeButton } = useChatWithHistoryContext()
const appConfig = useMemo(() => {
......@@ -53,6 +52,7 @@ const ChatWrapper: FC<Props> = ({ avatar, aiAvatar, doClear, presuppositionQuest
handleStop,
isResponding: respondingState,
suggestedQuestions,
handleRestart
} = useChat(
appConfig,
{
......@@ -99,7 +99,7 @@ const ChatWrapper: FC<Props> = ({ avatar, aiAvatar, doClear, presuppositionQuest
if (!hasAutoSended.current && presuppositionQuestion) {
doSend({
message: presuppositionQuestion,
type: InputMessageType.SELF,
type: InputMessageType.SYSTEM,
})
hasAutoSended.current = true
}
......@@ -194,7 +194,7 @@ const ChatWrapper: FC<Props> = ({ avatar, aiAvatar, doClear, presuppositionQuest
chatFooterClassName="pb-4"
chatFooterInnerClassName={`mx-auto w-full max-w-[800px] ${isMobile ? 'px-2' : 'px-4'}`}
onSend={doSend}
onClear={doClear}
onRestart={handleRestart}
inputs={currentConversationId ? (currentConversationInputs as any) : newConversationInputs}
// inputsForm={[]}
onRegenerate={doRegenerate}
......@@ -210,7 +210,7 @@ const ChatWrapper: FC<Props> = ({ avatar, aiAvatar, doClear, presuppositionQuest
suggestedQuestions={suggestedQuestions}
answerIcon={answerIcon}
questionIcon={questionIcon}
hideProcessDetail
// hideProcessDetail
themeBuilder={themeBuilder}
// switchSibling={siblingMessageId => setTargetMessageId(siblingMessageId)}
// inputDisabled={inputDisabled}
......
......@@ -54,22 +54,8 @@ const { avatar, domain, presuppositionProblem, practice_status, ...newInputs } =
const isShowPracticeButton = practice_status === PracticeStatus.Practicing || practice_status === PracticeStatus.Failed
const avatarUrl: string = avatar ?? AVATAR_USER_URL;
const ChatWithHistory: FC<ChatWithHistoryProps> = ({ className }) => {
const [showConfirm, setShowConfirm] = useState(false)
const handleReset = () => {
handleNewConversation()
setTimeout(() => {
handleNewConversation()
}, 1000)
setShowConfirm(false)
}
const handleCancelConfirm = () => {
setShowConfirm(false)
}
const { appInfoError, appInfoLoading, appChatListDataLoading, chatShouldReloadKey, isMobile, handleNewConversation } = useChatWithHistoryContext()
const doClear = useCallback(() => {
setShowConfirm(true)
}, [handleNewConversation])
if (appInfoLoading) {
return <Loading type="app" />
}
......@@ -79,14 +65,13 @@ const ChatWithHistory: FC<ChatWithHistoryProps> = ({ className }) => {
}
return (
<div className={cn('flex h-full bg-background-default-burn', isMobile && 'flex-col', className)}>
{showConfirm && <Confirm title="重置对话" confirmText="确认" cancelText="取消" content="您确定要重置此对话吗?" isShow onCancel={handleCancelConfirm} onConfirm={handleReset} />}
<div className={cn('relative grow', isMobile && 'h-[calc(100%_-_56px)] p-0')}>
<div className={cn('flex h-full flex-col overflow-hidden border-components-panel-border-subtle chat-panel-bg')}>
{!newInputs.no_header && <Header avatar={avatarUrl} title={MAIN_TITLE} />}
{!appChatListDataLoading && (
<ChatWrapper
presuppositionQuestion={presuppositionProblem}
doClear={doClear}
// doClear={doClear}
key={chatShouldReloadKey}
avatar={avatarUrl}
aiAvatar={AVATAR_AI_URL}
......
......@@ -27,7 +27,10 @@ const SuggestedQuestions: FC<SuggestedQuestionsProps> = ({ item }) => {
return (
<div className="w-[fit-content]">
{suggestedQuestions.map((question, index) => (
<Button key={index} text={question} onClick={() => onSend?.({ message: question, type: InputMessageType.SYSTEM })}></Button>
<Button
key={index}
text={question}
onClick={() => onSend?.({ message: question, type: InputMessageType.SYSTEM })}></Button>
))}
</div>
)
......
......@@ -18,7 +18,8 @@ import FeatureBar from '@/app/components/base/features/new-feature-panel/feature
import type { FileUpload } from '@/app/components/base/features/types'
import { TransferMethod } from '@/types/app'
import { InputMessageType } from '../../types'
import { useChatContext } from '../context'
import Confirm from '@/app/components/base/confirm'
type ChatInputAreaProps = {
showFeatureBar?: boolean
showFileUpload?: boolean
......@@ -27,25 +28,55 @@ type ChatInputAreaProps = {
visionConfig?: FileUpload
speechToTextConfig?: EnableType
onSend?: OnSend
onClear?: () => void
onRestart: () => void
inputs?: Record<string, any>
inputsForm?: InputForm[]
theme?: Theme | null
isResponding?: boolean
disabled?: boolean
}
const ChatInputArea = ({ showFeatureBar, showFileUpload, featureBarDisabled, onFeatureBarClick, visionConfig, speechToTextConfig = { enabled: true }, onSend, onClear, inputs = {}, inputsForm = [], theme, isResponding, disabled }: ChatInputAreaProps) => {
const ChatInputArea = ({
showFeatureBar,
showFileUpload,
featureBarDisabled,
onFeatureBarClick,
visionConfig,
speechToTextConfig = { enabled: true },
onRestart,
inputs = {},
inputsForm = [],
theme,
isResponding,
disabled,
}: ChatInputAreaProps) => {
const { t } = useTranslation()
const { notify } = useToastContext()
const { wrapperRef, textareaRef, textValueRef, holdSpaceRef, handleTextareaResize, isMultipleLine, setIsMultipleLine } = useTextAreaHeight()
const {
wrapperRef,
textareaRef,
textValueRef,
holdSpaceRef,
handleTextareaResize,
isMultipleLine,
setIsMultipleLine,
} = useTextAreaHeight()
const [query, setQuery] = useState('')
const [showVoiceInput, setShowVoiceInput] = useState(false)
const filesStore = useFileStore()
const { handleDragFileEnter, handleDragFileLeave, handleDragFileOver, handleDropFile, handleClipboardPasteFile, isDragActive } = useFile(visionConfig!)
const {
handleDragFileEnter,
handleDragFileLeave,
handleDragFileOver,
handleDropFile,
handleClipboardPasteFile,
isDragActive,
} = useFile(visionConfig!)
const { checkInputsForm } = useCheckInputsForms()
const historyRef = useRef([''])
const [currentIndex, setCurrentIndex] = useState(-1)
const isComposingRef = useRef(false)
const { onSend } = useChatContext()
const [showConfirm, setShowConfirm] = useState<boolean>(false)
const handleSend = () => {
if (isResponding) {
notify({
......@@ -78,11 +109,7 @@ const ChatInputArea = ({ showFeatureBar, showFileUpload, featureBarDisabled, onF
// }
}
}
const handleClear = () => {
if (onClear) {
onClear()
}
}
const handleCompositionStart = () => {
// e: React.CompositionEvent<HTMLTextAreaElement>
isComposingRef.current = true
......@@ -133,32 +160,77 @@ const ChatInputArea = ({ showFeatureBar, showFileUpload, featureBarDisabled, onF
)
}, [t, notify])
const operation = <Operation ref={holdSpaceRef} fileConfig={visionConfig} speechToTextConfig={speechToTextConfig} onShowVoiceInput={handleShowVoiceInput} onClear={handleClear} onSend={handleSend} theme={theme} />
const handleRestart = useCallback(() => {
if (isResponding) {
notify({
type: 'info',
message: t('appDebug.errorMessage.waitForResponse'),
})
return
}
setShowConfirm(true)
}, [isResponding])
const doRestart = useCallback(() => {
onRestart()
setShowConfirm(false)
},[])
const operation = (
<Operation
ref={holdSpaceRef}
fileConfig={visionConfig}
speechToTextConfig={speechToTextConfig}
onShowVoiceInput={handleShowVoiceInput}
onRestart={handleRestart}
onSend={handleSend}
theme={theme}
/>
)
// const clear = <Operation ref={holdSpaceRef} onSend={handleClear} imgUrl={CLEAR_BUTTON} />
const hasQuery = useMemo(() => query.length > 0, [query])
useEffect(() => {
if (!hasQuery) {
setIsMultipleLine(false)
}
}, [hasQuery, setIsMultipleLine])
const maxRow = useMemo(() => {
return hasQuery ? undefined : 1
}, [hasQuery])
useEffect(() => {
if (!hasQuery) {
setIsMultipleLine(false)
}
}, [hasQuery, setIsMultipleLine])
const maxRow = useMemo(() => {
return hasQuery ? undefined : 1
}, [hasQuery])
return (
<>
<div className={cn('relative z-10 rounded-xl border border-components-chat-input-border bg-[#fff] pb-[9px] shadow-md', isDragActive && 'border border-dashed border-components-option-card-option-selected-border')}>
{showConfirm && (
<Confirm
title="重置对话"
confirmText="确认"
cancelText="取消"
content="您确定要重置此对话吗?"
isShow
onCancel={() => setShowConfirm(false)}
onConfirm={doRestart}
/>
)}
<div
className={cn(
'relative z-10 rounded-xl border border-components-chat-input-border bg-[#fff] pb-[9px] shadow-md',
isDragActive && 'border border-dashed border-components-option-card-option-selected-border',
)}>
<div className="relative max-h-[158px] overflow-y-auto overflow-x-hidden px-[9px] pt-[9px]">
<FileListInChatInput fileConfig={visionConfig!} />
<div ref={wrapperRef} className="flex items-center justify-between">
<div className="relative flex w-full grow items-center ml-8">
<div ref={textValueRef} className="body-lg-regular pointer-events-none invisible absolute h-auto w-auto whitespace-pre p-1 leading-6">
<div
ref={textValueRef}
className="body-lg-regular pointer-events-none invisible absolute h-auto w-auto whitespace-pre p-1 leading-6">
{query}
</div>
<Textarea
ref={ref => (textareaRef.current = ref as any)}
className={cn('body-lg-regular w-full resize-none bg-transparent p-1 leading-6 text-text-tertiary outline-none')}
className={cn(
'body-lg-regular w-full resize-none bg-transparent p-1 leading-6 text-text-tertiary outline-none',
)}
placeholder={t('common.chat.inputPlaceholder') || ''}
autoFocus
maxRows={maxRow}
......@@ -180,11 +252,19 @@ const maxRow = useMemo(() => {
</div>
{!isMultipleLine && operation}
</div>
{showVoiceInput && <VoiceInput onCancel={() => setShowVoiceInput(false)} onConverted={text => setQuery(text)} />}
{showVoiceInput && (
<VoiceInput onCancel={() => setShowVoiceInput(false)} onConverted={text => setQuery(text)} />
)}
</div>
{isMultipleLine && <div className="px-[9px]">{operation}</div>}
</div>
{showFeatureBar && <FeatureBar showFileUpload={showFileUpload} disabled={featureBarDisabled} onFeatureBarClick={onFeatureBarClick} />}
{showFeatureBar && (
<FeatureBar
showFileUpload={showFileUpload}
disabled={featureBarDisabled}
onFeatureBarClick={onFeatureBarClick}
/>
)}
</>
)
}
......
import { memo, use, useMemo } from "react";
import { RiMicLine, RiSendPlane2Fill } from "@remixicon/react";
import type { EnableType } from "../../types";
import type { Theme } from "../../embedded-chatbot/theme/theme-context";
import Button from "@/app/components/base/button";
import ActionButton from "@/app/components/base/action-button";
import { FileUploaderInChatInput } from "@/app/components/base/file-uploader";
import type { FileUpload } from "@/app/components/base/features/types";
import cn from "@/utils/classnames";
import { Dispatch, memo, SetStateAction, use, useMemo } from 'react'
import { RiMicLine, RiSendPlane2Fill } from '@remixicon/react'
import type { EnableType } from '../../types'
import type { Theme } from '../../embedded-chatbot/theme/theme-context'
import Button from '@/app/components/base/button'
import ActionButton from '@/app/components/base/action-button'
import { FileUploaderInChatInput } from '@/app/components/base/file-uploader'
import type { FileUpload } from '@/app/components/base/features/types'
import cn from '@/utils/classnames'
import {
// SELF_INPUT,
SEND_BUTTON,
CLEAR_BUTTON,
} from '@/app/components/base/chat/constants'
type OperationProps = {
fileConfig?: FileUpload;
speechToTextConfig?: EnableType;
onShowVoiceInput?: () => void;
onSend: () => void;
imgUrl?: string;
theme?: Theme | null;
onClear: () => void;
};
fileConfig?: FileUpload
speechToTextConfig?: EnableType
onShowVoiceInput?: () => void
onSend: () => void
imgUrl?: string
theme?: Theme | null
onRestart: () => void
}
const Operation = ({
ref,
onSend,
speechToTextConfig,
onShowVoiceInput,
onClear,
onRestart,
}: OperationProps & {
ref: React.RefObject<HTMLDivElement>;
ref: React.RefObject<HTMLDivElement>
}) => {
return (
<div className={cn("flex shrink-0 items-center justify-end")}>
<div className={cn('flex shrink-0 items-center justify-end')}>
<div className="absolute left-3">
<img
onClick={onClear}
src={CLEAR_BUTTON}
className="size-6 hover:cursor-pointer"
alt="icon"
/>
<img onClick={onRestart} src={CLEAR_BUTTON} className="size-6 hover:cursor-pointer" alt="icon" />
</div>
<div className="flex items-center pl-1" ref={ref}>
<div className='flex items-center space-x-1 pr-2'>
<div className="flex items-center space-x-1 pr-2">
{/* {fileConfig?.enabled && <FileUploaderInChatInput fileConfig={fileConfig} />} */}
{
speechToTextConfig?.enabled && (
<ActionButton
size='l'
onClick={onShowVoiceInput}
>
<RiMicLine className='h-5 w-5' />
</ActionButton>
)
}
{speechToTextConfig?.enabled && (
<ActionButton size="l" onClick={onShowVoiceInput}>
<RiMicLine className="h-5 w-5" />
</ActionButton>
)}
</div>
<img
onClick={onSend}
src={SEND_BUTTON}
className="size-6 hover:cursor-pointer"
alt="icon"
/>
<img onClick={onSend} src={SEND_BUTTON} className="size-6 hover:cursor-pointer" alt="icon" />
</div>
</div>
);
};
Operation.displayName = "Operation";
)
}
Operation.displayName = 'Operation'
export default memo(Operation);
export default memo(Operation)
......@@ -3,6 +3,7 @@
import type { ReactNode } from 'react'
import { createContext, useContext } from 'use-context-selector'
import type { ChatProps } from './index'
import { noop } from 'lodash-es'
export type ChatContextValue = Pick<ChatProps, 'config'
| 'isResponding'
......@@ -12,6 +13,8 @@ export type ChatContextValue = Pick<ChatProps, 'config'
| 'answerIcon'
| 'onSend'
| 'onRegenerate'
| 'onStopResponding'
| 'onRestart'
// | 'onAnnotationEdited'
// | 'onAnnotationAdded'
// | 'onAnnotationRemoved'
......@@ -20,6 +23,7 @@ export type ChatContextValue = Pick<ChatProps, 'config'
const ChatContext = createContext<ChatContextValue>({
chatList: [],
onRestart: noop,
})
type ChatContextProviderProps = {
......@@ -36,10 +40,12 @@ export const ChatContextProvider = ({
answerIcon,
onSend,
onRegenerate,
onRestart,
// onAnnotationEdited,
// onAnnotationAdded,
// onAnnotationRemoved,
onFeedback,
onStopResponding
}: ChatContextProviderProps) => {
return (
<ChatContext.Provider value={{
......@@ -54,7 +60,9 @@ export const ChatContextProvider = ({
// onAnnotationEdited,
// onAnnotationAdded,
// onAnnotationRemoved,
onRestart,
onFeedback,
onStopResponding
}}>
{children}
</ChatContext.Provider>
......
......@@ -22,7 +22,7 @@ type FooterProps = {
showFeatureBar?: boolean
showFileUpload?: boolean
onFeatureBarClick?: (state: boolean) => void
onClear?: () => void
onRestart: () => void
inputs?: Record<string, any>
inputsForm?: InputForm[]
themeBuilder?: ThemeBuilder
......@@ -32,7 +32,7 @@ type FooterProps = {
isResponding?: boolean
}
const Footer: FC<FooterProps> = ({ chatFooterClassName, chatFooterInnerClassName, onSend, noStopResponding, onStopResponding, noChatInput, isMobile, inputDisabled, showFeatureBar, showFileUpload, onFeatureBarClick, onClear, inputs, inputsForm, themeBuilder, config, suggestedQuestions, isShowPracticeButton, chatFooterRef, chatFooterInnerRef, isResponding }) => {
const Footer: FC<FooterProps> = ({ chatFooterClassName, chatFooterInnerClassName, onSend, noStopResponding, onStopResponding, noChatInput, isMobile, inputDisabled, showFeatureBar, showFileUpload, onFeatureBarClick, onRestart, inputs, inputsForm, themeBuilder, config, suggestedQuestions, isShowPracticeButton, chatFooterRef, chatFooterInnerRef, isResponding }) => {
const { t } = useTranslation()
const hasTryToAsk = config?.suggested_questions_after_answer?.enabled && !!suggestedQuestions?.length && onSend
return (
......@@ -43,7 +43,7 @@ const Footer: FC<FooterProps> = ({ chatFooterClassName, chatFooterInnerClassName
{isResponding && !noStopResponding && <StopResponding onStopResponding={onStopResponding} />}
</div>
{hasTryToAsk && <TryToAsk suggestedQuestions={suggestedQuestions} onSend={onSend} isMobile={isMobile} />}
{!noChatInput && <ChatInputArea disabled={inputDisabled} showFeatureBar={showFeatureBar} showFileUpload={showFileUpload} featureBarDisabled={isResponding} onFeatureBarClick={onFeatureBarClick} visionConfig={config?.file_upload} speechToTextConfig={config?.speech_to_text} onSend={onSend} onClear={onClear} inputs={inputs} inputsForm={inputsForm} theme={themeBuilder?.theme} isResponding={isResponding} />}
{!noChatInput && <ChatInputArea disabled={inputDisabled} showFeatureBar={showFeatureBar} showFileUpload={showFileUpload} featureBarDisabled={isResponding} onFeatureBarClick={onFeatureBarClick} visionConfig={config?.file_upload} speechToTextConfig={config?.speech_to_text} onSend={onSend} onRestart={onRestart} inputs={inputs} inputsForm={inputsForm} theme={themeBuilder?.theme} isResponding={isResponding} />}
</div>
</div>
)
......
......@@ -4,11 +4,13 @@ import type { OnSend } from '@/app/components/base/chat/types'
import Button from '@/app/components/base/button'
import { InputMessageType } from '@/app/components/base/chat/types'
import { Practice as PracticeIcon } from '@/app/components/base/icons/src/image/icons'
import { useChatContext } from '../context'
type PracticeProps = {
question: string
onSend: OnSend
}
const Practice: FC<PracticeProps> = ({ question, onSend }) => {
const Practice: FC<PracticeProps> = ({ question }) => {
const { onSend } = useChatContext()
return (
<div>
{
......@@ -19,7 +21,7 @@ const Practice: FC<PracticeProps> = ({ question, onSend }) => {
rounded-8
shadow-[0_3px_8px_0_#7D94B840]"
onClick={() =>
onSend({
onSend?.({
message: question,
type: InputMessageType.SELF,
})
......
......@@ -2,21 +2,14 @@
* @Author: liimin 17653212@qq.com
* @Date: 2025-04-16 18:17:38
* @LastEditors: limin
* @LastEditTime: 2025-06-27 10:27:07
* @LastEditTime: 2025-06-29 02:06:50
* @FilePath: \ai-assistant\app\components\base\chat\chat\index.tsx
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
*/
import type { ReactNode } from 'react'
import React, { FC, memo, useCallback, useEffect, useRef } from 'react'
// import { useShallow } from 'zustand/react/shallow'
import type {
ChatConfig,
ChatItem,
Feedback,
InputMessageProp,
OnRegenerate,
OnSend,
} from '../types'
import type { ChatConfig, ChatItem, Feedback, InputMessageProp, OnRegenerate, OnSend } from '../types'
import type { ThemeBuilder } from '../embedded-chatbot/theme/theme-context'
import Question from './question'
import Answer from './answer'
......@@ -42,7 +35,7 @@ export type ChatProps = {
onStopResponding?: () => void
noChatInput?: boolean
onSend?: OnSend
onClear?: () => void
onRestart: () => void
inputs?: Record<string, any>
inputsForm?: InputForm[]
onRegenerate?: OnRegenerate
......@@ -85,7 +78,7 @@ const Chat: FC<ChatProps> = ({
appData,
config,
onSend,
onClear,
onRestart,
inputs,
inputsForm,
onRegenerate,
......@@ -146,10 +139,7 @@ const Chat: FC<ChatProps> = ({
if (!container) return
// 如果用户没有手动滚动,则直接到底
const isAtBottom =
Math.abs(
container.scrollHeight - container.clientHeight - container.scrollTop,
) <= 1
const isAtBottom = Math.abs(container.scrollHeight - container.clientHeight - container.scrollTop) <= 1
if (!userScrolledRef.current || isAtBottom) {
// 添加节流控制
......@@ -270,8 +260,7 @@ const Chat: FC<ChatProps> = ({
if (!container) return
const handleScroll = () => {
const bottomThreshold =
container.scrollHeight - container.clientHeight - 8
const bottomThreshold = container.scrollHeight - container.clientHeight - 8
const isUserScroll = container.scrollTop < bottomThreshold
userScrolledRef.current = isUserScroll
}
......@@ -280,13 +269,11 @@ const Chat: FC<ChatProps> = ({
return () => container.removeEventListener('scroll', handleScroll)
}, [])
const handleSend: OnSend = useCallback(
(query: InputMessageProp, files: FileEntity[] | undefined) => {
onSend && onSend(query, files)
userScrolledRef.current = false
},
[onSend],
)
const handleSend: OnSend = (query: InputMessageProp, files: FileEntity[] | undefined) => {
onSend && onSend(query, files)
userScrolledRef.current = false
}
return (
<ChatContextProvider
config={config}
......@@ -297,6 +284,8 @@ const Chat: FC<ChatProps> = ({
answerIcon={answerIcon}
onSend={handleSend}
onRegenerate={onRegenerate}
onRestart={onRestart}
// onStopResponding={onStopResponding}
// onAnnotationAdded={onAnnotationAdded}
// onAnnotationEdited={onAnnotationEdited}
// onAnnotationRemoved={onAnnotationRemoved}
......@@ -310,13 +299,7 @@ const Chat: FC<ChatProps> = ({
chatStyles.chatContainer,
)}>
{chatNode}
<div
ref={chatContainerInnerRef}
className={cn(
'w-full',
!noSpacing && 'px-8',
chatContainerInnerClassName,
)}>
<div ref={chatContainerInnerRef} className={cn('w-full', !noSpacing && 'px-8', chatContainerInnerClassName)}>
{config?.initial_message && (
<InitQuestions
config={config}
......@@ -346,14 +329,7 @@ const Chat: FC<ChatProps> = ({
/>
)
}
return (
<Question
key={item.id}
item={item}
questionIcon={questionIcon}
theme={themeBuilder?.theme}
/>
)
return <Question key={item.id} item={item} questionIcon={questionIcon} theme={themeBuilder?.theme} />
})}
</div>
</div>
......@@ -366,7 +342,7 @@ const Chat: FC<ChatProps> = ({
onSend={handleSend}
inputs={inputs}
inputsForm={inputsForm}
onClear={onClear}
onRestart={onRestart}
noStopResponding={noStopResponding}
onStopResponding={onStopResponding}
noChatInput={noChatInput}
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!