Bläddra i källkod

Adds custom message for 404 on model access

main
Eric Amodio 1 år sedan
förälder
incheckning
628dfe0d37
1 ändrade filer med 5 tillägg och 0 borttagningar
  1. +5
    -0
      src/ai/openaiProvider.ts

+ 5
- 0
src/ai/openaiProvider.ts Visa fil

@ -142,6 +142,11 @@ export class OpenAIProvider implements AIProvider {
if (!rsp.ok) {
debugger;
if (rsp.status === 404) {
throw new Error(
`Unable to explain commit: Your API key doesn't seem to have access to the selected '${model}' model`,
);
}
if (rsp.status === 429) {
throw new Error(
`Unable to explain commit: (${this.name}:${rsp.status}) Too many requests (rate limit exceeded) or your API key is associated with an expired trial`,

Laddar…
Avbryt
Spara