Update askai

This commit is contained in:
tofasthacker 2024-01-04 02:53:35 +00:00
parent 1a8ce29c72
commit fba97b7130

17
askai
View File

@ -6,14 +6,6 @@ import os
import sys
import textwrap
# Load model details from the config file
try:
with open(os.path.expanduser('~/.config.json'), 'r') as f:
data = json.load(f)
except FileNotFoundError:
print("Error: Please run this tool with the --config flag set before you continue.")
sys.exit()
if '--config' in sys.argv:
# Check that no
if not sys.stdin.isatty():
@ -52,6 +44,15 @@ if '--config' in sys.argv:
print("You have secessfully saved " + data['model'] + " as you default model and " + data['base_url'] + " as the ollama url")
print('')
exit()
else:
# Load model details from the config file
try:
with open(os.path.expanduser('~/.config.json'), 'r') as f:
data = json.load(f)
except FileNotFoundError:
print("Error: Please run this tool with the --config flag set before you continue.")
exit()
if 'base_url' not in data or 'model' not in data:
print('Error: missing base url or model please rerun with --config flag')