sturdy-dev / codereview.gpt

Reviews your Pull/Merge Requests using ChatGPT
MIT License
529 stars 63 forks source link

Not working on GitLab #34

Open ybloch opened 1 year ago

ybloch commented 1 year ago

I tried the extension on Gitlab's MR and I got the Error from OpenAI:

Status: 413
{"detail":{"message":"The message you submitted was too long, please reload the conversation and submit something shorter.","code":"message_length_exceeds_limit"}}

From looking at the payload of the request and also at the code itself, it seems that the tool does not capture the code well, it sends too many lines (not only code) in one single request

nickveenhof commented 1 year ago

Is the MR you tried it on public? I think the context/description of the MR might have been too big. The patches itself are truncated already but the description is not.

ybloch commented 1 year ago

@nickveenhof I tried on private... So I had another test on a public repo, and I got a JS error:

Uncaught (in promise) TypeError: Cannot read properties of null (reading 'getAttribute')
    at popup.js:2:290946

this is the random repo I tested: https://gitlab.com/Amppatil/home/-/merge_requests/1/diffs

webstercharly commented 1 year ago

It is not an issue of private vs public, here is a public PR/MR I tested on and get the same error as this issue: https://github.com/vercel/satori/pull/287/files https://gitlab.com/gitlab-org/gitlab/-/merge_requests/117832/diffs

POST https://chat.openai.com/backend-api/conversation HTTP/1.1
Host: chat.openai.com
Connection: keep-alive
Content-Length: 31273

I have tried it on a number of private PRs and they work fine up to a certain size.

HTTP/1.1 413 Payload Too Large
Date: Tue, 18 Apr 2023 10:57:01 GMT
Content-Type: application/json
Content-Length: 163
Connection: keep-alive

{"detail":{"message":"The message you submitted was too long, please reload the conversation and submit something shorter.","code":"message_length_exceeds_limit"}}

From my understand of ChatGPT you'd want to count the number of token's in the message before sending and consider sending multiple messages to the Chat asking for it to wait for a certain command before responding. Then there will be an issue with the Chat only able to remember so many previous messages / tokens, but it ultimately means multiple api calls.

webstercharly commented 1 year ago

@nickveenhof I tried on private... So I had another test on a public repo, and I got a JS error:

Uncaught (in promise) TypeError: Cannot read properties of null (reading 'getAttribute')
    at popup.js:2:290946

this is the random repo I tested: https://gitlab.com/Amppatil/home/-/merge_requests/1/diffs

You are getting this error because document.querySelector('.description textarea').getAttribute('data-value') cannot be found so is returning null on the querySelection.

The assumption of a description is an issue as not all MR in GitLab will render a description textarea, so that is a bug

nickveenhof commented 1 year ago

Does this bug still exist in the latest dev version? We also just pushed out a new version to the chrome store