diff --git a/assistant.py b/assistant.py index 4ae15d3..d5c7735 100755 --- a/assistant.py +++ b/assistant.py @@ -70,7 +70,7 @@ def parse_commands(text): case '/copy': blocks = extract_code_block(history[-1]['content']) if len(blocks): - copy_string_to_clipboard(blocks[0]) + copy_string_to_clipboard(blocks[0][1:-1]) return True case '/exit': exit() @@ -133,10 +133,10 @@ def extract_code_block(markdown_text): for match in matches: code_block = match.group(0) - highlighted_code = highlight_code(None, code_block) + #highlighted_code = highlight_code(None, code_block) # Add the highlighted code block to the list of code blocks - code_blocks.append(highlighted_code) + code_blocks.append(code_block) if len(code_blocks) == 0: @@ -274,6 +274,8 @@ def parse_args(): parser.add_argument('--reasoning', '-r', action='store_true', help='Use the default reasoning model deepseek-r1:14b') # Add the --new argument parser.add_argument('--new', '-n', action='store_true', help='Start a chat with a fresh history') + # Add the --temporary argument + parser.add_argument('--temporary', action='store_true', help='Start a chat with a fresh history, without deleting old history') # Parse the arguments return parser.parse_args() @@ -383,9 +385,6 @@ def handle_non_piped_input(args): result = chat2(args, user_input) exit() - global history - history = load_history(history_path) - print("\033[91massistant\033[0m: Type your message (press Ctrl+D to send):") while True: try: @@ -422,10 +421,14 @@ def main(): if args.context: global num_ctx num_ctx = int(args.context) + global history if args.new: - global history history = [system_prompt] save_history(history, history_path) + elif args.temporary: + history = [system_prompt] + else: + history = load_history(history_path) if not sys.stdin.isatty(): handle_piped_input(args) else: