Merge branch 'main' into watch

This commit is contained in:
Paul Gauthier 2024-11-07 13:44:51 -08:00
commit d4a88d08e4
21 changed files with 521 additions and 289 deletions

View file

@ -1,6 +1,7 @@
import base64
import os
import threading
import webbrowser
from collections import defaultdict
from dataclasses import dataclass
from datetime import datetime
@ -532,6 +533,15 @@ class InputOutput:
hist = "\n" + content.strip() + "\n\n"
self.append_chat_history(hist)
def offer_url(self, url, prompt="Open URL for more info?"):
"""Offer to open a URL in the browser, returns True if opened."""
if url in self.never_prompts:
return False
if self.confirm_ask(prompt, subject=url, allow_never=True):
webbrowser.open(url)
return True
return False
def confirm_ask(
self,
question,