Skip to content

armgit / dify

Public Imported from GitHub
0

Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.

fix typo: responsing -> responding (#2718)

Lance Mao70525653809e
diff --git a/web/app/components/app/chat/answer/index.tsx b/web/app/components/app/chat/answer/index.tsx
index 68615341ccd..7138aeba881 100644
--- a/web/app/components/app/chat/answer/index.tsx
+++ b/web/app/components/app/chat/answer/index.tsx
@@ -49,7 +49,7 @@ export type IAnswerProps = {
onQueryChange: (query: string) => void
onFeedback?: FeedbackFunc
displayScene: DisplayScene
- isResponsing?: boolean
+ isResponding?: boolean
answerIcon?: ReactNode
citation?: CitationItem[]
dataSets?: DataSet[]
@@ -74,7 +74,7 @@ const Answer: FC<IAnswerProps> = ({
isHideFeedbackEdit = false,
onFeedback,
displayScene = 'web',
- isResponsing,
+ isResponding,
answerIcon,
citation,
isShowCitation,
@@ -229,7 +229,7 @@ const Answer: FC<IAnswerProps> = ({
<Thought
thought={item}
allToolIcons={allToolIcons || {}}
- isFinished={!!item.observation || !isResponsing}
+ isFinished={!!item.observation || !isResponding}
/>
)}
@@ -248,7 +248,7 @@ const Answer: FC<IAnswerProps> = ({
{
answerIcon || (
<div className={`${s.answerIcon} w-10 h-10 shrink-0`}>
- {isResponsing
+ {isResponding
&& <div className={s.typeingIcon}>
<LoadingAnim type='avatar' />
</div>
@@ -260,7 +260,7 @@ const Answer: FC<IAnswerProps> = ({
<div className={`${s.answerWrap} ${showEdit ? 'w-full' : ''}`}>
<div className={`${s.answer} relative text-sm text-gray-900`}>
<div className={'ml-2 py-3 px-4 bg-gray-100 rounded-tr-2xl rounded-b-2xl'}>
- {(isResponsing && (isAgentMode ? (!content && (agent_thoughts || []).filter(item => !!item.thought || !!item.tool).length === 0) : !content))
+ {(isResponding && (isAgentMode ? (!content && (agent_thoughts || []).filter(item => !!item.thought || !!item.tool).length === 0) : !content))
? (
<div className='flex items-center justify-center w-6 h-5'>
<LoadingAnim type='text' />
@@ -314,7 +314,7 @@ const Answer: FC<IAnswerProps> = ({
</div>
)}
{
- !!citation?.length && isShowCitation && !isResponsing && (
+ !!citation?.length && isShowCitation && !isResponding && (
<Citation data={citation} showHitInfo={isShowCitationHitInfo} />
)
}
diff --git a/web/app/components/app/chat/index.tsx b/web/app/components/app/chat/index.tsx
index c683416b574..0abdaab6d59 100644
--- a/web/app/components/app/chat/index.tsx
+++ b/web/app/components/app/chat/index.tsx
@@ -49,9 +49,9 @@ export type IChatProps = {
onSend?: (message: string, files: VisionFile[]) => void
displayScene?: DisplayScene
useCurrentUserAvatar?: boolean
- isResponsing?: boolean
- canStopResponsing?: boolean
- abortResponsing?: () => void
+ isResponding?: boolean
+ canStopResponding?: boolean
+ abortResponding?: () => void
controlClearQuery?: number
controlFocus?: number
isShowSuggestion?: boolean
@@ -82,9 +82,9 @@ const Chat: FC<IChatProps> = ({
onSend = () => { },
displayScene,
useCurrentUserAvatar,
- isResponsing,
- canStopResponsing,
- abortResponsing,
+ isResponding,
+ canStopResponding,
+ abortResponding,
controlClearQuery,
controlFocus,
isShowSuggestion,
@@ -153,7 +153,7 @@ const Chat: FC<IChatProps> = ({
if (!files.find(item => item.type === TransferMethod.local_file && !item.fileId)) {
if (files.length)
onClear()
- if (!isResponsing)
+ if (!isResponding)
onQueryChange('')
}
}
@@ -286,7 +286,7 @@ const Chat: FC<IChatProps> = ({
isHideFeedbackEdit={isHideFeedbackEdit}
onFeedback={onFeedback}
displayScene={displayScene ?? 'web'}
- isResponsing={isResponsing && isLast}
+ isResponding={isResponding && isLast}
answerIcon={answerIcon}
citation={citation}
dataSets={dataSets}
@@ -311,7 +311,7 @@ const Chat: FC<IChatProps> = ({
useCurrentUserAvatar={useCurrentUserAvatar}
item={item}
isShowPromptLog={isShowPromptLog}
- isResponsing={isResponsing}
+ isResponding={isResponding}
/>
)
})}
@@ -320,9 +320,9 @@ const Chat: FC<IChatProps> = ({
!isHideSendInput && (
<div className={cn(!feedbackDisabled && '!left-3.5 !right-3.5', 'absolute z-10 bottom-0 left-0 right-0')}>
{/* Thinking is sync and can not be stopped */}
- {(isResponsing && canStopResponsing && ((!!chatList[chatList.length - 1]?.content) || (chatList[chatList.length - 1]?.agent_thoughts && chatList[chatList.length - 1].agent_thoughts!.length > 0))) && (
+ {(isResponding && canStopResponding && ((!!chatList[chatList.length - 1]?.content) || (chatList[chatList.length - 1]?.agent_thoughts && chatList[chatList.length - 1].agent_thoughts!.length > 0))) && (
<div className='flex justify-center mb-4'>
- <Button className='flex items-center space-x-1 bg-white' onClick={() => abortResponsing?.()}>
+ <Button className='flex items-center space-x-1 bg-white' onClick={() => abortResponding?.()}>
{stopIcon}
<span className='text-xs text-gray-500 font-normal'>{t('appDebug.operation.stopResponding')}</span>
</Button>
diff --git a/web/app/components/app/chat/question/index.tsx b/web/app/components/app/chat/question/index.tsx
index e5806709ea2..7006682f7c5 100644
--- a/web/app/components/app/chat/question/index.tsx
+++ b/web/app/components/app/chat/question/index.tsx
@@ -13,10 +13,10 @@ import ImageGallery from '@/app/components/base/image-gallery'
type IQuestionProps = Pick<IChatItem, 'id' | 'content' | 'more' | 'useCurrentUserAvatar'> & {
isShowPromptLog?: boolean
item: IChatItem
- isResponsing?: boolean
+ isResponding?: boolean
}
-const Question: FC<IQuestionProps> = ({ id, content, more, useCurrentUserAvatar, isShowPromptLog, item, isResponsing }) => {
+const Question: FC<IQuestionProps> = ({ id, content, more, useCurrentUserAvatar, isShowPromptLog, item, isResponding }) => {
const { userProfile } = useContext(AppContext)
const userName = userProfile?.name
const ref = useRef(null)
@@ -28,7 +28,7 @@ const Question: FC<IQuestionProps> = ({ id, content, more, useCurrentUserAvatar,
<div className={`${s.question} group relative text-sm text-gray-900`}>
{
- isShowPromptLog && !isResponsing && (
+ isShowPromptLog && !isResponding && (
<Log log={item.log!} containerRef={ref} />
)
}
diff --git a/web/app/components/app/configuration/debug/debug-with-multiple-model/chat-item.tsx b/web/app/components/app/configuration/debug/debug-with-multiple-model/chat-item.tsx
index 2178527e4b9..6c6722a8ecf 100644
--- a/web/app/components/app/configuration/debug/debug-with-multiple-model/chat-item.tsx
+++ b/web/app/components/app/configuration/debug/debug-with-multiple-model/chat-item.tsx
@@ -46,7 +46,7 @@ const ChatItem: FC<ChatItemProps> = ({
const config = useConfigFromDebugContext()
const {
chatList,
- isResponsing,
+ isResponding,
handleSend,
suggestedQuestions,
handleRestart,
@@ -118,7 +118,7 @@ const ChatItem: FC<ChatItemProps> = ({
<Chat
config={config}
chatList={chatList}
- isResponsing={isResponsing}
+ isResponding={isResponding}
noChatInput
noStopResponding
chatContainerclassName='p-4'
diff --git a/web/app/components/app/configuration/debug/debug-with-multiple-model/text-generation-item.tsx b/web/app/components/app/configuration/debug/debug-with-multiple-model/text-generation-item.tsx
index 4de9a4e3285..15a425b5b48 100644
--- a/web/app/components/app/configuration/debug/debug-with-multiple-model/text-generation-item.tsx
+++ b/web/app/components/app/configuration/debug/debug-with-multiple-model/text-generation-item.tsx
@@ -83,7 +83,7 @@ const TextGenerationItem: FC<TextGenerationItemProps> = ({
const {
completion,
handleSend,
- isResponsing,
+ isResponding,
messageId,
} = useTextGeneration()
@@ -143,8 +143,8 @@ const TextGenerationItem: FC<TextGenerationItemProps> = ({
innerClassName='grow flex flex-col'
contentClassName='grow'
content={completion}
- isLoading={!completion && isResponsing}
- isResponsing={isResponsing}
+ isLoading={!completion && isResponding}
+ isResponding={isResponding}
isInstalledApp={false}
messageId={messageId}
isError={false}
diff --git a/web/app/components/app/configuration/debug/debug-with-single-model/index.tsx b/web/app/components/app/configuration/debug/debug-with-single-model/index.tsx
index 6a8a416e816..a14211efa1a 100644
--- a/web/app/components/app/configuration/debug/debug-with-single-model/index.tsx
+++ b/web/app/components/app/configuration/debug/debug-with-single-model/index.tsx
@@ -45,7 +45,7 @@ const DebugWithSingleModel = forwardRef<DebugWithSingleModelRefType, DebugWithSi
const config = useConfigFromDebugContext()
const {
chatList,
- isResponsing,
+ isResponding,
handleSend,
suggestedQuestions,
handleStop,
@@ -118,7 +118,7 @@ const DebugWithSingleModel = forwardRef<DebugWithSingleModelRefType, DebugWithSi
<Chat
config={config}
chatList={chatList}
- isResponsing={isResponsing}
+ isResponding={isResponding}
chatContainerclassName='p-6'
chatFooterClassName='px-6 pt-10 pb-4'
suggestedQuestions={suggestedQuestions}
diff --git a/web/app/components/app/configuration/debug/index.tsx b/web/app/components/app/configuration/debug/index.tsx
index 68bbdacfad3..6cf42d07b6f 100644
--- a/web/app/components/app/configuration/debug/index.tsx
+++ b/web/app/components/app/configuration/debug/index.tsx
@@ -93,7 +93,7 @@ const Debug: FC<IDebug> = ({
}
}, [])
- const [isResponsing, { setTrue: setResponsingTrue, setFalse: setResponsingFalse }] = useBoolean(false)
+ const [isResponding, { setTrue: setRespondingTrue, setFalse: setRespondingFalse }] = useBoolean(false)
const [isShowFormattingChangeConfirm, setIsShowFormattingChangeConfirm] = useState(false)
const [isShowCannotQueryDataset, setShowCannotQueryDataset] = useState(false)
@@ -191,7 +191,7 @@ const Debug: FC<IDebug> = ({
const [messageId, setMessageId] = useState<string | null>(null)
const sendTextCompletion = async () => {
- if (isResponsing) {
+ if (isResponding) {
notify({ type: 'info', message: t('appDebug.errorMessage.waitForResponse') })
return false
}
@@ -277,7 +277,7 @@ const Debug: FC<IDebug> = ({
setMessageId('')
let res: string[] = []
- setResponsingTrue()
+ setRespondingTrue()
sendCompletionMessage(appId, data, {
onData: (data: string, _isFirstMessage: boolean, { messageId }) => {
res.push(data)
@@ -289,10 +289,10 @@ const Debug: FC<IDebug> = ({
setCompletionRes(res.join(''))
},
onCompleted() {
- setResponsingFalse()
+ setRespondingFalse()
},
onError() {
- setResponsingFalse()
+ setRespondingFalse()
},
})
}
@@ -440,13 +440,13 @@ const Debug: FC<IDebug> = ({
{mode === AppType.completion && (
<div className="mt-6 px-6 pb-4">
<GroupName name={t('appDebug.result')} />
- {(completionRes || isResponsing) && (
+ {(completionRes || isResponding) && (
<TextGeneration
className="mt-2"
content={completionRes}
- isLoading={!completionRes && isResponsing}
+ isLoading={!completionRes && isResponding}
isShowTextToSpeech={textToSpeechConfig.enabled && !!text2speechDefaultModel}
- isResponsing={isResponsing}
+ isResponding={isResponding}
isInstalledApp={false}
messageId={messageId}
isError={false}
diff --git a/web/app/components/app/text-generate/item/index.tsx b/web/app/components/app/text-generate/item/index.tsx
index ad641c31c94..5b1265384e0 100644
--- a/web/app/components/app/text-generate/item/index.tsx
+++ b/web/app/components/app/text-generate/item/index.tsx
@@ -32,7 +32,7 @@ export type IGenerationItemProps = {
messageId?: string | null
conversationId?: string
isLoading?: boolean
- isResponsing?: boolean
+ isResponding?: boolean
isInWebApp?: boolean
moreLikeThis?: boolean
depth?: number
@@ -81,7 +81,7 @@ const GenerationItem: FC<IGenerationItemProps> = ({
content,
messageId,
isLoading,
- isResponsing,
+ isResponding,
moreLikeThis,
isInWebApp = false,
feedback,
@@ -277,7 +277,7 @@ const GenerationItem: FC<IGenerationItemProps> = ({
<div className='flex items-center justify-between mt-3'>
<div className='flex items-center'>
{
- !isInWebApp && !isInstalledApp && !isResponsing && (
+ !isInWebApp && !isInstalledApp && !isResponding && (
<PromptLog
log={promptLog}
containerRef={ref}
diff --git a/web/app/components/base/chat/chat-with-history/chat-wrapper.tsx b/web/app/components/base/chat/chat-with-history/chat-wrapper.tsx
index 85db8ae438e..9e20bddada0 100644
--- a/web/app/components/base/chat/chat-with-history/chat-wrapper.tsx
+++ b/web/app/components/base/chat/chat-with-history/chat-wrapper.tsx
@@ -43,7 +43,7 @@ const ChatWrapper = () => {
chatList,
handleSend,
handleStop,
- isResponsing,
+ isResponding,
suggestedQuestions,
} = useChat(
appConfig,
@@ -130,7 +130,7 @@ const ChatWrapper = () => {
<Chat
config={appConfig}
chatList={chatList}
- isResponsing={isResponsing}
+ isResponding={isResponding}
chatContainerInnerClassName={`mx-auto pt-6 w-full max-w-[720px] ${isMobile && 'px-4'}`}
chatFooterClassName='pb-4'
chatFooterInnerClassName={`mx-auto w-full max-w-[720px] ${isMobile && 'px-4'}`}
diff --git a/web/app/components/base/chat/chat/answer/agent-content.tsx b/web/app/components/base/chat/chat/answer/agent-content.tsx
index c8953328160..b6050606155 100644
--- a/web/app/components/base/chat/chat/answer/agent-content.tsx
+++ b/web/app/components/base/chat/chat/answer/agent-content.tsx
@@ -11,12 +11,12 @@ import type { Emoji } from '@/app/components/tools/types'
type AgentContentProps = {
item: ChatItem
- responsing?: boolean
+ responding?: boolean
allToolIcons?: Record<string, string | Emoji>
}
const AgentContent: FC<AgentContentProps> = ({
item,
- responsing,
+ responding,
allToolIcons,
}) => {
const {
@@ -46,7 +46,7 @@ const AgentContent: FC<AgentContentProps> = ({
<Thought
thought={thought}
allToolIcons={allToolIcons || {}}
- isFinished={!!thought.observation || !responsing}
+ isFinished={!!thought.observation || !responding}
/>
)}
diff --git a/web/app/components/base/chat/chat/answer/index.tsx b/web/app/components/base/chat/chat/answer/index.tsx
index 088336c00b1..84b397462c4 100644
--- a/web/app/components/base/chat/chat/answer/index.tsx
+++ b/web/app/components/base/chat/chat/answer/index.tsx
@@ -25,7 +25,7 @@ type AnswerProps = {
index: number
config?: ChatConfig
answerIcon?: ReactNode
- responsing?: boolean
+ responding?: boolean
allToolIcons?: Record<string, string | Emoji>
}
const Answer: FC<AnswerProps> = ({
@@ -34,7 +34,7 @@ const Answer: FC<AnswerProps> = ({
index,
config,
answerIcon,
- responsing,
+ responding,
allToolIcons,
}) => {
const { t } = useTranslation()
@@ -58,7 +58,7 @@ const Answer: FC<AnswerProps> = ({
)
}
{
- responsing && (
+ responding && (
<div className='absolute -top-[3px] -left-[3px] pl-[6px] flex items-center w-4 h-4 bg-white rounded-full shadow-xs border-[0.5px] border-gray-50'>
<LoadingAnim type='avatar' />
</div>
@@ -70,7 +70,7 @@ const Answer: FC<AnswerProps> = ({
<AnswerTriangle className='absolute -left-2 top-0 w-2 h-3 text-gray-100' />
<div className='group relative inline-block px-4 py-3 max-w-full bg-gray-100 rounded-b-2xl rounded-tr-2xl text-sm text-gray-900'>
{
- !responsing && (
+ !responding && (
<Operation
item={item}
question={question}
@@ -79,7 +79,7 @@ const Answer: FC<AnswerProps> = ({
)
}
{
- responsing && !content && !hasAgentThoughts && (
+ responding && !content && !hasAgentThoughts && (
<div className='flex items-center justify-center w-6 h-5'>
<LoadingAnim type='text' />
</div>
@@ -94,7 +94,7 @@ const Answer: FC<AnswerProps> = ({
hasAgentThoughts && (
<AgentContent
item={item}
- responsing={responsing}
+ responding={responding}
allToolIcons={allToolIcons}
/>
)
@@ -109,7 +109,7 @@ const Answer: FC<AnswerProps> = ({
}
<SuggestedQuestions item={item} />
{
- !!citation?.length && config?.retriever_resource?.enabled && !responsing && (
+ !!citation?.length && config?.retriever_resource?.enabled && !responding && (
<Citation data={citation} showHitInfo={config.supportCitationHitInfo} />
)
}
diff --git a/web/app/components/base/chat/chat/context.tsx b/web/app/components/base/chat/chat/context.tsx
index a2086e0819e..ba6f67189e1 100644
--- a/web/app/components/base/chat/chat/context.tsx
+++ b/web/app/components/base/chat/chat/context.tsx
@@ -5,7 +5,7 @@ import { createContext, useContext } from 'use-context-selector'
import type { ChatProps } from './index'
export type ChatContextValue = Pick<ChatProps, 'config'
- | 'isResponsing'
+ | 'isResponding'
| 'chatList'
| 'showPromptLog'
| 'questionIcon'
@@ -29,7 +29,7 @@ type ChatContextProviderProps = {
export const ChatContextProvider = ({
children,
config,
- isResponsing,
+ isResponding,
chatList,
showPromptLog,
questionIcon,
@@ -44,7 +44,7 @@ export const ChatContextProvider = ({
return (
<ChatContext.Provider value={{
config,
- isResponsing,
+ isResponding,
chatList: chatList || [],
showPromptLog,
questionIcon,
diff --git a/web/app/components/base/chat/chat/hooks.ts b/web/app/components/base/chat/chat/hooks.ts
index d870cfc79f0..618a1bf7e02 100644
--- a/web/app/components/base/chat/chat/hooks.ts
+++ b/web/app/components/base/chat/chat/hooks.ts
@@ -80,8 +80,8 @@ export const useChat = (
const { notify } = useToastContext()
const connversationId = useRef('')
const hasStopResponded = useRef(false)
- const [isResponsing, setIsResponsing] = useState(false)
- const isResponsingRef = useRef(false)
+ const [isResponding, setIsResponding] = useState(false)
+ const isRespondingRef = useRef(false)
const [chatList, setChatList] = useState<ChatItem[]>(prevChatList || [])
const chatListRef = useRef<ChatItem[]>(prevChatList || [])
const taskIdRef = useRef('')
@@ -101,9 +101,9 @@ export const useChat = (
setChatList(newChatList)
chatListRef.current = newChatList
}, [])
- const handleResponsing = useCallback((isResponsing: boolean) => {
- setIsResponsing(isResponsing)
- isResponsingRef.current = isResponsing
+ const handleResponding = useCallback((isResponding: boolean) => {
+ setIsResponding(isResponding)
+ isRespondingRef.current = isResponding
}, [])
const getIntroduction = useCallback((str: string) => {
@@ -136,14 +136,14 @@ export const useChat = (
const handleStop = useCallback(() => {
hasStopResponded.current = true
- handleResponsing(false)
+ handleResponding(false)
if (stopChat && taskIdRef.current)
stopChat(taskIdRef.current)
if (conversationMessagesAbortControllerRef.current)
conversationMessagesAbortControllerRef.current.abort()
if (suggestedQuestionsAbortControllerRef.current)
suggestedQuestionsAbortControllerRef.current.abort()
- }, [stopChat, handleResponsing])
+ }, [stopChat, handleResponding])
const handleRestart = useCallback(() => {
connversationId.current = ''
@@ -200,7 +200,7 @@ export const useChat = (
) => {
setSuggestQuestions([])
- if (isResponsingRef.current) {
+ if (isRespondingRef.current) {
notify({ type: 'info', message: t('appDebug.errorMessage.waitForResponse') })
return false
}
@@ -235,7 +235,7 @@ export const useChat = (
isAnswer: true,
}
- handleResponsing(true)
+ handleResponding(true)
hasStopResponded.current = false
const bodyParams = {
@@ -295,7 +295,7 @@ export const useChat = (
})
},
async onCompleted(hasError?: boolean) {
- handleResponsing(false)
+ handleResponding(false)
if (hasError)
return
@@ -416,7 +416,7 @@ export const useChat = (
responseItem.content = messageReplace.answer
},
onError() {
- handleResponsing(false)
+ handleResponding(false)
const newChatList = produce(chatListRef.current, (draft) => {
draft.splice(draft.findIndex(item => item.id === placeholderAnswerId), 1)
})
@@ -432,7 +432,7 @@ export const useChat = (
notify,
promptVariablesConfig,
handleUpdateChatList,
- handleResponsing,
+ handleResponding,
])
const handleAnnotationEdited = useCallback((query: string, answer: string, index: number) => {
@@ -506,8 +506,8 @@ export const useChat = (
chatList,
setChatList,
conversationId: connversationId.current,
- isResponsing,
- setIsResponsing,
+ isResponding,
+ setIsResponding,
handleSend,
suggestedQuestions,
handleRestart,
diff --git a/web/app/components/base/chat/chat/index.tsx b/web/app/components/base/chat/chat/index.tsx
index 67a91e21506..2f3ae501314 100644
--- a/web/app/components/base/chat/chat/index.tsx
+++ b/web/app/components/base/chat/chat/index.tsx
@@ -28,7 +28,7 @@ import { StopCircle } from '@/app/components/base/icons/src/vender/solid/mediaAn
export type ChatProps = {
chatList: ChatItem[]
config?: ChatConfig
- isResponsing?: boolean
+ isResponding?: boolean
noStopResponding?: boolean
onStopResponding?: () => void
noChatInput?: boolean
@@ -52,7 +52,7 @@ const Chat: FC<ChatProps> = ({
config,
onSend,
chatList,
- isResponsing,
+ isResponding,
noStopResponding,
onStopResponding,
noChatInput,
@@ -125,7 +125,7 @@ const Chat: FC<ChatProps> = ({
<ChatContextProvider
config={config}
chatList={chatList}
- isResponsing={isResponsing}
+ isResponding={isResponding}
showPromptLog={showPromptLog}
questionIcon={questionIcon}
answerIcon={answerIcon}
@@ -158,7 +158,7 @@ const Chat: FC<ChatProps> = ({
index={index}
config={config}
answerIcon={answerIcon}
- responsing={isLast && isResponsing}
+ responding={isLast && isResponding}
allToolIcons={allToolIcons}
/>
)
@@ -169,7 +169,7 @@ const Chat: FC<ChatProps> = ({
item={item}
showPromptLog={showPromptLog}
questionIcon={questionIcon}
- isResponsing={isResponsing}
+ isResponding={isResponding}
/>
)
})
@@ -188,7 +188,7 @@ const Chat: FC<ChatProps> = ({
className={`${chatFooterInnerClassName}`}
>
{
- !noStopResponding && isResponsing && (
+ !noStopResponding && isResponding && (
<div className='flex justify-center mb-2'>
<Button className='py-0 px-3 h-7 bg-white shadow-xs' onClick={onStopResponding}>
<StopCircle className='mr-[5px] w-3.5 h-3.5 text-gray-500' />
diff --git a/web/app/components/base/chat/chat/question.tsx b/web/app/components/base/chat/chat/question.tsx
index 103412db778..a123540a890 100644
--- a/web/app/components/base/chat/chat/question.tsx
+++ b/web/app/components/base/chat/chat/question.tsx
@@ -17,12 +17,12 @@ type QuestionProps = {
item: ChatItem
showPromptLog?: boolean
questionIcon?: ReactNode
- isResponsing?: boolean
+ isResponding?: boolean
}
const Question: FC<QuestionProps> = ({
item,
showPromptLog,
- isResponsing,
+ isResponding,
questionIcon,
}) => {
const ref = useRef(null)
@@ -38,7 +38,7 @@ const Question: FC<QuestionProps> = ({
<div className='group relative mr-4'>
<QuestionTriangle className='absolute -right-2 top-0 w-2 h-3 text-[#D1E9FF]/50' />
{
- showPromptLog && !isResponsing && (
+ showPromptLog && !isResponding && (
<Log log={item.log!} containerRef={ref} />
)
}
diff --git a/web/app/components/base/text-generation/hooks.ts b/web/app/components/base/text-generation/hooks.ts
index 5ca9f83ee8a..3d1bae98643 100644
--- a/web/app/components/base/text-generation/hooks.ts
+++ b/web/app/components/base/text-generation/hooks.ts
@@ -6,7 +6,7 @@ import { ssePost } from '@/service/base'
export const useTextGeneration = () => {
const { t } = useTranslation()
const { notify } = useToastContext()
- const [isResponsing, setIsResponsing] = useState(false)
+ const [isResponding, setIsResponding] = useState(false)
const [completion, setCompletion] = useState('')
const [messageId, setMessageId] = useState<string | null>(null)
@@ -14,12 +14,12 @@ export const useTextGeneration = () => {
url: string,
data: any,
) => {
- if (isResponsing) {
+ if (isResponding) {
notify({ type: 'info', message: t('appDebug.errorMessage.waitForResponse') })
return false
}
- setIsResponsing(true)
+ setIsResponding(true)
setCompletion('')
setMessageId('')
let res: string[] = []
@@ -42,10 +42,10 @@ export const useTextGeneration = () => {
setCompletion(res.join(''))
},
onCompleted() {
- setIsResponsing(false)
+ setIsResponding(false)
},
onError() {
- setIsResponsing(false)
+ setIsResponding(false)
},
})
return true
@@ -53,8 +53,8 @@ export const useTextGeneration = () => {
return {
completion,
- isResponsing,
- setIsResponsing,
+ isResponding,
+ setIsResponding,
handleSend,
messageId,
}
diff --git a/web/app/components/share/chat/index.tsx b/web/app/components/share/chat/index.tsx
index 544207bc78e..381558922d1 100644
--- a/web/app/components/share/chat/index.tsx
+++ b/web/app/components/share/chat/index.tsx
@@ -190,7 +190,7 @@ const Main: FC<IMainProps> = ({
const [citationConfig, setCitationConfig] = useState<CitationConfig | null>(null)
const [chatList, setChatList, getChatList] = useGetState<IChatItem[]>([])
const chatListDomRef = useRef<HTMLDivElement>(null)
- const [isResponsing, { setTrue: setResponsingTrue, setFalse: setResponsingFalse }] = useBoolean(false)
+ const [isResponding, { setTrue: setRespondingTrue, setFalse: setRespondingFalse }] = useBoolean(false)
const [abortController, setAbortController] = useState<AbortController | null>(null)
const [conversationIdChangeBecauseOfNew, setConversationIdChangeBecauseOfNew, getConversationIdChangeBecauseOfNew] = useGetState(false)
const [isChatStarted, { setTrue: setChatStarted, setFalse: setChatNotStarted }] = useBoolean(false)
@@ -198,7 +198,7 @@ const Main: FC<IMainProps> = ({
const createNewChat = useCallback(async () => {
// if new chat is already exist, do not create new chat
abortController?.abort()
- setResponsingFalse()
+ setRespondingFalse()
if (conversationList.some(item => item.id === '-1'))
return
@@ -212,7 +212,7 @@ const Main: FC<IMainProps> = ({
}))
}, [
abortController,
- setResponsingFalse,
+ setRespondingFalse,
setConversationList,
conversationList,
newConversationInputs,
@@ -504,11 +504,11 @@ const Main: FC<IMainProps> = ({
}, [currConversationId, currInputs, promptConfig, t, logError])
const [controlFocus, setControlFocus] = useState(0)
- const doShowSuggestion = isShowSuggestion && !isResponsing
+ const doShowSuggestion = isShowSuggestion && !isResponding
const [openingSuggestedQuestions, setOpeningSuggestedQuestions] = useState<string[]>([])
const [messageTaskId, setMessageTaskId] = useState('')
const [hasStopResponded, setHasStopResponded, getHasStopResponded] = useGetState(false)
- const [isResponsingConIsCurrCon, setIsResponsingConCurrCon, getIsResponsingConIsCurrCon] = useGetState(true)
+ const [isRespondingConIsCurrCon, setIsRespondingConCurrCon, getIsRespondingConIsCurrCon] = useGetState(true)
const [userQuery, setUserQuery] = useState('')
const [visionConfig, setVisionConfig] = useState<VisionSettings>({
enabled: false,
@@ -541,7 +541,7 @@ const Main: FC<IMainProps> = ({
}
const handleSend = async (message: string, files?: VisionFile[]) => {
- if (isResponsing) {
+ if (isResponding) {
notify({ type: 'info', message: t('appDebug.errorMessage.waitForResponse') })
return
}
@@ -605,9 +605,9 @@ const Main: FC<IMainProps> = ({
let tempNewConversationId = prevTempNewConversationId
setHasStopResponded(false)
- setResponsingTrue()
+ setRespondingTrue()
setIsShowSuggestion(false)
- setIsResponsingConCurrCon(true)
+ setIsRespondingConCurrCon(true)
sendChatMessage(data, {
getAbortController: (abortController) => {
setAbortController(abortController)
@@ -632,7 +632,7 @@ const Main: FC<IMainProps> = ({
setMessageTaskId(taskId)
// has switched to other conversation
if (prevTempNewConversationId !== getCurrConversationId()) {
- setIsResponsingConCurrCon(false)
+ setIsRespondingConCurrCon(false)
return
}
updateCurrentQA({
@@ -660,12 +660,12 @@ const Main: FC<IMainProps> = ({
resetNewConversationInputs()
setChatNotStarted()
setCurrConversationId(tempNewConversationId, appId, true)
- if (getIsResponsingConIsCurrCon() && suggestedQuestionsAfterAnswerConfig?.enabled && !getHasStopResponded()) {
+ if (getIsRespondingConIsCurrCon() && suggestedQuestionsAfterAnswerConfig?.enabled && !getHasStopResponded()) {
const { data }: any = await fetchSuggestedQuestions(responseItem.id, isInstalledApp, installedAppInfo?.id)
setSuggestQuestions(data)
setIsShowSuggestion(true)
}
- setResponsingFalse()
+ setRespondingFalse()
},
onFile(file) {
const lastThought = responseItem.agent_thoughts?.[responseItem.agent_thoughts?.length - 1]
@@ -704,7 +704,7 @@ const Main: FC<IMainProps> = ({
}
// has switched to other conversation
if (prevTempNewConversationId !== getCurrConversationId()) {
- setIsResponsingConCurrCon(false)
+ setIsRespondingConCurrCon(false)
return false
}
@@ -766,7 +766,7 @@ const Main: FC<IMainProps> = ({
}
},
onError() {
- setResponsingFalse()
+ setRespondingFalse()
// role back placeholder answer
setChatList(produce(getChatList(), (draft) => {
draft.splice(draft.findIndex(item => item.id === placeholderAnswerId), 1)
@@ -832,10 +832,10 @@ const Main: FC<IMainProps> = ({
)
}
- const handleAbortResponsing = useCallback(async () => {
+ const handleAbortResponding = useCallback(async () => {
await stopChatMessageResponding(appId, messageTaskId, isInstalledApp, installedAppInfo?.id)
setHasStopResponded(true)
- setResponsingFalse()
+ setRespondingFalse()
}, [appId, messageTaskId, isInstalledApp, installedAppInfo?.id])
if (appUnavailable)
@@ -905,7 +905,7 @@ const Main: FC<IMainProps> = ({
{
hasSetInputs && (
- <div className={cn(doShowSuggestion ? 'pb-[140px]' : (isResponsing ? 'pb-[113px]' : 'pb-[76px]'), 'relative grow h-[200px] pc:w-[794px] max-w-full mobile:w-full mx-auto mb-3.5 overflow-hidden')}>
+ <div className={cn(doShowSuggestion ? 'pb-[140px]' : (isResponding ? 'pb-[113px]' : 'pb-[76px]'), 'relative grow h-[200px] pc:w-[794px] max-w-full mobile:w-full mx-auto mb-3.5 overflow-hidden')}>
<div className='h-full overflow-y-auto' ref={chatListDomRef}>
<Chat
chatList={chatList}
@@ -914,9 +914,9 @@ const Main: FC<IMainProps> = ({
onSend={handleSend}
isHideFeedbackEdit
onFeedback={handleFeedback}
- isResponsing={isResponsing}
- canStopResponsing={!!messageTaskId && isResponsingConIsCurrCon}
- abortResponsing={handleAbortResponsing}
+ isResponding={isResponding}
+ canStopResponding={!!messageTaskId && isRespondingConIsCurrCon}
+ abortResponding={handleAbortResponding}
checkCanSend={checkCanSend}
controlFocus={controlFocus}
isShowSuggestion={doShowSuggestion}
diff --git a/web/app/components/share/chatbot/index.tsx b/web/app/components/share/chatbot/index.tsx
index f3faa08ad06..d31c6d691c3 100644
--- a/web/app/components/share/chatbot/index.tsx
+++ b/web/app/components/share/chatbot/index.tsx
@@ -203,7 +203,7 @@ const Main: FC<IMainProps> = ({
}
// update chat list of current conversation
- if (!isNewConversation && !conversationIdChangeBecauseOfNew && !isResponsing) {
+ if (!isNewConversation && !conversationIdChangeBecauseOfNew && !isResponding) {
fetchChatList(currConversationId, isInstalledApp, installedAppInfo?.id).then((res: any) => {
const { data } = res
const newChatList: IChatItem[] = generateNewChatListWithOpenstatement(notSyncToStateIntroduction, notSyncToStateInputs)
@@ -252,7 +252,7 @@ const Main: FC<IMainProps> = ({
const createNewChat = async () => {
// if new chat is already exist, do not create new chat
abortController?.abort()
- setResponsingFalse()
+ setRespondingFalse()
if (conversationList.some(item => item.id === '-1'))
return
@@ -369,7 +369,7 @@ const Main: FC<IMainProps> = ({
})()
}, [])
- const [isResponsing, { setTrue: setResponsingTrue, setFalse: setResponsingFalse }] = useBoolean(false)
+ const [isResponding, { setTrue: setRespondingTrue, setFalse: setRespondingFalse }] = useBoolean(false)
const [abortController, setAbortController] = useState<AbortController | null>(null)
const { notify } = useContext(ToastContext)
const logError = (message: string) => {
@@ -407,11 +407,11 @@ const Main: FC<IMainProps> = ({
const [controlFocus, setControlFocus] = useState(0)
const [isShowSuggestion, setIsShowSuggestion] = useState(false)
- const doShowSuggestion = isShowSuggestion && !isResponsing
+ const doShowSuggestion = isShowSuggestion && !isResponding
const [suggestQuestions, setSuggestQuestions] = useState<string[]>([])
const [messageTaskId, setMessageTaskId] = useState('')
const [hasStopResponded, setHasStopResponded, getHasStopResponded] = useGetState(false)
- const [isResponsingConIsCurrCon, setIsResponsingConCurrCon, getIsResponsingConIsCurrCon] = useGetState(true)
+ const [isRespondingConIsCurrCon, setIsRespondingConCurrCon, getIsRespondingConIsCurrCon] = useGetState(true)
const [shouldReload, setShouldReload] = useState(false)
const [userQuery, setUserQuery] = useState('')
const [visionConfig, setVisionConfig] = useState<VisionSettings>({
@@ -445,7 +445,7 @@ const Main: FC<IMainProps> = ({
}
const handleSend = async (message: string, files?: VisionFile[]) => {
- if (isResponsing) {
+ if (isResponding) {
notify({ type: 'info', message: t('appDebug.errorMessage.waitForResponse') })
return
}
@@ -507,7 +507,7 @@ const Main: FC<IMainProps> = ({
let tempNewConversationId = prevTempNewConversationId
setHasStopResponded(false)
- setResponsingTrue()
+ setRespondingTrue()
setIsShowSuggestion(false)
sendChatMessage(data, {
getAbortController: (abortController) => {
@@ -533,7 +533,7 @@ const Main: FC<IMainProps> = ({
setMessageTaskId(taskId)
// has switched to other conversation
if (prevTempNewConversationId !== getCurrConversationId()) {
- setIsResponsingConCurrCon(false)
+ setIsRespondingConCurrCon(false)
return
}
updateCurrentQA({
@@ -565,7 +565,7 @@ const Main: FC<IMainProps> = ({
setSuggestQuestions(data)
setIsShowSuggestion(true)
}
- setResponsingFalse()
+ setRespondingFalse()
},
onFile(file) {
const lastThought = responseItem.agent_thoughts?.[responseItem.agent_thoughts?.length - 1]
@@ -604,7 +604,7 @@ const Main: FC<IMainProps> = ({
}
// has switched to other conversation
if (prevTempNewConversationId !== getCurrConversationId()) {
- setIsResponsingConCurrCon(false)
+ setIsRespondingConCurrCon(false)
return false
}
@@ -666,7 +666,7 @@ const Main: FC<IMainProps> = ({
}
},
onError() {
- setResponsingFalse()
+ setRespondingFalse()
// role back placeholder answer
setChatList(produce(getChatList(), (draft) => {
draft.splice(draft.findIndex(item => item.id === placeholderAnswerId), 1)
@@ -773,7 +773,7 @@ const Main: FC<IMainProps> = ({
}
{
hasSetInputs && (
- <div className={cn(doShowSuggestion ? 'pb-[140px]' : (isResponsing ? 'pb-[113px]' : 'pb-[76px]'), 'relative grow h-[200px] pc:w-[794px] max-w-full mobile:w-full mx-auto mb-3.5 overflow-hidden')}>
+ <div className={cn(doShowSuggestion ? 'pb-[140px]' : (isResponding ? 'pb-[113px]' : 'pb-[76px]'), 'relative grow h-[200px] pc:w-[794px] max-w-full mobile:w-full mx-auto mb-3.5 overflow-hidden')}>
<div className='h-full overflow-y-auto' ref={chatListDomRef}>
<Chat
chatList={chatList}
@@ -782,12 +782,12 @@ const Main: FC<IMainProps> = ({
onSend={handleSend}
isHideFeedbackEdit
onFeedback={handleFeedback}
- isResponsing={isResponsing}
- canStopResponsing={!!messageTaskId && isResponsingConIsCurrCon}
- abortResponsing={async () => {
+ isResponding={isResponding}
+ canStopResponding={!!messageTaskId && isRespondingConIsCurrCon}
+ abortResponding={async () => {
await stopChatMessageResponding(appId, messageTaskId, isInstalledApp, installedAppInfo?.id)
setHasStopResponded(true)
- setResponsingFalse()
+ setRespondingFalse()
}}
checkCanSend={checkCanSend}
controlFocus={controlFocus}
diff --git a/web/app/components/share/text-generation/result/index.tsx b/web/app/components/share/text-generation/result/index.tsx
index d75fbcc8f05..ad7f5b92bca 100644
--- a/web/app/components/share/text-generation/result/index.tsx
+++ b/web/app/components/share/text-generation/result/index.tsx
@@ -60,10 +60,10 @@ const Result: FC<IResultProps> = ({
visionConfig,
completionFiles,
}) => {
- const [isResponsing, { setTrue: setResponsingTrue, setFalse: setResponsingFalse }] = useBoolean(false)
+ const [isResponding, { setTrue: setRespondingTrue, setFalse: setRespondingFalse }] = useBoolean(false)
useEffect(() => {
if (controlStopResponding)
- setResponsingFalse()
+ setRespondingFalse()
}, [controlStopResponding])
const [completionRes, doSetCompletionRes] = useState('')
@@ -130,7 +130,7 @@ const Result: FC<IResultProps> = ({
}
const handleSend = async () => {
- if (isResponsing) {
+ if (isResponding) {
notify({ type: 'info', message: t('appDebug.errorMessage.waitForResponse') })
return false
}
@@ -165,13 +165,13 @@ const Result: FC<IResultProps> = ({
if (!isPC)
onShowRes()
- setResponsingTrue()
+ setRespondingTrue()
const startTime = Date.now()
let isTimeout = false
const runId = setInterval(() => {
if (Date.now() - startTime > 1000 * 60) { // 1min timeout
clearInterval(runId)
- setResponsingFalse()
+ setRespondingFalse()
onCompleted(getCompletionRes(), taskId, false)
isTimeout = true
}
@@ -186,7 +186,7 @@ const Result: FC<IResultProps> = ({
if (isTimeout)
return
- setResponsingFalse()
+ setRespondingFalse()
setMessageId(tempMessageId)
onCompleted(getCompletionRes(), taskId, true)
clearInterval(runId)
@@ -199,7 +199,7 @@ const Result: FC<IResultProps> = ({
if (isTimeout)
return
- setResponsingFalse()
+ setRespondingFalse()
onCompleted(getCompletionRes(), taskId, false)
clearInterval(runId)
},
@@ -234,7 +234,7 @@ const Result: FC<IResultProps> = ({
isMobile={isMobile}
isInstalledApp={isInstalledApp}
installedAppId={installedAppInfo?.id}
- isLoading={isCallBatchAPI ? (!completionRes && isResponsing) : false}
+ isLoading={isCallBatchAPI ? (!completionRes && isResponding) : false}
taskId={isCallBatchAPI ? ((taskId as number) < 10 ? `0${taskId}` : `${taskId}`) : undefined}
controlClearMoreLikeThis={controlClearMoreLikeThis}
isShowTextToSpeech={isShowTextToSpeech}
@@ -244,7 +244,7 @@ const Result: FC<IResultProps> = ({
return (
<div className={cn(isNoData && !isCallBatchAPI && 'h-full')}>
{!isCallBatchAPI && (
- (isResponsing && !completionRes)
+ (isResponding && !completionRes)
? (
<div className='flex h-full w-full justify-center items-center'>
<Loading type='area' />