Skip to content

Commit 0380e63

Browse files
Merge pull request #12 from microsoft/bug-fix-1026
Merging bug fixes 1026
2 parents c1ee29f + 3666771 commit 0380e63

File tree

2 files changed

+10
-8
lines changed

2 files changed

+10
-8
lines changed

App/backend-api/Microsoft.GS.DPS.sln

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.GS.DPS", "Microso
77
EndProject
88
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.GS.DPS.Host", "Microsoft.GS.DPS.Host\Microsoft.GS.DPS.Host.csproj", "{3BBCDD67-966B-442A-9A34-FE6D311B4824}"
99
EndProject
10-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.GS.DPS.Playground", "Microsoft.GS.DPS.Playground\Microsoft.GS.DPS.Playground.csproj", "{D3A41803-45E6-4641-A27A-CB86A2337361}"
11-
EndProject
1210
Global
1311
GlobalSection(SolutionConfigurationPlatforms) = preSolution
1412
Debug|Any CPU = Debug|Any CPU
@@ -23,8 +21,6 @@ Global
2321
{3BBCDD67-966B-442A-9A34-FE6D311B4824}.Debug|Any CPU.Build.0 = Debug|Any CPU
2422
{3BBCDD67-966B-442A-9A34-FE6D311B4824}.Release|Any CPU.ActiveCfg = Release|Any CPU
2523
{3BBCDD67-966B-442A-9A34-FE6D311B4824}.Release|Any CPU.Build.0 = Release|Any CPU
26-
{D3A41803-45E6-4641-A27A-CB86A2337361}.Debug|Any CPU.ActiveCfg = Release|Any CPU
27-
{D3A41803-45E6-4641-A27A-CB86A2337361}.Release|Any CPU.ActiveCfg = Release|Any CPU
2824
EndGlobalSection
2925
GlobalSection(SolutionProperties) = preSolution
3026
HideSolutionNode = FALSE

App/backend-api/Microsoft.GS.DPS/API/ChatHost/ChatHost.cs

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using Microsoft.GS.DPS.Model.ChatHost;
1+
using Microsoft.GS.DPS.Model.ChatHost;
22
using Microsoft.GS.DPS.Storage.ChatSessions.Entities;
33
using Microsoft.GS.DPS.Storage.ChatSessions;
44
using Microsoft.KernelMemory;
@@ -159,6 +159,7 @@ public async Task<ChatResponse> Chat(ChatRequest chatRequest)
159159
//Get the answer from the Kernel Memory
160160
var answer = await _kernelMemory.Ask(chatRequest.Question + ChatHost.s_additionalPrompt, chatRequest.DocumentIds, context: context);
161161

162+
answer.Result = System.Text.Encoding.UTF8.GetString(Encoding.UTF8.GetBytes(answer.Result));
162163
Console.WriteLine($"Question: {answer.Question}");
163164
Console.WriteLine($"Answer: {answer.Result}");
164165

@@ -201,8 +202,13 @@ public async Task<ChatResponse> Chat(ChatRequest chatRequest)
201202

202203
try
203204
{
204-
answerObject = JsonSerializer.Deserialize<Answer>(returnedChatMessageContent.Content, options: JsonSerializationOptionsCache.JsonSerializationOptionsIgnoreCase);
205-
205+
//Adding for non English Response.
206+
returnedChatMessageContent.Content = System.Text.Encoding.UTF8.GetString(System.Text.Encoding.UTF8.GetBytes(returnedChatMessageContent.Content));
207+
answerObject = JsonSerializer.Deserialize<Answer>(returnedChatMessageContent.Content, options: new JsonSerializerOptions
208+
{
209+
PropertyNameCaseInsensitive = true,
210+
DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull
211+
});
206212
}
207213
catch
208214
{
@@ -245,4 +251,4 @@ public async Task<ChatResponse> Chat(ChatRequest chatRequest)
245251
};
246252
}
247253
}
248-
}
254+
}

0 commit comments

Comments
 (0)