Skip to content

Update Assistant V1 and V2 for missing fields #489

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

Merged
merged 4 commits into from
Jan 2, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions Scripts/Services/Assistant/v1/Models/CreateDialogNode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,12 @@ public enum EventNameEnum
[fsProperty("context")]
public object Context { get; set; }
/// <summary>
/// Whether to consider the dialog node during runtime evaluation. Set to `true` to ignore the
/// dialog node.
/// </summary>
[fsProperty("disabled")]
public bool Disabled { get; set; }
/// <summary>
/// The metadata for the dialog node.
/// </summary>
/// <value>The metadata for the dialog node.</value>
Expand Down
5 changes: 5 additions & 0 deletions Scripts/Services/Assistant/v2/Models/MessageOutput.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,11 @@ public class MessageOutput
/// </summary>
[fsProperty("debug")]
public MessageOutputDebug Debug { get; set; }
/// <summary>
/// Arbitrary variables that can be read and written to by a particular skill within the Assistant.
/// </summary>
[fsProperty("user_defined")]
public dynamic UserDefined { get; set; }
}

}
800 changes: 0 additions & 800 deletions Scripts/UnitTests/TestAssistantCF.cs

This file was deleted.

11 changes: 0 additions & 11 deletions Scripts/UnitTests/TestAssistantRC.cs.meta

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@
* limitations under the License.
*
*/
// Uncomment to test RC
//#define TEST_RC

using System.Collections;
using System.Collections.Generic;
Expand All @@ -29,11 +27,8 @@

namespace Assets.Watson.Scripts.UnitTests
{
#if TEST_RC
class TestAssistantRC : UnitTest
class TestAssistantV1 : UnitTest
{
private string _username = null;
private string _password = null;
private string _workspaceId = null;
private string _createdWorkspaceId;

Expand All @@ -43,9 +38,9 @@ class TestAssistantRC : UnitTest
private fsSerializer _serializer = new fsSerializer();

private string _inputString = "Hello";
private string _conversationString0 = "unlock the door";
private string _conversationString1 = "turn on the ac";
private string _conversationString2 = "turn down the radio";
private string _conversationString0 = "Are you open on christmas?";
private string _conversationString1 = "Can you connect me to a real person?";
private string _conversationString2 = "goodbye";
private static string _lastIntent = null;

private static string _createdWorkspaceName = "unity-sdk-example-workspace-delete";
Expand Down Expand Up @@ -141,12 +136,11 @@ public override IEnumerator RunTest()
throw new WatsonException(r.FormattedMessages);

// Set credentials from imported credntials
Credential credential = vcapCredentials.GetCredentialByname("assistant-sdk-iam")[0].Credentials;
Credential credential = vcapCredentials.GetCredentialByname("assistant-sdk")[0].Credentials;
// Create credential and instantiate service
TokenOptions tokenOptions = new TokenOptions()
{
IamApiKey = credential.IamApikey,
IamUrl = "https://iam.stage1.bluemix.net/identity/token"
};

Credentials credentials = new Credentials(tokenOptions, credential.Url);
Expand Down Expand Up @@ -794,5 +788,4 @@ private void OnFail(RESTConnector.Error error, Dictionary<string, object> custom
Log.Error("TestAssistant.OnFail()", "Error received: {0}", error.ToString());
}
}
#endif
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 10 additions & 6 deletions Scripts/UnitTests/TestAssistantV2.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@ namespace Assets.Watson.Scripts.UnitTests
{
public class TestAssistantV2 : UnitTest
{
private string _username;
private string _password;
private fsSerializer _serializer = new fsSerializer();

private Assistant _service;
Expand Down Expand Up @@ -81,13 +79,19 @@ public override IEnumerator RunTest()

// Set credentials from imported credntials
Credential credential = vcapCredentials.GetCredentialByname("assistant-sdk")[0].Credentials;
_username = credential.Username.ToString();
_password = credential.Password.ToString();
_url = credential.Url.ToString();
// Create credential and instantiate service
TokenOptions tokenOptions = new TokenOptions()
{
IamApiKey = credential.IamApikey,
};
_assistantId = credential.AssistantId.ToString();

// Create credential and instantiate service
Credentials credentials = new Credentials(_username, _password, _url);
Credentials credentials = new Credentials(tokenOptions, _url);

// Wait for tokendata
while (!credentials.HasIamTokenData())
yield return null;

_service = new Assistant(credentials);
_service.VersionDate = _assistantVersionDate;
Expand Down
208 changes: 0 additions & 208 deletions Scripts/UnitTests/TestConversation.cs

This file was deleted.

12 changes: 0 additions & 12 deletions Scripts/UnitTests/TestConversation.cs.meta

This file was deleted.

16 changes: 10 additions & 6 deletions Scripts/UnitTests/TestDiscovery.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@ namespace IBM.Watson.DeveloperCloud.UnitTests
{
public class TestDiscovery : UnitTest
{
private string _username = null;
private string _password = null;
private fsSerializer _serializer = new fsSerializer();

private Discovery _discovery;
Expand Down Expand Up @@ -128,12 +126,18 @@ public override IEnumerator RunTest()

// Set credentials from imported credntials
Credential credential = vcapCredentials.GetCredentialByname("discovery-sdk")[0].Credentials;
_username = credential.Username.ToString();
_password = credential.Password.ToString();
_url = credential.Url.ToString();
// Create credential and instantiate service
TokenOptions tokenOptions = new TokenOptions()
{
IamApiKey = credential.IamApikey,
};

// Create credential and instantiate service
Credentials credentials = new Credentials(_username, _password, _url);
Credentials credentials = new Credentials(tokenOptions, credential.Url);

// Wait for tokendata
while (!credentials.HasIamTokenData())
yield return null;

_discovery = new Discovery(credentials);
_discovery.VersionDate = _discoveryVersionDate;
Expand Down
Loading