question_cmd: fixed '--ask' command

This commit is contained in:
2023-09-10 07:52:07 +02:00
parent dd3d3ffc82
commit cf50818f28
3 changed files with 30 additions and 10 deletions
+10 -5
View File
@@ -63,15 +63,20 @@ def question_cmd(args: argparse.Namespace, config: Config) -> None:
# create the correct AI instance
ai: AI = create_ai(args, config)
if args.ask:
ai.print()
chat.print(paged=False)
response: AIResponse = ai.request(message,
chat,
args.num_answers, # FIXME
args.output_tags) # FIXME
assert response
# TODO:
# * add answer to the message above (and create
# more messages for any additional answers)
pass
chat.update_messages([response.messages[0]])
chat.add_to_cache(response.messages[1:])
for idx, msg in enumerate(response.messages):
print(f"=== ANSWER {idx+1} ===")
print(msg.answer)
if response.tokens:
print("===============")
print(response.tokens)
elif args.repeat:
lmessage = chat.latest_message()
assert lmessage