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
Rust agentsagiaiai-memoryaudio-recordingcomputer-visionhermeshermes-agentllmlocal-ailocal-firstmachine-learningmcpmultimodalopenclawprivacyrewindscreen-recordingspeech-to-textycombinator
fix: summary cards and chat improvements
Louis Beaumontd84e09d49799
diff --git a/apps/screenpipe-app-tauri/components/chat/summary-cards.tsx b/apps/screenpipe-app-tauri/components/chat/summary-cards.tsxindex 3b80299b8..286e00ded 100644--- a/apps/screenpipe-app-tauri/components/chat/summary-cards.tsx+++ b/apps/screenpipe-app-tauri/components/chat/summary-cards.tsx@@ -144,9 +144,12 @@ export function SummaryCards({</div><div className="grid grid-cols-2 gap-2">{customTemplates.map((ct) => (- <button+ <divkey={ct.id}+ role="button"+ tabIndex={0}onClick={() => handleCustomTemplateClick(ct)}+ onKeyDown={(e) => e.key === "Enter" && handleCustomTemplateClick(ct)}className="group text-left p-3 rounded-xl border border-border/30 bg-muted/10 hover:bg-muted/40 hover:border-border/60 transition-all duration-150 cursor-pointer relative"><div className="text-lg mb-1">π</div>@@ -166,7 +169,7 @@ export function SummaryCards({><Plus className="w-3 h-3 rotate-45" /></button>- </button>+ </div>))}</div></div>diff --git a/apps/screenpipe-app-tauri/components/standalone-chat.tsx b/apps/screenpipe-app-tauri/components/standalone-chat.tsxindex 0f772794e..eed81ecd0 100644--- a/apps/screenpipe-app-tauri/components/standalone-chat.tsx+++ b/apps/screenpipe-app-tauri/components/standalone-chat.tsx@@ -1365,18 +1365,40 @@ export function StandaloneChat() {const errorStr = data.finalError || "Request failed after retries";console.error("[Pi] Auto-retry failed:", errorStr);- // Detect daily_limit_exceeded from the error- if (errorStr.includes("daily_limit_exceeded") || errorStr.includes("429")) {+ // Detect rate limit or daily limit from the error+ if (errorStr.includes("daily_limit_exceeded") || errorStr.includes("429") || errorStr.includes("rate limit")) {+ // Distinguish between daily limit and per-minute rate limit+ const isDailyLimit = errorStr.includes("daily_limit_exceeded");+ const isPerMinuteRate = errorStr.includes("rate limit exceeded") || errorStr.includes("requests per minute");++ // Extract reset time if availabletry {- const match = errorStr.match(/"resets_at":\s*"([^"]+)"/);- if (match) setUpgradeResetsAt(match[1]);+ const resetMatch = errorStr.match(/"reset_in":\s*(\d+)/);+ const resetsAtMatch = errorStr.match(/"resets_at":\s*"([^"]+)"/);+ if (resetsAtMatch) setUpgradeResetsAt(resetsAtMatch[1]);+ else if (resetMatch) setUpgradeResetsAt(`${resetMatch[1]} seconds`);} catch {}- setUpgradeReason("daily_limit");- posthog.capture("wall_hit", { reason: "daily_limit", source: "chat" });++ if (isDailyLimit) {+ setUpgradeReason("daily_limit");+ posthog.capture("wall_hit", { reason: "daily_limit", source: "chat" });+ } else {+ setUpgradeReason("rate_limit");+ }if (piMessageIdRef.current) {const msgId = piMessageIdRef.current;- const content = "You've used all your free queries for today.";+ let content: string;+ if (isDailyLimit) {+ content = "You've used all your free queries for today.";+ } else if (isPerMinuteRate) {+ // Extract wait time from error+ const waitMatch = errorStr.match(/wait (\d+) seconds/i);+ const waitTime = waitMatch ? waitMatch[1] : "a moment";+ content = `Rate limited β please wait ${waitTime} seconds and try again.`;+ } else {+ content = "Rate limited β try again in a moment or switch to a different model.";+ }setMessages((prev) =>prev.map((m) => m.id === msgId ? { ...m, content } : m));@@ -1401,15 +1423,29 @@ export function StandaloneChat() {const msgId = piMessageIdRef.current;const fullError = `${reason} ${errorDetail}`.trim();- if (fullError.includes("daily_limit_exceeded") || fullError.includes("429")) {- try {- const match = fullError.match(/"resets_at":\s*"([^"]+)"/);- if (match) setUpgradeResetsAt(match[1]);- } catch {}- setUpgradeReason("daily_limit");- setMessages((prev) =>- prev.map((m) => m.id === msgId ? { ...m, content: "You've used all your free queries for today." } : m)- );+ if (fullError.includes("daily_limit_exceeded") || fullError.includes("429") || fullError.includes("rate limit")) {+ const isDailyLimit = fullError.includes("daily_limit_exceeded");+ const isPerMinuteRate = fullError.includes("rate limit exceeded") || fullError.includes("requests per minute");+ if (isDailyLimit) {+ try {+ const match = fullError.match(/"resets_at":\s*"([^"]+)"/);+ if (match) setUpgradeResetsAt(match[1]);+ } catch {}+ setUpgradeReason("daily_limit");+ setMessages((prev) =>+ prev.map((m) => m.id === msgId ? { ...m, content: "You've used all your free queries for today." } : m)+ );+ } else {+ setUpgradeReason("rate_limit");+ const waitMatch = fullError.match(/wait (\d+) seconds/i);+ const waitTime = waitMatch ? waitMatch[1] : "a moment";+ const content = isPerMinuteRate+ ? `Rate limited β please wait ${waitTime} seconds and try again.`+ : "Rate limited β try again in a moment or switch to a different model.";+ setMessages((prev) =>+ prev.map((m) => m.id === msgId ? { ...m, content } : m)+ );+ }} else if (fullError.includes("model_not_allowed")) {setUpgradeReason("model_not_allowed");setMessages((prev) =>@@ -1447,6 +1483,8 @@ export function StandaloneChat() {// Don't overwrite error messages with "Done" or empty contentconst isErrorMessage = existing?.content?.includes("used all your free queries") ||existing?.content?.includes("requires an upgrade") ||+ existing?.content?.includes("Rate limited") ||+ existing?.content?.includes("rate limit") ||existing?.content?.startsWith("Error:");if (isErrorMessage) {return prev;@@ -1488,15 +1526,29 @@ export function StandaloneChat() {if (piMessageIdRef.current) {const msgId = piMessageIdRef.current;- if (errorStr.includes("daily_limit_exceeded") || errorStr.includes("429")) {- try {- const match = errorStr.match(/"resets_at":\s*"([^"]+)"/);- if (match) setUpgradeResetsAt(match[1]);- } catch {}- setUpgradeReason("daily_limit");- setMessages((prev) =>- prev.map((m) => m.id === msgId ? { ...m, content: "You've used all your free queries for today." } : m)- );+ if (errorStr.includes("daily_limit_exceeded") || errorStr.includes("429") || errorStr.includes("rate limit")) {+ const isDailyLimit = errorStr.includes("daily_limit_exceeded");+ const isPerMinuteRate = errorStr.includes("rate limit exceeded") || errorStr.includes("requests per minute");+ if (isDailyLimit) {+ try {+ const match = errorStr.match(/"resets_at":\s*"([^"]+)"/);+ if (match) setUpgradeResetsAt(match[1]);+ } catch {}+ setUpgradeReason("daily_limit");+ setMessages((prev) =>+ prev.map((m) => m.id === msgId ? { ...m, content: "You've used all your free queries for today." } : m)+ );+ } else {+ setUpgradeReason("rate_limit");+ const waitMatch = errorStr.match(/wait (\d+) seconds/i);+ const waitTime = waitMatch ? waitMatch[1] : "a moment";+ const content = isPerMinuteRate+ ? `Rate limited β please wait ${waitTime} seconds and try again.`+ : "Rate limited β try again in a moment or switch to a different model.";+ setMessages((prev) =>+ prev.map((m) => m.id === msgId ? { ...m, content } : m)+ );+ }} else if (errorStr.includes("model_not_allowed")) {setUpgradeReason("model_not_allowed");setMessages((prev) =>diff --git a/apps/screenpipe-app-tauri/src-tauri/Cargo.lock b/apps/screenpipe-app-tauri/src-tauri/Cargo.lockindex b8fcace5d..031697ed9 100755--- a/apps/screenpipe-app-tauri/src-tauri/Cargo.lock+++ b/apps/screenpipe-app-tauri/src-tauri/Cargo.lock@@ -8097,7 +8097,7 @@ dependencies = [[[package]]name = "screenpipe-app"-version = "2.0.507"+version = "2.0.508"dependencies = ["anyhow","arboard",diff --git a/apps/screenpipe-app-tauri/src-tauri/src/pi.rs b/apps/screenpipe-app-tauri/src-tauri/src/pi.rsindex 521cfd0ee..29156d2a2 100644--- a/apps/screenpipe-app-tauri/src-tauri/src/pi.rs+++ b/apps/screenpipe-app-tauri/src-tauri/src/pi.rs@@ -412,10 +412,14 @@ fn ensure_pi_config(user_token: Option<&str>, provider_config: Option<&PiProvide};// Always add screenpipe cloud provider+ // Use actual token value in apiKey (not env var name) β Pi v0.51.1+ may not+ // resolve env var names reliably, causing tier=anonymous on the gateway.+ // Falls back to env var name for backwards compatibility when token is absent.+ let api_key_value = user_token.unwrap_or("SCREENPIPE_API_KEY");let screenpipe_provider = json!({"baseUrl": SCREENPIPE_API_URL,"api": "openai-completions",- "apiKey": "SCREENPIPE_API_KEY",+ "apiKey": api_key_value,"authHeader": true,"models": screenpipe_cloud_models()});