Add missing parameter prompt
This commit is contained in:
parent
6d9cf5ddbb
commit
4c91f6475f
|
|
@ -9,8 +9,11 @@ namespace BotSharp.Core.Adapters.Dialogflow
|
|||
public string Id { get; set; }
|
||||
public bool Required { get; set; }
|
||||
public string DataType { get; set; }
|
||||
public string DefaultValue { get; set; }
|
||||
public string Name { get; set; }
|
||||
public string Value { get; set; }
|
||||
public bool IsList { get; set; }
|
||||
|
||||
public List<DialogflowIntentResponseParameterPrompt> PromptList { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,13 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace BotSharp.Core.Adapters.Dialogflow
|
||||
{
|
||||
public class DialogflowIntentResponseParameterPrompt
|
||||
{
|
||||
public string Lang { get; set; }
|
||||
|
||||
public string Value { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
@ -1,7 +1,6 @@
|
|||
using BotSharp.Core.Adapters.Rasa;
|
||||
using BotSharp.Core.Engines;
|
||||
using BotSharp.Core.Entities;
|
||||
using BotSharp.Core.Expressions;
|
||||
using BotSharp.Core.Intents;
|
||||
using BotSharp.Core.Models;
|
||||
using EntityFrameworkCore.BootKit;
|
||||
|
|
|
|||
|
|
@ -79,6 +79,7 @@ namespace BotSharp.Core.Engines
|
|||
// avoid confict data structure
|
||||
intentJson = intentJson.Replace("\"contexts\":", "\"contextList\":");
|
||||
intentJson = intentJson.Replace("\"messages\":", "\"messageList\":");
|
||||
intentJson = intentJson.Replace("\"prompts\":", "\"promptList\":");
|
||||
|
||||
var intent = JsonConvert.DeserializeObject<DialogflowIntent>(intentJson);
|
||||
|
||||
|
|
@ -124,6 +125,13 @@ namespace BotSharp.Core.Engines
|
|||
}
|
||||
|
||||
}).ToList();
|
||||
|
||||
newResponse.Parameters = res.Parameters.Select(p =>
|
||||
{
|
||||
var rp = p.ToObject<IntentResponseParameter>();
|
||||
rp.Prompts = p.PromptList.Select(pl => new ResponseParameterPrompt { Prompt = pl.Value }).ToList();
|
||||
return rp;
|
||||
}).ToList();
|
||||
});
|
||||
|
||||
newIntent.Contexts = intent.ContextList.Select(x => new IntentInputContext { Name = x }).ToList();
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ namespace BotSharp.Core.Intents
|
|||
var intent = dc.Table<Intent>()
|
||||
.Include(x => x.Contexts)
|
||||
.Include(x => x.Responses).ThenInclude(x => x.Contexts)
|
||||
.Include(x => x.Responses).ThenInclude(x => x.Parameters)
|
||||
.Include(x => x.Responses).ThenInclude(x => x.Parameters).ThenInclude(x => x.Prompts)
|
||||
.Include(x => x.Responses).ThenInclude(x => x.Messages)
|
||||
.Include(x => x.UserSays).ThenInclude(x => x.Data)
|
||||
.FirstOrDefault(x => x.Id == intentId);
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
using BotSharp.Core.Expressions;
|
||||
using EntityFrameworkCore.BootKit;
|
||||
using EntityFrameworkCore.BootKit;
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ using System.ComponentModel.DataAnnotations;
|
|||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.Text;
|
||||
|
||||
namespace BotSharp.Core.Expressions
|
||||
namespace BotSharp.Core.Intents
|
||||
{
|
||||
[Table("Bot_IntentExpressionPart")]
|
||||
public class IntentExpressionPart : DbRecord, IDbRecord
|
||||
|
|
@ -29,5 +29,8 @@ namespace BotSharp.Core.Intents
|
|||
public string Value { get; set; }
|
||||
|
||||
public bool IsList { get; set; }
|
||||
|
||||
[ForeignKey("ResponseParameterId")]
|
||||
public List<ResponseParameterPrompt> Prompts { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
|
|||
20
BotSharp.Core/Intents/ResponseParameterPrompt.cs
Normal file
20
BotSharp.Core/Intents/ResponseParameterPrompt.cs
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
using EntityFrameworkCore.BootKit;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.Text;
|
||||
|
||||
namespace BotSharp.Core.Intents
|
||||
{
|
||||
[Table("Bot_ResponseParameterPrompt")]
|
||||
public class ResponseParameterPrompt : DbRecord, IDbRecord
|
||||
{
|
||||
[Required]
|
||||
[StringLength(36)]
|
||||
public String ResponseParameterId { get; set; }
|
||||
|
||||
[MaxLength(256)]
|
||||
public string Prompt { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
@ -1,5 +1,4 @@
|
|||
using BotSharp.Core.Expressions;
|
||||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue