Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
boogiedk committed Dec 11, 2023
1 parent 3dda3d1 commit dfff8a3
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions SerfBot/OpenAiApi.fs
Original file line number Diff line number Diff line change
Expand Up @@ -51,15 +51,19 @@ let gptAnswer userQuestion =

let result =
if completionResult.Successful then
completionResult.Choices |> Seq.head |> fun c -> c.Message.Content
completionResult.Choices
|> Seq.head
|> fun c -> c.Message.Content
else
match completionResult.Error with
| null ->
"Unknown Error" |> logInfo
raise (Exception("Unknown Error"))
let errorMessage = "Unknown Error"
errorMessage |> logInfo
errorMessage
| error ->
$"{error.Code} {error.Message}" |> logInfo
sprintf "%s: %s" error.Code error.Message
let errorMessage = $"{error.Code} {error.Message}"
errorMessage |> logInfo
errorMessage

return result

Expand Down

0 comments on commit dfff8a3

Please # to comment.