mirror of https://github.com/langgenius/dify.git
chat
This commit is contained in:
parent
1ab3b73c14
commit
4e31d7b64f
|
|
@ -29,6 +29,7 @@ type AnswerProps = {
|
|||
responding?: boolean
|
||||
allToolIcons?: Record<string, string | Emoji>
|
||||
showPromptLog?: boolean
|
||||
chatAnswerContainerInner?: string
|
||||
}
|
||||
const Answer: FC<AnswerProps> = ({
|
||||
item,
|
||||
|
|
@ -39,6 +40,7 @@ const Answer: FC<AnswerProps> = ({
|
|||
responding,
|
||||
allToolIcons,
|
||||
showPromptLog,
|
||||
chatAnswerContainerInner,
|
||||
}) => {
|
||||
const { t } = useTranslation()
|
||||
const {
|
||||
|
|
@ -70,7 +72,7 @@ const Answer: FC<AnswerProps> = ({
|
|||
}
|
||||
</div>
|
||||
<div className='chat-answer-container grow w-0 ml-4'>
|
||||
<div className='relative pr-10'>
|
||||
<div className={`relative pr-10 ${chatAnswerContainerInner}`}>
|
||||
<AnswerTriangle className='absolute -left-2 top-0 w-2 h-3 text-gray-100' />
|
||||
<div
|
||||
className={`
|
||||
|
|
|
|||
|
|
@ -50,6 +50,7 @@ export type ChatProps = {
|
|||
onAnnotationRemoved?: (index: number) => void
|
||||
chatNode?: ReactNode
|
||||
onFeedback?: (messageId: string, feedback: Feedback) => void
|
||||
chatAnswerContainerInner?: string
|
||||
}
|
||||
const Chat: FC<ChatProps> = ({
|
||||
config,
|
||||
|
|
@ -73,6 +74,7 @@ const Chat: FC<ChatProps> = ({
|
|||
onAnnotationRemoved,
|
||||
chatNode,
|
||||
onFeedback,
|
||||
chatAnswerContainerInner,
|
||||
}) => {
|
||||
const { t } = useTranslation()
|
||||
const { currentLogItem, setCurrentLogItem, showPromptLogModal, setShowPromptLogModal } = useAppStore()
|
||||
|
|
@ -191,6 +193,7 @@ const Chat: FC<ChatProps> = ({
|
|||
responding={isLast && isResponding}
|
||||
allToolIcons={allToolIcons}
|
||||
showPromptLog={showPromptLog}
|
||||
chatAnswerContainerInner={chatAnswerContainerInner}
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -112,6 +112,7 @@ const ChatWrapper = forwardRef<ChatWrapperRefType>((_, ref) => {
|
|||
)}
|
||||
suggestedQuestions={suggestedQuestions}
|
||||
showPromptLog
|
||||
chatAnswerContainerInner='!pr-2'
|
||||
/>
|
||||
)
|
||||
})
|
||||
|
|
|
|||
|
|
@ -203,7 +203,7 @@ export const useChat = (
|
|||
handleRun(
|
||||
params,
|
||||
{
|
||||
onData: (message: string, isFirstMessage: boolean, { conversationId: newConversationId, messageId, taskId }: any) => {
|
||||
onData: (message: string, isFirstMessage: boolean, { conversationId: newConversationId, messageId, taskId, errorMessage }: any) => {
|
||||
responseItem.content = responseItem.content + message
|
||||
|
||||
if (messageId && !hasSetResponseId) {
|
||||
|
|
@ -257,10 +257,6 @@ export const useChat = (
|
|||
},
|
||||
onError() {
|
||||
handleResponding(false)
|
||||
const newChatList = produce(chatListRef.current, (draft) => {
|
||||
draft.splice(draft.findIndex(item => item.id === placeholderAnswerId), 1)
|
||||
})
|
||||
handleUpdateChatList(newChatList)
|
||||
},
|
||||
onWorkflowStarted: ({ workflow_run_id, task_id }) => {
|
||||
taskIdRef.current = task_id
|
||||
|
|
|
|||
Loading…
Reference in New Issue