Compare commits

..

2 Commits

Author SHA1 Message Date
Falko Victor Habel 243afd2f01 removed config file from code 2024-05-20 11:08:50 +02:00
Falko Victor Habel 038b1f3e92 improved error handling 2024-05-20 11:07:57 +02:00
2 changed files with 5 additions and 18 deletions

View File

@ -1,15 +0,0 @@
{
"mode": "gui",
"ollamaConfig": {
"base_url": "http://localhost:11434",
"embeddings_url": "http://localhost:11434",
"base_model": "mistral",
"embeddings_model": "mxbai-embed-large",
"base_header": {
"": ""
},
"embeddings_header": {
"": ""
}
}
}

View File

@ -6,6 +6,7 @@ import os
import sys import sys
CONFIG_FILE = "config/config.json" CONFIG_FILE = "config/config.json"
ERROR_CORRPUTED_CONFIG = "The config file seems to be corrupted, please run: 'python project.py --config'"
def main(): def main():
parser = argparse.ArgumentParser(description="Write with Ollama, using standard chat or RAG system, for \n\ parser = argparse.ArgumentParser(description="Write with Ollama, using standard chat or RAG system, for \n\
@ -36,8 +37,9 @@ def main():
gui = ChatGUI(**config["ollamaConfig"]) gui = ChatGUI(**config["ollamaConfig"])
gui.mainloop() gui.mainloop()
except TypeError: except TypeError:
sys.exit("The config file seems to be corrupted, please run: 'python project.py --config'") sys.exit(ERROR_CORRPUTED_CONFIG)
sys.exit("No Config available. please run: 'python project.py --config' to set it up") else:
sys.exit(ERROR_CORRPUTED_CONFIG)
@ -92,7 +94,7 @@ def handle_terminal(args):
bot = TerminalBot(args.p, args.f, **config["ollamaConfig"]) bot = TerminalBot(args.p, args.f, **config["ollamaConfig"])
bot.start() bot.start()
except TypeError: except TypeError:
sys.exit("The config file seems to be corrupted, please run: 'python project.py --config'") sys.exit(ERROR_CORRPUTED_CONFIG)
elif args.f: elif args.f:
sys.exit("failure: prompt needed") sys.exit("failure: prompt needed")
else: else: