Add interactive mode
This commit is contained in:
16
main.py
16
main.py
@@ -26,11 +26,15 @@ from io import StringIO
|
|||||||
# Parse arguments such as system prompt and batch mode
|
# Parse arguments such as system prompt and batch mode
|
||||||
import argparse
|
import argparse
|
||||||
parser = argparse.ArgumentParser(description='LocalAGI')
|
parser = argparse.ArgumentParser(description='LocalAGI')
|
||||||
|
# System prompt
|
||||||
parser.add_argument('--system-prompt', dest='system_prompt', action='store',
|
parser.add_argument('--system-prompt', dest='system_prompt', action='store',
|
||||||
help='System prompt to use')
|
help='System prompt to use')
|
||||||
|
# Batch mode
|
||||||
parser.add_argument('--prompt', dest='prompt', action='store', default=False,
|
parser.add_argument('--prompt', dest='prompt', action='store', default=False,
|
||||||
help='Prompt mode')
|
help='Prompt mode')
|
||||||
|
# Interactive mode
|
||||||
|
parser.add_argument('--interactive', dest='interactive', action='store_true', default=False,
|
||||||
|
help='Interactive mode. Can be used with --prompt to start an interactive session')
|
||||||
# skip avatar creation
|
# skip avatar creation
|
||||||
parser.add_argument('--skip-avatar', dest='skip_avatar', action='store_true', default=False,
|
parser.add_argument('--skip-avatar', dest='skip_avatar', action='store_true', default=False,
|
||||||
help='Skip avatar creation')
|
help='Skip avatar creation')
|
||||||
@@ -849,9 +853,10 @@ else:
|
|||||||
logger.info(">>> Prompt mode <<<")
|
logger.info(">>> Prompt mode <<<")
|
||||||
logger.info(args.prompt)
|
logger.info(args.prompt)
|
||||||
|
|
||||||
|
processed_messages = 0
|
||||||
# IF in prompt mode just evaluate, otherwise loop
|
# IF in prompt mode just evaluate, otherwise loop
|
||||||
if args.prompt:
|
if args.prompt:
|
||||||
evaluate(
|
conversation_history=evaluate(
|
||||||
args.prompt,
|
args.prompt,
|
||||||
conversation_history,
|
conversation_history,
|
||||||
re_evaluate=args.re_evaluate,
|
re_evaluate=args.re_evaluate,
|
||||||
@@ -859,11 +864,14 @@ if args.prompt:
|
|||||||
# Enable to lower context usage but increases LLM calls
|
# Enable to lower context usage but increases LLM calls
|
||||||
postprocess=args.postprocess,
|
postprocess=args.postprocess,
|
||||||
subtaskContext=args.subtaskContext,
|
subtaskContext=args.subtaskContext,
|
||||||
|
processed_messages=processed_messages,
|
||||||
)
|
)
|
||||||
else:
|
processed_messages+=1
|
||||||
|
|
||||||
|
if not args.prompt or args.interactive:
|
||||||
# TODO: process functions also considering the conversation history? conversation history + input
|
# TODO: process functions also considering the conversation history? conversation history + input
|
||||||
logger.info(">>> Ready! What can I do for you? ( try with: plan a roadtrip to San Francisco ) <<<")
|
logger.info(">>> Ready! What can I do for you? ( try with: plan a roadtrip to San Francisco ) <<<")
|
||||||
processed_messages = 0
|
|
||||||
while True:
|
while True:
|
||||||
user_input = input(">>> ")
|
user_input = input(">>> ")
|
||||||
# we are going to use the args to change the evaluation behavior
|
# we are going to use the args to change the evaluation behavior
|
||||||
|
|||||||
Reference in New Issue
Block a user