Add a better API KEY validation in the client
This commit is contained in:
parent
9ea6de6e1a
commit
5d94c59d3b
1 changed files with 6 additions and 0 deletions
|
|
@ -11,6 +11,12 @@ def get_codeflash_api_key() -> Optional[str]:
|
|||
+ "You can generate one at https://app.codeflash.ai/app/apikeys,\n"
|
||||
+ "then set it as a CODEFLASH_API_KEY environment variable."
|
||||
)
|
||||
if not api_key.startswith("cf-"):
|
||||
raise EnvironmentError(
|
||||
f"CodeFlash API key is invalid. It should start with a 'cf-' prefix, we found '{api_key}' instead.\n"
|
||||
+ "You can generate one at https://app.codeflash.ai/app/apikeys,\n"
|
||||
+ "then set it as a CODEFLASH_API_KEY environment variable."
|
||||
)
|
||||
return api_key
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue