Exemplo n.º 1
0
        static MasterResult GetSubResult(String prefix, Request prevRequest, User user, AltBot mybot, Request subRequest, bool showDebug, out Unifiable subResultOutput, out string subQueryRawOutput1, OutputDelegate writeToLog)
        {
            var          prev      = subRequest.GraphsAcceptingUserInput;
            var          prevSO    = user.SuspendAddResultToUser;
            MasterResult subResult = subRequest.CreateResult(subRequest);

            try
            {
                Dictionary <Unifiable, Unifiable> sraiMark = null;
                var originalSalientRequest = Request.GetOriginalSalientRequest(prevRequest);
                if (ChatOptions.UseSraiLimitersBasedOnTextContent)
                {
                    sraiMark = originalSalientRequest.CreateSRAIMark();
                }
                subRequest.GraphsAcceptingUserInput = true;
                //var newresult = new AIMLbot.Result(request.user, Proc, request);
                //subRequest.result = newresult;
                user.SuspendAddResultToUser = true;
                if (prevRequest.IsTraced)
                {
                    subRequest.IsTraced = !showDebug;
                }
                subRequest.IsTraced = true;
                subResult           = (MasterResult)mybot.ChatWithToplevelResults(subRequest, subResult, false,
                                                                                  RequestKind.TagHandler | RequestKind.SraiTag);
                subResultOutput = subResult.RawOutput;
                int resultCount = subResult.OutputSentences.Count;
                if (AltBot.BE_COMPLETE_NOT_FAST && resultCount == 0)
                {
                    subRequest.ResetValues(false);
                    if (ChatOptions.UseSraiLimitersBasedOnTextContent)
                    {
                        originalSalientRequest.ResetSRAIResults(sraiMark);
                    }
                    if (Unifiable.IsNullOrEmpty(subResultOutput))
                    {
                        subResult       = (MasterResult)mybot.ChatFor1Result(subRequest, subResult, RequestKind.TagHandler | RequestKind.SraiTag);
                        subResultOutput = subResult.Output;
                        if (!IsNullOrEmpty(subResultOutput))
                        {
                            writeToLog(prefix + "RESCUED RETURN " + subResultOutput);
                            //  subQueryRawOutput = "" + subResultOutput;
                        }
                    }
                }
            }
            finally
            {
                user.SuspendAddResultToUser         = prevSO;
                subRequest.GraphsAcceptingUserInput = prev;
            }
            subQueryRawOutput1 = subResultOutput;//.Trim();
            return(subResult);
        }
Exemplo n.º 2
0
        private static void ShowChatTrace(string subRequestrawInput, AltBot mybot, int depth, MasterResult subResult, XmlNode templateNode)
        {
            mybot.writeChatTrace("\"L{0}\" -> \"S{1}\" ;\n", depth, depth);
            mybot.writeChatTrace("\"S{0}\" -> \"SIN:{1}\" ;\n", depth, subRequestrawInput);
            //mybot.writeChatTrace("\"SIN:{0}\" -> \"LN:{1}\" ;\n", subRequestrawInput, CatTextInfo());
            mybot.writeChatTrace("\"SIN:{0}\" -> \"PATH:{1}\" [label=\"{2}\"] ;\n",
                                 subRequestrawInput, depth, subResult.GraphMasterPaths);
            mybot.writeChatTrace("\"PATH:{0}\" -> \"LN:{1}\" [label=\"{2}\"] ;\n", depth, depth,
                                 TextAndSourceInfo(templateNode));

            mybot.writeChatTrace("\"LN:{0}\" -> \"RPY:MISSING({1})\" ;\n", depth, depth);
        }