한국정보과학회 x Microsoft x 디모아 공동개최의 Chatbot 경진대회
최고기술상 및 특별상 수상
PiBot 실행하기https://vilut1002.github.io/AzureChatBot/index.html
피봇은 MS Azure를 사용해 만든 챗봇으로, 대한적십자사의 헌혈 예약, 조회, 취소 등의 서비스와 함께 헌혈에 대한 다양한 정보를 제공합니다.
- VISUAL STUDIO
- Bot Framework v4 SDK Templates for Visual Studio
- Bot Framework emulator
- Azure Trial
- .NET framework
- 개발환경 셋팅
- git clone
git clone https://github.com/vilut1002/AzureChatBot
- Visual Studio에서 로컬로 봇을 실행 (디버그)
- Bot framework emulator에서 Open Bot 후 실행 Bot Url ex) localhost:3978/api/messages
- 예약
- 조회 및 취소
Microsoft / csharp dotnet CoreBot
-
채팅 GUI: Adaptive Cards Schema
-
데이터 베이스 : MS Azure SQL
-
.NET 코드 예시
try { SqlConnectionStringBuilder builder = new SqlConnectionStringBuilder(); builder.DataSource = "yourServerName.database.windows.net"; builder.UserID = "yourID"; builder.Password = "yourPW"; builder.InitialCatalog = "yourDBname"; using (SqlConnection connection = new SqlConnection(builder.ConnectionString)) { connection.Open(); string sql_query = $"SELECT * from reservInfo WHERE Phone = '{stepContext.Values["phone"]}'AND reserv_date>current_timestamp;"; using (var command = new SqlCommand(sql_query, connection)) { using (SqlDataReader reader = command.ExecuteReader()) { while (reader.Read()) { // 애트리뷰트 순서로 index 구분해서 bookingDetail 인스턴스에 저장 BookingDetails bookingQuery = new BookingDetails(); bookingQuery.ID = reader.GetInt32(0); bookingQuery.Name = reader.GetString(1); bookingQuery.Sex = reader.GetString(2); bookingQuery.Age = reader.GetInt32(3); bookingQuery.Phone = reader.GetString(4); DateTime myDate = reader.GetDateTime(5); string convertedDate = myDate.ToString("yyyy-MM-ddhh:mm"); string dateStr = convertedDate.Substring(0, 10); string timeStr = convertedDate.Substring(10); bookingQuery.Date = dateStr; bookingQuery.Time = timeStr; bookingQuery.Center = reader.GetString(6); return bookingQuery; } } } } } catch (SqlException e) { Console.WriteLine(e.ToString()); }
-
Google map API (maps static API)
maps static API 코드 예시
http://maps.google.com/maps/api/staticmap?center={위도},{경도}&zoom=16&size=512x512&maptype=roadmap&markers=color:red%7C{위도},{경도}&sensor=false&key=<발급받은 API key>
LUIS applications에서 Authoring resource 생성 후, intent와 entity를 의도에 맞게 추가함.
LUIS 사용방법
BotServices.cs와 IBotServices.cs를 추가한다.
private readonly IBotServices _botServices;
var recognizerResult = await _botServices.Dispatch.RecognizeAsync(stepContext.Context, cancellationToken);
var topIntent = recognizerResult.GetTopScoringIntent();
//intent에 따라 다른 기능을 실행
if (topIntent.intent == "예약")
{
await stepContext.Context.SendActivityAsync(MessageFactory.Text("헌혈 예약 메뉴로 이동합니다."), cancellationToken);
return await stepContext.BeginDialogAsync(nameof(BookingDialog), new BookingDetails(), cancellationToken);
}
else if (topIntent.intent == "종료")
return await stepContext.EndDialogAsync(null, cancellationToken);
Microsoft / BotFramework-Samples/nlp-with-dispatch
Microsoft docs, Azure/cognitive service/LUIS
이화여자대학교 컴퓨터공학 전공
이수민 vilut1002@gmail.com
김은아 eaz03@ewhain.net
이다해 dah3132@gmail.com