@@ -4,7 +4,7 @@ use arboard::Clipboard;
4
4
5
5
use crate :: transform:: transform_text;
6
6
use crate :: history:: add_transformation_to_history;
7
- use crate :: api:: get_api_key ;
7
+ use crate :: api:: get_litellm_api_key ;
8
8
9
9
// Helper function to clean text while preserving formatting
10
10
fn clean_text ( text : & str ) -> String {
@@ -33,17 +33,17 @@ pub async fn transform_clipboard(
33
33
let prompt = settings. custom_prompts . get ( & prompt_key)
34
34
. ok_or_else ( || format ! ( "Prompt not found for key: {}" , prompt_key) ) ?
35
35
. clone ( ) ;
36
-
37
- // Get API key and transform
38
- let api_key = get_api_key ( ) . await
39
- . map_err ( |e| format ! ( "Failed to get API key: {}" , e) ) ?;
40
-
36
+
37
+ // Get LiteLLM API key and transform
38
+ let litellm_api_key = get_litellm_api_key ( ) . await
39
+ . map_err ( |e| format ! ( "Failed to get LiteLLM API key: {}" , e) ) ?;
40
+
41
41
// Drop the lock before async operation
42
42
drop ( settings) ;
43
-
44
- let transformed_text = transform_text ( & cleaned_original, & prompt, & api_key ) . await ?;
43
+
44
+ let transformed_text = transform_text ( & cleaned_original, & prompt, & litellm_api_key ) . await ?;
45
45
let cleaned_transformed = clean_text ( & transformed_text) ;
46
-
46
+
47
47
// Set transformed text back to clipboard
48
48
clipboard. set_text ( & cleaned_transformed)
49
49
. map_err ( |e| format ! ( "Failed to set clipboard text: {}" , e) ) ?;
@@ -55,13 +55,8 @@ pub async fn transform_clipboard(
55
55
cleaned_transformed,
56
56
) ?;
57
57
58
- // Send notification
59
- handle. notification ( )
60
- . builder ( )
61
- . title ( "Milo" )
62
- . body ( format ! ( "Text transformed with {} tone!" , prompt_key) )
63
- . show ( )
64
- . unwrap ( ) ;
58
+ // Success! Don't show notification - causes crashes on macOS
59
+ // User will see the transformed text in their clipboard
65
60
66
61
Ok ( ( ) )
67
62
}
@@ -77,16 +72,16 @@ pub async fn transform_clip_with_setting(handle: tauri::AppHandle, is_shortcut:
77
72
if is_shortcut && !settings. is_shortcut_enabled ( ) {
78
73
return Ok ( ( ) ) ;
79
74
}
80
-
75
+
81
76
let tone_key = settings. selected_tone . clone ( )
82
77
. ok_or_else ( || "No tone selected" . to_string ( ) ) ?;
83
-
78
+
84
79
// Update selected tone in settings
85
80
settings. save ( ) ?;
86
-
81
+
87
82
// Drop the lock before transformation
88
83
drop ( settings) ;
89
-
84
+
90
85
// Perform transformation (which now includes history tracking)
91
86
transform_clipboard ( handle. clone ( ) , tone_key) . await
92
87
}
0 commit comments