Exemple #1
0
        /// <summary>
        /// Restore a agent instance from backup json files
        /// </summary>
        /// <param name="importor"></param>
        /// <param name="agentId"></param>
        /// <returns></returns>
        public Agent RestoreAgent(IAgentImporter importer, String agentId)
        {
            string dataDir = $"{Database.ContentRootPath}\\App_Data\\DbInitializer\\Agents\\";

            // Load agent summary
            agent = importer.LoadAgent(agentId, dataDir);

            // Load agent entities
            importer.LoadEntities(agent, dataDir);

            // Load agent intents
            importer.LoadIntents(agent, dataDir);

            return(agent);
        }
Exemple #2
0
        public Agent LoadAgentFromFile(string dataDir)
        {
            var            meta     = LoadMeta(dataDir);
            IAgentImporter importer = null;

            switch (meta.Platform)
            {
            case PlatformType.Dialogflow:
                importer = new AgentImporterInDialogflow();
                break;

            case PlatformType.Rasa:
                importer = new AgentImporterInRasa();
                break;

            case PlatformType.Sebis:
                importer = new AgentImporterInSebis();
                break;

            case PlatformType.QuickQA:
                importer = new AgentImporterInQuickQA();
                break;

            default:
                break;
            }

            importer.AgentDir = dataDir;

            // Load agent summary
            agent = importer.LoadAgent(meta);

            // Load user custom entities
            importer.LoadCustomEntities(agent);

            // Load agent intents
            importer.LoadIntents(agent);

            // Load system buildin entities
            importer.LoadBuildinEntities(agent);

            // Generate corpus
            importer.AssembleTrainData(agent);

            return(agent);
        }