From 8deaa3b6e15ca7cef6f57bed3950267509cb5296 Mon Sep 17 00:00:00 2001 From: Hayden Johnson Date: Wed, 25 Sep 2024 12:54:27 -0700 Subject: [PATCH] Add option to specify host --- assistant.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/assistant.py b/assistant.py index 9845b00..48067b1 100755 --- a/assistant.py +++ b/assistant.py @@ -10,6 +10,7 @@ from pygments.lexers import get_lexer_by_name from pygments.formatters import TerminalFormatter +server = 'localhost:11434' model = 'llama3.1:8b-instruct-q8_0' temp = 0.2 @@ -88,7 +89,7 @@ def copy_string_to_clipboard(string): return # Point to the local server -client = Client(host='localhost:11434') +client = Client(host=server) code_history = [] @@ -150,9 +151,15 @@ def parse_args(): parser.add_argument('--model', '-m', nargs='?', const=True, default=False, help='Specify model') # Add the --temp (-t) argument parser.add_argument('--temp', '-t', nargs='?', const=True, default=False, help='Specify temperature') + # Add the --host (-s) argument + parser.add_argument('--h', '-h', nargs='1', const=True, default=False, help='Specify host of ollama server') # Parse the arguments return parser.parse_args() +def set_host(host): + global server + server = host + def arg_follow_up(args): sys.stdin = open('/dev/tty') if args.follow_up != True: @@ -205,6 +212,8 @@ def handle_non_piped_input(args): def main(): args = parse_args() + if args.host: + set_host(args.host) if args.model: global model model = args.model