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

Workflow HTTP request node keeps resetting to default on its own - restore fails as well #4011

Closed
4 tasks done
sigvardt opened this issue Apr 30, 2024 · 7 comments
Closed
4 tasks done
Labels
🐞 bug Something isn't working

Comments

@sigvardt
Copy link

sigvardt commented Apr 30, 2024

Self Checks

  • This is only for bug report, if you would like to ask a quesion, 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).
  • Pleas do not modify this template :) and fill in all the required fields.

Dify version

Version 0.6.5

Cloud or Self Hosted

Cloud

Steps to reproduce

See attached video.

  1. Define details of a HTTP request node
  2. Save and publish
  3. Reload the app
  4. HTTP request node has now reset
  5. Clicking the restore button shows old saved details of node, but clicking the restore button does not add it to the node again
  6. Manually adding the details to the http request node again does not work either
Screen.Recording.2024-04-30.at.10.24.09_comp.mov

✔️ Expected Behavior

Setting are retained and visible in panel

❌ Actual Behavior

Setting selv delete/hide on page reload

Copy link

dosubot bot commented Apr 30, 2024

To address the issue with the HTTP request node settings not being properly saved and persisted across sessions in Dify version 0.6.5, focus on enhancing the persistence and loading mechanisms. This involves ensuring that changes to the HTTP request node settings are correctly persisted to a backend service, local storage, or another persistence layer, and that these settings are accurately loaded when the app initializes or when the HTTP request node is loaded.

Here's a strategy to resolve the issue:

  1. Enhance Persistence Mechanism: Make sure the logic responsible for managing the state of the HTTP request node, possibly within a useConfig hook or similar, includes functionality to persist changes to settings.

  2. Improve Loading Mechanism: Modify the application's initialization or the HTTP request node's loading logic to correctly load persisted settings, ensuring they override the default settings.

  3. Ensure Proper State Management: Utilize controlled components for form inputs to manage the state of the HTTP request node settings effectively, reflecting changes in the UI.

  4. Debugging and Testing: Thoroughly test the application to ensure settings are correctly saved and restored. Pay attention to asynchronous operations and potential race conditions.

  5. User Feedback: Implement mechanisms to inform users about the status of their settings, such as successful saves or errors.

Here's a conceptual example for enhancing the persistence mechanism within a React component or hook:

function useConfig(nodeId, initialData) {
    const [data, setData] = useState(initialData);

    // Update settings and persist changes
    const updateSettings = async (newSettings) => {
        setData(newSettings); // Update local state
        await persistSettings(nodeId, newSettings); // Persist changes
    };

    // Load settings on hook initialization
    useEffect(() => {
        const loadSettings = async () => {
            const savedSettings = await fetchSettings(nodeId);
            if (savedSettings) {
                setData(savedSettings); // Override defaults with saved settings
            }
        };

        loadSettings();
    }, [nodeId]);

    return [data, updateSettings];
}

This example demonstrates integrating persistence logic into the state management of the HTTP request node. Adapt this to fit the actual architecture and data handling mechanisms used by Dify.

Details

Sources


About Dosu
This response is meant to be useful and save you time. It is not meant to be a precise solution, but rather a starting point for your own research.

Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is irrelevant.

To continue the conversation, mention @dosu.

@dosubot dosubot bot added the 🐞 bug Something isn't working label Apr 30, 2024
@Yash-1511
Copy link
Contributor

Same issue i am facing also!

@sigvardt
Copy link
Author

sigvardt commented May 1, 2024

Thanks for speaking up @Yash-1511! Hoping it will get some attention soon.

@nietao2
Copy link

nietao2 commented May 6, 2024

+1

@sigvardt
Copy link
Author

sigvardt commented May 6, 2024

FYI still confirmed to be an issue on 0.6.6 on managed solution.

@hjlarry
Copy link
Contributor

hjlarry commented May 8, 2024

I face the same issue too

It seems a frontend issue, when you add this http request pannel once, it auto saved works. But when you re-opened this pannel, the http method always init to POST, body always reset to None.

@hjlarry
Copy link
Contributor

hjlarry commented May 9, 2024

the new version 0.6.7 resolve this issue

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

4 participants