diff --git a/askchat/__init__.py b/askchat/__init__.py index f3c0b6b..dd8db72 100644 --- a/askchat/__init__.py +++ b/askchat/__init__.py @@ -2,6 +2,6 @@ __author__ = """Rex Wang""" __email__ = '1073853456@qq.com' -__version__ = '0.0.3' +__version__ = '0.0.4' from .askchat import ask \ No newline at end of file diff --git a/askchat/askchat.py b/askchat/askchat.py index d442c7d..51153d9 100644 --- a/askchat/askchat.py +++ b/askchat/askchat.py @@ -16,10 +16,12 @@ def ask(): """Interact with ChatGPT in terminal via chattool""" # parse arguments parser = ArgumentParser() - parser.add_argument('message', type=str, help='User message') + parser.add_argument('message', help='User message', default='', nargs='*') args = parser.parse_args() msg = args.message - + if isinstance(msg, list): + msg = ' '.join(msg) + assert len(msg.strip()), 'Please specify message' # call chat = Chat(msg) asyncio.run(show_resp(chat)) @@ -29,7 +31,7 @@ def main(): # parse arguments parser = ArgumentParser() ## use nargs='?' to make message optional - parser.add_argument('message', help='User message', default='', nargs='?') + parser.add_argument('message', help='User message', default='', nargs='*') parser.add_argument('-v', '--version', action='version', version=VERSION) parser.add_argument('--debug', action='store_true', help='Print debug log') parser.add_argument('--valid-models', action='store_true', help='Print valid models') @@ -46,6 +48,8 @@ def main(): return # get message and model model, msg = args.model, args.message + if isinstance(msg, list): + msg = ' '.join(msg) assert len(msg.strip()), 'Please specify message' # call chat = Chat(msg, model=model) diff --git a/setup.py b/setup.py index e7075a2..a6cdd54 100644 --- a/setup.py +++ b/setup.py @@ -4,7 +4,7 @@ from setuptools import setup, find_packages -VERSION = '0.0.3' +VERSION = '0.0.4' with open('README.md') as readme_file: readme = readme_file.read()