Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhancement: Sync agent with github repo #428

Open
dekdynamics opened this issue May 28, 2024 · 1 comment
Open

Enhancement: Sync agent with github repo #428

dekdynamics opened this issue May 28, 2024 · 1 comment

Comments

@dekdynamics
Copy link

Hi Team,

As agent file repositories grow and change over time, it could be useful to have some sort of version control and tracking. I dont think it makes sense to invest the time and challenge of writing your own agent version control, so maybe there is an opportunity for a github integration.

It would be cool if I could check all of my agent knowledge files into a github repo and have the agent read them from there. This approach would solve the version control problem, make updating #418 easier, and possibly save you space from hosting all of the files yourself.

Copy link

greptile-apps bot commented May 28, 2024

To integrate GitHub for agent knowledge files, follow these steps:

  1. Update Agent Model:

    • Add github_repo and github_branch fields to the Agent model.
    protected $fillable = [
        'name', 'image', 'about', 'message', 'prompt', 'rag_prompt', 'is_public', 'user_id', 'is_rag_ready', 'use_tools', 'github_repo', 'github_branch'
    ];
  2. Modify Migrations:

    • Update the agents table to include github_repo and github_branch columns.
    $table->string('github_repo')->nullable();
    $table->string('github_branch')->default('main');
  3. Update Create and Edit Components:

    • Add input fields for github_repo and github_branch in Create.php and Edit.php.
    public $github_repo;
    public $github_branch = 'main';
    • Include these fields in the rules method and submit method.
    'github_repo' => 'nullable|string',
    'github_branch' => 'nullable|string',
  4. Fetch Files from GitHub:

    • Use GreptileGateway to fetch files from the specified GitHub repository.
    $greptile = new GreptileGateway();
    $files = $greptile->getRepository($agent->github_repo, $agent->github_branch);
  5. Update Views:

    • Add input fields for github_repo and github_branch in create.blade.php and edit.blade.php.
    <input type="text" wire:model="github_repo" placeholder="GitHub Repository">
    <input type="text" wire:model="github_branch" placeholder="GitHub Branch">
  6. Sync Files:

    • Implement a method to sync files from GitHub to the agent's documents.
    public function syncFilesFromGithub(Agent $agent) {
        $greptile = new GreptileGateway();
        $files = $greptile->getRepository($agent->github_repo, $agent->github_branch);
        // Process and save files to the agent's documents
    }
  7. Trigger Sync:

    • Call the sync method after agent creation or update.
    $this->syncFilesFromGithub($agent);

References

/app/Livewire/Agents/Edit.php
/app/Livewire/Agents/Create.php
/app/Models/Agent.php
/app/Models/AgentFile.php
/app/Jobs/ProcessAgentRag.php
/app/Http/Controllers/Api/v1/DocumentsController.php
/app/AI/GreptileGateway.php
/database/migrations
/resources/views/livewire/agents
/routes/api/v1.php

Ask Greptile

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

No branches or pull requests

1 participant