1- using Microsoft . GS . DPS . Model . ChatHost ;
1+ using Microsoft . GS . DPS . Model . ChatHost ;
22using Microsoft . GS . DPS . Storage . ChatSessions . Entities ;
33using Microsoft . GS . DPS . Storage . ChatSessions ;
44using 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