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