示例#1
0
        public void SaveReaction(LuisExample example, string action, long _exampleTextId)
        {
            string entity_values = "";

            foreach (var label in example.EntityLabels)
            {
                var value = example.Text.Substring(label.StartCharIndex, (label.EndCharIndex - label.StartCharIndex + 1)) + ",";
                entity_values += value;
            }
            entity_values = entity_values.Trim(',');

            var model = SynAppsIntentModel.New();

            model.SynAppsDeviceId = this.DeviceId;
            model.Name            = example.IntentName;
            model.Entity          = entity_values;
            model.ReactionBody    = "{\"Talk\": \"" + action + "\"}";
            model.IsSynAppsLinked = false;
            model.Save();

            if (_exampleTextId > 0)
            {
                var m = ConversationHistoryModel.FindById(_exampleTextId);
                m.ToMessage       = action;
                m.IsSynAppsLinked = false;
                m.Save();
            }
        }
示例#2
0
        public LuisService(string _deviceId, string _luisAppId, string _luisSubscriptionKey, string _luisProgrammaticAPIKey, string _luisVersionId, string _connectionString)
        {
            this.DeviceId            = _deviceId;
            this.luisAppId           = _luisAppId;
            this.luisSubscriptionKey = _luisSubscriptionKey;
            this.luisVersionId       = _luisVersionId;

            this.httpClient.DefaultRequestHeaders.Add("Ocp-Apim-Subscription-Key", _luisProgrammaticAPIKey);

            SynAppsIntentModel.Connection(_connectionString);
            ConversationHistoryModel.Connection(_connectionString);
            PredictionIntentModel.Connection(_connectionString);
            PredictionEntityModel.Connection(_connectionString);
            SynAppsSyncStatusModel.Connection(_connectionString);
        }
        public static List <SynAppsIntentModel> FindAllByDeviceId(string _deviceId)
        {
            List <SynAppsIntentModel> list = new List <SynAppsIntentModel>();

            var dc      = new SynAppsIntentDataContext(SqlConnectionString);
            var intents =
                from n in dc.SynAppsIntents
                where n.SynAppsDeviceId == _deviceId
                select n;

            foreach (var intent in intents)
            {
                var model = SynAppsIntentModel.New();
                model.SynAppsDeviceId = intent.SynAppsDeviceId;
                model.Name            = intent.Name;
                model.ReactionBody    = intent.ReactionBody;
                model.Entity          = intent.Entity ?? "";

                list.Add(model);
            }

            return(list);
        }
示例#4
0
 private bool IsRefresh()
 {
     return(SynAppsIntentModel.IsRefresh(this.SynappsDeviceId));
 }
示例#5
0
 private void RefreshSQLDatabase(List <SynAppsIntentModel> list)
 {
     SynAppsIntentModel.Refresh(this.SynappsDeviceId, list);
 }
示例#6
0
 private List <SynAppsIntentModel> CreateFromSQLDatabase()
 {
     return(SynAppsIntentModel.FindAllByDeviceId(this.SynappsDeviceId));
 }