Fix: Revert to default theme for stability (v1.3.2)
This commit is contained in:
parent
1a2cf6afe8
commit
a9158d1b90
|
|
@ -1,92 +1,121 @@
|
|||
[project]
|
||||
# Nessuna API key richiesta agli utenti
|
||||
# Whether to enable telemetry (default: true). No personal data is collected.
|
||||
enable_telemetry = true
|
||||
|
||||
|
||||
# List of environment variables to be provided by each user to use the app.
|
||||
user_env = []
|
||||
|
||||
# Sessioni lunghe per comodità
|
||||
session_timeout = 7200 # 2 ore
|
||||
user_session_timeout = 2592000 # 30 giorni (come Perplexity Pro)
|
||||
# Duration (in seconds) during which the session is saved when the connection is lost
|
||||
session_timeout = 3600
|
||||
|
||||
# No cache esterno
|
||||
# Enable third parties caching (e.g LangChain cache)
|
||||
cache = false
|
||||
|
||||
# Security
|
||||
persist_user_env = false
|
||||
mask_user_env = true
|
||||
|
||||
# CORS permissivo per OAuth
|
||||
# Authorized origins
|
||||
allow_origins = ["*"]
|
||||
|
||||
# Follow symlink for asset mount (see https://github.com/Chainlit/chainlit/issues/317)
|
||||
# follow_symlink = false
|
||||
|
||||
[features]
|
||||
# HTML disabilitato per sicurezza
|
||||
# Process and display HTML in messages. This can be a security risk (see https://stackoverflow.com/questions/19603097/why-is-it-dangerous-to-render-user-generated-html-or-javascript)
|
||||
unsafe_allow_html = false
|
||||
|
||||
# LaTeX abilitato per formule matematiche
|
||||
latex = true
|
||||
# Process and display mathematical expressions. This can clash with "$" characters in messages.
|
||||
latex = false
|
||||
|
||||
# UX ottimizzata
|
||||
user_message_autoscroll = true
|
||||
# Automatically tag threads with the current chat profile (if a chat profile is used)
|
||||
auto_tag_thread = true
|
||||
|
||||
# Allow users to edit their own messages
|
||||
edit_message = true
|
||||
|
||||
# Thread sharing disabilitato (per ora)
|
||||
allow_thread_sharing = false
|
||||
|
||||
# Authorize users to spontaneously upload files with messages
|
||||
[features.spontaneous_file_upload]
|
||||
enabled = true
|
||||
# Solo PDF e TXT per RAG
|
||||
accept = ["application/pdf", "text/plain", "image/png", "image/jpeg"]
|
||||
max_files = 10
|
||||
max_size_mb = 100
|
||||
accept = ["*/*"]
|
||||
max_files = 20
|
||||
max_size_mb = 500
|
||||
|
||||
[features.audio]
|
||||
# Audio disabilitato (futuro: voice chat)
|
||||
enabled = false
|
||||
sample_rate = 24000
|
||||
# Threshold for audio recording
|
||||
min_decibels = -45
|
||||
# Delay for the user to start speaking in MS
|
||||
initial_silence_timeout = 3000
|
||||
# Delay for the user to continue speaking in MS. If the user stops speaking for this duration, the recording will stop.
|
||||
silence_timeout = 1500
|
||||
# Above this duration (MS), the recording will forcefully stop.
|
||||
max_duration = 15000
|
||||
# Duration of the audio chunks in MS
|
||||
chunk_duration = 1000
|
||||
# Sample rate of the audio
|
||||
sample_rate = 44100
|
||||
|
||||
[UI]
|
||||
# Nome branding
|
||||
name = "Dfm AI Station"
|
||||
# Name of the assistant.
|
||||
name = "Assistant"
|
||||
|
||||
# Tema dark di default (come Perplexity)
|
||||
default_theme = "dark"
|
||||
# Description of the assistant. This is used for HTML tags.
|
||||
# description = ""
|
||||
|
||||
# Layout wide per più spazio
|
||||
layout = "wide"
|
||||
# Large size content are by default collapsed for a cleaner ui
|
||||
default_collapse_content = true
|
||||
|
||||
# Sidebar aperta di default
|
||||
default_sidebar_state = "open"
|
||||
# Chain of Thought (CoT) display mode. Can be "hidden", "tool_call" or "full".
|
||||
cot = "full"
|
||||
|
||||
# Descrizione per SEO
|
||||
description = "AI Station powered by dFm - Assistente AI con RAG per analisi documentale e supporto tecnico"
|
||||
# Link to your github repo. This will add a github button in the UI's header.
|
||||
# github = ""
|
||||
|
||||
# Chain of Thought: mostra solo tool calls (pulito)
|
||||
cot = "tool_call"
|
||||
# Specify a CSS file that can be used to customize the user interface.
|
||||
# The CSS file can be served from the public directory or via an external link.
|
||||
# custom_css = "/public/test.css"
|
||||
|
||||
# Alert moderni
|
||||
alert_style = "modern"
|
||||
# Specify a Javascript file that can be used to customize the user interface.
|
||||
# The Javascript file can be served from the public directory.
|
||||
# custom_js = "/public/test.js"
|
||||
|
||||
# CSS Custom (stile Perplexity)
|
||||
custom_css = "/public/custom.css"
|
||||
# Specify a custom font url.
|
||||
# custom_font = "https://fonts.googleapis.com/css2?family=Inter:wght@400;500;700&display=swap"
|
||||
|
||||
# Logo e Avatar
|
||||
logo_file_url = "/public/images/logo2.png"
|
||||
default_avatar_file_url = "/public/images/fav4.png"
|
||||
# Specify a custom meta image url.
|
||||
# custom_meta_image_url = "https://chainlit-cloud.s3.eu-west-3.amazonaws.com/logo/chainlit_banner.png"
|
||||
|
||||
# Meta tags per sharing
|
||||
custom_meta_image_url = "/public/images/logo2.png"
|
||||
# Specify a custom build directory for the frontend.
|
||||
# This can be used to customize the frontend code.
|
||||
# Be careful: If this is a relative path, it should not start with a slash.
|
||||
# custom_build = "./public/build"
|
||||
|
||||
# Header links
|
||||
[[UI.header_links]]
|
||||
name = "dFm Website"
|
||||
display_name = "🏠 DEFRA WOOD MAKER"
|
||||
url = "https://www.dffm.it"
|
||||
target = "_blank"
|
||||
[UI.theme]
|
||||
default = "dark"
|
||||
#layout = "wide"
|
||||
#font_family = "Inter, sans-serif"
|
||||
# Override default MUI light theme. (Check theme.ts)
|
||||
[UI.theme.light]
|
||||
#background = "#FAFAFA"
|
||||
#paper = "#FFFFFF"
|
||||
|
||||
[[UI.header_links]]
|
||||
name = "Docs"
|
||||
display_name = "📚 Guida"
|
||||
url = "/public/docs.html"
|
||||
target = "_self"
|
||||
[UI.theme.light.primary]
|
||||
#main = "#F80061"
|
||||
#dark = "#980039"
|
||||
#light = "#FFE7EB"
|
||||
[UI.theme.light.text]
|
||||
#primary = "#212121"
|
||||
#secondary = "#616161"
|
||||
|
||||
# Override default MUI dark theme. (Check theme.ts)
|
||||
[UI.theme.dark]
|
||||
#background = "#FAFAFA"
|
||||
#paper = "#FFFFFF"
|
||||
|
||||
[UI.theme.dark.primary]
|
||||
#main = "#F80061"
|
||||
#dark = "#980039"
|
||||
#light = "#FFE7EB"
|
||||
[UI.theme.dark.text]
|
||||
#primary = "#EEEEEE"
|
||||
#secondary = "#BDBDBD"
|
||||
|
||||
[meta]
|
||||
generated_by = "1.3.2"
|
||||
|
|
|
|||
Binary file not shown.
Binary file not shown.
|
|
@ -0,0 +1,8 @@
|
|||
#!/home/giuseppe/ai-station/.venv/bin/python3
|
||||
# -*- coding: utf-8 -*-
|
||||
import re
|
||||
import sys
|
||||
from chainlit.cli import cli
|
||||
if __name__ == '__main__':
|
||||
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
||||
sys.exit(cli())
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
#!/home/giuseppe/ai-station/.venv/bin/python3
|
||||
# -*- coding: utf-8 -*-
|
||||
import re
|
||||
import sys
|
||||
from chevron import cli_main
|
||||
if __name__ == '__main__':
|
||||
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
||||
sys.exit(cli_main())
|
||||
|
|
@ -2,7 +2,7 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
import re
|
||||
import sys
|
||||
from aider.main import main
|
||||
from fastapi.cli import main
|
||||
if __name__ == '__main__':
|
||||
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
||||
sys.exit(main())
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
#!/home/giuseppe/ai-station/.venv/bin/python3
|
||||
# -*- coding: utf-8 -*-
|
||||
import re
|
||||
import sys
|
||||
from filetype.__main__ import main
|
||||
if __name__ == '__main__':
|
||||
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
||||
sys.exit(main())
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
#!/home/giuseppe/ai-station/.venv/bin/python3
|
||||
# -*- coding: utf-8 -*-
|
||||
import re
|
||||
import sys
|
||||
from opentelemetry.instrumentation.bootstrap import run
|
||||
if __name__ == '__main__':
|
||||
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
||||
sys.exit(run())
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
#!/home/giuseppe/ai-station/.venv/bin/python3
|
||||
# -*- coding: utf-8 -*-
|
||||
import re
|
||||
import sys
|
||||
from opentelemetry.instrumentation.auto_instrumentation import run
|
||||
if __name__ == '__main__':
|
||||
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
||||
sys.exit(run())
|
||||
|
|
@ -0,0 +1,164 @@
|
|||
/* -*- indent-tabs-mode: nil; tab-width: 4; -*- */
|
||||
|
||||
/* Greenlet object interface */
|
||||
|
||||
#ifndef Py_GREENLETOBJECT_H
|
||||
#define Py_GREENLETOBJECT_H
|
||||
|
||||
|
||||
#include <Python.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* This is deprecated and undocumented. It does not change. */
|
||||
#define GREENLET_VERSION "1.0.0"
|
||||
|
||||
#ifndef GREENLET_MODULE
|
||||
#define implementation_ptr_t void*
|
||||
#endif
|
||||
|
||||
typedef struct _greenlet {
|
||||
PyObject_HEAD
|
||||
PyObject* weakreflist;
|
||||
PyObject* dict;
|
||||
implementation_ptr_t pimpl;
|
||||
} PyGreenlet;
|
||||
|
||||
#define PyGreenlet_Check(op) (op && PyObject_TypeCheck(op, &PyGreenlet_Type))
|
||||
|
||||
|
||||
/* C API functions */
|
||||
|
||||
/* Total number of symbols that are exported */
|
||||
#define PyGreenlet_API_pointers 12
|
||||
|
||||
#define PyGreenlet_Type_NUM 0
|
||||
#define PyExc_GreenletError_NUM 1
|
||||
#define PyExc_GreenletExit_NUM 2
|
||||
|
||||
#define PyGreenlet_New_NUM 3
|
||||
#define PyGreenlet_GetCurrent_NUM 4
|
||||
#define PyGreenlet_Throw_NUM 5
|
||||
#define PyGreenlet_Switch_NUM 6
|
||||
#define PyGreenlet_SetParent_NUM 7
|
||||
|
||||
#define PyGreenlet_MAIN_NUM 8
|
||||
#define PyGreenlet_STARTED_NUM 9
|
||||
#define PyGreenlet_ACTIVE_NUM 10
|
||||
#define PyGreenlet_GET_PARENT_NUM 11
|
||||
|
||||
#ifndef GREENLET_MODULE
|
||||
/* This section is used by modules that uses the greenlet C API */
|
||||
static void** _PyGreenlet_API = NULL;
|
||||
|
||||
# define PyGreenlet_Type \
|
||||
(*(PyTypeObject*)_PyGreenlet_API[PyGreenlet_Type_NUM])
|
||||
|
||||
# define PyExc_GreenletError \
|
||||
((PyObject*)_PyGreenlet_API[PyExc_GreenletError_NUM])
|
||||
|
||||
# define PyExc_GreenletExit \
|
||||
((PyObject*)_PyGreenlet_API[PyExc_GreenletExit_NUM])
|
||||
|
||||
/*
|
||||
* PyGreenlet_New(PyObject *args)
|
||||
*
|
||||
* greenlet.greenlet(run, parent=None)
|
||||
*/
|
||||
# define PyGreenlet_New \
|
||||
(*(PyGreenlet * (*)(PyObject * run, PyGreenlet * parent)) \
|
||||
_PyGreenlet_API[PyGreenlet_New_NUM])
|
||||
|
||||
/*
|
||||
* PyGreenlet_GetCurrent(void)
|
||||
*
|
||||
* greenlet.getcurrent()
|
||||
*/
|
||||
# define PyGreenlet_GetCurrent \
|
||||
(*(PyGreenlet * (*)(void)) _PyGreenlet_API[PyGreenlet_GetCurrent_NUM])
|
||||
|
||||
/*
|
||||
* PyGreenlet_Throw(
|
||||
* PyGreenlet *greenlet,
|
||||
* PyObject *typ,
|
||||
* PyObject *val,
|
||||
* PyObject *tb)
|
||||
*
|
||||
* g.throw(...)
|
||||
*/
|
||||
# define PyGreenlet_Throw \
|
||||
(*(PyObject * (*)(PyGreenlet * self, \
|
||||
PyObject * typ, \
|
||||
PyObject * val, \
|
||||
PyObject * tb)) \
|
||||
_PyGreenlet_API[PyGreenlet_Throw_NUM])
|
||||
|
||||
/*
|
||||
* PyGreenlet_Switch(PyGreenlet *greenlet, PyObject *args)
|
||||
*
|
||||
* g.switch(*args, **kwargs)
|
||||
*/
|
||||
# define PyGreenlet_Switch \
|
||||
(*(PyObject * \
|
||||
(*)(PyGreenlet * greenlet, PyObject * args, PyObject * kwargs)) \
|
||||
_PyGreenlet_API[PyGreenlet_Switch_NUM])
|
||||
|
||||
/*
|
||||
* PyGreenlet_SetParent(PyObject *greenlet, PyObject *new_parent)
|
||||
*
|
||||
* g.parent = new_parent
|
||||
*/
|
||||
# define PyGreenlet_SetParent \
|
||||
(*(int (*)(PyGreenlet * greenlet, PyGreenlet * nparent)) \
|
||||
_PyGreenlet_API[PyGreenlet_SetParent_NUM])
|
||||
|
||||
/*
|
||||
* PyGreenlet_GetParent(PyObject* greenlet)
|
||||
*
|
||||
* return greenlet.parent;
|
||||
*
|
||||
* This could return NULL even if there is no exception active.
|
||||
* If it does not return NULL, you are responsible for decrementing the
|
||||
* reference count.
|
||||
*/
|
||||
# define PyGreenlet_GetParent \
|
||||
(*(PyGreenlet* (*)(PyGreenlet*)) \
|
||||
_PyGreenlet_API[PyGreenlet_GET_PARENT_NUM])
|
||||
|
||||
/*
|
||||
* deprecated, undocumented alias.
|
||||
*/
|
||||
# define PyGreenlet_GET_PARENT PyGreenlet_GetParent
|
||||
|
||||
# define PyGreenlet_MAIN \
|
||||
(*(int (*)(PyGreenlet*)) \
|
||||
_PyGreenlet_API[PyGreenlet_MAIN_NUM])
|
||||
|
||||
# define PyGreenlet_STARTED \
|
||||
(*(int (*)(PyGreenlet*)) \
|
||||
_PyGreenlet_API[PyGreenlet_STARTED_NUM])
|
||||
|
||||
# define PyGreenlet_ACTIVE \
|
||||
(*(int (*)(PyGreenlet*)) \
|
||||
_PyGreenlet_API[PyGreenlet_ACTIVE_NUM])
|
||||
|
||||
|
||||
|
||||
|
||||
/* Macro that imports greenlet and initializes C API */
|
||||
/* NOTE: This has actually moved to ``greenlet._greenlet._C_API``, but we
|
||||
keep the older definition to be sure older code that might have a copy of
|
||||
the header still works. */
|
||||
# define PyGreenlet_Import() \
|
||||
{ \
|
||||
_PyGreenlet_API = (void**)PyCapsule_Import("greenlet._C_API", 0); \
|
||||
}
|
||||
|
||||
#endif /* GREENLET_MODULE */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif /* !Py_GREENLETOBJECT_H */
|
||||
Binary file not shown.
|
|
@ -0,0 +1,56 @@
|
|||
Metadata-Version: 2.1
|
||||
Name: Lazify
|
||||
Version: 0.4.0
|
||||
Summary: Lazify all the things!
|
||||
Home-page: https://github.com/numberly/lazify
|
||||
Author: Guillaume Gelin
|
||||
Author-email: ramnes@1000mercis.com
|
||||
License: BSD
|
||||
Platform: any
|
||||
Classifier: Intended Audience :: Developers
|
||||
Classifier: Operating System :: OS Independent
|
||||
Classifier: Programming Language :: Python
|
||||
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
||||
|
||||
.. _Babel: https://github.com/python-babel/babel
|
||||
|
||||
.. image:: https://raw.githubusercontent.com/numberly/lazify/master/logo.jpg
|
||||
:alt: Lazify all the things!
|
||||
:align: center
|
||||
|
||||
======
|
||||
Lazify
|
||||
======
|
||||
|
||||
.. image:: https://img.shields.io/pypi/v/lazify.svg
|
||||
:target: https://pypi.python.org/pypi/Lazify
|
||||
.. image:: https://img.shields.io/github/license/numberly/lazify.svg
|
||||
:target: https://github.com/numberly/lazify/blob/master/LICENSE
|
||||
.. image:: https://img.shields.io/travis/numberly/lazify.svg
|
||||
:target: https://travis-ci.org/numberly/lazify
|
||||
.. image:: https://img.shields.io/coveralls/numberly/lazify.svg
|
||||
:target: https://coveralls.io/github/numberly/lazify
|
||||
|
||||
|
|
||||
|
||||
Lazify aims to be the defacto standard and most complete library for Python
|
||||
tools related to `lazy evaluation
|
||||
<https://en.wikipedia.org/wiki/Lazy_evaluation>`_.
|
||||
|
||||
It's originally based on Babel_ and its ``babel.support.LazyProxy`` class.
|
||||
|
||||
|
||||
Install
|
||||
=======
|
||||
|
||||
.. code-block:: sh
|
||||
|
||||
$ pip install lazify
|
||||
|
||||
|
||||
License
|
||||
=======
|
||||
|
||||
BSD, as per Babel_ licensing
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
Lazify-0.4.0.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
|
||||
Lazify-0.4.0.dist-info/METADATA,sha256=Bqj-jyTdeYYNfAu-PjoSBuPlExhzh-x6UWVv8sKF904,1446
|
||||
Lazify-0.4.0.dist-info/RECORD,,
|
||||
Lazify-0.4.0.dist-info/WHEEL,sha256=gduuPyBvFJQSQ0zdyxF7k0zynDXbIbvg5ZBHoXum5uk,110
|
||||
Lazify-0.4.0.dist-info/top_level.txt,sha256=5LBlPwI7rts4RzBnivx7oB6g6fwE3R9D16VxT9y7L8Y,7
|
||||
__pycache__/lazify.cpython-312.pyc,,
|
||||
lazify.py,sha256=Pnv1Zu9hrtim-rU59a3n4VW3UY37RYAKoD_X43j34lw,5369
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
Wheel-Version: 1.0
|
||||
Generator: bdist_wheel (0.31.1)
|
||||
Root-Is-Purelib: true
|
||||
Tag: py2-none-any
|
||||
Tag: py3-none-any
|
||||
|
||||
|
|
@ -0,0 +1 @@
|
|||
lazify
|
||||
Binary file not shown.
|
|
@ -1,20 +0,0 @@
|
|||
from packaging import version
|
||||
|
||||
__version__ = "0.86.1"
|
||||
safe_version = __version__
|
||||
|
||||
try:
|
||||
from aider._version import __version__
|
||||
except Exception:
|
||||
__version__ = safe_version + "+import"
|
||||
|
||||
if type(__version__) is not str:
|
||||
__version__ = safe_version + "+type"
|
||||
else:
|
||||
try:
|
||||
if version.parse(__version__) < version.parse(safe_version):
|
||||
__version__ = safe_version + "+less"
|
||||
except Exception:
|
||||
__version__ = safe_version + "+parse"
|
||||
|
||||
__all__ = [__version__]
|
||||
|
|
@ -1,4 +0,0 @@
|
|||
from .main import main
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
|
@ -1,21 +0,0 @@
|
|||
# file generated by setuptools-scm
|
||||
# don't change, don't track in version control
|
||||
|
||||
__all__ = ["__version__", "__version_tuple__", "version", "version_tuple"]
|
||||
|
||||
TYPE_CHECKING = False
|
||||
if TYPE_CHECKING:
|
||||
from typing import Tuple
|
||||
from typing import Union
|
||||
|
||||
VERSION_TUPLE = Tuple[Union[int, str], ...]
|
||||
else:
|
||||
VERSION_TUPLE = object
|
||||
|
||||
version: str
|
||||
__version__: str
|
||||
__version_tuple__: VERSION_TUPLE
|
||||
version_tuple: VERSION_TUPLE
|
||||
|
||||
__version__ = version = '0.86.1'
|
||||
__version_tuple__ = version_tuple = (0, 86, 1)
|
||||
|
|
@ -1,258 +0,0 @@
|
|||
import json
|
||||
import platform
|
||||
import sys
|
||||
import time
|
||||
import uuid
|
||||
from pathlib import Path
|
||||
|
||||
from mixpanel import MixpanelException
|
||||
from posthog import Posthog
|
||||
|
||||
from aider import __version__
|
||||
from aider.dump import dump # noqa: F401
|
||||
from aider.models import model_info_manager
|
||||
|
||||
PERCENT = 10
|
||||
|
||||
|
||||
def compute_hex_threshold(percent):
|
||||
"""Convert percentage to 6-digit hex threshold.
|
||||
|
||||
Args:
|
||||
percent: Percentage threshold (0-100)
|
||||
|
||||
Returns:
|
||||
str: 6-digit hex threshold
|
||||
"""
|
||||
return format(int(0xFFFFFF * percent / 100), "06x")
|
||||
|
||||
|
||||
def is_uuid_in_percentage(uuid_str, percent):
|
||||
"""Check if a UUID string falls within the first X percent of the UUID space.
|
||||
|
||||
Args:
|
||||
uuid_str: UUID string to test
|
||||
percent: Percentage threshold (0-100)
|
||||
|
||||
Returns:
|
||||
bool: True if UUID falls within the first X percent
|
||||
"""
|
||||
if not (0 <= percent <= 100):
|
||||
raise ValueError("Percentage must be between 0 and 100")
|
||||
|
||||
if not uuid_str:
|
||||
return False
|
||||
|
||||
# Convert percentage to hex threshold (1% = "04...", 10% = "1a...", etc)
|
||||
# Using first 6 hex digits
|
||||
if percent == 0:
|
||||
return False
|
||||
|
||||
threshold = compute_hex_threshold(percent)
|
||||
return uuid_str[:6] <= threshold
|
||||
|
||||
|
||||
mixpanel_project_token = "6da9a43058a5d1b9f3353153921fb04d"
|
||||
posthog_project_api_key = "phc_99T7muzafUMMZX15H8XePbMSreEUzahHbtWjy3l5Qbv"
|
||||
posthog_host = "https://us.i.posthog.com"
|
||||
|
||||
|
||||
class Analytics:
|
||||
# providers
|
||||
mp = None
|
||||
ph = None
|
||||
|
||||
# saved
|
||||
user_id = None
|
||||
permanently_disable = None
|
||||
asked_opt_in = None
|
||||
|
||||
# ephemeral
|
||||
logfile = None
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
logfile=None,
|
||||
permanently_disable=False,
|
||||
posthog_host=None,
|
||||
posthog_project_api_key=None,
|
||||
):
|
||||
self.logfile = logfile
|
||||
self.get_or_create_uuid()
|
||||
self.custom_posthog_host = posthog_host
|
||||
self.custom_posthog_project_api_key = posthog_project_api_key
|
||||
|
||||
if self.permanently_disable or permanently_disable or not self.asked_opt_in:
|
||||
self.disable(permanently_disable)
|
||||
|
||||
def enable(self):
|
||||
if not self.user_id:
|
||||
self.disable(False)
|
||||
return
|
||||
|
||||
if self.permanently_disable:
|
||||
self.disable(True)
|
||||
return
|
||||
|
||||
if not self.asked_opt_in:
|
||||
self.disable(False)
|
||||
return
|
||||
|
||||
# self.mp = Mixpanel(mixpanel_project_token)
|
||||
self.ph = Posthog(
|
||||
project_api_key=self.custom_posthog_project_api_key or posthog_project_api_key,
|
||||
host=self.custom_posthog_host or posthog_host,
|
||||
on_error=self.posthog_error,
|
||||
enable_exception_autocapture=True,
|
||||
super_properties=self.get_system_info(), # Add system info to all events
|
||||
)
|
||||
|
||||
def disable(self, permanently):
|
||||
self.mp = None
|
||||
self.ph = None
|
||||
|
||||
if permanently:
|
||||
self.asked_opt_in = True
|
||||
self.permanently_disable = True
|
||||
self.save_data()
|
||||
|
||||
def need_to_ask(self, args_analytics):
|
||||
if args_analytics is False:
|
||||
return False
|
||||
|
||||
could_ask = not self.asked_opt_in and not self.permanently_disable
|
||||
if not could_ask:
|
||||
return False
|
||||
|
||||
if args_analytics is True:
|
||||
return True
|
||||
|
||||
assert args_analytics is None, args_analytics
|
||||
|
||||
if not self.user_id:
|
||||
return False
|
||||
|
||||
return is_uuid_in_percentage(self.user_id, PERCENT)
|
||||
|
||||
def get_data_file_path(self):
|
||||
try:
|
||||
data_file = Path.home() / ".aider" / "analytics.json"
|
||||
data_file.parent.mkdir(parents=True, exist_ok=True)
|
||||
return data_file
|
||||
except OSError:
|
||||
# If we can't create/access the directory, just disable analytics
|
||||
self.disable(permanently=False)
|
||||
return None
|
||||
|
||||
def get_or_create_uuid(self):
|
||||
self.load_data()
|
||||
if self.user_id:
|
||||
return
|
||||
|
||||
self.user_id = str(uuid.uuid4())
|
||||
self.save_data()
|
||||
|
||||
def load_data(self):
|
||||
data_file = self.get_data_file_path()
|
||||
if not data_file:
|
||||
return
|
||||
|
||||
if data_file.exists():
|
||||
try:
|
||||
data = json.loads(data_file.read_text())
|
||||
self.permanently_disable = data.get("permanently_disable")
|
||||
self.user_id = data.get("uuid")
|
||||
self.asked_opt_in = data.get("asked_opt_in", False)
|
||||
except (json.decoder.JSONDecodeError, OSError):
|
||||
self.disable(permanently=False)
|
||||
|
||||
def save_data(self):
|
||||
data_file = self.get_data_file_path()
|
||||
if not data_file:
|
||||
return
|
||||
|
||||
data = dict(
|
||||
uuid=self.user_id,
|
||||
permanently_disable=self.permanently_disable,
|
||||
asked_opt_in=self.asked_opt_in,
|
||||
)
|
||||
|
||||
try:
|
||||
data_file.write_text(json.dumps(data, indent=4))
|
||||
except OSError:
|
||||
# If we can't write the file, just disable analytics
|
||||
self.disable(permanently=False)
|
||||
|
||||
def get_system_info(self):
|
||||
return {
|
||||
"python_version": sys.version.split()[0],
|
||||
"os_platform": platform.system(),
|
||||
"os_release": platform.release(),
|
||||
"machine": platform.machine(),
|
||||
"aider_version": __version__,
|
||||
}
|
||||
|
||||
def _redact_model_name(self, model):
|
||||
if not model:
|
||||
return None
|
||||
|
||||
info = model_info_manager.get_model_from_cached_json_db(model.name)
|
||||
if info:
|
||||
return model.name
|
||||
elif "/" in model.name:
|
||||
return model.name.split("/")[0] + "/REDACTED"
|
||||
return None
|
||||
|
||||
def posthog_error(self):
|
||||
"""disable posthog if we get an error"""
|
||||
print("X" * 100)
|
||||
# https://github.com/PostHog/posthog-python/blob/9e1bb8c58afaa229da24c4fb576c08bb88a75752/posthog/consumer.py#L86
|
||||
# https://github.com/Aider-AI/aider/issues/2532
|
||||
self.ph = None
|
||||
|
||||
def event(self, event_name, main_model=None, **kwargs):
|
||||
if not self.mp and not self.ph and not self.logfile:
|
||||
return
|
||||
|
||||
properties = {}
|
||||
|
||||
if main_model:
|
||||
properties["main_model"] = self._redact_model_name(main_model)
|
||||
properties["weak_model"] = self._redact_model_name(main_model.weak_model)
|
||||
properties["editor_model"] = self._redact_model_name(main_model.editor_model)
|
||||
|
||||
properties.update(kwargs)
|
||||
|
||||
# Handle numeric values
|
||||
for key, value in properties.items():
|
||||
if isinstance(value, (int, float)):
|
||||
properties[key] = value
|
||||
else:
|
||||
properties[key] = str(value)
|
||||
|
||||
if self.mp:
|
||||
try:
|
||||
self.mp.track(self.user_id, event_name, dict(properties))
|
||||
except MixpanelException:
|
||||
self.mp = None # Disable mixpanel on connection errors
|
||||
|
||||
if self.ph:
|
||||
self.ph.capture(event_name, distinct_id=self.user_id, properties=dict(properties))
|
||||
|
||||
if self.logfile:
|
||||
log_entry = {
|
||||
"event": event_name,
|
||||
"properties": properties,
|
||||
"user_id": self.user_id,
|
||||
"time": int(time.time()),
|
||||
}
|
||||
try:
|
||||
with open(self.logfile, "a") as f:
|
||||
json.dump(log_entry, f)
|
||||
f.write("\n")
|
||||
except OSError:
|
||||
pass # Ignore OS errors when writing to logfile
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
dump(compute_hex_threshold(PERCENT))
|
||||
|
|
@ -1,945 +0,0 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
import argparse
|
||||
import os
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
import configargparse
|
||||
import shtab
|
||||
|
||||
from aider import __version__
|
||||
from aider.args_formatter import (
|
||||
DotEnvFormatter,
|
||||
MarkdownHelpFormatter,
|
||||
YamlHelpFormatter,
|
||||
)
|
||||
from aider.deprecated import add_deprecated_model_args
|
||||
|
||||
from .dump import dump # noqa: F401
|
||||
|
||||
|
||||
def resolve_aiderignore_path(path_str, git_root=None):
|
||||
path = Path(path_str)
|
||||
if path.is_absolute():
|
||||
return str(path)
|
||||
elif git_root:
|
||||
return str(Path(git_root) / path)
|
||||
return str(path)
|
||||
|
||||
|
||||
def default_env_file(git_root):
|
||||
return os.path.join(git_root, ".env") if git_root else ".env"
|
||||
|
||||
|
||||
def get_parser(default_config_files, git_root):
|
||||
parser = configargparse.ArgumentParser(
|
||||
description="aider is AI pair programming in your terminal",
|
||||
add_config_file_help=True,
|
||||
default_config_files=default_config_files,
|
||||
config_file_parser_class=configargparse.YAMLConfigFileParser,
|
||||
auto_env_var_prefix="AIDER_",
|
||||
)
|
||||
# List of valid edit formats for argparse validation & shtab completion.
|
||||
# Dynamically gather them from the registered coder classes so the list
|
||||
# stays in sync if new formats are added.
|
||||
from aider import coders as _aider_coders
|
||||
|
||||
edit_format_choices = sorted(
|
||||
{
|
||||
c.edit_format
|
||||
for c in _aider_coders.__all__
|
||||
if hasattr(c, "edit_format") and c.edit_format is not None
|
||||
}
|
||||
)
|
||||
group = parser.add_argument_group("Main model")
|
||||
group.add_argument(
|
||||
"files", metavar="FILE", nargs="*", help="files to edit with an LLM (optional)"
|
||||
).complete = shtab.FILE
|
||||
group.add_argument(
|
||||
"--model",
|
||||
metavar="MODEL",
|
||||
default=None,
|
||||
help="Specify the model to use for the main chat",
|
||||
)
|
||||
|
||||
##########
|
||||
group = parser.add_argument_group("API Keys and settings")
|
||||
group.add_argument(
|
||||
"--openai-api-key",
|
||||
help="Specify the OpenAI API key",
|
||||
)
|
||||
group.add_argument(
|
||||
"--anthropic-api-key",
|
||||
help="Specify the Anthropic API key",
|
||||
)
|
||||
group.add_argument(
|
||||
"--openai-api-base",
|
||||
help="Specify the api base url",
|
||||
)
|
||||
group.add_argument(
|
||||
"--openai-api-type",
|
||||
help="(deprecated, use --set-env OPENAI_API_TYPE=<value>)",
|
||||
)
|
||||
group.add_argument(
|
||||
"--openai-api-version",
|
||||
help="(deprecated, use --set-env OPENAI_API_VERSION=<value>)",
|
||||
)
|
||||
group.add_argument(
|
||||
"--openai-api-deployment-id",
|
||||
help="(deprecated, use --set-env OPENAI_API_DEPLOYMENT_ID=<value>)",
|
||||
)
|
||||
group.add_argument(
|
||||
"--openai-organization-id",
|
||||
help="(deprecated, use --set-env OPENAI_ORGANIZATION=<value>)",
|
||||
)
|
||||
group.add_argument(
|
||||
"--set-env",
|
||||
action="append",
|
||||
metavar="ENV_VAR_NAME=value",
|
||||
help="Set an environment variable (to control API settings, can be used multiple times)",
|
||||
default=[],
|
||||
)
|
||||
group.add_argument(
|
||||
"--api-key",
|
||||
action="append",
|
||||
metavar="PROVIDER=KEY",
|
||||
help=(
|
||||
"Set an API key for a provider (eg: --api-key provider=<key> sets"
|
||||
" PROVIDER_API_KEY=<key>)"
|
||||
),
|
||||
default=[],
|
||||
)
|
||||
group = parser.add_argument_group("Model settings")
|
||||
group.add_argument(
|
||||
"--list-models",
|
||||
"--models",
|
||||
metavar="MODEL",
|
||||
help="List known models which match the (partial) MODEL name",
|
||||
)
|
||||
group.add_argument(
|
||||
"--model-settings-file",
|
||||
metavar="MODEL_SETTINGS_FILE",
|
||||
default=".aider.model.settings.yml",
|
||||
help="Specify a file with aider model settings for unknown models",
|
||||
).complete = shtab.FILE
|
||||
group.add_argument(
|
||||
"--model-metadata-file",
|
||||
metavar="MODEL_METADATA_FILE",
|
||||
default=".aider.model.metadata.json",
|
||||
help="Specify a file with context window and costs for unknown models",
|
||||
).complete = shtab.FILE
|
||||
group.add_argument(
|
||||
"--alias",
|
||||
action="append",
|
||||
metavar="ALIAS:MODEL",
|
||||
help="Add a model alias (can be used multiple times)",
|
||||
)
|
||||
group.add_argument(
|
||||
"--reasoning-effort",
|
||||
type=str,
|
||||
help="Set the reasoning_effort API parameter (default: not set)",
|
||||
)
|
||||
group.add_argument(
|
||||
"--thinking-tokens",
|
||||
type=str,
|
||||
help=(
|
||||
"Set the thinking token budget for models that support it. Use 0 to disable. (default:"
|
||||
" not set)"
|
||||
),
|
||||
)
|
||||
group.add_argument(
|
||||
"--verify-ssl",
|
||||
action=argparse.BooleanOptionalAction,
|
||||
default=True,
|
||||
help="Verify the SSL cert when connecting to models (default: True)",
|
||||
)
|
||||
group.add_argument(
|
||||
"--timeout",
|
||||
type=float,
|
||||
default=None,
|
||||
help="Timeout in seconds for API calls (default: None)",
|
||||
)
|
||||
group.add_argument(
|
||||
"--edit-format",
|
||||
"--chat-mode",
|
||||
metavar="EDIT_FORMAT",
|
||||
choices=edit_format_choices,
|
||||
default=None,
|
||||
help="Specify what edit format the LLM should use (default depends on model)",
|
||||
)
|
||||
group.add_argument(
|
||||
"--architect",
|
||||
action="store_const",
|
||||
dest="edit_format",
|
||||
const="architect",
|
||||
help="Use architect edit format for the main chat",
|
||||
)
|
||||
group.add_argument(
|
||||
"--auto-accept-architect",
|
||||
action=argparse.BooleanOptionalAction,
|
||||
default=True,
|
||||
help="Enable/disable automatic acceptance of architect changes (default: True)",
|
||||
)
|
||||
group.add_argument(
|
||||
"--weak-model",
|
||||
metavar="WEAK_MODEL",
|
||||
default=None,
|
||||
help=(
|
||||
"Specify the model to use for commit messages and chat history summarization (default"
|
||||
" depends on --model)"
|
||||
),
|
||||
)
|
||||
group.add_argument(
|
||||
"--editor-model",
|
||||
metavar="EDITOR_MODEL",
|
||||
default=None,
|
||||
help="Specify the model to use for editor tasks (default depends on --model)",
|
||||
)
|
||||
group.add_argument(
|
||||
"--editor-edit-format",
|
||||
metavar="EDITOR_EDIT_FORMAT",
|
||||
choices=edit_format_choices,
|
||||
default=None,
|
||||
help="Specify the edit format for the editor model (default: depends on editor model)",
|
||||
)
|
||||
group.add_argument(
|
||||
"--show-model-warnings",
|
||||
action=argparse.BooleanOptionalAction,
|
||||
default=True,
|
||||
help="Only work with models that have meta-data available (default: True)",
|
||||
)
|
||||
group.add_argument(
|
||||
"--check-model-accepts-settings",
|
||||
action=argparse.BooleanOptionalAction,
|
||||
default=True,
|
||||
help=(
|
||||
"Check if model accepts settings like reasoning_effort/thinking_tokens (default: True)"
|
||||
),
|
||||
)
|
||||
group.add_argument(
|
||||
"--max-chat-history-tokens",
|
||||
type=int,
|
||||
default=None,
|
||||
help=(
|
||||
"Soft limit on tokens for chat history, after which summarization begins."
|
||||
" If unspecified, defaults to the model's max_chat_history_tokens."
|
||||
),
|
||||
)
|
||||
|
||||
##########
|
||||
group = parser.add_argument_group("Cache settings")
|
||||
group.add_argument(
|
||||
"--cache-prompts",
|
||||
action=argparse.BooleanOptionalAction,
|
||||
default=False,
|
||||
help="Enable caching of prompts (default: False)",
|
||||
)
|
||||
group.add_argument(
|
||||
"--cache-keepalive-pings",
|
||||
type=int,
|
||||
default=0,
|
||||
help="Number of times to ping at 5min intervals to keep prompt cache warm (default: 0)",
|
||||
)
|
||||
|
||||
##########
|
||||
group = parser.add_argument_group("Repomap settings")
|
||||
group.add_argument(
|
||||
"--map-tokens",
|
||||
type=int,
|
||||
default=None,
|
||||
help="Suggested number of tokens to use for repo map, use 0 to disable",
|
||||
)
|
||||
group.add_argument(
|
||||
"--map-refresh",
|
||||
choices=["auto", "always", "files", "manual"],
|
||||
default="auto",
|
||||
help=(
|
||||
"Control how often the repo map is refreshed. Options: auto, always, files, manual"
|
||||
" (default: auto)"
|
||||
),
|
||||
)
|
||||
group.add_argument(
|
||||
"--map-multiplier-no-files",
|
||||
type=float,
|
||||
default=2,
|
||||
help="Multiplier for map tokens when no files are specified (default: 2)",
|
||||
)
|
||||
|
||||
##########
|
||||
group = parser.add_argument_group("History Files")
|
||||
default_input_history_file = (
|
||||
os.path.join(git_root, ".aider.input.history") if git_root else ".aider.input.history"
|
||||
)
|
||||
default_chat_history_file = (
|
||||
os.path.join(git_root, ".aider.chat.history.md") if git_root else ".aider.chat.history.md"
|
||||
)
|
||||
group.add_argument(
|
||||
"--input-history-file",
|
||||
metavar="INPUT_HISTORY_FILE",
|
||||
default=default_input_history_file,
|
||||
help=f"Specify the chat input history file (default: {default_input_history_file})",
|
||||
).complete = shtab.FILE
|
||||
group.add_argument(
|
||||
"--chat-history-file",
|
||||
metavar="CHAT_HISTORY_FILE",
|
||||
default=default_chat_history_file,
|
||||
help=f"Specify the chat history file (default: {default_chat_history_file})",
|
||||
).complete = shtab.FILE
|
||||
group.add_argument(
|
||||
"--restore-chat-history",
|
||||
action=argparse.BooleanOptionalAction,
|
||||
default=False,
|
||||
help="Restore the previous chat history messages (default: False)",
|
||||
)
|
||||
group.add_argument(
|
||||
"--llm-history-file",
|
||||
metavar="LLM_HISTORY_FILE",
|
||||
default=None,
|
||||
help="Log the conversation with the LLM to this file (for example, .aider.llm.history)",
|
||||
).complete = shtab.FILE
|
||||
|
||||
##########
|
||||
group = parser.add_argument_group("Output settings")
|
||||
group.add_argument(
|
||||
"--dark-mode",
|
||||
action="store_true",
|
||||
help="Use colors suitable for a dark terminal background (default: False)",
|
||||
default=False,
|
||||
)
|
||||
group.add_argument(
|
||||
"--light-mode",
|
||||
action="store_true",
|
||||
help="Use colors suitable for a light terminal background (default: False)",
|
||||
default=False,
|
||||
)
|
||||
group.add_argument(
|
||||
"--pretty",
|
||||
action=argparse.BooleanOptionalAction,
|
||||
default=True,
|
||||
help="Enable/disable pretty, colorized output (default: True)",
|
||||
)
|
||||
group.add_argument(
|
||||
"--stream",
|
||||
action=argparse.BooleanOptionalAction,
|
||||
default=True,
|
||||
help="Enable/disable streaming responses (default: True)",
|
||||
)
|
||||
group.add_argument(
|
||||
"--user-input-color",
|
||||
default="#00cc00",
|
||||
help="Set the color for user input (default: #00cc00)",
|
||||
)
|
||||
group.add_argument(
|
||||
"--tool-output-color",
|
||||
default=None,
|
||||
help="Set the color for tool output (default: None)",
|
||||
)
|
||||
group.add_argument(
|
||||
"--tool-error-color",
|
||||
default="#FF2222",
|
||||
help="Set the color for tool error messages (default: #FF2222)",
|
||||
)
|
||||
group.add_argument(
|
||||
"--tool-warning-color",
|
||||
default="#FFA500",
|
||||
help="Set the color for tool warning messages (default: #FFA500)",
|
||||
)
|
||||
group.add_argument(
|
||||
"--assistant-output-color",
|
||||
default="#0088ff",
|
||||
help="Set the color for assistant output (default: #0088ff)",
|
||||
)
|
||||
group.add_argument(
|
||||
"--completion-menu-color",
|
||||
metavar="COLOR",
|
||||
default=None,
|
||||
help="Set the color for the completion menu (default: terminal's default text color)",
|
||||
)
|
||||
group.add_argument(
|
||||
"--completion-menu-bg-color",
|
||||
metavar="COLOR",
|
||||
default=None,
|
||||
help=(
|
||||
"Set the background color for the completion menu (default: terminal's default"
|
||||
" background color)"
|
||||
),
|
||||
)
|
||||
group.add_argument(
|
||||
"--completion-menu-current-color",
|
||||
metavar="COLOR",
|
||||
default=None,
|
||||
help=(
|
||||
"Set the color for the current item in the completion menu (default: terminal's default"
|
||||
" background color)"
|
||||
),
|
||||
)
|
||||
group.add_argument(
|
||||
"--completion-menu-current-bg-color",
|
||||
metavar="COLOR",
|
||||
default=None,
|
||||
help=(
|
||||
"Set the background color for the current item in the completion menu (default:"
|
||||
" terminal's default text color)"
|
||||
),
|
||||
)
|
||||
group.add_argument(
|
||||
"--code-theme",
|
||||
default="default",
|
||||
help=(
|
||||
"Set the markdown code theme (default: default, other options include monokai,"
|
||||
" solarized-dark, solarized-light, or a Pygments builtin style,"
|
||||
" see https://pygments.org/styles for available themes)"
|
||||
),
|
||||
)
|
||||
group.add_argument(
|
||||
"--show-diffs",
|
||||
action="store_true",
|
||||
help="Show diffs when committing changes (default: False)",
|
||||
default=False,
|
||||
)
|
||||
|
||||
##########
|
||||
group = parser.add_argument_group("Git settings")
|
||||
group.add_argument(
|
||||
"--git",
|
||||
action=argparse.BooleanOptionalAction,
|
||||
default=True,
|
||||
help="Enable/disable looking for a git repo (default: True)",
|
||||
)
|
||||
group.add_argument(
|
||||
"--gitignore",
|
||||
action=argparse.BooleanOptionalAction,
|
||||
default=True,
|
||||
help="Enable/disable adding .aider* to .gitignore (default: True)",
|
||||
)
|
||||
group.add_argument(
|
||||
"--add-gitignore-files",
|
||||
action=argparse.BooleanOptionalAction,
|
||||
default=False,
|
||||
help="Enable/disable the addition of files listed in .gitignore to Aider's editing scope.",
|
||||
)
|
||||
default_aiderignore_file = (
|
||||
os.path.join(git_root, ".aiderignore") if git_root else ".aiderignore"
|
||||
)
|
||||
|
||||
group.add_argument(
|
||||
"--aiderignore",
|
||||
metavar="AIDERIGNORE",
|
||||
type=lambda path_str: resolve_aiderignore_path(path_str, git_root),
|
||||
default=default_aiderignore_file,
|
||||
help="Specify the aider ignore file (default: .aiderignore in git root)",
|
||||
).complete = shtab.FILE
|
||||
group.add_argument(
|
||||
"--subtree-only",
|
||||
action="store_true",
|
||||
help="Only consider files in the current subtree of the git repository",
|
||||
default=False,
|
||||
)
|
||||
group.add_argument(
|
||||
"--auto-commits",
|
||||
action=argparse.BooleanOptionalAction,
|
||||
default=True,
|
||||
help="Enable/disable auto commit of LLM changes (default: True)",
|
||||
)
|
||||
group.add_argument(
|
||||
"--dirty-commits",
|
||||
action=argparse.BooleanOptionalAction,
|
||||
default=True,
|
||||
help="Enable/disable commits when repo is found dirty (default: True)",
|
||||
)
|
||||
group.add_argument(
|
||||
"--attribute-author",
|
||||
action=argparse.BooleanOptionalAction,
|
||||
default=None,
|
||||
help=(
|
||||
"Attribute aider code changes in the git author name (default: True). If explicitly set"
|
||||
" to True, overrides --attribute-co-authored-by precedence."
|
||||
),
|
||||
)
|
||||
group.add_argument(
|
||||
"--attribute-committer",
|
||||
action=argparse.BooleanOptionalAction,
|
||||
default=None,
|
||||
help=(
|
||||
"Attribute aider commits in the git committer name (default: True). If explicitly set"
|
||||
" to True, overrides --attribute-co-authored-by precedence for aider edits."
|
||||
),
|
||||
)
|
||||
group.add_argument(
|
||||
"--attribute-commit-message-author",
|
||||
action=argparse.BooleanOptionalAction,
|
||||
default=False,
|
||||
help="Prefix commit messages with 'aider: ' if aider authored the changes (default: False)",
|
||||
)
|
||||
group.add_argument(
|
||||
"--attribute-commit-message-committer",
|
||||
action=argparse.BooleanOptionalAction,
|
||||
default=False,
|
||||
help="Prefix all commit messages with 'aider: ' (default: False)",
|
||||
)
|
||||
group.add_argument(
|
||||
"--attribute-co-authored-by",
|
||||
action=argparse.BooleanOptionalAction,
|
||||
default=True,
|
||||
help=(
|
||||
"Attribute aider edits using the Co-authored-by trailer in the commit message"
|
||||
" (default: True). If True, this takes precedence over default --attribute-author and"
|
||||
" --attribute-committer behavior unless they are explicitly set to True."
|
||||
),
|
||||
)
|
||||
group.add_argument(
|
||||
"--git-commit-verify",
|
||||
action=argparse.BooleanOptionalAction,
|
||||
default=False,
|
||||
help="Enable/disable git pre-commit hooks with --no-verify (default: False)",
|
||||
)
|
||||
group.add_argument(
|
||||
"--commit",
|
||||
action="store_true",
|
||||
help="Commit all pending changes with a suitable commit message, then exit",
|
||||
default=False,
|
||||
)
|
||||
group.add_argument(
|
||||
"--commit-prompt",
|
||||
metavar="PROMPT",
|
||||
help="Specify a custom prompt for generating commit messages",
|
||||
)
|
||||
group.add_argument(
|
||||
"--dry-run",
|
||||
action=argparse.BooleanOptionalAction,
|
||||
default=False,
|
||||
help="Perform a dry run without modifying files (default: False)",
|
||||
)
|
||||
group.add_argument(
|
||||
"--skip-sanity-check-repo",
|
||||
action="store_true",
|
||||
help="Skip the sanity check for the git repository (default: False)",
|
||||
default=False,
|
||||
)
|
||||
group.add_argument(
|
||||
"--watch-files",
|
||||
action=argparse.BooleanOptionalAction,
|
||||
default=False,
|
||||
help="Enable/disable watching files for ai coding comments (default: False)",
|
||||
)
|
||||
group = parser.add_argument_group("Fixing and committing")
|
||||
group.add_argument(
|
||||
"--lint",
|
||||
action="store_true",
|
||||
help="Lint and fix provided files, or dirty files if none provided",
|
||||
default=False,
|
||||
)
|
||||
group.add_argument(
|
||||
"--lint-cmd",
|
||||
action="append",
|
||||
help=(
|
||||
'Specify lint commands to run for different languages, eg: "python: flake8'
|
||||
' --select=..." (can be used multiple times)'
|
||||
),
|
||||
default=[],
|
||||
)
|
||||
group.add_argument(
|
||||
"--auto-lint",
|
||||
action=argparse.BooleanOptionalAction,
|
||||
default=True,
|
||||
help="Enable/disable automatic linting after changes (default: True)",
|
||||
)
|
||||
group.add_argument(
|
||||
"--test-cmd",
|
||||
help="Specify command to run tests",
|
||||
default=[],
|
||||
)
|
||||
group.add_argument(
|
||||
"--auto-test",
|
||||
action=argparse.BooleanOptionalAction,
|
||||
default=False,
|
||||
help="Enable/disable automatic testing after changes (default: False)",
|
||||
)
|
||||
group.add_argument(
|
||||
"--test",
|
||||
action="store_true",
|
||||
help="Run tests, fix problems found and then exit",
|
||||
default=False,
|
||||
)
|
||||
|
||||
##########
|
||||
group = parser.add_argument_group("Analytics")
|
||||
group.add_argument(
|
||||
"--analytics",
|
||||
action=argparse.BooleanOptionalAction,
|
||||
default=None,
|
||||
help="Enable/disable analytics for current session (default: random)",
|
||||
)
|
||||
group.add_argument(
|
||||
"--analytics-log",
|
||||
metavar="ANALYTICS_LOG_FILE",
|
||||
help="Specify a file to log analytics events",
|
||||
).complete = shtab.FILE
|
||||
group.add_argument(
|
||||
"--analytics-disable",
|
||||
action="store_true",
|
||||
help="Permanently disable analytics",
|
||||
default=False,
|
||||
)
|
||||
group.add_argument(
|
||||
"--analytics-posthog-host",
|
||||
metavar="ANALYTICS_POSTHOG_HOST",
|
||||
help="Send analytics to custom PostHog instance",
|
||||
)
|
||||
group.add_argument(
|
||||
"--analytics-posthog-project-api-key",
|
||||
metavar="ANALYTICS_POSTHOG_PROJECT_API_KEY",
|
||||
help="Send analytics to custom PostHog project",
|
||||
)
|
||||
|
||||
#########
|
||||
group = parser.add_argument_group("Upgrading")
|
||||
group.add_argument(
|
||||
"--just-check-update",
|
||||
action="store_true",
|
||||
help="Check for updates and return status in the exit code",
|
||||
default=False,
|
||||
)
|
||||
group.add_argument(
|
||||
"--check-update",
|
||||
action=argparse.BooleanOptionalAction,
|
||||
help="Check for new aider versions on launch",
|
||||
default=True,
|
||||
)
|
||||
group.add_argument(
|
||||
"--show-release-notes",
|
||||
action=argparse.BooleanOptionalAction,
|
||||
help="Show release notes on first run of new version (default: None, ask user)",
|
||||
default=None,
|
||||
)
|
||||
group.add_argument(
|
||||
"--install-main-branch",
|
||||
action="store_true",
|
||||
help="Install the latest version from the main branch",
|
||||
default=False,
|
||||
)
|
||||
group.add_argument(
|
||||
"--upgrade",
|
||||
"--update",
|
||||
action="store_true",
|
||||
help="Upgrade aider to the latest version from PyPI",
|
||||
default=False,
|
||||
)
|
||||
group.add_argument(
|
||||
"--version",
|
||||
action="version",
|
||||
version=f"%(prog)s {__version__}",
|
||||
help="Show the version number and exit",
|
||||
)
|
||||
|
||||
##########
|
||||
group = parser.add_argument_group("Modes")
|
||||
group.add_argument(
|
||||
"--message",
|
||||
"--msg",
|
||||
"-m",
|
||||
metavar="COMMAND",
|
||||
help=(
|
||||
"Specify a single message to send the LLM, process reply then exit (disables chat mode)"
|
||||
),
|
||||
)
|
||||
group.add_argument(
|
||||
"--message-file",
|
||||
"-f",
|
||||
metavar="MESSAGE_FILE",
|
||||
help=(
|
||||
"Specify a file containing the message to send the LLM, process reply, then exit"
|
||||
" (disables chat mode)"
|
||||
),
|
||||
).complete = shtab.FILE
|
||||
group.add_argument(
|
||||
"--gui",
|
||||
"--browser",
|
||||
action=argparse.BooleanOptionalAction,
|
||||
help="Run aider in your browser (default: False)",
|
||||
default=False,
|
||||
)
|
||||
group.add_argument(
|
||||
"--copy-paste",
|
||||
action=argparse.BooleanOptionalAction,
|
||||
default=False,
|
||||
help="Enable automatic copy/paste of chat between aider and web UI (default: False)",
|
||||
)
|
||||
group.add_argument(
|
||||
"--apply",
|
||||
metavar="FILE",
|
||||
help="Apply the changes from the given file instead of running the chat (debug)",
|
||||
).complete = shtab.FILE
|
||||
group.add_argument(
|
||||
"--apply-clipboard-edits",
|
||||
action="store_true",
|
||||
help="Apply clipboard contents as edits using the main model's editor format",
|
||||
default=False,
|
||||
)
|
||||
group.add_argument(
|
||||
"--exit",
|
||||
action="store_true",
|
||||
help="Do all startup activities then exit before accepting user input (debug)",
|
||||
default=False,
|
||||
)
|
||||
group.add_argument(
|
||||
"--show-repo-map",
|
||||
action="store_true",
|
||||
help="Print the repo map and exit (debug)",
|
||||
default=False,
|
||||
)
|
||||
group.add_argument(
|
||||
"--show-prompts",
|
||||
action="store_true",
|
||||
help="Print the system prompts and exit (debug)",
|
||||
default=False,
|
||||
)
|
||||
|
||||
##########
|
||||
group = parser.add_argument_group("Voice settings")
|
||||
group.add_argument(
|
||||
"--voice-format",
|
||||
metavar="VOICE_FORMAT",
|
||||
default="wav",
|
||||
choices=["wav", "mp3", "webm"],
|
||||
help="Audio format for voice recording (default: wav). webm and mp3 require ffmpeg",
|
||||
)
|
||||
group.add_argument(
|
||||
"--voice-language",
|
||||
metavar="VOICE_LANGUAGE",
|
||||
default="en",
|
||||
help="Specify the language for voice using ISO 639-1 code (default: auto)",
|
||||
)
|
||||
group.add_argument(
|
||||
"--voice-input-device",
|
||||
metavar="VOICE_INPUT_DEVICE",
|
||||
default=None,
|
||||
help="Specify the input device name for voice recording",
|
||||
)
|
||||
|
||||
######
|
||||
group = parser.add_argument_group("Other settings")
|
||||
group.add_argument(
|
||||
"--disable-playwright",
|
||||
action="store_true",
|
||||
help="Never prompt for or attempt to install Playwright for web scraping (default: False).",
|
||||
default=False,
|
||||
)
|
||||
group.add_argument(
|
||||
"--file",
|
||||
action="append",
|
||||
metavar="FILE",
|
||||
help="specify a file to edit (can be used multiple times)",
|
||||
).complete = shtab.FILE
|
||||
group.add_argument(
|
||||
"--read",
|
||||
action="append",
|
||||
metavar="FILE",
|
||||
help="specify a read-only file (can be used multiple times)",
|
||||
).complete = shtab.FILE
|
||||
group.add_argument(
|
||||
"--vim",
|
||||
action="store_true",
|
||||
help="Use VI editing mode in the terminal (default: False)",
|
||||
default=False,
|
||||
)
|
||||
group.add_argument(
|
||||
"--chat-language",
|
||||
metavar="CHAT_LANGUAGE",
|
||||
default=None,
|
||||
help="Specify the language to use in the chat (default: None, uses system settings)",
|
||||
)
|
||||
group.add_argument(
|
||||
"--commit-language",
|
||||
metavar="COMMIT_LANGUAGE",
|
||||
default=None,
|
||||
help="Specify the language to use in the commit message (default: None, user language)",
|
||||
)
|
||||
group.add_argument(
|
||||
"--yes-always",
|
||||
action="store_true",
|
||||
help="Always say yes to every confirmation",
|
||||
default=None,
|
||||
)
|
||||
group.add_argument(
|
||||
"-v",
|
||||
"--verbose",
|
||||
action="store_true",
|
||||
help="Enable verbose output",
|
||||
default=False,
|
||||
)
|
||||
group.add_argument(
|
||||
"--load",
|
||||
metavar="LOAD_FILE",
|
||||
help="Load and execute /commands from a file on launch",
|
||||
).complete = shtab.FILE
|
||||
group.add_argument(
|
||||
"--encoding",
|
||||
default="utf-8",
|
||||
help="Specify the encoding for input and output (default: utf-8)",
|
||||
)
|
||||
group.add_argument(
|
||||
"--line-endings",
|
||||
choices=["platform", "lf", "crlf"],
|
||||
default="platform",
|
||||
help="Line endings to use when writing files (default: platform)",
|
||||
)
|
||||
group.add_argument(
|
||||
"-c",
|
||||
"--config",
|
||||
is_config_file=True,
|
||||
metavar="CONFIG_FILE",
|
||||
help=(
|
||||
"Specify the config file (default: search for .aider.conf.yml in git root, cwd"
|
||||
" or home directory)"
|
||||
),
|
||||
).complete = shtab.FILE
|
||||
# This is a duplicate of the argument in the preparser and is a no-op by this time of
|
||||
# argument parsing, but it's here so that the help is displayed as expected.
|
||||
group.add_argument(
|
||||
"--env-file",
|
||||
metavar="ENV_FILE",
|
||||
default=default_env_file(git_root),
|
||||
help="Specify the .env file to load (default: .env in git root)",
|
||||
).complete = shtab.FILE
|
||||
group.add_argument(
|
||||
"--suggest-shell-commands",
|
||||
action=argparse.BooleanOptionalAction,
|
||||
default=True,
|
||||
help="Enable/disable suggesting shell commands (default: True)",
|
||||
)
|
||||
group.add_argument(
|
||||
"--fancy-input",
|
||||
action=argparse.BooleanOptionalAction,
|
||||
default=True,
|
||||
help="Enable/disable fancy input with history and completion (default: True)",
|
||||
)
|
||||
group.add_argument(
|
||||
"--multiline",
|
||||
action=argparse.BooleanOptionalAction,
|
||||
default=False,
|
||||
help="Enable/disable multi-line input mode with Meta-Enter to submit (default: False)",
|
||||
)
|
||||
group.add_argument(
|
||||
"--notifications",
|
||||
action=argparse.BooleanOptionalAction,
|
||||
default=False,
|
||||
help=(
|
||||
"Enable/disable terminal bell notifications when LLM responses are ready (default:"
|
||||
" False)"
|
||||
),
|
||||
)
|
||||
group.add_argument(
|
||||
"--notifications-command",
|
||||
metavar="COMMAND",
|
||||
default=None,
|
||||
help=(
|
||||
"Specify a command to run for notifications instead of the terminal bell. If not"
|
||||
" specified, a default command for your OS may be used."
|
||||
),
|
||||
)
|
||||
group.add_argument(
|
||||
"--detect-urls",
|
||||
action=argparse.BooleanOptionalAction,
|
||||
default=True,
|
||||
help="Enable/disable detection and offering to add URLs to chat (default: True)",
|
||||
)
|
||||
group.add_argument(
|
||||
"--editor",
|
||||
help="Specify which editor to use for the /editor command",
|
||||
)
|
||||
|
||||
supported_shells_list = sorted(list(shtab.SUPPORTED_SHELLS))
|
||||
group.add_argument(
|
||||
"--shell-completions",
|
||||
metavar="SHELL",
|
||||
choices=supported_shells_list,
|
||||
help=(
|
||||
"Print shell completion script for the specified SHELL and exit. Supported shells:"
|
||||
f" {', '.join(supported_shells_list)}. Example: aider --shell-completions bash"
|
||||
),
|
||||
)
|
||||
|
||||
##########
|
||||
group = parser.add_argument_group("Deprecated model settings")
|
||||
# Add deprecated model shortcut arguments
|
||||
add_deprecated_model_args(parser, group)
|
||||
|
||||
return parser
|
||||
|
||||
|
||||
def get_md_help():
|
||||
os.environ["COLUMNS"] = "70"
|
||||
sys.argv = ["aider"]
|
||||
parser = get_parser([], None)
|
||||
|
||||
# This instantiates all the action.env_var values
|
||||
parser.parse_known_args()
|
||||
|
||||
parser.formatter_class = MarkdownHelpFormatter
|
||||
|
||||
return argparse.ArgumentParser.format_help(parser)
|
||||
|
||||
|
||||
def get_sample_yaml():
|
||||
os.environ["COLUMNS"] = "100"
|
||||
sys.argv = ["aider"]
|
||||
parser = get_parser([], None)
|
||||
|
||||
# This instantiates all the action.env_var values
|
||||
parser.parse_known_args()
|
||||
|
||||
parser.formatter_class = YamlHelpFormatter
|
||||
|
||||
return argparse.ArgumentParser.format_help(parser)
|
||||
|
||||
|
||||
def get_sample_dotenv():
|
||||
os.environ["COLUMNS"] = "120"
|
||||
sys.argv = ["aider"]
|
||||
parser = get_parser([], None)
|
||||
|
||||
# This instantiates all the action.env_var values
|
||||
parser.parse_known_args()
|
||||
|
||||
parser.formatter_class = DotEnvFormatter
|
||||
|
||||
return argparse.ArgumentParser.format_help(parser)
|
||||
|
||||
|
||||
def main():
|
||||
if len(sys.argv) > 1:
|
||||
command = sys.argv[1]
|
||||
else:
|
||||
command = "yaml" # Default to yaml if no command is given
|
||||
|
||||
if command == "md":
|
||||
print(get_md_help())
|
||||
elif command == "dotenv":
|
||||
print(get_sample_dotenv())
|
||||
elif command == "yaml":
|
||||
print(get_sample_yaml())
|
||||
elif command == "completion":
|
||||
if len(sys.argv) > 2:
|
||||
shell = sys.argv[2]
|
||||
if shell not in shtab.SUPPORTED_SHELLS:
|
||||
print(f"Error: Unsupported shell '{shell}'.", file=sys.stderr)
|
||||
print(f"Supported shells are: {', '.join(shtab.SUPPORTED_SHELLS)}", file=sys.stderr)
|
||||
sys.exit(1)
|
||||
parser = get_parser([], None)
|
||||
parser.prog = "aider" # Set the program name on the parser
|
||||
print(shtab.complete(parser, shell=shell))
|
||||
else:
|
||||
print("Error: Please specify a shell for completion.", file=sys.stderr)
|
||||
print(f"Usage: python {sys.argv[0]} completion <shell_name>", file=sys.stderr)
|
||||
print(f"Supported shells are: {', '.join(shtab.SUPPORTED_SHELLS)}", file=sys.stderr)
|
||||
sys.exit(1)
|
||||
else:
|
||||
# Default to YAML for any other unrecognized argument, or if 'yaml' was explicitly passed
|
||||
print(get_sample_yaml())
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
status = main()
|
||||
sys.exit(status)
|
||||
|
|
@ -1,228 +0,0 @@
|
|||
import argparse
|
||||
|
||||
from aider import urls
|
||||
|
||||
from .dump import dump # noqa: F401
|
||||
|
||||
|
||||
class DotEnvFormatter(argparse.HelpFormatter):
|
||||
def start_section(self, heading):
|
||||
res = "\n\n"
|
||||
res += "#" * (len(heading) + 3)
|
||||
res += f"\n# {heading}"
|
||||
super().start_section(res)
|
||||
|
||||
def _format_usage(self, usage, actions, groups, prefix):
|
||||
return ""
|
||||
|
||||
def _format_text(self, text):
|
||||
return f"""
|
||||
##########################################################
|
||||
# Sample aider .env file.
|
||||
# Place at the root of your git repo.
|
||||
# Or use `aider --env <fname>` to specify.
|
||||
##########################################################
|
||||
|
||||
#################
|
||||
# LLM parameters:
|
||||
#
|
||||
# Include xxx_API_KEY parameters and other params needed for your LLMs.
|
||||
# See {urls.llms} for details.
|
||||
|
||||
## OpenAI
|
||||
#OPENAI_API_KEY=
|
||||
|
||||
## Anthropic
|
||||
#ANTHROPIC_API_KEY=
|
||||
|
||||
##...
|
||||
"""
|
||||
|
||||
def _format_action(self, action):
|
||||
if not action.option_strings:
|
||||
return ""
|
||||
|
||||
if not action.env_var:
|
||||
return
|
||||
|
||||
parts = [""]
|
||||
|
||||
default = action.default
|
||||
if default == argparse.SUPPRESS:
|
||||
default = ""
|
||||
elif isinstance(default, str):
|
||||
pass
|
||||
elif isinstance(default, list) and not default:
|
||||
default = ""
|
||||
elif action.default is not None:
|
||||
default = "true" if default else "false"
|
||||
else:
|
||||
default = ""
|
||||
|
||||
if action.help:
|
||||
parts.append(f"## {action.help}")
|
||||
|
||||
if action.env_var:
|
||||
env_var = action.env_var
|
||||
if default:
|
||||
parts.append(f"#{env_var}={default}\n")
|
||||
else:
|
||||
parts.append(f"#{env_var}=\n")
|
||||
|
||||
return "\n".join(parts) + "\n"
|
||||
|
||||
def _format_action_invocation(self, action):
|
||||
return ""
|
||||
|
||||
def _format_args(self, action, default_metavar):
|
||||
return ""
|
||||
|
||||
|
||||
class YamlHelpFormatter(argparse.HelpFormatter):
|
||||
def start_section(self, heading):
|
||||
res = "\n\n"
|
||||
res += "#" * (len(heading) + 3)
|
||||
res += f"\n# {heading}"
|
||||
super().start_section(res)
|
||||
|
||||
def _format_usage(self, usage, actions, groups, prefix):
|
||||
return ""
|
||||
|
||||
def _format_text(self, text):
|
||||
return """
|
||||
##########################################################
|
||||
# Sample .aider.conf.yml
|
||||
# This file lists *all* the valid configuration entries.
|
||||
# Place in your home dir, or at the root of your git repo.
|
||||
##########################################################
|
||||
|
||||
# Note: You can only put OpenAI and Anthropic API keys in the YAML
|
||||
# config file. Keys for all APIs can be stored in a .env file
|
||||
# https://aider.chat/docs/config/dotenv.html
|
||||
|
||||
"""
|
||||
|
||||
def _format_action(self, action):
|
||||
if not action.option_strings:
|
||||
return ""
|
||||
|
||||
parts = [""]
|
||||
|
||||
metavar = action.metavar
|
||||
if not metavar and isinstance(action, argparse._StoreAction):
|
||||
metavar = "VALUE"
|
||||
|
||||
default = action.default
|
||||
if default == argparse.SUPPRESS:
|
||||
default = ""
|
||||
elif isinstance(default, str):
|
||||
pass
|
||||
elif isinstance(default, list) and not default:
|
||||
default = ""
|
||||
elif action.default is not None:
|
||||
default = "true" if default else "false"
|
||||
else:
|
||||
default = ""
|
||||
|
||||
if action.help:
|
||||
parts.append(f"## {action.help}")
|
||||
|
||||
for switch in action.option_strings:
|
||||
if switch.startswith("--"):
|
||||
break
|
||||
switch = switch.lstrip("-")
|
||||
|
||||
if isinstance(action, argparse._StoreTrueAction):
|
||||
default = False
|
||||
elif isinstance(action, argparse._StoreConstAction):
|
||||
default = False
|
||||
|
||||
if default is False:
|
||||
default = "false"
|
||||
if default is True:
|
||||
default = "true"
|
||||
|
||||
if default:
|
||||
if "#" in default:
|
||||
parts.append(f'#{switch}: "{default}"\n')
|
||||
else:
|
||||
parts.append(f"#{switch}: {default}\n")
|
||||
elif action.nargs in ("*", "+") or isinstance(action, argparse._AppendAction):
|
||||
parts.append(f"#{switch}: xxx")
|
||||
parts.append("## Specify multiple values like this:")
|
||||
parts.append(f"#{switch}:")
|
||||
parts.append("# - xxx")
|
||||
parts.append("# - yyy")
|
||||
parts.append("# - zzz")
|
||||
else:
|
||||
if switch.endswith("color"):
|
||||
parts.append(f'#{switch}: "xxx"\n')
|
||||
else:
|
||||
parts.append(f"#{switch}: xxx\n")
|
||||
|
||||
###
|
||||
# parts.append(str(action))
|
||||
|
||||
return "\n".join(parts) + "\n"
|
||||
|
||||
def _format_action_invocation(self, action):
|
||||
return ""
|
||||
|
||||
def _format_args(self, action, default_metavar):
|
||||
return ""
|
||||
|
||||
|
||||
class MarkdownHelpFormatter(argparse.HelpFormatter):
|
||||
def start_section(self, heading):
|
||||
super().start_section(f"## {heading}")
|
||||
|
||||
def _format_usage(self, usage, actions, groups, prefix):
|
||||
res = super()._format_usage(usage, actions, groups, prefix)
|
||||
quote = "```\n"
|
||||
return quote + res + quote
|
||||
|
||||
def _format_text(self, text):
|
||||
return ""
|
||||
|
||||
def _format_action(self, action):
|
||||
if not action.option_strings:
|
||||
return ""
|
||||
|
||||
parts = [""]
|
||||
|
||||
metavar = action.metavar
|
||||
if not metavar and isinstance(action, argparse._StoreAction):
|
||||
metavar = "VALUE"
|
||||
|
||||
for switch in action.option_strings:
|
||||
if switch.startswith("--"):
|
||||
break
|
||||
|
||||
if metavar:
|
||||
parts.append(f"### `{switch} {metavar}`")
|
||||
else:
|
||||
parts.append(f"### `{switch}`")
|
||||
if action.help:
|
||||
parts.append(action.help + " ")
|
||||
|
||||
if action.default not in (argparse.SUPPRESS, None):
|
||||
parts.append(f"Default: {action.default} ")
|
||||
|
||||
if action.env_var:
|
||||
parts.append(f"Environment variable: `{action.env_var}` ")
|
||||
|
||||
if len(action.option_strings) > 1:
|
||||
parts.append("Aliases:")
|
||||
for switch in action.option_strings:
|
||||
if metavar:
|
||||
parts.append(f" - `{switch} {metavar}`")
|
||||
else:
|
||||
parts.append(f" - `{switch}`")
|
||||
|
||||
return "\n".join(parts) + "\n"
|
||||
|
||||
def _format_action_invocation(self, action):
|
||||
return ""
|
||||
|
||||
def _format_args(self, action, default_metavar):
|
||||
return ""
|
||||
|
|
@ -1,34 +0,0 @@
|
|||
from .architect_coder import ArchitectCoder
|
||||
from .ask_coder import AskCoder
|
||||
from .base_coder import Coder
|
||||
from .context_coder import ContextCoder
|
||||
from .editblock_coder import EditBlockCoder
|
||||
from .editblock_fenced_coder import EditBlockFencedCoder
|
||||
from .editor_diff_fenced_coder import EditorDiffFencedCoder
|
||||
from .editor_editblock_coder import EditorEditBlockCoder
|
||||
from .editor_whole_coder import EditorWholeFileCoder
|
||||
from .help_coder import HelpCoder
|
||||
from .patch_coder import PatchCoder
|
||||
from .udiff_coder import UnifiedDiffCoder
|
||||
from .udiff_simple import UnifiedDiffSimpleCoder
|
||||
from .wholefile_coder import WholeFileCoder
|
||||
|
||||
# from .single_wholefile_func_coder import SingleWholeFileFunctionCoder
|
||||
|
||||
__all__ = [
|
||||
HelpCoder,
|
||||
AskCoder,
|
||||
Coder,
|
||||
EditBlockCoder,
|
||||
EditBlockFencedCoder,
|
||||
WholeFileCoder,
|
||||
PatchCoder,
|
||||
UnifiedDiffCoder,
|
||||
UnifiedDiffSimpleCoder,
|
||||
# SingleWholeFileFunctionCoder,
|
||||
ArchitectCoder,
|
||||
EditorEditBlockCoder,
|
||||
EditorWholeFileCoder,
|
||||
EditorDiffFencedCoder,
|
||||
ContextCoder,
|
||||
]
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue