app.moderation.input 扩展点 ,当flagged为false时,返回数据格式问题 #3

Closed
opened 2026-02-16 11:19:29 -05:00 by yindo · 3 comments
Owner

Originally created by @anyfeng on GitHub (Apr 15, 2024).

Originally created by @anyfeng on GitHub (Apr 15, 2024).
yindo added the bug label 2026-02-16 11:19:29 -05:00
yindo closed this issue 2026-02-16 11:19:29 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (Apr 15, 2024):

When the flagged parameter is set to true in the app.moderation.input extension point, the format of the returned data depends on the specified action. For action set to direct_output, the format should be:

{
    "flagged": true,
    "action": "direct_output",
    "preset_response": "Your content violates our usage policy."
}

This indicates a direct response to the violation. If the action is overrided, the format changes to:

{
    "flagged": true,
    "action": "overrided",
    "inputs": {
        "var_1": "I will *** you.",
        "var_2": "I will *** you."
    },
    "query": "Happy everydays."
}

Here, inputs contain the variables to be overridden, and query is the new query. This setup allows for a customized response based on the moderation outcome.

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.

If you want to continue the conversation, start your reply with @dosu-bot.

@dosubot[bot] commented on GitHub (Apr 15, 2024): <!-- Answer --> When the `flagged` parameter is set to true in the `app.moderation.input` extension point, the format of the returned data depends on the specified `action`. For `action` set to `direct_output`, the format should be: ```json { "flagged": true, "action": "direct_output", "preset_response": "Your content violates our usage policy." } ``` This indicates a direct response to the violation. If the `action` is `overrided`, the format changes to: ```json { "flagged": true, "action": "overrided", "inputs": { "var_1": "I will *** you.", "var_2": "I will *** you." }, "query": "Happy everydays." } ``` Here, `inputs` contain the variables to be overridden, and `query` is the new query. This setup allows for a customized response based on the moderation outcome. ## Sources - [en/features/extension/api_based_extension/moderation-extension.md](https://github.com/langgenius/dify-docs/blob/main/en/features/extension/api_based_extension/moderation-extension.md) <!-- Dosu Comment Footer --> <details> <summary> #### About Dosu </summary> 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. If you want to continue the conversation, start your reply with @dosu-bot. </details>
Author
Owner

@anyfeng commented on GitHub (Apr 15, 2024):

When the flagged parameter is set to true in the app.moderation.input extension point, the format of the returned data depends on the specified action. For action set to direct_output, the format should be:

{
    "flagged": true,
    "action": "direct_output",
    "preset_response": "Your content violates our usage policy."
}

This indicates a direct response to the violation. If the action is overrided, the format changes to:

{
    "flagged": true,
    "action": "overrided",
    "inputs": {
        "var_1": "I will *** you.",
        "var_2": "I will *** you."
    },
    "query": "Happy everydays."
}

Here, inputs contain the variables to be overridden, and query is the new query. This setup allows for a customized response based on the moderation outcome.

Sources

About Dosu

sorry, i made a mistake;doc has that,but when flagged is false, the doc not displayed

@anyfeng commented on GitHub (Apr 15, 2024): > When the `flagged` parameter is set to true in the `app.moderation.input` extension point, the format of the returned data depends on the specified `action`. For `action` set to `direct_output`, the format should be: > > ```json > { > "flagged": true, > "action": "direct_output", > "preset_response": "Your content violates our usage policy." > } > ``` > > This indicates a direct response to the violation. If the `action` is `overrided`, the format changes to: > > ```json > { > "flagged": true, > "action": "overrided", > "inputs": { > "var_1": "I will *** you.", > "var_2": "I will *** you." > }, > "query": "Happy everydays." > } > ``` > > Here, `inputs` contain the variables to be overridden, and `query` is the new query. This setup allows for a customized response based on the moderation outcome. > > ## Sources > * [en/features/extension/api_based_extension/moderation-extension.md](https://github.com/langgenius/dify-docs/blob/main/en/features/extension/api_based_extension/moderation-extension.md) > > #### About Dosu sorry, i made a mistake;doc has that,but when flagged is false, the doc not displayed
Author
Owner

@anyfeng commented on GitHub (Apr 15, 2024):

this is my api result
image

@anyfeng commented on GitHub (Apr 15, 2024): this is my api result ![image](https://github.com/langgenius/dify-docs/assets/6287288/3510deb7-bb03-496c-8969-5801839080e6)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify-docs-archived#3