File tree 2 files changed +20
-0
lines changed
2 files changed +20
-0
lines changed Original file line number Diff line number Diff line change 7
7
8
8
log = get_logger (__name__ )
9
9
10
+ try :
11
+ from rubicon .objc import ObjCClass
12
+ NSUserNotification = ObjCClass ("NSUserNotification" )
13
+ NSUserNotificationCenter = ObjCClass ("NSUserNotificationCenter" )
14
+ NOTIFICATIONS_AVAILABLE = True
15
+ except ImportError :
16
+ log .warning ("rubicon.objc not found, macOS notifications disabled" )
17
+ NOTIFICATIONS_AVAILABLE = False
18
+
10
19
11
20
class PlainConsoleUI (UIBase ):
12
21
"""
@@ -53,6 +62,13 @@ async def send_feature_finished(
53
62
):
54
63
pass
55
64
65
+ async def send_notification (self , title : str , message : str ):
66
+ if NOTIFICATIONS_AVAILABLE :
67
+ notification = NSUserNotification .alloc ().init ()
68
+ notification .title = title
69
+ notification .informativeText = message
70
+ NSUserNotificationCenter .defaultUserNotificationCenter .deliverNotification_ (notification )
71
+
56
72
async def ask_question (
57
73
self ,
58
74
question : str ,
@@ -65,6 +81,9 @@ async def ask_question(
65
81
initial_text : Optional [str ] = None ,
66
82
source : Optional [UISource ] = None ,
67
83
) -> UserInput :
84
+ # Send notification
85
+ await self .send_notification ("GPT Pilot Input Required" , question )
86
+
68
87
if source :
69
88
print (f"[{ source } ] { question } " )
70
89
else :
Original file line number Diff line number Diff line change @@ -40,3 +40,4 @@ tqdm==4.66.4
40
40
typing-extensions == 4.12.1
41
41
urllib3 == 2.2.1
42
42
wcwidth == 0.2.13
43
+ rubicon-objc == 0.4.9
You can’t perform that action at this time.
0 commit comments