Skip to content

Commit

Permalink
Add threds, messages refactor, etc
Browse files Browse the repository at this point in the history
  • Loading branch information
frontmesh committed May 9, 2023
1 parent 5845429 commit eda8d19
Show file tree
Hide file tree
Showing 4 changed files with 257 additions and 79 deletions.
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!DOCTYPE html>
<html lang="en">
<html lang="en" data-theme="emerald">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
Expand Down
6 changes: 3 additions & 3 deletions src/elm/Api.elm
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module Api exposing (..)
-- import Json.Decode exposing (Decoder)

import Http exposing (emptyBody, expectJson, request)
import Json.Decode as Decode exposing (Decoder, int)
import Json.Decode as Decode exposing (Decoder, string)
import Json.Decode.Pipeline exposing (required)
import Json.Encode as Encode
import RemoteData exposing (WebData)
Expand All @@ -15,7 +15,7 @@ baseUrl =


type CompId
= CompId Int
= CompId String


type alias Comp =
Expand Down Expand Up @@ -89,4 +89,4 @@ compDecoder =

idDecoder : Decoder CompId
idDecoder =
Decode.map CompId int
Decode.map CompId string
19 changes: 18 additions & 1 deletion src/elm/Error.elm
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,24 @@ buildErrorMessage httpError =
"Unable to reach server."

Http.BadStatus statusCode ->
"Request failed with status code: " ++ String.fromInt statusCode
if statusCode == 429 then
errorMessage429

else if statusCode == 401 then
errorMessage401

else
"Request failed with status code: " ++ String.fromInt statusCode

Http.BadBody message ->
message


errorMessage429 : String
errorMessage429 =
"Your API key is not working. You need a paid API account on OpenAI in order to use the ChatGPT API Key (the free trial won't work). To verify that you have a paid API account, go here and make sure you have your billing info added: https://platform.openai.com/account/billing/overview. Note that you do not need to have a ChatGPT Plus subscription, it's not needed. If you already have a paid OpenAI account, check to see if you still have sufficient credits. Also, try creating a new API key and trying again. If this problem persists, please contact support."


errorMessage401 : String
errorMessage401 =
"Incorrect API key provided. You can find your API key at https://platform.openai.com/account/api-keys"

0 comments on commit eda8d19

Please sign in to comment.