Skip to content

Commit

Permalink
Fixed SAST findings
Browse files Browse the repository at this point in the history
  • Loading branch information
adubovik committed Sep 18, 2023
1 parent a2088e7 commit a04f6e5
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 6 deletions.
6 changes: 5 additions & 1 deletion client/client_adapter.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,11 @@ def main():

input = make_input()

while True:
turn = 0
max_turns = 128
while turn < max_turns:
turn += 1

content = input()
if content == ":clear":
history = []
Expand Down
13 changes: 10 additions & 3 deletions client/client_bedrock.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
from utils.cli import choose_deployment
from utils.env import get_env
from utils.init import init
from utils.printing import get_input, print_ai, print_info
from utils.input import make_input
from utils.printing import print_ai, print_info


async def main():
Expand All @@ -24,8 +25,14 @@ async def main():

history: List[Message] = []

while True:
content = get_input("> ")
input = make_input()

turn = 0
max_turns = 128
while turn < max_turns:
turn += 1

content = input()
history.append(Message(role="user", content=content))

response = await model.achat(chat_emulation_type, history)
Expand Down
5 changes: 3 additions & 2 deletions utils/input.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from utils.files import get_project_root


def make_input():
def make_input(limit: int = 8000):
session = None

def input(prompt_text="> ", style=Style.from_dict({"": "#ff0000"})):
Expand All @@ -15,6 +15,7 @@ def input(prompt_text="> ", style=Style.from_dict({"": "#ff0000"})):
history=FileHistory(str(get_project_root() / ".history"))
)

return session.prompt(prompt_text, style=style)
response = session.prompt(prompt_text, style=style)
return response[:limit]

return input

0 comments on commit a04f6e5

Please sign in to comment.