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

sys.query Cannot Be Modified via action=overridden in Dify 1.0.0 Beta API Extension #14187

Open
5 tasks done
hzcoolwind opened this issue Feb 22, 2025 · 6 comments
Open
5 tasks done
Labels
🐞 bug Something isn't working

Comments

@hzcoolwind
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

1.0.0-beta1

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

  1. Configure API Extension:
    Set up a moderation API endpoint that returns JSON responses.
  2. Create a chatbot and enable moderation for in mode. then run app.
  3. API Returns action=overridden:
    return {
    "flagged": true,
    "action": "overridden",
    "inputs": {
    "var_1": "",
    "var_2": "
    "
    },
    "query": "Sanitized query" // Expected to update sys.query
    }
  4. Observe Behavior:
    sys.query remains the original value . Provided query ("Sanitized query") is ignored.

✔️ Expected Behavior

No response

❌ Actual Behavior

No response

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

dosubot bot commented Feb 22, 2025

Hey @hzcoolwind! 👋 I'm here to help you with any bugs, questions, or contributions you have for Dify 1.0.0 Beta API Extension. I'm looking forward to assisting you!

The issue you're experiencing with sys.query not being modified when the API returns action=overridden in Dify 1.0.0 Beta seems to contradict the expected behavior. According to the documentation, when the API returns action=overridden, the input variable values and the current dialogue input content from the end-user should be overridden with the values provided in the response [1].

If sys.query is not being updated as expected, it might be due to a bug or a configuration issue. Here are a few steps you can take to troubleshoot:

  1. Verify Configuration: Ensure that the moderation API endpoint is correctly configured and that the response format matches the expected structure.

  2. Check Logs: Look at the application logs to see if there are any errors or warnings that might indicate why the sys.query is not being updated.

  3. Review Code: If you have access to the code, review the part responsible for handling the moderation API response to ensure it processes the action=overridden correctly.

  4. Test with Different Inputs: Try using different inputs to see if the issue persists across various scenarios.

If the problem continues, it might be worth checking for any updates or patches that address this issue in newer versions of Dify.

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

@hzcoolwind
Copy link
Author

And another question is:
API-Based Extension supported module extensions include: external_data_tool.
I write a external_data_tool service. and I launch the API service. Configure this API in Dify.
then I want to Select this API extension in the App. but i can't find where should select this api extension , can not find in tools, can not find api extension.
Could you tell me how I can invoke this 'external_data_tool' API extension in the APP, it's impormant to me, thanks.

Copy link

dosubot bot commented Feb 22, 2025

To invoke the 'external_data_tool' API extension in the Dify app after configuring it, follow these steps:

  1. Configure the API in Dify: Ensure that you have added the API extension in Dify by providing the API endpoint and the API Key through the Dify interface.

  2. Select the API Extension in the App: After configuring the API, you should be able to select this API extension within your Dify app. Look for a section labeled "选择扩展" (Select Extension) in the app interface, which is indicated by a screenshot in the documentation.

  3. Verify API Functionality: Ensure that your API is set up to handle requests from Dify correctly. The API should respond to a "ping" request with a "pong" response to verify its functionality.

  4. API Specification: Make sure your API follows the required specifications. Dify will call your API using a POST request to your specified endpoint. The request will include headers such as Content-Type: application/json and Authorization: Bearer {api_key}. The request body will contain a "point" and "params" as specified in the documentation.

  5. Example Implementation: You can refer to the provided example using Python FastAPI to implement your API. This includes handling different points like "ping" and "app.external_data_tool.query" [1][2][3][4].

If you have configured the API correctly and still cannot find where to select it, ensure that you have followed all configuration steps and check for any additional documentation or support from Dify regarding the app interface.

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

@hzcoolwind
Copy link
Author

@dosu I done all these 5 steps and i sure it's all ok , but only I can not find where to select it in my app (chatbot/chatflow/workflow).

Copy link

dosubot bot commented Feb 22, 2025

To select the 'external_data_tool' API extension in your Dify app after completing all configuration steps, follow these instructions:

  1. Go to the prompt composition page in your Dify app.
  2. Click the "+添加" (Add) button on the right side of "工具" (Tools).
  3. In the "添加工具" (Add Tool) dialog that opens, enter the name and variable name (ensure the variable name is in English as it will be referenced in the prompt).
  4. Select the API-based extension you added during the configuration process.

Ensure that your API is correctly set up according to Dify's API specifications. This includes setting up the API endpoint to handle requests with the appropriate headers and request body format. Dify will send a request to verify the API's availability, expecting a response of result=pong when the point=ping is sent. Make sure your API is ready to handle these requests and return the expected responses [1][2][3][4].

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

@hzcoolwind
Copy link
Author

@ dosu I go to the prompt compositon page in my app, i can only find '接点‘、‘工具’ but not find the Add button.
just like this :

Image

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