Protect env and report better errors when using unexistent ones

This commit is contained in:
pancake 2023-11-29 12:17:34 +01:00
parent 2cf08f4949
commit 95bf393d8d
3 changed files with 7 additions and 2 deletions

View File

@ -164,12 +164,15 @@ def runline(usertext):
if v == "":
# del ai.env[k]
ai.env[k] = ""
else:
elif k in ai.env:
ai.env[k] = v
else:
print("Invalid config key")
else:
try:
print(ai.env[k])
except:
print("Invalid config key")
pass
elif usertext.startswith("-w"):
ai.withresponse = not ai.withresponse

View File

@ -161,6 +161,8 @@ def vectordb_search(query_text, source_files, use_mastodon, use_debug):
print("On macOS you'll need to also do this:")
print(" python -m pip install spacy")
print(" python -m spacy download en_core_web_sm")
if not have_vectordb:
return []
try:
vectordb_instance = vectordb.Memory(embeddings="best") # normal or fast
except:

View File

@ -345,7 +345,7 @@ class Interpreter:
self.env["debug"] = "false"
self.env["llm.model"] = ""
self.env["llm.window"] = "4096" # context_window
self.env["llm.maxtoken"] = "1750"
self.env["llm.maxtokens"] = "1750"
self.env["llm.temperature"] = "0.002"
self.env["user.name"] = "" # TODO auto fill?
self.env["user.os"] = ""