address change requests in PR

1. Prompt has changed to "invoke> ".
2. Function to initialize the autocompleter has been renamed "set_autocompleter()"
This commit is contained in:
Lincoln Stein
2023-03-27 12:20:24 -04:00
parent dc14701d20
commit 019a9f0329
2 changed files with 9 additions and 5 deletions

View File

@ -6,7 +6,6 @@ completer object.
import atexit import atexit
import readline import readline
import shlex import shlex
import sys
from pathlib import Path from pathlib import Path
from typing import List, Dict, Literal, get_args, get_type_hints, get_origin from typing import List, Dict, Literal, get_args, get_type_hints, get_origin
@ -131,7 +130,7 @@ class Completer(object):
readline.redisplay() readline.redisplay()
self.linebuffer = None self.linebuffer = None
def get_completer(model_manager: ModelManager) -> Completer: def set_autocompleter(model_manager: ModelManager) -> Completer:
global completer global completer
if completer: if completer:

View File

@ -14,7 +14,7 @@ from pydantic.fields import Field
from ..backend import Args from ..backend import Args
from .cli.commands import BaseCommand, CliContext, ExitCli, add_parsers, get_graph_execution_history from .cli.commands import BaseCommand, CliContext, ExitCli, add_parsers, get_graph_execution_history
from .cli.completer import get_completer from .cli.completer import set_autocompleter
from .invocations import * from .invocations import *
from .invocations.baseinvocation import BaseInvocation from .invocations.baseinvocation import BaseInvocation
from .services.events import EventServiceBase from .services.events import EventServiceBase
@ -130,7 +130,12 @@ def invoke_cli():
config = Args() config = Args()
config.parse_args() config.parse_args()
model_manager = get_model_manager(config) model_manager = get_model_manager(config)
completer = get_completer(model_manager)
# This initializes the autocompleter and returns it.
# Currently nothing is done with the returned Completer
# object, but the object can be used to change autocompletion
# behavior on the fly, if desired.
completer = set_autocompleter(model_manager)
events = EventServiceBase() events = EventServiceBase()
@ -164,7 +169,7 @@ def invoke_cli():
while True: while True:
try: try:
cmd_input = input(f"{model_manager.current_model or '(no model)'}> ") cmd_input = input("invoke> ")
except (KeyboardInterrupt, EOFError): except (KeyboardInterrupt, EOFError):
# Ctrl-c exits # Ctrl-c exits
break break