mirror of
https://github.com/Aider-AI/aider.git
synced 2025-12-23 08:48:18 +00:00
feat: Omit time from archived chat filename when task is specified
This commit is contained in:
parent
db9d6d202f
commit
b48bfa1d80
5 changed files with 12 additions and 10 deletions
|
|
@ -295,7 +295,7 @@ def get_parser(default_config_files, git_root):
|
|||
default=None,
|
||||
help=(
|
||||
"Specify a directory to archive dated chat history files (e.g., .ai-chats). If set,"
|
||||
" chat history files will be saved as YYYY-MM-DD HH-MM.aider.md (or YYYY-MM-DD HH-MM"
|
||||
" chat history files will be saved as YYYY-MM-DD HH-MM.aider.md (or YYYY-MM-DD"
|
||||
" TASK_TITLE.aider.md if --task is used) in this directory, overriding the"
|
||||
" --chat-history-file setting."
|
||||
),
|
||||
|
|
@ -306,7 +306,7 @@ def get_parser(default_config_files, git_root):
|
|||
default=None,
|
||||
help=(
|
||||
"Specify a title for the chat session. If --chat-history-archive is enabled, this"
|
||||
" title will be included in the archived chat history filename (e.g., YYYY-MM-DD HH-MM"
|
||||
" title will be included in the archived chat history filename (e.g., YYYY-MM-DD"
|
||||
" TASK_TITLE.aider.md)."
|
||||
),
|
||||
)
|
||||
|
|
|
|||
|
|
@ -506,18 +506,20 @@ def main(argv=None, input=None, output=None, force_git_root=None, return_coder=F
|
|||
|
||||
if args.chat_history_archive:
|
||||
archive_dir = Path(args.chat_history_archive).resolve()
|
||||
datetime_str = datetime.datetime.now().strftime("%Y-%m-%d %H-%M")
|
||||
now = datetime.datetime.now()
|
||||
|
||||
datetime_str = now.strftime("%Y-%m-%d %H-%M")
|
||||
dated_filename = f"{datetime_str}.aider.md"
|
||||
|
||||
task_title_for_filename = ""
|
||||
if args.task:
|
||||
# Sanitize the task title for use in a filename. Keep only allowed characters.
|
||||
allowed_chars = ".,_-+#%&'!()[]=; "
|
||||
core_sanitized_title = "".join([c for c in args.task if c.isalnum() or c in allowed_chars]).strip()
|
||||
|
||||
if core_sanitized_title:
|
||||
task_title_for_filename = " " + core_sanitized_title
|
||||
date_str = now.strftime("%Y-%m-%d")
|
||||
dated_filename = f"{date_str} {core_sanitized_title}.aider.md"
|
||||
|
||||
dated_filename = f"{datetime_str}{task_title_for_filename}.aider.md"
|
||||
final_chat_history_path = archive_dir / dated_filename
|
||||
|
||||
os.makedirs(archive_dir, exist_ok=True)
|
||||
|
|
|
|||
|
|
@ -153,7 +153,7 @@
|
|||
#restore-chat-history: false
|
||||
|
||||
## Specify a directory to archive dated chat history files.
|
||||
## If set, files like YYYY-MM-DD HH-MM.aider.md (or YYYY-MM-DD HH-MM TASK_TITLE.aider.md if --task is used)
|
||||
## If set, files like YYYY-MM-DD HH-MM.aider.md (or YYYY-MM-DD TASK_TITLE.aider.md if --task is used)
|
||||
## will be saved here, overriding the chat-history-file setting.
|
||||
#chat-history-archive: .ai-chats
|
||||
|
||||
|
|
|
|||
|
|
@ -208,7 +208,7 @@ cog.outl("```")
|
|||
#restore-chat-history: false
|
||||
|
||||
## Specify a directory to archive dated chat history files.
|
||||
## If set, files like YYYY-MM-DD HH-MM.aider.md (or YYYY-MM-DD HH-MM TASK_TITLE.aider.md if --task is used)
|
||||
## If set, files like YYYY-MM-DD HH-MM.aider.md (or YYYY-MM-DD TASK_TITLE.aider.md if --task is used)
|
||||
## will be saved here, overriding the chat-history-file setting.
|
||||
#chat-history-archive: .ai-chats
|
||||
|
||||
|
|
|
|||
|
|
@ -289,12 +289,12 @@ Aliases:
|
|||
- `--no-restore-chat-history`
|
||||
|
||||
### `chat-history-archive CHAT_HISTORY_ARCHIVE_DIR`
|
||||
Specify a directory to archive dated chat history files (e.g., `.ai-chats`). If set, chat history files will be saved as `YYYY-MM-DD HH-MM.aider.md` (or `YYYY-MM-DD HH-MM TASK_TITLE.aider.md` if `--task` is used) in this directory, overriding the `--chat-history-file` setting. This option is typically set in the `.aider.conf.yml` file or via the `AIDER_CHAT_HISTORY_ARCHIVE` environment variable.
|
||||
Specify a directory to archive dated chat history files (e.g., `.ai-chats`). If set, chat history files will be saved as `YYYY-MM-DD HH-MM.aider.md` (or `YYYY-MM-DD TASK_TITLE.aider.md` if `--task` is used) in this directory, overriding the `--chat-history-file` setting. This option is typically set in the `.aider.conf.yml` file or via the `AIDER_CHAT_HISTORY_ARCHIVE` environment variable.
|
||||
Default: None
|
||||
Environment variable: `AIDER_CHAT_HISTORY_ARCHIVE`
|
||||
|
||||
### `--task TASK_TITLE`
|
||||
Specify a title for the chat session. If `--chat-history-archive` is enabled, this title will be included in the archived chat history filename (e.g., `YYYY-MM-DD HH-MM TASK_TITLE.aider.md`).
|
||||
Specify a title for the chat session. If `--chat-history-archive` is enabled, this title will be included in the archived chat history filename (e.g., `YYYY-MM-DD TASK_TITLE.aider.md`).
|
||||
Environment variable: `AIDER_TASK`
|
||||
|
||||
### `--llm-history-file LLM_HISTORY_FILE`
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue