Feature/pr assistant#14
Conversation
f0d019a to
93ff26e
Compare
RuliLG
left a comment
There was a problem hiding this comment.
I think we should also merge once we implement also Gitlab and Bitbucket!
| $client = new Client([ | ||
| 'base_uri' => 'https://github.com/', | ||
| 'headers' => [ | ||
| 'Accept' => 'application/vnd.github.v3+json', | ||
| ], | ||
| ]); | ||
|
|
||
| $clientId = config('services.github.client_id'); | ||
| $clientSecret = config('services.github.client_secret'); | ||
| $response = $client->post("login/oauth/access_token?client_id={$clientId}&client_secret={$clientSecret}&code={$code}"); | ||
| $impersonateToken = json_decode($response->getBody()->getContents(), true)['access_token']; | ||
| return $impersonateToken; |
There was a problem hiding this comment.
Change to use Laravel's HTTP client
| 'secret' => $secret, | ||
| ], | ||
| 'events' => ['push'], | ||
| 'events' => [GithubWebhookEvents::PUSH->value, GithubWebhookEvents::PULL_REQUEST_COMMENT->value], |
There was a problem hiding this comment.
Why don't you use the SourceCodeProvider of Github here? We have the repo and everything :-) Also, using it will make it easier for when you implement Gitlab and Bitbucket!
|
|
||
| public function handle(string $repository, string $branch, string $filePath, string $owner, string $newContent, string $commitMessage) | ||
| { | ||
| $this->githubService->pushNewContentToRepository($repository, $branch, $filePath, $owner, $newContent, $commitMessage); |
There was a problem hiding this comment.
To refactor and add into the SourceCodeProvider
| $prompt = 'I am giving to you an array with this format: '.$requestChangesFileLines.'. Each /n means a new line in the file and I want you give me back the same format but: '.$commentContent; | ||
| $systemPrompt = 'You are an expert in modifying files changing exactly only the things you are asked to and return the same format you are asked'; | ||
|
|
||
| $llm = app(Llm::class); | ||
| $response = $llm->completion($systemPrompt, $prompt); | ||
| $formattedResponse = $this->formatResponse($response->completion); | ||
| if (! array_key_exists(0, $formattedResponse)) { | ||
| return []; | ||
| } |
There was a problem hiding this comment.
Shouldn't this be a Prompt class like you made for the Technical description?
There was a problem hiding this comment.
Could be changed to use library?
There was a problem hiding this comment.
Could be changed to use library?
| */ | ||
| public function handle(Request $request, Closure $next): Response | ||
| { | ||
| if(config('services.ngrok.active_helper')) { |
There was a problem hiding this comment.
Just in case I would also add && app()→environment('local') 😂
| public function handle(Request $request, Closure $next): Response | ||
| { | ||
| // @codeCoverageIgnoreStart | ||
| if(config('services.ngrok.active_helper')) { |
There was a problem hiding this comment.
I think this should be implemented in the SourceCodeProvider, and some parts of it could be a trait implemented by all providers
No description provided.