コード例 #1
0
ファイル: SolutionLog.cs プロジェクト: m9ra/KnowledgeDialog
        internal void Input(string utterance, int taskId)
        {
            var isReset = utterance != null && utterance.Trim().ToLowerInvariant() == "reset";

            logUtterance(utterance);
            if (isReset)
            {
                _console = createConsole(taskId);
            }
            else
            {
                _console.Input(utterance);
                logResponse(_console.LastResponse);

                if (HasTask)
                {
                    _task.Register(utterance, _console.LastResponse);

                    var informativeTask = _task as InformativeTaskInstance;
                    if (informativeTask != null)
                    {
                        informativeTask.Register(_console.Manager as IInformativeFeedbackProvider);
                    }
                }

                if (HasTask && _task.IsComplete)
                {
                    //task has been completed
                    if (!_completitionReported)
                    {
                        reportCompletition();
                    }
                }
            }
        }
コード例 #2
0
ファイル: SolutionLog.cs プロジェクト: m9ra/KnowledgeDialog
        internal SolutionLog(UserData userData, ExperimentBase experiment, int taskId)
        {
            _experiment = experiment;
            _taskId     = taskId;
            _task       = experiment.GetTask(taskId);

            var isInitialized = false;
            var logPath       = experiment.GetLogPath(userData.UserID, taskId);

            _logStorage       = new CallStorage(logPath);
            _infoCall         = _logStorage.RegisterCall("Info", c => { isInitialized = true; });
            _completitionCall = _logStorage.RegisterCall("ReportTaskCompletition", c => { });

            _logStorage.ReadStorage();
            if (!isInitialized)
            {
                logInfo("solution initialized");
            }

            reportTaskStart(_task);

            //console has to be created after log storage is prepared
            _console = createConsole(taskId);
        }