diff --git a/charla/chat.py b/charla/chat.py index 621b369..9522b1d 100644 --- a/charla/chat.py +++ b/charla/chat.py @@ -77,7 +77,7 @@ def run(argv: argparse.Namespace) -> None: open_location = '' # Prompt used to give directions to the model at the beginning of the chat. - system_prompt = argv.system_prompt.read() if argv.system_prompt else '' + system_prompt = Path(argv.system_prompt).read_text() if argv.system_prompt else '' # Determine which Client class to import. if argv.provider == 'ollama': @@ -104,7 +104,7 @@ def run(argv: argparse.Namespace) -> None: session = prompt_session(argv) print_fmt('Chat with:', HTML(f'{argv.model}'), '\n') if system_prompt: - print_fmt('Using system prompt:', HTML(f'{argv.system_prompt.name}'), '\n') + print_fmt('Using system prompt:', HTML(f'{argv.system_prompt}'), '\n') while True: try: diff --git a/charla/cli.py b/charla/cli.py index bf50202..5de57d5 100755 --- a/charla/cli.py +++ b/charla/cli.py @@ -24,7 +24,7 @@ def main(args=None) -> None: ) parser.add_argument('--multiline', action='store_true', help='Use multiline mode.') parser.add_argument( - '--system-prompt', '-sp', type=argparse.FileType(), help='File that contains system prompt to use.' + '--system-prompt', '-sp', type=str, help='File that contains system prompt to use.' ) parser.add_argument('--version', action='version', version=f'%(prog)s {__version__}') parser.set_defaults(**user_settings, func=chat.run) diff --git a/charla/config.py b/charla/config.py index e1536f1..333abfa 100644 --- a/charla/config.py +++ b/charla/config.py @@ -35,8 +35,8 @@ def manage(argv: argparse.Namespace) -> None: if argv.location: print(path_settings) else: - user_settings = {k: v for k, v in vars(argv).items() if k in default_settings} - out = json.dumps(user_settings, indent=4) + current_settings = {k: v for k, v in vars(argv).items() if k in default_settings} + out = json.dumps(current_settings, indent=4) if argv.save: filename = '.charla.json' Path(filename).write_text(out) @@ -54,10 +54,10 @@ def mkdir(path: Path, **kwds): sys.exit(str(err)) -def settings(user_settings: dict) -> dict: +def settings(current_settings: dict) -> dict: """Return settings based on user input.""" - default_settings.update(user_settings) + default_settings.update(current_settings) return default_settings