File tree Expand file tree Collapse file tree
src/BE/Controllers/Chats/Chats Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1919using ModelContextProtocol . Protocol ;
2020using OpenAI . Chat ;
2121using System . ClientModel ;
22+ using System . ClientModel . Primitives ;
2223using System . Diagnostics ;
2324using System . Security . Cryptography ;
2425using System . Text . Json ;
@@ -707,7 +708,15 @@ async Task<Step> RunOne(List<OpenAIChatMessage> messageToSend)
707708 catch ( ClientResultException e )
708709 {
709710 icc . FinishReason = DBFinishReason . UpstreamError ;
710- errorText = e . Message ;
711+ PipelineResponse ? pr = e . GetRawResponse ( ) ;
712+ if ( pr != null )
713+ {
714+ errorText = pr . Content . ToString ( ) ;
715+ }
716+ else
717+ {
718+ errorText = e . Message ;
719+ }
711720 logger . LogError ( e , "Upstream error: {userMessageId}" , req . LastMessageId ) ;
712721 }
713722 catch ( AggregateException e ) when ( e . InnerException is TaskCanceledException )
You can’t perform that action at this time.
0 commit comments