Skip to content

Feature/pr assistant#14

Open
ismaelilloDev wants to merge 8 commits into
mainfrom
feature/pr-assistant
Open

Feature/pr assistant#14
ismaelilloDev wants to merge 8 commits into
mainfrom
feature/pr-assistant

Conversation

@ismaelilloDev

Copy link
Copy Markdown
Contributor

No description provided.

@ismaelilloDev ismaelilloDev requested a review from a team March 18, 2024 13:15

@RuliLG RuliLG left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should also merge once we implement also Gitlab and Bitbucket!

Comment on lines +52 to +63
$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;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change to use Laravel's HTTP client

'secret' => $secret,
],
'events' => ['push'],
'events' => [GithubWebhookEvents::PUSH->value, GithubWebhookEvents::PULL_REQUEST_COMMENT->value],

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mola!

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To refactor and add into the SourceCodeProvider

Comment on lines +15 to +23
$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 [];
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this be a Prompt class like you made for the Technical description?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could be changed to use library?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could be changed to use library?

*/
public function handle(Request $request, Closure $next): Response
{
if(config('services.ngrok.active_helper')) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just in case I would also add && app()→environment('local') 😂

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, and testing I guess

public function handle(Request $request, Closure $next): Response
{
// @codeCoverageIgnoreStart
if(config('services.ngrok.active_helper')) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should be implemented in the SourceCodeProvider, and some parts of it could be a trait implemented by all providers

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants