fixed context

This commit is contained in:
jad2121 2024-02-18 16:34:47 -05:00
parent 8f4ab672c6
commit d15e022abf
3 changed files with 13 additions and 5 deletions

View File

@ -1,3 +1,3 @@
# Context # Context
The user should place a context here please give all responses in spanish

View File

@ -14,7 +14,7 @@ def main():
) )
parser.add_argument("--text", "-t", help="Text to extract summary from") parser.add_argument("--text", "-t", help="Text to extract summary from")
parser.add_argument( parser.add_argument(
"--copy", "-c", help="Copy the response to the clipboard", action="store_true" "--copy", "-C", help="Copy the response to the clipboard", action="store_true"
) )
parser.add_argument( parser.add_argument(
"--output", "--output",
@ -45,7 +45,7 @@ def main():
parser.add_argument( parser.add_argument(
"--listmodels", help="List all available models", action="store_true" "--listmodels", help="List all available models", action="store_true"
) )
parser.add_argument('--context', '-C', parser.add_argument('--context', '-c',
help="Use Context file (context.md) to add context to your pattern", action="store_true") help="Use Context file (context.md) to add context to your pattern", action="store_true")
args = parser.parse_args() args = parser.parse_args()

View File

@ -79,6 +79,10 @@ class Standalone:
except FileNotFoundError: except FileNotFoundError:
print("pattern not found") print("pattern not found")
return return
else:
if context:
user_message += {role: "system", content: context}
messages = [user_message]
else: else:
messages = [user_message] messages = [user_message]
try: try:
@ -141,6 +145,10 @@ class Standalone:
except FileNotFoundError: except FileNotFoundError:
print("pattern not found") print("pattern not found")
return return
else:
if context:
user_message += {'role': 'system', 'content': context}
messages = [user_message]
else: else:
messages = [user_message] messages = [user_message]
try: try: