Skip to content

Commit 6033052

Browse files
committed
conversation data models
1 parent ed46e35 commit 6033052

File tree

5 files changed

+542
-0
lines changed

5 files changed

+542
-0
lines changed

Scripts/Services/Conversation.meta

Lines changed: 9 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 134 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,134 @@
1+
/**
2+
* Copyright 2015 IBM Corp. All Rights Reserved.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*
16+
*/
17+
using FullSerializer;
18+
using IBM.Watson.DeveloperCloud.Utilities;
19+
20+
namespace IBM.Watson.DeveloperCloud.Services.Conversation.v1
21+
{
22+
/// <summary>
23+
/// This class wraps the Watson Conversation service.
24+
/// <a href="http://www.ibm.com/smarterplanet/us/en/ibmwatson/developercloud/conversation.html">Conversation Service</a>
25+
/// </summary>
26+
public class Conversation : IWatsonService {
27+
#region Public Types
28+
#endregion
29+
30+
#region Public Properties
31+
#endregion
32+
33+
#region Private Data
34+
private const string SERVICE_ID = "ConversationV1";
35+
private static fsSerializer sm_Serializer = new fsSerializer();
36+
#endregion
37+
38+
#region IWatsonService implementation
39+
40+
/// <exclude />
41+
public string GetServiceID()
42+
{
43+
return SERVICE_ID;
44+
}
45+
46+
/// <exclude />
47+
public void GetServiceStatus(ServiceStatus callback)
48+
{
49+
/*if (Config.Instance.FindCredentials(SERVICE_ID) != null)
50+
new CheckServiceStatus(this, callback);
51+
else
52+
{
53+
if (callback != null && callback.Target != null)
54+
{
55+
callback(SERVICE_ID, false);
56+
}
57+
}*/
58+
}
59+
60+
/*private class CheckServiceStatus
61+
{
62+
private Conversation m_Service = null;
63+
private ServiceStatus m_Callback = null;
64+
private int m_DialogCount = 0;
65+
66+
public CheckServiceStatus(Conversation service, ServiceStatus callback)
67+
{
68+
m_Service = service;
69+
m_Callback = callback;
70+
71+
string customServiceID = Config.Instance.GetVariableValue(SERVICE_ID + "_ID");
72+
73+
//If custom classifierID is defined then we are using it to check the service health
74+
// if (!string.IsNullOrEmpty(customServiceID))
75+
// {
76+
//
77+
// if (!m_Service.Converse(customServiceID, "Hello", OnDialog))
78+
// OnFailure("Failed to invoke Converse().");
79+
// else
80+
// m_DialogCount += 1;
81+
// }
82+
// else
83+
// {
84+
// if (!m_Service.GetDialogs(OnGetDialogs))
85+
// OnFailure("Failed to invoke GetDialogs().");
86+
// }
87+
88+
89+
}
90+
91+
// private void OnGetDialogs(Dialogs dialogs)
92+
// {
93+
// if (m_Callback != null)
94+
// {
95+
// foreach (var dialog in dialogs.dialogs)
96+
// {
97+
// if (!m_Service.Converse(dialog.dialog_id, "Hello", OnDialog))
98+
// OnFailure("Failed to invoke Converse().");
99+
// else
100+
// m_DialogCount += 1;
101+
// }
102+
// }
103+
// else
104+
// OnFailure("GetDialogs() failed.");
105+
// }
106+
//
107+
// private void OnDialog(ConverseResponse resp)
108+
// {
109+
// if (m_DialogCount > 0)
110+
// {
111+
// m_DialogCount -= 1;
112+
// if (resp != null)
113+
// {
114+
// if (m_DialogCount == 0 && m_Callback != null && m_Callback.Target != null)
115+
// m_Callback(SERVICE_ID, true);
116+
// }
117+
// else
118+
// OnFailure("ConverseResponse is null.");
119+
// }
120+
// }
121+
//
122+
// private void OnFailure(string msg)
123+
// {
124+
// Log.Error("Dialog", msg);
125+
// m_Callback(SERVICE_ID, false);
126+
// m_DialogCount = 0;
127+
// }
128+
}
129+
*/
130+
#endregion
131+
132+
133+
}
134+
}

Scripts/Services/Conversation/Conversation.cs.meta

Lines changed: 12 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)