Skip to content

Commit

Permalink
Using git_dname instead of repo
Browse files Browse the repository at this point in the history
  • Loading branch information
wladimiiir committed Oct 16, 2024
1 parent bff6727 commit 01a2df0
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 11 deletions.
10 changes: 5 additions & 5 deletions aider/companion.py
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
import requests

from aider.repo import GitRepo
from aider.io import InputOutput


class Companion:
repo: GitRepo = None
base_dir = ""
io: InputOutput = None
base_url = "http://localhost:24337"
enabled = False

def __init__(
self,
repo,
base_dir,
io=None,
base_url="http://localhost:24337",
enabled=False,
):
self.repo = repo
self.base_dir = base_dir
self.io = io
self.base_url = base_url
self.enabled = enabled
Expand All @@ -33,7 +33,7 @@ def get_open_files(self):

try:
url = f"{self.base_url}/open-files"
response = requests.post(url, json={"projectBase": self.repo.get_rel_repo_dir()})
response = requests.post(url, json={"projectBase": self.base_dir.replace("\\", "/")})

if response.status_code == 200:
return response.json()
Expand Down
11 changes: 5 additions & 6 deletions aider/main.py
Original file line number Diff line number Diff line change
@@ -1,29 +1,27 @@
import configparser
import git
import json
import os
import re
import sys
import threading
import traceback
from pathlib import Path

import git
from dotenv import load_dotenv
from pathlib import Path
from prompt_toolkit.enums import EditingMode

from aider import __version__, models, urls, utils
from aider.args import get_parser
from aider.coders import Coder
from aider.commands import Commands, SwitchCoder
from aider.companion import Companion
from aider.format_settings import format_settings, scrub_sensitive_info
from aider.history import ChatSummary
from aider.io import InputOutput
from aider.llm import litellm # noqa: F401; properly init litellm on launch
from aider.repo import ANY_GIT_ERROR, GitRepo
from aider.report import report_uncaught_exceptions
from aider.versioncheck import check_version, install_from_main_branch, install_upgrade
from aider.companion import Companion

from .dump import dump # noqa: F401


Expand Down Expand Up @@ -646,7 +644,8 @@ def get_io(pretty):
)
args.stream = False

companion = Companion(repo, io, args.companion_base_url, args.enable_companion)
if git_dname:
companion = Companion(git_dname, io, args.companion_base_url, args.enable_companion)

try:
coder = Coder.create(
Expand Down

0 comments on commit 01a2df0

Please sign in to comment.