Inputs in the same conversation cannot be changed #3989

Closed
opened 2026-02-21 18:04:16 -05:00 by yindo · 10 comments
Owner

Originally created by @link-king on GitHub (Jun 5, 2024).

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).
  • Please do not modify this template :) and fill in all the required fields.

Dify version

0.6.9

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

I am debugging using POSTman, and the inputs in the same conversation cannot be changed

✔️ Expected Behavior

No response

Actual Behavior

No response

Originally created by @link-king on GitHub (Jun 5, 2024). ### Self Checks - [X] This is only for bug report, if you would like to ask a question, please head to [Discussions](https://github.com/langgenius/dify/discussions/categories/general). - [X] I have searched for existing issues [search for existing issues](https://github.com/langgenius/dify/issues), including closed ones. - [X] I confirm that I am using English to submit this report (我已阅读并同意 [Language Policy](https://github.com/langgenius/dify/issues/1542)). - [X] Please do not modify this template :) and fill in all the required fields. ### Dify version 0.6.9 ### Cloud or Self Hosted Self Hosted (Docker) ### Steps to reproduce I am debugging using POSTman, and the inputs in the same conversation cannot be changed ### ✔️ Expected Behavior _No response_ ### ❌ Actual Behavior _No response_
yindo added the 🐞 bug label 2026-02-21 18:04:16 -05:00
yindo closed this issue 2026-02-21 18:04:16 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (Jun 5, 2024):

Hello @link-king! I'm a bot here to help you with bug fixes, answering questions, and contributing to the repository. Let's tackle this issue together!

To resolve the issue where inputs in the same conversation cannot be changed while using Dify version 0.6.9, self-hosted with Docker, and debugging with POSTman, you need to ensure that the setCurrInputs function is properly utilized to update the currInputs state in the useConversation hook.

Here is the relevant part of the useConversation hook that includes the currInputs and setCurrInputs:

import { useState } from 'react'
import produce from 'immer'
import { useGetState } from 'ahooks'
import type { ConversationItem } from '@/models/share'

const storageConversationIdKey = 'conversationIdInfo'

function useConversation() {
  const [conversationList, setConversationList] = useState<ConversationItem[]>([])
  const [pinnedConversationList, setPinnedConversationList] = useState<ConversationItem[]>([])
  const [currConversationId, doSetCurrConversationId, getCurrConversationId] = useGetState<string>('-1')
  const isNewConversation = currConversationId === '-1'
  const [newConversationInputs, setNewConversationInputs] = useState<Record<string, any> | null>(null)
  const [existConversationInputs, setExistConversationInputs] = useState<Record<string, any> | null>(null)
  const currInputs = isNewConversation ? newConversationInputs : existConversationInputs
  const setCurrInputs = isNewConversation ? setNewConversationInputs : setExistConversationInputs

  return {
    currInputs,
    setCurrInputs,
    // ... other properties
  }
}

export default useConversation

To change the inputs in the same conversation, you should call the setCurrInputs function with the new inputs. Here is an example of how you might do this:

const { setCurrInputs } = useConversation();

// Example new inputs
const newInputs = {
  input1: 'new value 1',
  input2: 'new value 2',
  // ... other inputs
};

// Update the inputs
setCurrInputs(newInputs);

Ensure that the setCurrInputs function is correctly implemented and called whenever you need to update the inputs in the conversation. This should resolve the issue of inputs not being changeable within the same conversation [1].

To continue talking to Dosu, mention @dosu.

@dosubot[bot] commented on GitHub (Jun 5, 2024): <!-- Greeting --> Hello @link-king! I'm a bot here to help you with bug fixes, answering questions, and contributing to the repository. Let's tackle this issue together! <!-- Answer --> To resolve the issue where inputs in the same conversation cannot be changed while using Dify version 0.6.9, self-hosted with Docker, and debugging with POSTman, you need to ensure that the `setCurrInputs` function is properly utilized to update the `currInputs` state in the `useConversation` hook. Here is the relevant part of the `useConversation` hook that includes the `currInputs` and `setCurrInputs`: ```ts import { useState } from 'react' import produce from 'immer' import { useGetState } from 'ahooks' import type { ConversationItem } from '@/models/share' const storageConversationIdKey = 'conversationIdInfo' function useConversation() { const [conversationList, setConversationList] = useState<ConversationItem[]>([]) const [pinnedConversationList, setPinnedConversationList] = useState<ConversationItem[]>([]) const [currConversationId, doSetCurrConversationId, getCurrConversationId] = useGetState<string>('-1') const isNewConversation = currConversationId === '-1' const [newConversationInputs, setNewConversationInputs] = useState<Record<string, any> | null>(null) const [existConversationInputs, setExistConversationInputs] = useState<Record<string, any> | null>(null) const currInputs = isNewConversation ? newConversationInputs : existConversationInputs const setCurrInputs = isNewConversation ? setNewConversationInputs : setExistConversationInputs return { currInputs, setCurrInputs, // ... other properties } } export default useConversation ``` To change the inputs in the same conversation, you should call the `setCurrInputs` function with the new inputs. Here is an example of how you might do this: ```ts const { setCurrInputs } = useConversation(); // Example new inputs const newInputs = { input1: 'new value 1', input2: 'new value 2', // ... other inputs }; // Update the inputs setCurrInputs(newInputs); ``` Ensure that the `setCurrInputs` function is correctly implemented and called whenever you need to update the inputs in the conversation. This should resolve the issue of inputs not being changeable within the same conversation <sup>[[1]](https://github.com/langgenius/dify/blob/main/web/app/components/share/chatbot/hooks/use-conversation.ts)</sup>. <!-- Dosu Comment Footer --> *To continue talking to [Dosu](https://dosu.dev), mention @dosu.*
Author
Owner

@crazywoola commented on GitHub (Jun 5, 2024):

Do you have a screenshot? We need more details, this issue seems vague to me.

@crazywoola commented on GitHub (Jun 5, 2024): Do you have a screenshot? We need more details, this issue seems vague to me.
Author
Owner

@link-king commented on GitHub (Jun 5, 2024):

Do you have a screenshot? We need more details, this issue seems vague to me.

Please see my reply

@link-king commented on GitHub (Jun 5, 2024): > Do you have a screenshot? We need more details, this issue seems vague to me. Please see my reply
Author
Owner

@link-king commented on GitHub (Jun 5, 2024):

@crazywoola

@link-king commented on GitHub (Jun 5, 2024): @crazywoola
Author
Owner

@link-king commented on GitHub (Jun 5, 2024):

image
image

@link-king commented on GitHub (Jun 5, 2024): ![image](https://github.com/langgenius/dify/assets/41622183/cd6b98c9-d89f-4f4a-86d6-21843eea82f9) ![image](https://github.com/langgenius/dify/assets/41622183/ef78f3fa-8eaa-4b8e-890f-a07827937f27)
Author
Owner

@crazywoola commented on GitHub (Jun 5, 2024):

Do you mean you are calling a workflow from both API and the web UI?
I see those pictures have the same conversation id. The inputs only works for the first api call or web ui call. The rest of the conversation will use previous one as the snapshot.

@crazywoola commented on GitHub (Jun 5, 2024): Do you mean you are calling a workflow from both API and the web UI? I see those pictures have the same conversation id. The inputs only works for the first api call or web ui call. The rest of the conversation will use previous one as the snapshot.
Author
Owner

@link-king commented on GitHub (Jun 5, 2024):

@crazywoola yes, I am testing the functionality of API calls and found that variables cannot be modified within the same session. Is this a bug?

@link-king commented on GitHub (Jun 5, 2024): @crazywoola yes, I am testing the functionality of API calls and found that variables cannot be modified within the same session. Is this a bug?
Author
Owner

@crazywoola commented on GitHub (Jun 5, 2024):

No, it's by design.

I see those pictures have the same conversation id. The inputs only works for the first api call or web ui call. The rest of the conversation will use previous one as the snapshot.

@crazywoola commented on GitHub (Jun 5, 2024): No, it's by design. > I see those pictures have the same conversation id. The inputs only works for the first api call or web ui call. The rest of the conversation will use previous one as the snapshot.
Author
Owner

@link-king commented on GitHub (Jun 5, 2024):

@crazywoola What is this for? I think it should be modifiable, otherwise it cannot support workflow using dynamic variables passed in through APIs

@link-king commented on GitHub (Jun 5, 2024): @crazywoola What is this for? I think it should be modifiable, otherwise it cannot support workflow using dynamic variables passed in through APIs
Author
Owner

@tmkddskf commented on GitHub (Jun 7, 2024):

Why design it this way

@tmkddskf commented on GitHub (Jun 7, 2024): Why design it this way
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#3989