Improved messaging for missing OpenAI Api key.

This commit is contained in:
Martin Sosic 2023-06-23 12:09:09 +02:00
parent d3454a5f58
commit 83ef006a98
2 changed files with 14 additions and 9 deletions

View File

@ -102,8 +102,14 @@ getOpenAIApiKey =
throwMissingOpenAIApiKeyEnvVarError =
throwError $
CommandError
"Missing OPENAI_API_KEY env var"
"You can obtain this key from your OpenAI profile."
"Missing OPENAI_API_KEY environment variable"
$ unlines
[ "Wasp AI uses ChatGPT to generate your project, and therefore requires you to provide it with an OpenAI API key.",
"You can obtain this key via your OpenAI account's user settings (https://platform.openai.com/account/api-keys).",
"Then, add",
" export OPENAI_API_KEY=<yourkeyhere>",
"to .bash_profile or .profile, restart your shell, and you should be good to go."
]
newProjectDetails :: String -> String -> NewProjectDetails
newProjectDetails webAppName webAppDescription =

View File

@ -10,7 +10,6 @@ where
import Data.Aeson (FromJSON)
import Data.List (isPrefixOf)
import Data.Maybe (fromMaybe)
import qualified Data.Text as T
import GHC.Generics (Generic)
import NeatInterpolation (trimming)
@ -180,16 +179,16 @@ instance Show OperationType where
show Query = "query"
data Operation = Operation
{ opImpl :: OperationImpl,
opPlan :: Plan.Operation,
opType :: OperationType
{ opImpl :: !OperationImpl,
opPlan :: !Plan.Operation,
opType :: !OperationType
}
deriving (Show)
data OperationImpl = OperationImpl
{ opWaspDecl :: String,
opJsImpl :: String,
opJsImports :: Maybe String
{ opWaspDecl :: !String,
opJsImpl :: !String,
opJsImports :: !(Maybe String)
}
deriving (Generic, Show)