public override void Process(SyncQueue queue) { if (entity == null) { // Entity was deleted. succeeded = false; isDone = true; return; } succeeded = true; if (string.IsNullOrEmpty(entity.EntityName)) { Debug.LogError("Entity name required"); succeeded = false; } foreach (LexiconEntityValue entityValue in entity.Values) { if (entityValue == null) { Debug.LogError("Entity has a null value"); succeeded = false; } else if (string.IsNullOrEmpty(entityValue.ValueName)) { Debug.LogError("Entity has an empty value name"); succeeded = false; } } isDone = true; }
public void SaveEntity(LexiconEntity entity) { //Debug.Log("SaveEntity"); if (assemblyReload) { //Debug.Log("Trying to save entity on assembly reload, this is not safe!"); entityToSave = entity; } else { SyncQueue assetsQueue = ScriptableObject.CreateInstance <SyncQueue>(); assetsQueue.Enqueue(ValidateEntity.CreateInstance(entity)); List <LexiconIntent> intents = GetAllIntents(); foreach (LexiconIntent intent in intents) { if (intent.UsesEntity(entity)) { //Debug.Log(" Generate strings for " + intent.intentName); assetsQueue.Enqueue(GenerateIntentStrings.CreateInstance(intent)); } } assetsQueue.Process(); generateAssetsQueues.Add(assetsQueue); } }
public void CleanUp() { //Debug.Log("CleanUp"); for (int i = generateAssetsQueues.Count - 1; i >= 0; i--) { SyncQueue queue = generateAssetsQueues[i]; if (queue.IsFinished) { generateAssetsQueues.RemoveAt(i); DestroyImmediate(queue); } } for (int i = watsonSpeechToTextSyncQueues.Count - 1; i >= 0; i--) { SyncQueue queue = watsonSpeechToTextSyncQueues[i]; if (queue.IsFinished) { watsonSpeechToTextSyncQueues.RemoveAt(i); DestroyImmediate(queue); } } for (int i = watsonConversationSyncQueues.Count - 1; i >= 0; i--) { SyncQueue queue = watsonConversationSyncQueues[i]; if (queue.IsFinished) { watsonConversationSyncQueues.RemoveAt(i); DestroyImmediate(queue); } } }
public override void Process(SyncQueue queue) { Debug.Log("Watson Train Conversation Complete: " + (succeeded ? "Succeeded" : "Failed")); workspace.WatsonConversationManager.IsTraining = false; EditorUtility.SetDirty(workspace); AssetDatabase.SaveAssets(); }
public override void Process(SyncQueue queue) { if (CreateSpeechToText()) { speechToText.TrainCustomization(HandleSuccessCallback, HandleFailCallback, workspace.WatsonSpeechToTextManager.CustomizationId); } }
public override void Process(SyncQueue queue) { if (intent == null) { // Intent was deleted. succeeded = false; isDone = true; return; } succeeded = true; if (string.IsNullOrEmpty(intent.IntentName)) { Debug.LogError("Intent name required"); succeeded = false; } if (string.IsNullOrEmpty(intent.ActionName)) { Debug.LogError("Action name required"); succeeded = false; } foreach (LexiconEntity entity in intent.RequiredEntities) { if (entity == null) { Debug.LogError("Intent has a null entry in the Required Entities list"); succeeded = false; } else if (string.IsNullOrEmpty(entity.EntityName)) { Debug.LogError("Intent has a Required Entity with an empty name: " + entity.name); succeeded = false; } } foreach (LexiconEntity entity in intent.OptionalEntities) { if (entity == null) { Debug.LogError("Intent has a null entry in the Optional Entities list"); succeeded = false; } else if (string.IsNullOrEmpty(entity.EntityName)) { Debug.LogError("Intent has an Optional Entity with an empty name: " + entity.name); succeeded = false; } } isDone = true; }
public override void Process(SyncQueue queue) { if (CreateConversation()) { UnityEngine.Debug.Log("Deleting Intent: " + intentName); conversation.DeleteIntent(HandleSuccessCallback, HandleFailCallback, workspace.WatsonConversationManager.WorkspaceId, intentName); } }
public override void Process(SyncQueue queue) { this.queue = queue; if (CreateConversation()) { conversation.GetWorkspace(HandleSuccessCallback, HandleFailCallback, workspace.WatsonConversationManager.WorkspaceId, false); } }
public override void Process(SyncQueue queue) { if (CreateConversation()) { this.queue = (WatsonSyncQueue)queue; conversation.ListIntents(HandleSuccessCallback, HandleFailCallback, workspace.WatsonConversationManager.WorkspaceId, false); } }
public void SaveIntent(LexiconIntent intent) { //Debug.Log("SaveIntent"); SyncQueue assetsQueue = ScriptableObject.CreateInstance <SyncQueue>(); assetsQueue.Enqueue(ValidateIntent.CreateInstance(intent)); assetsQueue.Enqueue(GenerateIntentStrings.CreateInstance(intent)); assetsQueue.Process(); generateAssetsQueues.Add(assetsQueue); }
public override void Process(SyncQueue queue) { if (intent == null) { // Intent asset was deleted succeeded = false; isDone = true; return; } string normalizedName = StringUtility.ToCamelCase(intent.ActionName); string path = AssetDatabase.GetAssetPath(intent); string directory = Path.GetDirectoryName(path); string filename = normalizedName + "Action"; string prefabPath = directory + "/" + filename + ".prefab"; string typeName = intent.NamespaceString + "." + filename; Type actionType = Type.GetType(typeName + ",Assembly-CSharp"); GameObject prefab = AssetDatabase.LoadAssetAtPath <GameObject>(prefabPath); if (prefab == null) { Debug.Log("Could not find prefab: " + prefabPath); succeeded = false; isDone = true; } else if (actionType == null) { Debug.Log("Could not find type: " + typeName); succeeded = false; isDone = true; } else { LexiconAction newAction = (LexiconAction)prefab.AddComponent(actionType); LexiconPlaceholderAction tempAction = prefab.GetComponent <LexiconPlaceholderAction>(); if (intent.DefaultAction == tempAction) { Debug.Log("Replacing temp action"); intent.DefaultAction = newAction; GameObject.DestroyImmediate(tempAction, true); } // TODO: Set dirty? succeeded = true; isDone = true; } }
public override void Process(SyncQueue queue) { if (CreateConversation()) { // TODO: Would be better to update phrases individually instead of replacing all conversation.UpdateIntent(HandleSuccessCallback, HandleFailCallback, workspace.WatsonConversationManager.WorkspaceId, localIntent.name, null, localIntent.phrases.ToArray()); } }
public override void Process(SyncQueue queue) { if (CreateConversation()) { // TODO: Can't create intent with spaces in name conversation.CreateIntent(HandleSuccessCallback, HandleFailCallback, workspace.WatsonConversationManager.WorkspaceId, localIntent.name, null, localIntent.phrases.ToArray()); } }
public override void Process(SyncQueue queue) { if (CreateSpeechToText()) { string corpusName = workspace.CanonicalName + "_Intents"; string corpusData = CreateCorpusData(((WatsonSyncQueue)queue).syncData); speechToText.AddCustomCorpus(HandleSuccessCallback, HandleFailCallback, workspace.WatsonSpeechToTextManager.CustomizationId, corpusName, true, corpusData); } }
public void CreateDefaultAction(LexiconIntent intent) { //Debug.Log("CreateAction"); SyncQueue assetsQueue = ScriptableObject.CreateInstance <SyncQueue>(); assetsQueue.Enqueue(GenerateActionPrefab.CreateInstance(intent)); assetsQueue.Enqueue(GenerateIntentStrings.CreateInstance(intent)); assetsQueue.Enqueue(GenerateActionScript.CreateInstance(intent)); assetsQueue.Enqueue(ReloadSyncAction.CreateInstance()); assetsQueue.Enqueue(UpdateActionPrefab.CreateInstance(intent)); assetsQueue.Process(); generateAssetsQueues.Add(assetsQueue); }
public override void Process(SyncQueue queue) { if (!string.IsNullOrEmpty(workspace.WatsonSpeechToTextManager.CustomizationId)) { Debug.LogError("Watson custom model already exists"); succeeded = false; isDone = true; return; } if (CreateSpeechToText()) { speechToText.CreateCustomization(HandleSuccessCallback, HandleFailCallback, workspace.WorkspaceName, workspace.WatsonSpeechToTextManager.Model); } }
public override void Process(SyncQueue queue) { if (!string.IsNullOrEmpty(workspace.WatsonConversationManager.WorkspaceId)) { Debug.LogError("Watson workspace already exists"); succeeded = false; isDone = true; return; } if (CreateConversation()) { conversation.CreateWorkspace(HandleSuccessCallback, HandleFailCallback, workspace.WorkspaceName, workspace.WatsonConversationManager.Language, workspace.WorkspaceDescription); } }
public override void Process(SyncQueue queue) { Words customWords = GetCustomWords(((WatsonSyncQueue)queue).syncData); if (customWords.words.Length == 0) { succeeded = true; isDone = true; return; } if (CreateSpeechToText()) { speechToText.AddCustomWords(HandleSuccessCallback, HandleFailCallback, workspace.WatsonSpeechToTextManager.CustomizationId, customWords); } }
public override void Process(SyncQueue queue) { string normalizedName = StringUtility.ToCamelCase(intent.ActionName); string path = AssetDatabase.GetAssetPath(intent); string directory = Path.GetDirectoryName(path); string filename = normalizedName + "Action"; string enumScript = ActionScript(normalizedName); CreateScript(directory, filename, enumScript); //AssetDatabase.Refresh(); //AssetDatabase.ImportAsset(directory + "/" + filename + ".cs"); //AssetDatabase.SaveAssets(); succeeded = true; isDone = true; }
public override void Process(SyncQueue queue) { Debug.Log("ReloadSyncAction process"); if (!triggeredReload) { Debug.Log("Triggering reload"); reloaded = false; triggeredReload = true; AssetDatabase.Refresh(); //EditorUtility.SetDirty(queue); //AssetDatabase.SaveAssets(); } succeeded = reloaded; isDone = true; retry = true; retryDelay = 5.0f; }
public override void Process(SyncQueue queue) { Debug.Log("Watson Sync Speech to Text Completed: " + (succeeded ? "Succeeded" : "Failed")); if (succeeded) { workspace.WatsonSpeechToTextManager.LastSyncTime = DateTime.Now.ToString("g"); workspace.WatsonSpeechToTextManager.IsSyncing = false; EditorUtility.SetDirty(workspace); AssetDatabase.SaveAssets(); EditorManager.Instance.MonitorWatsonSpeechToTextTraining(workspace); } else { workspace.WatsonSpeechToTextManager.SyncStatus = "Sync Failed"; workspace.WatsonSpeechToTextManager.IsSyncing = false; EditorUtility.SetDirty(workspace); AssetDatabase.SaveAssets(); } }
public override void Process(SyncQueue queue) { if (intent == null) { // Intent was deleted. succeeded = false; isDone = true; return; } string path = AssetDatabase.GetAssetPath(intent); string directory = Path.GetDirectoryName(path); string filename = StringUtility.ToCamelCase(intent.ActionName) + "Strings"; string stringsScript = StringsScript(); CreateScript(directory, filename, stringsScript); AssetDatabase.Refresh(); succeeded = true; isDone = true; }
public override void Process(SyncQueue queue) { if (CreateConversation()) { List <CreateValue> createValues = new List <CreateValue>(); foreach (EntityValueData valueData in localEntity.values) { CreateValue createValue = new CreateValue(); createValue.value = valueData.name; createValue.synonyms = valueData.synonyms.ToArray(); createValues.Add(createValue); } conversation.CreateEntity(HandleSuccessCallback, HandleFailCallback, workspace.WatsonConversationManager.WorkspaceId, localEntity.name, null, createValues.ToArray()); } }
public override void Process(SyncQueue queue) { string normalizedName = StringUtility.ToCamelCase(intent.ActionName); string path = AssetDatabase.GetAssetPath(intent); string directory = Path.GetDirectoryName(path); string filename = normalizedName + "Action"; string prefabPath = directory + "/" + filename + ".prefab"; GameObject prefabTemplate = new GameObject(filename); prefabTemplate.AddComponent <LexiconPlaceholderAction>(); GameObject prefab = PrefabUtility.CreatePrefab(prefabPath, prefabTemplate); intent.DefaultAction = prefab.GetComponent <LexiconAction>(); GameObject.DestroyImmediate(prefabTemplate); succeeded = true; isDone = true; }
public override void Process(SyncQueue queue) { if (CreateConversation()) { // TODO: Would be better to update values individually instead of replacing all List <CreateValue> createValues = new List <CreateValue>(); foreach (EntityValueData valueData in localEntity.values) { CreateValue createValue = new CreateValue(); createValue.value = valueData.name; createValue.synonyms = valueData.synonyms.ToArray(); createValues.Add(createValue); } conversation.UpdateEntity(HandleSuccessCallback, HandleFailCallback, workspace.WatsonConversationManager.WorkspaceId, localEntity.name, null, createValues.ToArray()); } }
public override void Process(SyncQueue queue) { startTime = EditorApplication.timeSinceStartup; EditorApplication.update += Tick; }
public override void Process(SyncQueue queue) { }
public virtual void Process(SyncQueue queue) { Debug.LogWarning("SyncAction base class Process called"); }