Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation cannot be stopped manually #14255

Open
5 tasks done
NieRonghua opened this issue Feb 24, 2025 · 2 comments
Open
5 tasks done

Conversation cannot be stopped manually #14255

NieRonghua opened this issue Feb 24, 2025 · 2 comments
Labels
🐞 bug Something isn't working

Comments

@NieRonghua
Copy link

Self Checks

  • This is only for bug report, if you would like to ask a question, please head to Discussions.
  • I have searched for existing issues search for existing issues, including closed ones.
  • I confirm that I am using English to submit this report (我已阅读并同意 Language Policy).
  • [FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:)
  • Please do not modify this template :) and fill in all the required fields.

Dify version

0.15.3

Cloud or Self Hosted

Cloud

Steps to reproduce

step1:
Chat
Image

step2:
Stop conversation

Image

step3:
The conversation was still answered

✔️ Expected Behavior

No response

❌ Actual Behavior

No response

@NieRonghua
Copy link
Author

step3

Image

@dosubot dosubot bot added the 🐞 bug Something isn't working label Feb 24, 2025
Copy link

dosubot bot commented Feb 24, 2025

To manually stop a conversation in the DeepSeek-Reasoner chat interface, you can use the handleStop function. This function is designed to stop the chat by setting the responding state to false and aborting any ongoing requests. Here is the relevant code snippet:

const handleStop = useCallback(() => {
  hasStopResponded.current = true
  handleResponding(false)
  if (stopChat && taskIdRef.current)
    stopChat(taskIdRef.current)
  if (conversationMessagesAbortControllerRef.current)
    conversationMessagesAbortControllerRef.current.abort()
  if (suggestedQuestionsAbortControllerRef.current)
    suggestedQuestionsAbortControllerRef.current.abort()
}, [stopChat, handleResponding])

This function will:

  1. Set hasStopResponded.current to true to indicate that a stop has been requested.
  2. Call handleResponding(false) to update the responding state.
  3. If a stopChat function and a taskId are available, it will call stopChat(taskIdRef.current).
  4. Abort any ongoing requests using conversationMessagesAbortControllerRef.current.abort() and suggestedQuestionsAbortControllerRef.current.abort().

Additionally, in the chat interface, there is a button to stop responding, which is conditionally rendered when isResponding is true and noStopResponding is false. You can click this button to stop the conversation:

{
  !noStopResponding && isResponding && (
    <div className='flex justify-center mb-2'>
      <Button onClick={onStopResponding}>
        <StopCircle className='mr-[5px] w-3.5 h-3.5 text-gray-500' />
        <span className='text-xs text-gray-500 font-normal'>{t('appDebug.operation.stopResponding')}</span>
      </Button>
    </div>
  )
}

Ensure that the onStopResponding function is properly implemented to handle the stop action [1][2].

To continue talking to Dosu, mention @dosu.


Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Bug Report | Other

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐞 bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant