Skip to content

Commit 37ad9f7

Browse files
committed
fix: dev server fix
1 parent 9905334 commit 37ad9f7

File tree

18 files changed

+436
-314
lines changed

18 files changed

+436
-314
lines changed

.claude/settings.local.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,11 @@
66
"WebFetch(domain:thatgurjot.com)",
77
"Bash(pnpm add:*)",
88
"Bash(pnpm tauri signer generate:*)",
9-
"Bash(chmod:*)"
9+
"Bash(chmod:*)",
10+
"Bash(cargo clean:*)",
11+
"Bash(pnpm install:*)",
12+
"Bash(pnpm tauri build:*)",
13+
"Bash(pnpm tauri:*)"
1014
],
1115
"deny": [],
1216
"ask": []

README.md

Lines changed: 2 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,6 @@ Milo is a lightweight desktop application that helps you transform text using AI
1010

1111
- 🎯 **Instant transformations** - Transform clipboard text with global shortcuts
1212
- 🎨 **Custom tones** - Create personalized transformation prompts
13-
- 📊 **Usage tracking** - Monitor your transformations and word counts
14-
- 🔄 **Auto-updates** - Seamless updates with built-in update system
15-
- 🌙 **Dark mode** - Beautiful light and dark themes
16-
-**Lightweight** - Fast, native desktop app built with Tauri
1713

1814
## 🚀 Quick Start
1915

@@ -25,7 +21,7 @@ Milo is a lightweight desktop application that helps you transform text using AI
2521

2622
### Setup
2723

28-
1. **Get a usage key** from the [official Milo website](https://milo-ai.com)
24+
1. **Get a usage key** from the [official Milo website](https://milomilo.work)
2925
2. **Open Milo settings** from the system tray
3026
3. **Enter your usage key** in the settings
3127
4. **Start transforming!** Copy text and use the shortcut (default: `Cmd+M`)
@@ -34,8 +30,7 @@ Milo is a lightweight desktop application that helps you transform text using AI
3430

3531
1. **Copy any text** you want to transform
3632
2. **Press your shortcut** (default: `Cmd+M`)
37-
3. **Your transformed text** replaces the clipboard content
38-
4. **Paste anywhere** - the improved text is ready to use!
33+
3. **Paste anywhere** - the improved text is ready to use!
3934

4035
## ⚙️ Configuration
4136

@@ -44,15 +39,6 @@ Milo is a lightweight desktop application that helps you transform text using AI
4439
- **Usage tracking** - View your transformation history and statistics
4540
- **Auto-updates** - Enable automatic app updates
4641

47-
# Releasing
48-
49-
## 🔐 Important: Back Up Your Signing Key
50-
51-
**For developers building from source:**
52-
53-
Your Tauri signing key is located at `~/.tauri/milo.key`. **CRITICAL:** Back this up securely!
54-
55-
---
5642

5743
## 🛠️ Development
5844

@@ -61,7 +47,6 @@ Your Tauri signing key is located at `~/.tauri/milo.key`. **CRITICAL:** Back thi
6147
- Node.js (v16 or later)
6248
- pnpm (latest version)
6349
- Rust (latest stable)
64-
- Milo usage key (for testing)
6550

6651
### Tech Stack
6752

@@ -89,21 +74,6 @@ Your Tauri signing key is located at `~/.tauri/milo.key`. **CRITICAL:** Back thi
8974
pnpm run tauri build
9075
```
9176

92-
### 🚀 Release Process
93-
94-
See [`RELEASE.md`](RELEASE.md) for complete release instructions.
95-
96-
### 📁 Project Structure
97-
98-
```
99-
milo/
100-
├── src/ # React frontend
101-
├── src-tauri/ # Rust backend
102-
├── scripts/ # Release automation
103-
├── public/ # Static assets
104-
└── dist/ # Built frontend
105-
```
106-
10777
## Contributing
10878

10979
Contributions are welcome! Please feel free to submit a Pull Request.
@@ -121,5 +91,3 @@ This project is licensed under the MIT License - see the [LICENSE](LICENSE) file
12191
## Acknowledgments
12292

12393
- Built with [Tauri](https://tauri.app)
124-
- AI powered by [OpenAI](https://openai.com)
125-
- Icons by [Heroicons](https://heroicons.com)

public/icon.png

353 KB
Loading

src-tauri/src/api.rs

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
use tauri::Manager;
22

3+
use crate::{
4+
settings::{api_key_file_path, litellm_api_key_file_path, Settings},
5+
state::AppState,
6+
};
37
use std::fs;
4-
use crate::{settings::{api_key_file_path, litellm_api_key_file_path, Settings}, state::AppState};
58

69
#[tauri::command]
710
pub async fn save_api_key(key: String) -> Result<(), String> {
@@ -38,16 +41,16 @@ pub async fn get_usage_key_preview() -> Result<String, String> {
3841
let suffix = &key[suffix_start..];
3942
Ok(format!("{}****{}", prefix, suffix))
4043
}
41-
},
42-
Err(_) => Ok("".to_string())
44+
}
45+
Err(_) => Ok("".to_string()),
4346
}
4447
}
4548

46-
47-
48-
4949
#[tauri::command]
50-
pub async fn save_settings(state: tauri::State<'_, AppState>, settings: Settings) -> Result<(), String> {
50+
pub async fn save_settings(
51+
state: tauri::State<'_, AppState>,
52+
settings: Settings,
53+
) -> Result<(), String> {
5154
settings.save()?;
5255
*state.settings.lock().await = settings;
5356
Ok(())
@@ -64,23 +67,23 @@ pub async fn show_settings(window: tauri::Window) -> Result<(), String> {
6467
if let Some(settings_window) = app.get_webview_window("main") {
6568
// Show window first
6669
settings_window.show().map_err(|e| e.to_string())?;
67-
70+
6871
#[cfg(target_os = "macos")]
6972
{
7073
use tauri::UserAttentionType;
7174
let _ = crate::system::move_window_to_active_space(&settings_window);
72-
75+
7376
// Request user attention to draw focus
7477
let _ = settings_window.request_user_attention(Some(UserAttentionType::Critical));
7578
}
76-
79+
7780
// Multiple focus attempts with increasing delays for desktop switching
7881
std::thread::sleep(std::time::Duration::from_millis(200));
7982
settings_window.set_focus().map_err(|e| e.to_string())?;
80-
83+
8184
std::thread::sleep(std::time::Duration::from_millis(100));
8285
settings_window.set_focus().map_err(|e| e.to_string())?;
83-
86+
8487
// Final attempt with even longer delay
8588
std::thread::sleep(std::time::Duration::from_millis(100));
8689
settings_window.set_focus().map_err(|e| e.to_string())?;

src-tauri/src/config.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,4 @@ impl AppConfig {
2626
// Global config instance
2727
lazy_static::lazy_static! {
2828
pub static ref CONFIG: AppConfig = AppConfig::load();
29-
}
29+
}

src-tauri/src/core.rs

Lines changed: 26 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
use tauri::{Manager, Emitter};
21
use arboard::Clipboard;
2+
use tauri::Manager;
33

4-
use crate::transform::transform_text;
5-
use crate::history::add_transformation_to_history;
64
use crate::api::get_litellm_api_key;
5+
use crate::history::add_transformation_to_history;
6+
use crate::transform::transform_text;
77

88
// Helper function to clean text while preserving formatting
99
fn clean_text(text: &str) -> String {
@@ -29,12 +29,15 @@ pub async fn transform_clipboard(
2929
// Get the state and prompt
3030
let state = handle.state::<crate::AppState>();
3131
let settings = state.settings.lock().await;
32-
let prompt = settings.custom_prompts.get(&prompt_key)
32+
let prompt = settings
33+
.custom_prompts
34+
.get(&prompt_key)
3335
.ok_or_else(|| format!("Prompt not found for key: {}", prompt_key))?
3436
.clone();
3537

3638
// Get LiteLLM API key and transform
37-
let litellm_api_key = get_litellm_api_key().await
39+
let litellm_api_key = get_litellm_api_key()
40+
.await
3841
.map_err(|e| format!("Failed to get LiteLLM API key: {}", e))?;
3942

4043
// Drop the lock before async operation
@@ -44,26 +47,30 @@ pub async fn transform_clipboard(
4447
let cleaned_transformed = clean_text(&transformed_text);
4548

4649
// Set transformed text back to clipboard
47-
clipboard.set_text(&cleaned_transformed)
50+
clipboard
51+
.set_text(&cleaned_transformed)
4852
.map_err(|e| format!("Failed to set clipboard text: {}", e))?;
4953

5054
// Store in history (this is the key addition!)
51-
add_transformation_to_history(
52-
prompt_key.clone(),
53-
cleaned_original,
54-
cleaned_transformed,
55-
)?;
55+
add_transformation_to_history(prompt_key.clone(), cleaned_original, cleaned_transformed)?;
5656

57-
// Emit success notification
58-
let notification_message = format!("Successfully transformed with \"{}\" tone", prompt_key);
59-
let _ = handle.emit("transformation_complete", notification_message);
57+
crate::notifications::show_notification(
58+
&handle,
59+
"Milo",
60+
format!("Text transformed with {} tone!", prompt_key),
61+
);
62+
63+
println!("Text transformed with {} tone!", prompt_key);
6064

6165
Ok(())
6266
}
6367

6468
// Function that reads tone from settings and performs transform with history
6569
#[tauri::command]
66-
pub async fn transform_clip_with_setting(handle: tauri::AppHandle, is_shortcut: bool) -> Result<(), String> {
70+
pub async fn transform_clip_with_setting(
71+
handle: tauri::AppHandle,
72+
is_shortcut: bool,
73+
) -> Result<(), String> {
6774
// Get the state and selected tone
6875
let state = handle.state::<crate::AppState>();
6976
let settings = state.settings.lock().await;
@@ -73,7 +80,9 @@ pub async fn transform_clip_with_setting(handle: tauri::AppHandle, is_shortcut:
7380
return Ok(());
7481
}
7582

76-
let tone_key = settings.selected_tone.clone()
83+
let tone_key = settings
84+
.selected_tone
85+
.clone()
7786
.ok_or_else(|| "No tone selected".to_string())?;
7887

7988
// Update selected tone in settings
@@ -84,4 +93,4 @@ pub async fn transform_clip_with_setting(handle: tauri::AppHandle, is_shortcut:
8493

8594
// Perform transformation (which now includes history tracking)
8695
transform_clipboard(handle.clone(), tone_key).await
87-
}
96+
}

0 commit comments

Comments
 (0)