mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-24 06:15:00 +00:00
refactor
This commit is contained in:
parent
fcaf4e15c8
commit
b139dbf475
2 changed files with 14 additions and 16 deletions
|
@ -4,6 +4,8 @@ import os
|
||||||
import sys
|
import sys
|
||||||
import re
|
import re
|
||||||
import traceback
|
import traceback
|
||||||
|
import time
|
||||||
|
from openai.error import RateLimitError
|
||||||
|
|
||||||
from rich.console import Console
|
from rich.console import Console
|
||||||
from rich.prompt import Confirm, Prompt
|
from rich.prompt import Confirm, Prompt
|
||||||
|
@ -265,26 +267,10 @@ class Coder:
|
||||||
self.cur_messages = []
|
self.cur_messages = []
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def show_messages(self, messages, title):
|
|
||||||
print(title.upper(), "*" * 50)
|
|
||||||
|
|
||||||
for msg in messages:
|
|
||||||
print()
|
|
||||||
print("-" * 50)
|
|
||||||
role = msg["role"].upper()
|
|
||||||
content = msg["content"].splitlines()
|
|
||||||
for line in content:
|
|
||||||
print(role, line)
|
|
||||||
|
|
||||||
def send(self, messages, model=None, silent=False):
|
def send(self, messages, model=None, silent=False):
|
||||||
# self.show_messages(messages, "all")
|
|
||||||
|
|
||||||
if not model:
|
if not model:
|
||||||
model = self.main_model
|
model = self.main_model
|
||||||
|
|
||||||
import time
|
|
||||||
from openai.error import RateLimitError
|
|
||||||
|
|
||||||
self.resp = ""
|
self.resp = ""
|
||||||
interrupted = False
|
interrupted = False
|
||||||
try:
|
try:
|
||||||
|
|
|
@ -111,3 +111,15 @@ def do_replace(fname, before_text, after_text):
|
||||||
|
|
||||||
fname.write_text(new_content)
|
fname.write_text(new_content)
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
|
def show_messages(self, messages, title):
|
||||||
|
print(title.upper(), "*" * 50)
|
||||||
|
|
||||||
|
for msg in messages:
|
||||||
|
print()
|
||||||
|
print("-" * 50)
|
||||||
|
role = msg["role"].upper()
|
||||||
|
content = msg["content"].splitlines()
|
||||||
|
for line in content:
|
||||||
|
print(role, line)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue