Skip to content

YC (S26) | Open Computer History | Continuously record your company computer work, map your workflows, help you find work worth automating, and power your agents' context

feat: add refresh button to bottom suggestion chips + smarter idle suggestions

Louis Beaumont71559523142e
diff --git a/apps/screenpipe-app-tauri/components/standalone-chat.tsx b/apps/screenpipe-app-tauri/components/standalone-chat.tsx
index fc67a2ba8..777306587 100644
--- a/apps/screenpipe-app-tauri/components/standalone-chat.tsx
+++ b/apps/screenpipe-app-tauri/components/standalone-chat.tsx
@@ -10,7 +10,7 @@ import { Input } from "@/components/ui/input";
import { Button } from "@/components/ui/button";
import { useSettings, ChatMessage, ChatConversation } from "@/lib/hooks/use-settings";
import { cn } from "@/lib/utils";
-import { Loader2, Send, Square, User, Settings, ExternalLink, X, ImageIcon, Zap, History, Search, Trash2, ChevronLeft, ChevronDown, ChevronUp, Plus, Copy, Check, Clock, Paperclip } from "lucide-react";
+import { Loader2, Send, Square, User, Settings, ExternalLink, X, ImageIcon, Zap, History, Search, Trash2, ChevronLeft, ChevronDown, ChevronUp, Plus, Copy, Check, Clock, Paperclip, RefreshCw } from "lucide-react";
import { SchedulePromptDialog } from "@/components/chat/schedule-prompt-dialog";
import { toast } from "@/components/ui/use-toast";
import { motion, AnimatePresence } from "framer-motion";
@@ -3273,7 +3273,7 @@ export function StandaloneChat({ className }: { className?: string } = {}) {
{/* Auto-suggestions above input */}
{!isLoading && messages.length > 0 && autoSuggestions.length > 0 && (
- <div className="px-3 pt-2 flex flex-wrap gap-1.5">
+ <div className="px-3 pt-2 flex flex-wrap items-center gap-1.5">
<AnimatePresence mode="popLayout">
{autoSuggestions.slice(0, 3).map((s, i) => (
<motion.button
@@ -3291,6 +3291,14 @@ export function StandaloneChat({ className }: { className?: string } = {}) {
</motion.button>
))}
</AnimatePresence>
+ <button
+ onClick={refreshSuggestions}
+ disabled={suggestionsRefreshing}
+ className="p-1 text-muted-foreground/30 hover:text-foreground transition-colors duration-150 disabled:opacity-30 cursor-pointer"
+ title="refresh suggestions"
+ >
+ <RefreshCw className={`w-3.5 h-3.5 ${suggestionsRefreshing ? "animate-spin" : ""}`} strokeWidth={1.5} />
+ </button>
</div>
)}
diff --git a/apps/screenpipe-app-tauri/src-tauri/src/suggestions.rs b/apps/screenpipe-app-tauri/src-tauri/src/suggestions.rs
index 918151845..83c4d2566 100644
--- a/apps/screenpipe-app-tauri/src-tauri/src/suggestions.rs
+++ b/apps/screenpipe-app-tauri/src-tauri/src/suggestions.rs
@@ -56,7 +56,7 @@ pub async fn get_cached_suggestions(
) -> Result<CachedSuggestions, String> {
let guard = state.cache.lock().await;
Ok(guard.clone().unwrap_or_else(|| CachedSuggestions {
- suggestions: idle_suggestions(),
+ suggestions: idle_suggestions(&[], &[]),
generated_at: chrono::Utc::now().to_rfc3339(),
mode: "idle".to_string(),
ai_generated: false,
@@ -561,21 +561,54 @@ fn video_editing_suggestions(top_apps: &[String]) -> Vec<Suggestion> {
]
}
-fn idle_suggestions() -> Vec<Suggestion> {
- vec![
+fn idle_suggestions(top_apps: &[String], windows: &[WindowActivity]) -> Vec<Suggestion> {
+ let mut suggestions = vec![
Suggestion {
text: "what did I work on in the last hour?".into(),
},
- Suggestion {
+ ];
+
+ // Add app-specific suggestion from top active app
+ let skip = ["finder", "screenpipe", "screenpipe-app", "loginwindow", "systemuiserver"];
+ if let Some(app) = top_apps.iter().find(|a| !skip.contains(&a.to_lowercase().as_str())) {
+ suggestions.push(Suggestion {
+ text: format!("what was I doing in {}?", app),
+ });
+ }
+
+ // Add a window-specific suggestion from the most active window
+ let interesting_window = windows.iter().find(|w| {
+ w.window_name.len() > 5
+ && w.window_name != "Untitled"
+ && w.window_name != "New Tab"
+ && !skip.contains(&w.app_name.to_lowercase().as_str())
+ });
+ if let Some(w) = interesting_window {
+ let title = if w.window_name.chars().count() > 35 {
+ let truncated: String = w.window_name.chars().take(32).collect();
+ format!("{}...", truncated)
+ } else {
+ w.window_name.clone()
+ };
+ suggestions.push(Suggestion {
+ text: format!("summarize \"{}\"", title),
+ });
+ }
+
+ // Fill remaining slots
+ if suggestions.len() < 4 {
+ suggestions.push(Suggestion {
text: "summarize my day so far".into(),
- },
- Suggestion {
+ });
+ }
+ if suggestions.len() < 4 {
+ suggestions.push(Suggestion {
text: "which apps did I use most today?".into(),
- },
- Suggestion {
- text: "how did I spend my time today?".into(),
- },
- ]
+ });
+ }
+
+ suggestions.truncate(4);
+ suggestions
}
fn template_suggestions(
@@ -590,7 +623,7 @@ fn template_suggestions(
"writing" => writing_suggestions(top_apps),
"communication" => communication_suggestions(windows),
"video_editing" => video_editing_suggestions(top_apps),
- _ => idle_suggestions(),
+ _ => idle_suggestions(top_apps, windows),
}
}