""" Initialize the class with the provided arguments and environment file.
@ -143,7 +146,7 @@ class Standalone:
system_message={"role":"system","content":system}
messages=[system_message,user_message]
exceptFileNotFoundError:
print("pattern not found")
eprint("pattern not found")
return
else:
ifcontext:
@ -183,17 +186,17 @@ class Standalone:
sys.stdout.flush()
exceptExceptionase:
if"All connection attempts failed"instr(e):
print(
eprint(
"Error: cannot connect to llama2. If you have not already, please visit https://ollama.com for installation instructions")
if"CLAUDE_API_KEY"instr(e):
print(
eprint(
"Error: CLAUDE_API_KEY not found in environment variables. Please run --setup and add the key")
if"overloaded_error"instr(e):
print(
eprint(
"Error: Fabric is working fine, but claude is overloaded. Please try again later.")
else:
print(f"Error: {e}")
print(e)
eprint(f"Error: {e}")
eprint(e)
ifself.args.copy:
pyperclip.copy(buffer)
ifself.args.output:
@ -229,7 +232,7 @@ class Standalone:
system_message={"role":"system","content":system}
messages=[system_message,user_message]
exceptFileNotFoundError:
print("pattern not found")
eprint("pattern not found")
return
else:
ifcontext:
@ -262,19 +265,19 @@ class Standalone:
f.write(response.choices[0].message.content)
exceptExceptionase:
if"All connection attempts failed"instr(e):
print(
eprint(
"Error: cannot connect to llama2. If you have not already, please visit https://ollama.com for installation instructions")
if"CLAUDE_API_KEY"instr(e):
print(
eprint(
"Error: CLAUDE_API_KEY not found in environment variables. Please run --setup and add the key")
if"overloaded_error"instr(e):
print(
eprint(
"Error: Fabric is working fine, but claude is overloaded. Please try again later.")
if"Attempted to call a sync iterator on an async stream"instr(e):
print("Error: There is a problem connecting fabric with your local ollama installation. Please visit https://ollama.com for installation instructions. It is possible that you have chosen the wrong model. Please run fabric --listmodels to see the available models and choose the right one with fabric --model <model> or fabric --changeDefaultModel. If this does not work. Restart your computer (always a good idea) and try again. If you are still having problems, please visit https://ollama.com for installation instructions.")
eprint("Error: There is a problem connecting fabric with your local ollama installation. Please visit https://ollama.com for installation instructions. It is possible that you have chosen the wrong model. Please run fabric --listmodels to see the available models and choose the right one with fabric --model <model> or fabric --changeDefaultModel. If this does not work. Restart your computer (always a good idea) and try again. If you are still having problems, please visit https://ollama.com for installation instructions.")