Skip to content
This repository has been archived by the owner on Jun 30, 2022. It is now read-only.

Fix ContentModerator Middleware #2277

Merged
merged 1 commit into from
Sep 6, 2019

Conversation

mdrichardson
Copy link
Contributor

Fixes: https://stackoverflow.com/questions/57774564/content-moderator-in-virtual-assistant-template

Purpose

There's no example for how to use ContentModerator and it's a bit difficult to get working right. See above linked issue/answer for more detail.

Note: I'm not terribly familiar with the PR process for VA. Happy to update as necessary.

Changes

  1. Removes the Microsoft.Azure.CognitiveServices.ContentModerator NuGet package from the relevant projects. It's been added to Microsoft.Bot.Builder.Solutions and having it in the VA project causes a "Could Not Load Type..." error.
    In /Adapters/DefaultAdapter.cs and DefaultWebsocketAdapter.cs, it adds (near the rest of the middleware pipeline):
// Uncomment and fill in the following line to use ContentModerator
// Use(new ContentModeratorMiddleware(settings.ContentModerator.Key, "<yourCMRegion>"));

Tests

Tested in a bot, but had some difficulty running the VA tests.

Feature Plan

No

Checklist

General

  • I have commented my code, particularly in hard-to-understand areas
  • [N/A] I have added or updated the appropriate tests
  • [N/A] I have updated related documentation

Bots

  • [N/A] I have validated that new and updated responses use appropriate Speak and InputHint properties to ensure a high-quality speech-first experience
  • [N/A] I have replicated language model changes across the English, French, Italian, German, Spanish, and Chinese .lu files and validated that deployment is successful

Deployment Scripts

  • I have replicated my changes in the Virtual Assistant Template and Sample projects
  • [N/A?] I have replicated my changes in the Skill Template and Sample projects

@ryanisgrig
Copy link
Collaborator

Thanks @mdrichardson, closing #2318 with this

@ryanisgrig ryanisgrig closed this Sep 6, 2019
@ryanisgrig ryanisgrig reopened this Sep 6, 2019
@ryanisgrig ryanisgrig merged commit ab9f0ca into microsoft:master Sep 6, 2019
@mdrichardson mdrichardson deleted the contentModeratorFix branch September 6, 2019 21:22
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants