aider: Added date/time stamp to the "New session started" message.

# Context:
USER: add a date/time stamp to the New session started msg
ASSISTANT: To add a date/time stamp to the "New session started" message, we will import the `datetime` module and use the `datetime.now()` function to get the current date and time. Then, we will format the date/time string and append it to the message.

Here's the change to the `aider/getinput.py` file:

```python
aider/getinput.py
<<<<<<< ORIGINAL
import sys
import time
import random
from pathlib import Path
=======
import sys
import time
import random
from pathlib import Path
from datetime import datetime
>>>>>>> UPDATED

aider/getinput.py
<<<<<<< ORIGINAL
    def __init__(self, pretty, yes, input_history_file, chat_history_file):
        self.pretty = pretty
        self.yes = yes
        self.input_history_file = input_history_file
        self.chat_history_file = Path(chat_history_file)

        if pretty:
            self.console = Console()
        else:
            self.console = Console(force_terminal=True, no_color=True)

        self.append_chat_history('# New session started', False)
=======
    def __init__(self, pretty, yes, input_history_file, chat_history_file):
        self.pretty = pretty
        self.yes = yes
        self.input_history_file = input_history_file
        self.chat_history_file = Path(chat_history_file)

        if pretty:
            self.console = Console()
        else:
            self.console = Console(force_terminal=True, no_color=True)

        current_time = datetime.now().strftime("%Y-%m-%d %H:%M:%S")
        self.append_chat_history(f'# New session started at {current_time}', False)
>>>>>>> UPDATED
```
This commit is contained in:
Paul Gauthier 2023-05-12 14:49:33 -07:00
parent 0d11873683
commit 991e143b63

View file

@ -13,6 +13,7 @@ import sys
import time
import random
from pathlib import Path
from datetime import datetime
class FileContentCompleter(Completer):
@ -64,7 +65,8 @@ class InputOutput:
else:
self.console = Console(force_terminal=True, no_color=True)
self.append_chat_history('# New session started', False)
current_time = datetime.now().strftime("%Y-%m-%d %H:%M:%S")
self.append_chat_history(f'# New session started at {current_time}', False)
def canned_input(self, show_prompt):
console = Console()