From 85d0080e2e3d5817196917a7d278ad837b7265aa Mon Sep 17 00:00:00 2001 From: rex <1073853456@qq.com> Date: Sun, 24 Nov 2024 00:16:23 +0800 Subject: [PATCH] fix regenerate method --- askchat/__init__.py | 2 +- askchat/cli.py | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/askchat/__init__.py b/askchat/__init__.py index 761ba2f..6f74a11 100644 --- a/askchat/__init__.py +++ b/askchat/__init__.py @@ -2,7 +2,7 @@ __author__ = """Rex Wang""" __email__ = '1073853456@qq.com' -__version__ = '1.2.2' +__version__ = '1.2.3' import asyncio from pathlib import Path diff --git a/askchat/cli.py b/askchat/cli.py index 481aa29..6130649 100644 --- a/askchat/cli.py +++ b/askchat/cli.py @@ -170,8 +170,7 @@ def main( message, model, base_url, api_base, api_key, use_env chattool.load_envs() # update the environment variables in chattool # print chat messages if p: - fname = message_text if message_text else '_last_chat' - fname = f"{CONFIG_PATH}/{fname}.json" + fname = f"{CONFIG_PATH}/{message_text}.json" if message_text else LAST_CHAT_FILE try: Chat().load(fname).print_log() except FileNotFoundError: @@ -189,6 +188,9 @@ def main( message, model, base_url, api_base, api_key, use_env click.echo("You should have at least two messages in the conversation") return chat.pop() + if message_text: # user message + chat.pop() + chat.user(message_text) elif c: # continue the last conversation if not message_text: click.echo("Please specify message!")