commit
2959bf6f72
|
@ -92,4 +92,3 @@ class AIConfig:
|
||||||
|
|
||||||
full_prompt += f"\n\n{data.load_prompt()}"
|
full_prompt += f"\n\n{data.load_prompt()}"
|
||||||
return full_prompt
|
return full_prompt
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,7 @@ def scrape_text(url):
|
||||||
# Most basic check if the URL is valid:
|
# Most basic check if the URL is valid:
|
||||||
if not url.startswith('http'):
|
if not url.startswith('http'):
|
||||||
return "Error: Invalid URL"
|
return "Error: Invalid URL"
|
||||||
|
|
||||||
# Restrict access to local files
|
# Restrict access to local files
|
||||||
if check_local_file_access(url):
|
if check_local_file_access(url):
|
||||||
return "Error: Access to local files is restricted"
|
return "Error: Access to local files is restricted"
|
||||||
|
|
|
@ -63,10 +63,10 @@ def chat_with_ai(
|
||||||
"""
|
"""
|
||||||
model = cfg.fast_llm_model # TODO: Change model from hardcode to argument
|
model = cfg.fast_llm_model # TODO: Change model from hardcode to argument
|
||||||
# Reserve 1000 tokens for the response
|
# Reserve 1000 tokens for the response
|
||||||
|
|
||||||
if cfg.debug:
|
if cfg.debug:
|
||||||
print(f"Token limit: {token_limit}")
|
print(f"Token limit: {token_limit}")
|
||||||
|
|
||||||
send_token_limit = token_limit - 1000
|
send_token_limit = token_limit - 1000
|
||||||
|
|
||||||
relevant_memory = permanent_memory.get_relevant(str(full_message_history[-5:]), 10)
|
relevant_memory = permanent_memory.get_relevant(str(full_message_history[-5:]), 10)
|
||||||
|
|
|
@ -71,11 +71,11 @@ def fix_and_parse_json(
|
||||||
return json_str
|
return json_str
|
||||||
else:
|
else:
|
||||||
raise e
|
raise e
|
||||||
|
|
||||||
|
|
||||||
def fix_json(json_str: str, schema: str) -> str:
|
def fix_json(json_str: str, schema: str) -> str:
|
||||||
"""Fix the given JSON string to make it parseable and fully complient with the provided schema."""
|
"""Fix the given JSON string to make it parseable and fully complient with the provided schema."""
|
||||||
|
|
||||||
# Try to fix the JSON using gpt:
|
# Try to fix the JSON using gpt:
|
||||||
function_string = "def fix_json(json_str: str, schema:str=None) -> str:"
|
function_string = "def fix_json(json_str: str, schema:str=None) -> str:"
|
||||||
args = [f"'''{json_str}'''", f"'''{schema}'''"]
|
args = [f"'''{json_str}'''", f"'''{schema}'''"]
|
||||||
|
|
|
@ -415,4 +415,3 @@ while True:
|
||||||
chat.create_chat_message(
|
chat.create_chat_message(
|
||||||
"system", "Unable to execute command"))
|
"system", "Unable to execute command"))
|
||||||
print_to_console("SYSTEM: ", Fore.YELLOW, "Unable to execute command")
|
print_to_console("SYSTEM: ", Fore.YELLOW, "Unable to execute command")
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue