yagil/ChatIDE

No response from Chat Gpt

Closed this issue · 9 comments

Ive supplied my api key. but chatgpt isnt responding?

image
image

yagil commented

Do you have access to gpt-4? If not, try to set gpt-3.5-turbo. To be extra sure, restart VS code afterwards.

still no response.
image

Is there a way to see logs?

yagil commented

Exiting VS Code and reopening it didn't help?

You can try this: https://stackoverflow.com/a/65938179

If this doesn't work, you can debug like so:

  1. Clone the project from this repo
  2. Open the project in VS Code
  3. Open extension.ts
  4. Press F5
    This should open a new VS Code instance in extension debug mode. Errors will be printed to the debug console

So it says too many requests. My api key shows never used on the dashboard.

Error fetching stream: Error: Request failed with status code 429
    at createError (c:\Users\acoop\Downloads\ChatIDE-main\ChatIDE-main\dist\webpack:\chatide\node_modules\axios\lib\core\createError.js:16:1)
    at settle (c:\Users\acoop\Downloads\ChatIDE-main\ChatIDE-main\dist\webpack:\chatide\node_modules\axios\lib\core\settle.js:17:1)
    at RedirectableRequest.handleResponse (c:\Users\acoop\Downloads\ChatIDE-main\ChatIDE-main\dist\webpack:\chatide\node_modules\axios\lib\adapters\http.js:278:1)
    at RedirectableRequest.emit (C:\Users\acoop\Downloads\ChatIDE-main\ChatIDE-main\lib\events.js:526:28)
    at RedirectableRequest._processResponse (c:\Users\acoop\Downloads\ChatIDE-main\ChatIDE-main\dist\webpack:\chatide\node_modules\follow-redirects\index.js:356:1)
    at ClientRequest.RedirectableRequest._onNativeResponse (c:\Users\acoop\Downloads\ChatIDE-main\ChatIDE-main\dist\webpack:\chatide\node_modules\follow-redirects\index.js:62:1)
    at Object.onceWrapper (C:\Users\acoop\Downloads\ChatIDE-main\ChatIDE-main\lib\events.js:646:26)
    at ClientRequest.emit (C:\Users\acoop\Downloads\ChatIDE-main\ChatIDE-main\lib\events.js:538:35)
    at HTTPParser.parserOnIncomingClient (C:\Users\acoop\Downloads\ChatIDE-main\ChatIDE-main\lib\_http_client.js:618:27)
    at HTTPParser.parserOnHeadersComplete (C:\Users\acoop\Downloads\ChatIDE-main\ChatIDE-main\lib\_http_common.js:128:17)
    at TLSSocket.socketOnData (C:\Users\acoop\Downloads\ChatIDE-main\ChatIDE-main\lib\_http_client.js:482:22)
    at TLSSocket.emit (C:\Users\acoop\Downloads\ChatIDE-main\ChatIDE-main\lib\events.js:526:28)
    at addChunk (C:\Users\acoop\Downloads\ChatIDE-main\ChatIDE-main\lib\internal\streams\readable.js:315:12)
    at readableAddChunk (C:\Users\acoop\Downloads\ChatIDE-main\ChatIDE-main\lib\internal\streams\readable.js:289:9)
    at TLSSocket.Readable.push (C:\Users\acoop\Downloads\ChatIDE-main\ChatIDE-main\lib\internal\streams\readable.js:228:10)
    at TLSWrap.onStreamRead (C:\Users\acoop\Downloads\ChatIDE-main\ChatIDE-main\lib\internal\stream_base_commons.js:190:23)
    at TLSWrap.callbackTrampoline (node:internal/async_hooks:130:17) {config: {…}, request: ClientRequest, response: {…}, isAxiosError: true, toJSON: ƒ, …}

response: {status: 429, statusText: 'Too Many Requests', headers: {…}, config: {…}, request: ClientRequest, …}
yagil commented

This seems to be coming from this catch clause:

try {
    const res = await openai.createChatCompletion({
      model: modelString,
      messages: messages,
      // eslint-disable-next-line @typescript-eslint/naming-convention
      max_tokens: maxTokensNumber,
      temperature: temperatureNumber,
      stream: true,
    }, { responseType: 'stream' });

    for await (const token of streamToTokens(res)) {
      yield token;
    }
  } catch (error: any) {
    console.error('Error fetching stream:', error);
  }

Let's try to hit the OpenAI API separately from the extension, for example using curl. Can you try this and see if this works?

curl https://api.openai.com/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $OPENAI_API_KEY" \
  -d '{
     "model": "gpt-3.5-turbo",
     "messages": [{"role": "user", "content": "Say this is a test!"}],
     "temperature": 0.7
   }'

Swap out $OPENAI_API_KEY for your actual api key
(from https://platform.openai.com/docs/api-reference/making-requests)

yagil commented

@Snazzie the newest version here https://marketplace.visualstudio.com/items?itemName=ChatIDE.chatide might solve your issue, but let me know if not

Looks like it was due to having to have a paid account? Bummer

    "error": {
        "message": "You exceeded your current quota, please check your plan and billing details.",
        "type": "insufficient_quota",
        "param": null,
        "code": null
    }
yagil commented

@Snazzie this error is from OpenAI