refac all urls into urls.py

This commit is contained in:
Paul Gauthier 2024-06-08 12:53:54 -07:00
parent 09d3d02971
commit 1f1da4b1a2
7 changed files with 26 additions and 18 deletions

View file

@ -17,7 +17,7 @@ from jsonschema import Draft7Validator
from rich.console import Console, Text from rich.console import Console, Text
from rich.markdown import Markdown from rich.markdown import Markdown
from aider import __version__, models, prompts, utils from aider import __version__, models, prompts, urls, utils
from aider.commands import Commands from aider.commands import Commands
from aider.history import ChatSummary from aider.history import ChatSummary
from aider.io import InputOutput from aider.io import InputOutput
@ -1213,9 +1213,7 @@ class Coder:
return return
self.io.tool_error("Warning: it's best to only add files that need changes to the chat.") self.io.tool_error("Warning: it's best to only add files that need changes to the chat.")
self.io.tool_error( self.io.tool_error(urls.edit_errors)
"https://aider.chat/docs/faq.html#how-can-i-add-all-the-files-to-the-chat"
)
self.warning_given = True self.warning_given = True
def prepare_to_edit(self, edits): def prepare_to_edit(self, edits):
@ -1255,9 +1253,7 @@ class Coder:
err = err.args[0] err = err.args[0]
self.io.tool_error("The LLM did not conform to the edit format.") self.io.tool_error("The LLM did not conform to the edit format.")
self.io.tool_error( self.io.tool_error(urls.edit_errors)
"For more info see: https://aider.chat/docs/faq.html#aider-isnt-editing-my-files"
)
self.io.tool_error() self.io.tool_error()
self.io.tool_error(str(err), strip=False) self.io.tool_error(str(err), strip=False)

View file

@ -6,6 +6,7 @@ import sys
import streamlit as st import streamlit as st
from aider import urls
from aider.coders import Coder from aider.coders import Coder
from aider.dump import dump # noqa: F401 from aider.dump import dump # noqa: F401
from aider.io import InputOutput from aider.io import InputOutput
@ -159,12 +160,12 @@ class GUI:
pass pass
def do_recommended_actions(self): def do_recommended_actions(self):
text = "Aider works best when your code is stored in a git repo. \n"
text += f"[See the FAQ for more info]({urls.git})"
with st.expander("Recommended actions", expanded=True): with st.expander("Recommended actions", expanded=True):
with st.popover("Create a git repo to track changes"): with st.popover("Create a git repo to track changes"):
st.write( st.write(text)
"Aider works best when your code is stored in a git repo. \n[See the FAQ"
" for more info](https://aider.chat/docs/git.html)"
)
self.button("Create git repo", key=random.random(), help="?") self.button("Create git repo", key=random.random(), help="?")
with st.popover("Update your `.gitignore` file"): with st.popover("Update your `.gitignore` file"):
@ -513,9 +514,9 @@ def gui_main():
st.set_page_config( st.set_page_config(
layout="wide", layout="wide",
page_title="Aider", page_title="Aider",
page_icon="https://aider.chat/assets/favicon-32x32.png", page_icon=urls.favicon,
menu_items={ menu_items={
"Get Help": "https://aider.chat/", "Get Help": urls.website,
"Report a bug": "https://github.com/paul-gauthier/aider/issues", "Report a bug": "https://github.com/paul-gauthier/aider/issues",
"About": "# Aider\nAI pair programming in your browser.", "About": "# Aider\nAI pair programming in your browser.",
}, },

View file

@ -8,6 +8,7 @@ from typing import Optional
from PIL import Image from PIL import Image
from aider import urls
from aider.dump import dump # noqa: F401 from aider.dump import dump # noqa: F401
from aider.litellm import litellm from aider.litellm import litellm
@ -471,7 +472,7 @@ def sanity_check_model(io, model):
io.tool_error(f"- {m} ({fq})") io.tool_error(f"- {m} ({fq})")
if show: if show:
io.tool_error("For more info see https://aider.chat/docs/llms/warnings.html") io.tool_error(urls.model_warnings)
def fuzzy_match_models(name): def fuzzy_match_models(name):

View file

@ -8,18 +8,18 @@ import pypandoc
from bs4 import BeautifulSoup from bs4 import BeautifulSoup
from playwright.sync_api import sync_playwright from playwright.sync_api import sync_playwright
from aider import __version__ from aider import __version__, urls
aider_user_agent = f"Aider/{__version__} +https://aider.chat" aider_user_agent = f"Aider/{__version__} +{urls.website}"
# Playwright is nice because it has a simple way to install dependencies on most # Playwright is nice because it has a simple way to install dependencies on most
# platforms. # platforms.
PLAYWRIGHT_INFO = """ PLAYWRIGHT_INFO = f"""
For better web scraping, install Playwright chromium with this command in your terminal: For better web scraping, install Playwright chromium with this command in your terminal:
playwright install --with-deps chromium playwright install --with-deps chromium
See https://aider.chat/docs/install/optional.html#enable-playwright for more info. See {urls.enable_playwrite} for more info.
""" """

7
aider/urls.py Normal file
View file

@ -0,0 +1,7 @@
website = "https://aider.chat/"
add_all_files = "https://aider.chat/docs/faq.html#how-can-i-add-all-the-files-to-the-chat"
edit_errors = "https://aider.chat/docs/troubleshooting/edit-errors.html"
git = "https://aider.chat/docs/git.html"
enable_playwrite = "https://aider.chat/docs/install/optional.html#enable-playwright"
favicon = "https://aider.chat/assets/favicon-32x32.png"
model_warnings = "https://aider.chat/docs/llms/warnings.html"

View file

@ -26,6 +26,7 @@ pypandoc
litellm litellm
google-generativeai google-generativeai
streamlit streamlit
watchdog
flake8 flake8
# v3.3 no longer works on python 3.9 # v3.3 no longer works on python 3.9

View file

@ -321,6 +321,8 @@ uritemplate==4.1.1
# via google-api-python-client # via google-api-python-client
urllib3==2.2.1 urllib3==2.2.1
# via requests # via requests
watchdog==4.0.1
# via -r requirements.in
wcwidth==0.2.13 wcwidth==0.2.13
# via prompt-toolkit # via prompt-toolkit
yarl==1.9.4 yarl==1.9.4