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

tighten chat composer controls

Louis Beaumont33c20de0736a
diff --git a/apps/screenpipe-app-tauri/components/rewind/ai-presets-selector.tsx b/apps/screenpipe-app-tauri/components/rewind/ai-presets-selector.tsx
index 43dac8af2..e21ebd173 100644
--- a/apps/screenpipe-app-tauri/components/rewind/ai-presets-selector.tsx
+++ b/apps/screenpipe-app-tauri/components/rewind/ai-presets-selector.tsx
@@ -972,6 +972,12 @@ interface AIPresetsSelectorProps {
noneLabel?: string;
/** Compact size variant for inline usage */
compact?: boolean;
+ /** Class applied to the outer selector wrapper. */
+ containerClassName?: string;
+ /** Class applied to the trigger button. */
+ triggerClassName?: string;
+ /** For tight composer UIs, show the active model instead of preset details. */
+ showModelOnly?: boolean;
}
export const AIPresetDialog = ({
@@ -1060,6 +1066,9 @@ export const AIPresetsSelector = ({
allowNone = false,
noneLabel = "none (use pipe defaults)",
compact = false,
+ containerClassName,
+ triggerClassName,
+ showModelOnly = false,
}: AIPresetsSelectorProps) => {
const { settings, updateSettings } = useSettings();
const [open, setOpen] = useState(false);
@@ -1094,6 +1103,11 @@ export const AIPresetsSelector = ({
return preset?.provider === "screenpipe-cloud" && !settings?.user?.token;
}, [aiPresets, selectedPreset, settings?.user?.token]);
+ const selectedPresetData = useMemo(
+ () => aiPresets.find((p) => p.id === selectedPreset),
+ [aiPresets, selectedPreset]
+ );
+
useEffect(() => {
if (onPresetChange) {
onPresetChange(aiPresets.find((p) => p.id === selectedPreset) as AIPreset);
@@ -1370,8 +1384,8 @@ export const AIPresetsSelector = ({
return (
<>
- <div className="flex flex-col w-full gap-2">
- {!isControlled && selectedPresetRequiresLogin && (
+ <div className={cn("flex flex-col w-full gap-2", containerClassName)}>
+ {!isControlled && selectedPresetRequiresLogin && !showModelOnly && (
<div className="flex items-center gap-2 p-2 text-sm bg-muted border border-border rounded-lg">
<AlertTriangle className="h-4 w-4 text-muted-foreground shrink-0" />
<span className="text-foreground flex-1">
@@ -1398,46 +1412,54 @@ export const AIPresetsSelector = ({
<Tooltip>
<PopoverTrigger asChild>
<Button
+ type="button"
variant="outline"
role="combobox"
aria-expanded={open}
className={cn(
"w-full justify-between hover:bg-accent hover:text-accent-foreground",
compact && "h-8 text-xs",
- selectedPresetRequiresLogin && "border-amber-500/50"
+ selectedPresetRequiresLogin && "border-amber-500/50",
+ triggerClassName
)}
>
{selectedPreset ? (
- <div className="flex w-full items-center justify-between gap-2 overflow-hidden min-w-0">
- <div className="flex items-center gap-2 min-w-0 flex-shrink overflow-hidden">
+ showModelOnly ? (
+ <div className="flex min-w-0 flex-1 items-center gap-1.5 overflow-hidden">
{selectedPresetRequiresLogin && (
<AlertTriangle className="h-4 w-4 text-amber-500 shrink-0" />
)}
- <span className="font-medium truncate text-left">
- {formatPresetName(
- aiPresets.find(
- (preset) => preset.id === selectedPreset,
- )?.id || ''
- )}
- </span>
- </div>
- <div className="flex items-center gap-2 text-xs text-muted-foreground min-w-0 flex-1 justify-end overflow-hidden">
- <span className="rounded bg-muted px-1.5 py-0.5 whitespace-nowrap shrink-0">
- {
- aiPresets.find(
- (preset) => preset.id === selectedPreset,
- )?.provider
- }
- </span>
- <span className="hidden sm:block truncate min-w-0" title={aiPresets.find((p) => p.id === selectedPreset)?.model}>
- {
- aiPresets.find(
- (preset) => preset.id === selectedPreset,
- )?.model
+ <span
+ className="truncate text-left font-medium"
+ title={
+ selectedPresetData
+ ? `${selectedPresetData.id} (${selectedPresetData.model})`
+ : undefined
}
+ >
+ {selectedPresetData?.model || formatPresetName(selectedPreset)}
</span>
</div>
- </div>
+ ) : (
+ <div className="flex w-full items-center justify-between gap-2 overflow-hidden min-w-0">
+ <div className="flex items-center gap-2 min-w-0 flex-shrink overflow-hidden">
+ {selectedPresetRequiresLogin && (
+ <AlertTriangle className="h-4 w-4 text-amber-500 shrink-0" />
+ )}
+ <span className="font-medium truncate text-left">
+ {formatPresetName(selectedPresetData?.id || '')}
+ </span>
+ </div>
+ <div className="flex items-center gap-2 text-xs text-muted-foreground min-w-0 flex-1 justify-end overflow-hidden">
+ <span className="rounded bg-muted px-1.5 py-0.5 whitespace-nowrap shrink-0">
+ {selectedPresetData?.provider}
+ </span>
+ <span className="hidden sm:block truncate min-w-0" title={selectedPresetData?.model}>
+ {selectedPresetData?.model}
+ </span>
+ </div>
+ </div>
+ )
) : allowNone && isControlled ? (
<span className="text-muted-foreground">{noneLabel}</span>
) : (
@@ -1463,7 +1485,13 @@ export const AIPresetsSelector = ({
</TooltipContent>
</Tooltip>
</TooltipProvider>
- <PopoverContent side="top" sideOffset={6} className="min-w-[500px] w-[--radix-popover-trigger-width] p-0">
+ <PopoverContent
+ side="top"
+ sideOffset={6}
+ align={showModelOnly ? "end" : "center"}
+ alignOffset={showModelOnly ? -16 : 0}
+ className="min-w-[500px] w-[--radix-popover-trigger-width] p-0"
+ >
<Command>
<CommandInput placeholder="search presets..." />
<CommandList>
diff --git a/apps/screenpipe-app-tauri/components/standalone-chat.tsx b/apps/screenpipe-app-tauri/components/standalone-chat.tsx
index f32a21ab5..65d0b866f 100644
--- a/apps/screenpipe-app-tauri/components/standalone-chat.tsx
+++ b/apps/screenpipe-app-tauri/components/standalone-chat.tsx
@@ -3229,6 +3229,19 @@ export function StandaloneChat({
activeFilters.contentType ||
activeFilters.appName ||
activeFilters.speakerName;
+ const activeFilterCount = (activeFilters.timeRanges.length > 0 ? 1 : 0) +
+ (activeFilters.contentType ? 1 : 0) +
+ (activeFilters.appName ? 1 : 0) +
+ (activeFilters.speakerName ? 1 : 0);
+ const activeFilterLabels = React.useMemo(
+ () => [
+ ...activeFilters.timeRanges.map((range) => range.label),
+ activeFilters.contentType,
+ activeFilters.appName,
+ activeFilters.speakerName,
+ ].filter((label): label is string => Boolean(label)),
+ [activeFilters]
+ );
// Remove a specific @mention from input
const removeFilter = (filterType: "time" | "content" | "app" | "speaker", label?: string) => {
@@ -5745,6 +5758,266 @@ export function StandaloneChat({
setIsStreaming(false);
};
+ const renderComposerUtilityMenu = () => {
+ const isPro = settings.user?.cloud_subscribed === true;
+ const privacyOn = isPro && settings.piPrivacyFilter === true;
+ const timeLabels: Record<string, string> = {
+ "today's activity": "today",
+ "yesterday": "yesterday",
+ "past 7 days": "last week",
+ "past hour": "last hour",
+ "this morning": "this morning",
+ };
+
+ return (
+ <>
+ <div className="p-1 border-b border-border/50">
+ <button
+ type="button"
+ disabled={isLoading || !canChat}
+ onClick={async () => {
+ setAppFilterOpen(false);
+ await handleFilePicker();
+ }}
+ className="w-full flex items-center gap-2 px-2 py-2 text-left text-sm rounded-md hover:bg-muted disabled:opacity-40 disabled:pointer-events-none transition-colors"
+ >
+ <Paperclip className="h-4 w-4 text-muted-foreground shrink-0" />
+ <span>add photos & files</span>
+ </button>
+ <TooltipProvider delayDuration={150}>
+ <Tooltip>
+ <TooltipTrigger asChild>
+ <button
+ type="button"
+ disabled={isLoading}
+ onClick={() => {
+ if (!isPro) {
+ setAppFilterOpen(false);
+ openUrl("https://screenpi.pe/onboarding");
+ return;
+ }
+ updateSettings({ piPrivacyFilter: !privacyOn });
+ }}
+ className="w-full flex items-center gap-2 px-2 py-2 text-left text-sm rounded-md hover:bg-muted disabled:opacity-40 disabled:pointer-events-none transition-colors"
+ >
+ {privacyOn ? (
+ <ShieldCheck className="h-4 w-4 text-foreground shrink-0" />
+ ) : (
+ <Shield className="h-4 w-4 text-muted-foreground shrink-0" />
+ )}
+ <span className="flex-1 min-w-0">privacy filter</span>
+ <span className="text-[10px] uppercase tracking-wider text-muted-foreground">
+ {!isPro ? "pro" : privacyOn ? "on" : "off"}
+ </span>
+ </button>
+ </TooltipTrigger>
+ <TooltipContent
+ side="right"
+ align="start"
+ className="max-w-[320px] p-3 space-y-2 text-xs leading-relaxed"
+ >
+ <div className="font-medium text-sm">
+ {!isPro
+ ? "Privacy filter — Pro"
+ : privacyOn
+ ? "Privacy filter: ON"
+ : "Privacy filter: OFF"}
+ </div>
+ <div className="text-muted-foreground">
+ {!isPro
+ ? "Remove names, emails, phone numbers and other personal info from your screen data before the AI sees it. Adds ~1-2s per search. Click to upgrade."
+ : privacyOn
+ ? "Names, emails, phone numbers and other personal info are removed from your screen data before it reaches the AI. Adds ~1-2s per search. Click to turn off."
+ : "Turn this on to strip personal info (names, emails, phones, addresses, account numbers) from your screen data before the AI sees it. Adds ~1-2s per search."}
+ </div>
+ <button
+ type="button"
+ onClick={(e) => {
+ e.stopPropagation();
+ e.preventDefault();
+ openUrl("https://docs.screenpi.pe/privacy-filter");
+ }}
+ className="text-[11px] underline text-muted-foreground hover:text-foreground transition-colors"
+ >
+ How it works →
+ </button>
+ </TooltipContent>
+ </Tooltip>
+ </TooltipProvider>
+ </div>
+
+ <div className="px-2 py-1 text-[10px] font-medium uppercase tracking-wider text-muted-foreground bg-muted/30 border-b border-border/50 flex items-center gap-1.5">
+ <Filter className="h-3 w-3" />
+ <span>filters</span>
+ {activeFilterCount > 0 && (
+ <span className="ml-auto text-foreground">{activeFilterCount}</span>
+ )}
+ </div>
+
+ <div className="px-2 py-1 text-[10px] font-medium uppercase tracking-wider text-muted-foreground bg-muted/30 border-b border-border/50">
+ time
+ </div>
+ {STATIC_MENTION_SUGGESTIONS.filter((s) => s.category === "time").map((s) => {
+ const isActive = activeFilters.timeRanges.some((r) => r.label === timeLabels[s.description]);
+ return (
+ <button
+ key={s.tag}
+ type="button"
+ onClick={() => {
+ if (isActive) {
+ removeFilter("time", timeLabels[s.description]);
+ } else {
+ removeFilter("time");
+ setTimeout(() => {
+ setInput((prev) => `${s.tag} ${prev.trim()}`.trim() + " ");
+ }, 0);
+ }
+ setAppFilterOpen(false);
+ }}
+ className={cn(
+ "w-full px-3 py-1.5 text-left text-xs font-mono hover:bg-muted/50 transition-colors flex items-center justify-between gap-2",
+ isActive && "bg-muted"
+ )}
+ >
+ <span>{s.tag}</span>
+ <span className="text-[10px] text-muted-foreground">{s.description}</span>
+ </button>
+ );
+ })}
+
+ <div className="px-2 py-1 text-[10px] font-medium uppercase tracking-wider text-muted-foreground bg-muted/30 border-b border-border/50 border-t">
+ content type
+ </div>
+ {STATIC_MENTION_SUGGESTIONS.filter((s) => s.category === "content").map((s) => {
+ const contentTypeMap: Record<string, string> = { screen: "screen", audio: "audio", input: "input" };
+ const tagName = s.tag.slice(1);
+ const isActive = activeFilters.contentType === (contentTypeMap[tagName] || tagName);
+ return (
+ <button
+ key={s.tag}
+ type="button"
+ onClick={() => {
+ if (isActive) {
+ removeFilter("content");
+ } else {
+ removeFilter("content");
+ setTimeout(() => {
+ setInput((prev) => `${s.tag} ${prev.trim()}`.trim() + " ");
+ }, 0);
+ }
+ setAppFilterOpen(false);
+ }}
+ className={cn(
+ "w-full px-3 py-1.5 text-left text-xs font-mono hover:bg-muted/50 transition-colors flex items-center justify-between gap-2",
+ isActive && "bg-muted"
+ )}
+ >
+ <span>{s.tag}</span>
+ <span className="text-[10px] text-muted-foreground">{s.description}</span>
+ </button>
+ );
+ })}
+
+ <div className="px-2 py-1 text-[10px] font-medium uppercase tracking-wider text-muted-foreground bg-muted/30 border-b border-border/50 border-t">
+ apps
+ </div>
+ {appMentionSuggestions.length === 0 ? (
+ <div className="px-3 py-2 text-[10px] text-muted-foreground">no apps detected yet</div>
+ ) : (
+ appMentionSuggestions.map((suggestion) => {
+ const isActive = activeFilters.appName === suggestion.appName;
+ return (
+ <button
+ key={`app-${suggestion.tag}`}
+ type="button"
+ onClick={() => {
+ if (isActive) {
+ removeFilter("app");
+ } else {
+ if (activeFilters.appName) removeFilter("app");
+ setInput((prev) => `${suggestion.tag} ${prev.trim()}`.trim() + " ");
+ }
+ setAppFilterOpen(false);
+ }}
+ className={cn(
+ "w-full px-3 py-1.5 text-left text-xs font-mono hover:bg-muted/50 transition-colors flex items-center justify-between gap-2",
+ isActive && "bg-muted"
+ )}
+ >
+ <span>{suggestion.tag}</span>
+ <span className="text-[10px] text-muted-foreground truncate">{suggestion.description}</span>
+ </button>
+ );
+ })
+ )}
+
+ {connections.length > 0 && (
+ <>
+ <div className="px-2 py-1 text-[10px] font-medium uppercase tracking-wider text-muted-foreground bg-muted/30 border-b border-border/50 border-t">
+ connections
+ </div>
+ {connections.map((c) => {
+ const tag = `@${c.id}`;
+ return (
+ <button
+ key={`conn-${c.id}`}
+ type="button"
+ onClick={() => {
+ setInput((prev) => `${tag} ${prev.trim()}`.trim() + " ");
+ setAppFilterOpen(false);
+ }}
+ className="w-full px-3 py-1.5 text-left text-xs font-mono hover:bg-muted/50 transition-colors flex items-center justify-between gap-2"
+ >
+ <span className="flex items-center gap-1.5 min-w-0">
+ <ConnectionToolIcon name={c.icon || c.id} />
+ <span className="truncate">{tag}</span>
+ </span>
+ <span className="text-[10px] text-muted-foreground truncate">
+ {c.name}
+ </span>
+ </button>
+ );
+ })}
+ </>
+ )}
+
+ {recentSpeakers.length > 0 && (
+ <>
+ <div className="px-2 py-1 text-[10px] font-medium uppercase tracking-wider text-muted-foreground bg-muted/30 border-b border-border/50 border-t">
+ speakers
+ </div>
+ {recentSpeakers.map((s) => {
+ const speakerName = s.tag.startsWith('@"') ? s.tag.slice(2, -1) : s.tag.slice(1);
+ const isActive = activeFilters.speakerName === speakerName;
+ return (
+ <button
+ key={`speaker-${s.tag}`}
+ type="button"
+ onClick={() => {
+ if (isActive) {
+ removeFilter("speaker");
+ } else {
+ if (activeFilters.speakerName) removeFilter("speaker");
+ setInput((prev) => `${s.tag} ${prev.trim()}`.trim() + " ");
+ }
+ setAppFilterOpen(false);
+ }}
+ className={cn(
+ "w-full px-3 py-1.5 text-left text-xs font-mono hover:bg-muted/50 transition-colors flex items-center justify-between gap-2",
+ isActive && "bg-muted"
+ )}
+ >
+ <span>{s.tag}</span>
+ <span className="text-[10px] text-muted-foreground">speaker</span>
+ </button>
+ );
+ })}
+ </>
+ )}
+ </>
+ );
+ };
+
return (
<div className={cn("flex flex-col bg-background", className ?? "h-screen")} data-testid="section-home">
{/* Header - draggable only in standalone mode */}
@@ -6013,7 +6286,7 @@ export function StandaloneChat({
setTimeout(() => document.addEventListener("mousedown", remove), 0);
}}
>
- <div className={cn(CHAT_RAIL_CLASS, "p-4 space-y-4")}>
+ <div className={cn(CHAT_RAIL_CLASS, "px-5 sm:px-6 py-4 space-y-4")}>
{/* Pipe-watch banner — shown when the user clicked through from
a running pipe execution. Replaces the prior synthetic
"Watching pipe: X" user-bubble sentinel. */}
@@ -6358,7 +6631,7 @@ export function StandaloneChat({
{/* Prefill, filters, suggestions first; then attached images in gap; then agent bar; then form */}
{/* Prefill context indicator from search */}
{(prefillContext || prefillFrameId) && (
- <div className="px-4 py-2 border-b border-border/30 bg-muted/30">
+ <div className="px-5 sm:px-6 py-2 border-b border-border/30 bg-muted/30">
<div className="flex items-start justify-between gap-2">
{prefillFrameId && (
<div className="flex-shrink-0">
@@ -6403,57 +6676,6 @@ export function StandaloneChat({
</div>
)}
- {/* Active filters chips */}
- {hasActiveFilters && (
- <div className="px-4 py-2 border-b border-border/30 flex flex-wrap gap-1.5">
- {activeFilters.timeRanges.map((range, idx) => (
- <button
- key={`time-${idx}`}
- type="button"
- onClick={() => removeFilter("time", range.label)}
- className="inline-flex items-center gap-1 px-2 py-0.5 text-[10px] font-medium bg-blue-500/10 text-blue-600 dark:text-blue-400 border border-blue-500/20 rounded-full hover:bg-blue-500/20 transition-colors"
- >
- <span>🕐</span>
- <span>{range.label}</span>
- <X className="w-2.5 h-2.5 ml-0.5" />
- </button>
- ))}
- {activeFilters.contentType && (
- <button
- type="button"
- onClick={() => removeFilter("content")}
- className="inline-flex items-center gap-1 px-2 py-0.5 text-[10px] font-medium bg-purple-500/10 text-purple-600 dark:text-purple-400 border border-purple-500/20 rounded-full hover:bg-purple-500/20 transition-colors"
- >
- <span>{activeFilters.contentType === "audio" ? "🎤" : "🖥️"}</span>
- <span>{activeFilters.contentType}</span>
- <X className="w-2.5 h-2.5 ml-0.5" />
- </button>
- )}
- {activeFilters.appName && (
- <button
- type="button"
- onClick={() => removeFilter("app")}
- className="inline-flex items-center gap-1 px-2 py-0.5 text-[10px] font-medium bg-green-500/10 text-green-600 dark:text-green-400 border border-green-500/20 rounded-full hover:bg-green-500/20 transition-colors"
- >
- <span>📱</span>
- <span>{activeFilters.appName}</span>
- <X className="w-2.5 h-2.5 ml-0.5" />
- </button>
- )}
- {activeFilters.speakerName && (
- <button
- type="button"
- onClick={() => removeFilter("speaker")}
- className="inline-flex items-center gap-1 px-2 py-0.5 text-[10px] font-medium bg-orange-500/10 text-orange-600 dark:text-orange-400 border border-orange-500/20 rounded-full hover:bg-orange-500/20 transition-colors"
- >
- <span>👤</span>
- <span>{activeFilters.speakerName}</span>
- <X className="w-2.5 h-2.5 ml-0.5" />
- </button>
- )}
- </div>
- )}
-
{/* Follow-up suggestions (TikTok-style) */}
<AnimatePresence>
{!isLoading && followUpSuggestions.length > 0 && messages.length > 0 && (
@@ -6462,7 +6684,7 @@ export function StandaloneChat({
animate={{ opacity: 1, y: 0 }}
exit={{ opacity: 0, y: 8 }}
transition={{ duration: 0.2 }}
- className="px-4 pt-2 flex flex-col gap-1"
+ className="px-5 sm:px-6 pt-2 flex flex-col gap-1"
>
<span className="text-[10px] text-muted-foreground/60 uppercase tracking-wider font-medium">follow up</span>
<div className="flex flex-wrap gap-1.5">
@@ -6484,12 +6706,12 @@ export function StandaloneChat({
{/* Persistent auto-suggestions above input. Inline chips when the
input is wide enough; collapses to a single trigger button that
opens a popover when narrow (e.g. BrowserSidebar squeezed the
- chat column). 520px is the rough threshold below which 4 chips
+ chat column). 520px is the rough threshold below which 3 chips
wrap to multiple rows and eat too much vertical space. */}
{messages.length > 0 && !isLoading && connectionAwareSuggestions.length > 0 && (
inputSectionWidth >= 520 ? (
- <div className="px-4 pt-2 flex flex-wrap gap-1.5 items-center">
- {connectionAwareSuggestions.slice(0, 4).map((s, i) => (
+ <div className="px-5 sm:px-6 pt-2 flex flex-wrap gap-1.5 items-center">
+ {connectionAwareSuggestions.slice(0, 3).map((s, i) => (
<button
key={i}
type="button"
@@ -6511,7 +6733,7 @@ export function StandaloneChat({
</button>
</div>
) : (
- <div className="px-4 pt-2 flex items-center gap-1.5">
+ <div className="px-5 sm:px-6 pt-2 flex items-center gap-1.5">
<Popover>
<PopoverTrigger asChild>
<button
@@ -6531,7 +6753,7 @@ export function StandaloneChat({
sideOffset={6}
>
<div className="flex flex-col gap-0.5">
- {connectionAwareSuggestions.slice(0, 4).map((s, i) => (
+ {connectionAwareSuggestions.slice(0, 3).map((s, i) => (
<button
key={i}
type="button"
@@ -6560,7 +6782,7 @@ export function StandaloneChat({
{/* Attached images in the gap (above agent bar, like reference); click to open full-screen viewer */}
{pastedImages.length > 0 && (
- <div className="px-4 py-2 border-b border-border/30 flex flex-wrap items-center gap-2">
+ <div className="px-5 sm:px-6 py-2 border-b border-border/30 flex flex-wrap items-center gap-2">
{pastedImages.map((img, i) => (
<div key={i} className="relative group shrink-0">
<button
@@ -6587,222 +6809,9 @@ export function StandaloneChat({
</div>
)}
- <div className="px-4 py-2 border-b border-border/30 flex items-center gap-2">
- <Popover open={appFilterOpen} onOpenChange={setAppFilterOpen}>
- <PopoverTrigger asChild>
- <button
- type="button"
- className={cn(
- "shrink-0 flex items-center gap-1 px-2 h-10 text-[11px] font-mono border rounded-md transition-colors",
- hasActiveFilters
- ? "border-foreground text-foreground"
- : "border-border text-muted-foreground hover:text-foreground hover:border-foreground"
- )}
- title="Search filters"
- >
- <Filter className="w-3 h-3" />
- <span>filter</span>
- {hasActiveFilters && (
- <span className="text-[10px] text-muted-foreground">
- ({(activeFilters.timeRanges.length > 0 ? 1 : 0) +
- (activeFilters.contentType ? 1 : 0) +
- (activeFilters.appName ? 1 : 0) +
- (activeFilters.speakerName ? 1 : 0)})
- </span>
- )}
- </button>
- </PopoverTrigger>
- <PopoverContent className="w-64 p-0 max-h-[360px] overflow-y-auto" align="start">
- {/* Time filters */}
- <div className="px-2 py-1 text-[10px] font-medium uppercase tracking-wider text-muted-foreground bg-muted/30 border-b border-border/50">
- time
- </div>
- {STATIC_MENTION_SUGGESTIONS.filter((s) => s.category === "time").map((s) => {
- const timeLabels: Record<string, string> = {
- "today's activity": "today",
- "yesterday": "yesterday",
- "past 7 days": "last week",
- "past hour": "last hour",
- "this morning": "this morning",
- };
- const isActive = activeFilters.timeRanges.some((r) => r.label === timeLabels[s.description]);
- return (
- <button
- key={s.tag}
- type="button"
- onClick={() => {
- if (isActive) {
- removeFilter("time", timeLabels[s.description]);
- } else {
- removeFilter("time");
- setTimeout(() => {
- setInput((prev) => `${s.tag} ${prev.trim()}`.trim() + " ");
- }, 0);
- }
- setAppFilterOpen(false);
- }}
- className={cn(
- "w-full px-3 py-1.5 text-left text-xs font-mono hover:bg-muted/50 transition-colors flex items-center justify-between gap-2",
- isActive && "bg-muted"
- )}
- >
- <span>{s.tag}</span>
- <span className="text-[10px] text-muted-foreground">{s.description}</span>
- </button>
- );
- })}
-
- {/* Content type filters */}
- <div className="px-2 py-1 text-[10px] font-medium uppercase tracking-wider text-muted-foreground bg-muted/30 border-b border-border/50 border-t">
- content type
- </div>
- {STATIC_MENTION_SUGGESTIONS.filter((s) => s.category === "content").map((s) => {
- const contentTypeMap: Record<string, string> = { screen: "screen", audio: "audio", input: "input" };
- const tagName = s.tag.slice(1);
- const isActive = activeFilters.contentType === (contentTypeMap[tagName] || tagName);
- return (
- <button
- key={s.tag}
- type="button"
- onClick={() => {
- if (isActive) {
- removeFilter("content");
- } else {
- removeFilter("content");
- setTimeout(() => {
- setInput((prev) => `${s.tag} ${prev.trim()}`.trim() + " ");
- }, 0);
- }
- setAppFilterOpen(false);
- }}
- className={cn(
- "w-full px-3 py-1.5 text-left text-xs font-mono hover:bg-muted/50 transition-colors flex items-center justify-between gap-2",
- isActive && "bg-muted"
- )}
- >
- <span>{s.tag}</span>
- <span className="text-[10px] text-muted-foreground">{s.description}</span>
- </button>
- );
- })}
-
- {/* App filters */}
- <div className="px-2 py-1 text-[10px] font-medium uppercase tracking-wider text-muted-foreground bg-muted/30 border-b border-border/50 border-t">
- apps
- </div>
- {appMentionSuggestions.length === 0 ? (
- <div className="px-3 py-2 text-[10px] text-muted-foreground">no apps detected yet</div>
- ) : (
- appMentionSuggestions.map((suggestion) => {
- const isActive = activeFilters.appName === suggestion.appName;
- return (
- <button
- key={`app-${suggestion.tag}`}
- type="button"
- onClick={() => {
- if (isActive) {
- removeFilter("app");
- } else {
- if (activeFilters.appName) removeFilter("app");
- setInput((prev) => `${suggestion.tag} ${prev.trim()}`.trim() + " ");
- }
- setAppFilterOpen(false);
- }}
- className={cn(
- "w-full px-3 py-1.5 text-left text-xs font-mono hover:bg-muted/50 transition-colors flex items-center justify-between gap-2",
- isActive && "bg-muted"
- )}
- >
- <span>{suggestion.tag}</span>
- <span className="text-[10px] text-muted-foreground truncate">{suggestion.description}</span>
- </button>
- );
- })
- )}
-
- {/* Connections — lets users mention their own integrations (gmail, slack, etc.) */}
- {connections.length > 0 && (
- <>
- <div className="px-2 py-1 text-[10px] font-medium uppercase tracking-wider text-muted-foreground bg-muted/30 border-b border-border/50 border-t">
- connections
- </div>
- {connections.map((c) => {
- const tag = `@${c.id}`;
- return (
- <button
- key={`conn-${c.id}`}
- type="button"
- onClick={() => {
- setInput((prev) => `${tag} ${prev.trim()}`.trim() + " ");
- setAppFilterOpen(false);
- }}
- className="w-full px-3 py-1.5 text-left text-xs font-mono hover:bg-muted/50 transition-colors flex items-center justify-between gap-2"
- >
- <span className="flex items-center gap-1.5 min-w-0">
- <ConnectionToolIcon name={c.icon || c.id} />
- <span className="truncate">{tag}</span>
- </span>
- <span className="text-[10px] text-muted-foreground truncate">
- {c.name}
- </span>
- </button>
- );
- })}
- </>
- )}
-
- {/* Speakers */}
- {recentSpeakers.length > 0 && (
- <>
- <div className="px-2 py-1 text-[10px] font-medium uppercase tracking-wider text-muted-foreground bg-muted/30 border-b border-border/50 border-t">
- speakers
- </div>
- {recentSpeakers.map((s) => {
- const speakerName = s.tag.startsWith('@"') ? s.tag.slice(2, -1) : s.tag.slice(1);
- const isActive = activeFilters.speakerName === speakerName;
- return (
- <button
- key={`speaker-${s.tag}`}
- type="button"
- onClick={() => {
- if (isActive) {
- removeFilter("speaker");
- } else {
- if (activeFilters.speakerName) removeFilter("speaker");
- setInput((prev) => `${s.tag} ${prev.trim()}`.trim() + " ");
- }
- setAppFilterOpen(false);
- }}
- className={cn(
- "w-full px-3 py-1.5 text-left text-xs font-mono hover:bg-muted/50 transition-colors flex items-center justify-between gap-2",
- isActive && "bg-muted"
- )}
- >
- <span>{s.tag}</span>
- <span className="text-[10px] text-muted-foreground">speaker</span>
- </button>
- );
- })}
- </>
- )}
- </PopoverContent>
- </Popover>
- <div className="flex-1 min-w-0">
- <AIPresetsSelector
- onPresetChange={setActivePreset}
- onPresetSaved={handlePiRestart}
- controlledPresetId={activePipeExecution ? activePreset?.id : undefined}
- onControlledSelect={activePipeExecution ? (id) => {
- const match = settings.aiPresets?.find((p) => p.id === id);
- if (match) setActivePreset(match);
- } : undefined}
- />
- </div>
- </div>
-
<form
onSubmit={handleSubmit}
- className="px-4 pb-4 pt-3 relative"
+ className="px-5 sm:px-6 pb-4 pt-3 relative"
onPaste={handlePaste}
>
{/* Drop zone overlay — only shown in embedded (non-overlay) chat */}
@@ -7003,94 +7012,70 @@ export function StandaloneChat({
</AnimatePresence>
</div>
{/* Buttons row below textarea so scrollbar is above and full width is typeable */}
- <div className="flex items-center justify-end gap-0.5 shrink-0 px-2 pb-2 pt-1">
- {(() => {
- // Privacy filter: removes personal info (names, emails, phones,
- // addresses, account numbers) from screenpipe API responses
- // before the AI sees them. Pro-only; non-pro click opens upsell.
- const isPro = settings.user?.cloud_subscribed === true;
- const privacyOn = isPro && settings.piPrivacyFilter === true;
- return (
- <TooltipProvider delayDuration={150}>
- <Tooltip>
- <TooltipTrigger asChild>
- <Button
- type="button"
- size="icon"
- variant="ghost"
- onClick={() => {
- if (!isPro) {
- openUrl("https://screenpi.pe/onboarding");
- return;
- }
- updateSettings({ piPrivacyFilter: !privacyOn });
- }}
- disabled={isLoading}
- className={cn(
- "h-8 w-8 hover:bg-muted/50",
- privacyOn
- ? "text-foreground hover:text-foreground"
- : "text-muted-foreground hover:text-foreground"
- )}
- aria-label={
- privacyOn
- ? "Disable privacy filter"
- : "Enable privacy filter"
- }
- >
- {privacyOn ? (
- <ShieldCheck className="h-4 w-4" />
- ) : (
- <Shield className="h-4 w-4" />
- )}
- </Button>
- </TooltipTrigger>
- <TooltipContent
- side="top"
- align="center"
- className="max-w-[320px] p-3 space-y-2 text-xs leading-relaxed"
- >
- <div className="font-medium text-sm">
- {!isPro
- ? "Privacy filter — Pro"
- : privacyOn
- ? "Privacy filter: ON"
- : "Privacy filter: OFF"}
- </div>
- <div className="text-muted-foreground">
- {!isPro
- ? "Remove names, emails, phone numbers and other personal info from your screen data before the AI sees it. Adds ~1–2s per search. Click the shield to upgrade."
- : privacyOn
- ? "Names, emails, phone numbers and other personal info are removed from your screen data before it reaches the AI. Adds ~1–2s per search. Click the shield to turn off."
- : "Turn this on to strip personal info (names, emails, phones, addresses, account numbers) from your screen data before the AI sees it. Adds ~1–2s per search."}
- </div>
- <button
- type="button"
- onClick={(e) => {
- e.stopPropagation();
- e.preventDefault();
- openUrl("https://docs.screenpi.pe/privacy-filter");
- }}
- className="text-[11px] underline text-muted-foreground hover:text-foreground transition-colors"
- >
- How it works →
- </button>
- </TooltipContent>
- </Tooltip>
- </TooltipProvider>
- );
- })()}
- <Button
- type="button"
- size="icon"
- variant="ghost"
- onClick={handleFilePicker}
- disabled={isLoading || !canChat}
- className="h-8 w-8 text-muted-foreground hover:text-foreground hover:bg-muted/50"
- title="Attach image"
- >
- <Paperclip className="h-4 w-4" />
- </Button>
+ <div className="flex items-center gap-1.5 shrink-0 px-2 pb-2 pt-1">
+ <Popover open={appFilterOpen} onOpenChange={setAppFilterOpen}>
+ <PopoverTrigger asChild>
+ <Button
+ type="button"
+ size="icon"
+ variant="ghost"
+ className={cn(
+ "h-8 w-8 text-muted-foreground hover:text-foreground hover:bg-muted/50 relative shrink-0",
+ hasActiveFilters && "text-foreground bg-muted/50"
+ )}
+ title="Add attachments and filters"
+ aria-label="Add attachments and filters"
+ >
+ <Plus className="h-4 w-4" />
+ {activeFilterCount > 0 && (
+ <span className="absolute -top-1 -right-1 min-w-[15px] h-[15px] px-1 rounded-full bg-foreground text-background text-[9px] font-mono font-semibold flex items-center justify-center">
+ {activeFilterCount}
+ </span>
+ )}
+ </Button>
+ </PopoverTrigger>
+ <PopoverContent
+ className="w-72 p-0 max-h-[420px] overflow-y-auto"
+ align="start"
+ side="top"
+ sideOffset={6}
+ >
+ {renderComposerUtilityMenu()}
+ </PopoverContent>
+ </Popover>
+ <div className="flex-1 min-w-0">
+ {hasActiveFilters && (
+ <div className="hidden sm:flex min-w-0 items-center gap-1 overflow-hidden">
+ {activeFilterLabels.slice(0, 2).map((label, idx) => (
+ <span
+ key={`${label}-${idx}`}
+ className="inline-flex h-6 max-w-[140px] items-center rounded-md border border-border/50 px-2 text-[10px] font-medium text-muted-foreground truncate"
+ title={label}
+ >
+ {label}
+ </span>
+ ))}
+ {activeFilterLabels.length > 2 && (
+ <span className="inline-flex h-6 items-center rounded-md border border-border/50 px-2 text-[10px] font-medium text-muted-foreground shrink-0">
+ +{activeFilterLabels.length - 2}
+ </span>
+ )}
+ </div>
+ )}
+ </div>
+ <AIPresetsSelector
+ compact
+ showModelOnly
+ containerClassName="w-[180px] max-w-[42vw] min-w-[120px] shrink-0 gap-0"
+ triggerClassName="h-8 border-0 bg-transparent px-1.5 text-xs text-muted-foreground shadow-none hover:bg-muted/50 hover:text-foreground"
+ onPresetChange={setActivePreset}
+ onPresetSaved={handlePiRestart}
+ controlledPresetId={activePipeExecution ? activePreset?.id : undefined}
+ onControlledSelect={activePipeExecution ? (id) => {
+ const match = settings.aiPresets?.find((p) => p.id === id);
+ if (match) setActivePreset(match);
+ } : undefined}
+ />
{(() => {
const hasInput = input.trim().length > 0 || pastedImages.length > 0;
const primaryAction = getComposerPrimaryAction(isLoading || isStreaming, hasInput);