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: command iter (#1580)
shaik-zeeshanf730c282cd2f
diff --git a/pipes/example-pipe/components/ai-presets-dialog.tsx b/pipes/example-pipe/components/ai-presets-dialog.tsxindex 1195b1e01..be2a82396 100644--- a/pipes/example-pipe/components/ai-presets-dialog.tsx+++ b/pipes/example-pipe/components/ai-presets-dialog.tsx@@ -7,6 +7,7 @@ import {CommandGroup,CommandInput,CommandItem,+ CommandList,} from "./ui/command";import {Dialog,@@ -1116,13 +1117,92 @@ export const AIPresetsDialog = ({<div className="space-y-4"><Command><CommandInput placeholder="search presets..." />- <CommandEmpty>no presets found.</CommandEmpty>- {recommendedPresets && recommendedPresets.length > 0 && (- <CommandGroup heading="Recommended Presets">- {recommendedPresets.map((preset) => (+ <CommandList>+ <CommandEmpty>no presets found.</CommandEmpty>+ {recommendedPresets && recommendedPresets.length > 0 && (+ <CommandGroup heading="Recommended Presets">+ {recommendedPresets.map((preset) => (+ <CommandItem+ key={`${preset.id}-recommended`}+ value={`${preset.id}-recommended`}+ className="flex py-3"+ >+ <div className="flex w-full items-center justify-between gap-4 overflow-hidden">+ <div className="flex items-center gap-3 min-w-0">+ <Check+ className={cn(+ "h-4 w-4 shrink-0",+ selectedPreset?.id === preset.id+ ? "opacity-100"+ : "opacity-0",+ )}+ />+ <span className="font-medium truncate max-w-[180px]">+ {preset.id}+ </span>+ <span className="rounded bg-primary/10 text-primary px-1.5 py-0.5 text-xs font-medium shrink-0">+ recommended+ </span>+ </div>+ <div className="flex items-center justify-end gap-4 text-xs text-muted-foreground shrink-0">+ <div className="flex items-center gap-3">+ <span className="rounded bg-muted px-1.5 py-0.5 whitespace-nowrap">+ {preset.provider}+ </span>+ <span className="truncate max-w-[180px]">+ {preset.model}+ </span>+ </div>+ <span className="whitespace-nowrap">+ {(preset.maxContextChars / 1000).toFixed(0)}k+ </span>+ <div className="flex items-center gap-2">+ <Button+ variant="ghost"+ size="icon"+ className="h-7 w-7 shrink-0"+ onClick={(e) => {+ e.stopPropagation();+ // Create a full preset from the recommended preset with -copy suffix+ const fullPreset = {+ ...preset,+ id: `${preset.id}`,+ url:+ preset.provider === "openai"+ ? "https://api.openai.com/v1"+ : preset.provider === "screenpipe-cloud"+ ? "https://ai-proxy.i-f9f.workers.dev/v1"+ : preset.provider === "native-ollama"+ ? "http://localhost:11434/v1"+ : "",+ defaultPreset: false,+ } as AIPreset;+ setSelectedPresetToEdit(fullPreset);+ setPresetDialogOpen(true);+ }}+ >+ <Copy className="h-4 w-4" />+ </Button>+ </div>+ </div>+ </div>+ </CommandItem>+ ))}+ </CommandGroup>+ )}+ <CommandGroup heading="Your Presets">+ {aiPresets.map((preset) => (<CommandItem- key={`${preset.id}-recommended`}- value={`${preset.id}-recommended`}+ key={preset.id}+ value={preset.id}+ onSelect={(currentValue) => {+ updatePipeSettings({+ [aiKey]:+ currentValue === selectedPreset?.id+ ? ""+ : currentValue,+ });+ }}className="flex py-3"><div className="flex w-full items-center justify-between gap-4 overflow-hidden">@@ -1138,9 +1218,11 @@ export const AIPresetsDialog = ({<span className="font-medium truncate max-w-[180px]">{preset.id}</span>- <span className="rounded bg-primary/10 text-primary px-1.5 py-0.5 text-xs font-medium shrink-0">- recommended- </span>+ {preset.defaultPreset && (+ <span className="rounded bg-muted px-1.5 py-0.5 text-xs font-medium shrink-0">+ default+ </span>+ )}</div><div className="flex items-center justify-end gap-4 text-xs text-muted-foreground shrink-0"><div className="flex items-center gap-3">@@ -1161,145 +1243,66 @@ export const AIPresetsDialog = ({className="h-7 w-7 shrink-0"onClick={(e) => {e.stopPropagation();- // Create a full preset from the recommended preset with -copy suffix- const fullPreset = {- ...preset,- id: `${preset.id}`,- url:- preset.provider === "openai"- ? "https://api.openai.com/v1"- : preset.provider === "screenpipe-cloud"- ? "https://ai-proxy.i-f9f.workers.dev/v1"- : preset.provider === "native-ollama"- ? "http://localhost:11434/v1"- : "",- defaultPreset: false,- } as AIPreset;- setSelectedPresetToEdit(fullPreset);- setPresetDialogOpen(true);+ handleEditPreset(preset);+ }}+ >+ <Edit2 className="h-4 w-4" />+ </Button>+ <Button+ variant="ghost"+ size="icon"+ className="h-7 w-7 shrink-0"+ onClick={(e) => {+ e.stopPropagation();+ handleDuplicatePreset(preset);}}><Copy className="h-4 w-4" /></Button>+ {!preset.defaultPreset && (+ <>+ <Button+ variant="ghost"+ size="icon"+ className="h-7 w-7 shrink-0"+ onClick={(e) => {+ e.stopPropagation();+ handleSetDefaultPreset(preset);+ }}+ >+ <Star className="h-4 w-4" />+ </Button>+ <Button+ variant="ghost"+ size="icon"+ className="h-7 w-7 shrink-0"+ onClick={(e) => {+ e.stopPropagation();+ handleRemovePreset(preset);+ }}+ >+ <Trash2 className="h-4 w-4" />+ </Button>+ </>+ )}</div></div></div></CommandItem>))}</CommandGroup>- )}- <CommandGroup heading="Your Presets">- {aiPresets.map((preset) => (+ <CommandGroup><CommandItem- key={preset.id}- value={preset.id}- onSelect={(currentValue) => {- updatePipeSettings({- [aiKey]:- currentValue === selectedPreset?.id- ? ""- : currentValue,- });+ onSelect={() => {+ setSelectedPresetToEdit(undefined);+ setPresetDialogOpen(true);}}- className="flex py-3">- <div className="flex w-full items-center justify-between gap-4 overflow-hidden">- <div className="flex items-center gap-3 min-w-0">- <Check- className={cn(- "h-4 w-4 shrink-0",- selectedPreset?.id === preset.id- ? "opacity-100"- : "opacity-0",- )}- />- <span className="font-medium truncate max-w-[180px]">- {preset.id}- </span>- {preset.defaultPreset && (- <span className="rounded bg-muted px-1.5 py-0.5 text-xs font-medium shrink-0">- default- </span>- )}- </div>- <div className="flex items-center justify-end gap-4 text-xs text-muted-foreground shrink-0">- <div className="flex items-center gap-3">- <span className="rounded bg-muted px-1.5 py-0.5 whitespace-nowrap">- {preset.provider}- </span>- <span className="truncate max-w-[180px]">- {preset.model}- </span>- </div>- <span className="whitespace-nowrap">- {(preset.maxContextChars / 1000).toFixed(0)}k- </span>- <div className="flex items-center gap-2">- <Button- variant="ghost"- size="icon"- className="h-7 w-7 shrink-0"- onClick={(e) => {- e.stopPropagation();- handleEditPreset(preset);- }}- >- <Edit2 className="h-4 w-4" />- </Button>- <Button- variant="ghost"- size="icon"- className="h-7 w-7 shrink-0"- onClick={(e) => {- e.stopPropagation();- handleDuplicatePreset(preset);- }}- >- <Copy className="h-4 w-4" />- </Button>- {!preset.defaultPreset && (- <>- <Button- variant="ghost"- size="icon"- className="h-7 w-7 shrink-0"- onClick={(e) => {- e.stopPropagation();- handleSetDefaultPreset(preset);- }}- >- <Star className="h-4 w-4" />- </Button>- <Button- variant="ghost"- size="icon"- className="h-7 w-7 shrink-0"- onClick={(e) => {- e.stopPropagation();- handleRemovePreset(preset);- }}- >- <Trash2 className="h-4 w-4" />- </Button>- </>- )}- </div>- </div>- </div>+ <Plus className="mr-2 h-4 w-4" />+ create new preset</CommandItem>- ))}- </CommandGroup>- <CommandGroup>- <CommandItem- onSelect={() => {- setSelectedPresetToEdit(undefined);- setPresetDialogOpen(true);- }}- >- <Plus className="mr-2 h-4 w-4" />- create new preset- </CommandItem>- </CommandGroup>+ </CommandGroup>+ </CommandList></Command></div></DialogContent>diff --git a/pipes/example-pipe/components/ai-presets-selector.tsx b/pipes/example-pipe/components/ai-presets-selector.tsxindex c9415a495..1d4c39c1c 100644--- a/pipes/example-pipe/components/ai-presets-selector.tsx+++ b/pipes/example-pipe/components/ai-presets-selector.tsx@@ -7,6 +7,7 @@ import {CommandGroup,CommandInput,CommandItem,+ CommandList,} from "./ui/command";import { Popover, PopoverContent, PopoverTrigger } from "./ui/popover";import {@@ -1113,17 +1114,95 @@ export const AIPresetsSelector = ({<PopoverContent className="min-w-[500px] w-[--radix-popover-trigger-width] p-0"><Command><CommandInput placeholder="search presets..." />- <CommandEmpty>no presets found.</CommandEmpty>- {recommendedPresets && recommendedPresets.length > 0 && (- <CommandGroup heading="Recommended Presets">- {recommendedPresets.map((preset) => (+ <CommandList>+ <CommandEmpty>no presets found.</CommandEmpty>+ {recommendedPresets && recommendedPresets.length > 0 && (+ <CommandGroup heading="Recommended Presets">+ {recommendedPresets.map((preset) => (+ <CommandItem+ key={`${preset.id}-recommended`}+ value={`${preset.id}-recommened`}+ className="flex py-2"+ >+ <div className="flex w-full items-center justify-between gap-2 overflow-hidden">+ <div className="flex items-center gap-2 min-w-0 flex-shrink">+ <Check+ className={cn(+ "h-4 w-4 shrink-0",+ selectedPreset === preset.id+ ? "opacity-100"+ : "opacity-0",+ )}+ />+ <span className="font-medium truncate max-w-[30%]">+ {preset.id}+ </span>+ <span className="rounded bg-primary/10 text-primary px-1.5 py-0.5 text-xs font-medium shrink-0">+ recommended+ </span>+ </div>+ <div className="flex items-center justify-end gap-2 text-xs text-muted-foreground shrink-0">+ <div className="flex items-center gap-2">+ <span className="rounded bg-muted px-1.5 py-0.5 whitespace-nowrap">+ {preset.provider}+ </span>+ <span className="hidden sm:block truncate max-w-[30%]">+ {preset.model}+ </span>+ </div>+ <span className="whitespace-nowrap">+ {(preset.maxContextChars / 1000).toFixed(0)}k+ </span>+ <div className="flex items-center gap-1">+ <Button+ variant="ghost"+ size="icon"+ className="h-6 w-6 shrink-0"+ onClick={(e) => {+ e.stopPropagation();+ // Create a full preset from the recommended preset with -copy suffix+ const fullPreset = {+ ...preset,+ id: `${preset.id}`,+ url:+ preset.provider === "openai"+ ? "https://api.openai.com/v1"+ : preset.provider === "screenpipe-cloud"+ ? "https://ai-proxy.i-f9f.workers.dev/v1"+ : preset.provider === "native-ollama"+ ? "http://localhost:11434/v1"+ : "",+ defaultPreset: false,+ } as AIPreset;+ setSelectedPresetToEdit(fullPreset);+ setDialogOpen(true);+ }}+ >+ <Copy className="h-3 w-3" />+ </Button>+ </div>+ </div>+ </div>+ </CommandItem>+ ))}+ </CommandGroup>+ )}+ <CommandGroup>+ {aiPresets.map((preset) => (<CommandItem- key={`${preset.id}-recommended`}- value={`${preset.id}-recommened`}+ key={preset.id}+ value={preset.id}+ onSelect={(currentValue) => {+ updatePipeSettings({+ [aiKey]:+ currentValue === selectedPreset ? "" : currentValue,+ });+ setOpen(false);+ }}className="flex py-2"><div className="flex w-full items-center justify-between gap-2 overflow-hidden">- <div className="flex items-center gap-2 min-w-0 flex-shrink">+ <div className="flex items-center gap-2 min-w-0"><CheckclassName={cn("h-4 w-4 shrink-0",@@ -1132,19 +1211,21 @@ export const AIPresetsSelector = ({: "opacity-0",)}/>- <span className="font-medium truncate max-w-[30%]">+ <span className="font-medium truncate max-w-[120px]">{preset.id}</span>- <span className="rounded bg-primary/10 text-primary px-1.5 py-0.5 text-xs font-medium shrink-0">- recommended- </span>+ {preset.defaultPreset && (+ <span className="rounded bg-muted px-1.5 py-0.5 text-xs font-medium shrink-0">+ default+ </span>+ )}</div><div className="flex items-center justify-end gap-2 text-xs text-muted-foreground shrink-0"><div className="flex items-center gap-2"><span className="rounded bg-muted px-1.5 py-0.5 whitespace-nowrap">{preset.provider}</span>- <span className="hidden sm:block truncate max-w-[30%]">+ <span className="truncate max-w-[120px]">{preset.model}</span></div>@@ -1158,145 +1239,67 @@ export const AIPresetsSelector = ({className="h-6 w-6 shrink-0"onClick={(e) => {e.stopPropagation();- // Create a full preset from the recommended preset with -copy suffix- const fullPreset = {- ...preset,- id: `${preset.id}`,- url:- preset.provider === "openai"- ? "https://api.openai.com/v1"- : preset.provider === "screenpipe-cloud"- ? "https://ai-proxy.i-f9f.workers.dev/v1"- : preset.provider === "native-ollama"- ? "http://localhost:11434/v1"- : "",- defaultPreset: false,- } as AIPreset;- setSelectedPresetToEdit(fullPreset);- setDialogOpen(true);+ handleEditPreset(preset);+ }}+ >+ <Edit2 className="h-3 w-3" />+ </Button>+ <Button+ variant="ghost"+ size="icon"+ className="h-6 w-6 shrink-0"+ onClick={(e) => {+ e.stopPropagation();+ handleDuplicatePreset(preset);}}><Copy className="h-3 w-3" /></Button>+ {!preset.defaultPreset && (+ <>+ <Button+ variant="ghost"+ size="icon"+ className="h-6 w-6 shrink-0"+ onClick={(e) => {+ e.stopPropagation();+ handleSetDefaultPreset(preset);+ }}+ >+ <Star className="h-3 w-3" />+ </Button>+ <Button+ variant="ghost"+ size="icon"+ className="h-6 w-6 shrink-0"+ onClick={(e) => {+ e.stopPropagation();+ handleRemovePreset(preset);+ }}+ >+ <Trash2 className="h-3 w-3" />+ </Button>+ </>+ )}</div></div></div></CommandItem>))}</CommandGroup>- )}- <CommandGroup>- {aiPresets.map((preset) => (+ <CommandGroup><CommandItem- key={preset.id}- value={preset.id}- onSelect={(currentValue) => {- updatePipeSettings({- [aiKey]:- currentValue === selectedPreset ? "" : currentValue,- });+ onSelect={() => {setOpen(false);+ setSelectedPresetToEdit(undefined);+ setDialogOpen(true);}}- className="flex py-2">- <div className="flex w-full items-center justify-between gap-2 overflow-hidden">- <div className="flex items-center gap-2 min-w-0">- <Check- className={cn(- "h-4 w-4 shrink-0",- selectedPreset === preset.id- ? "opacity-100"- : "opacity-0",- )}- />- <span className="font-medium truncate max-w-[120px]">- {preset.id}- </span>- {preset.defaultPreset && (- <span className="rounded bg-muted px-1.5 py-0.5 text-xs font-medium shrink-0">- default- </span>- )}- </div>- <div className="flex items-center justify-end gap-2 text-xs text-muted-foreground shrink-0">- <div className="flex items-center gap-2">- <span className="rounded bg-muted px-1.5 py-0.5 whitespace-nowrap">- {preset.provider}- </span>- <span className="truncate max-w-[120px]">- {preset.model}- </span>- </div>- <span className="whitespace-nowrap">- {(preset.maxContextChars / 1000).toFixed(0)}k- </span>- <div className="flex items-center gap-1">- <Button- variant="ghost"- size="icon"- className="h-6 w-6 shrink-0"- onClick={(e) => {- e.stopPropagation();- handleEditPreset(preset);- }}- >- <Edit2 className="h-3 w-3" />- </Button>- <Button- variant="ghost"- size="icon"- className="h-6 w-6 shrink-0"- onClick={(e) => {- e.stopPropagation();- handleDuplicatePreset(preset);- }}- >- <Copy className="h-3 w-3" />- </Button>- {!preset.defaultPreset && (- <>- <Button- variant="ghost"- size="icon"- className="h-6 w-6 shrink-0"- onClick={(e) => {- e.stopPropagation();- handleSetDefaultPreset(preset);- }}- >- <Star className="h-3 w-3" />- </Button>- <Button- variant="ghost"- size="icon"- className="h-6 w-6 shrink-0"- onClick={(e) => {- e.stopPropagation();- handleRemovePreset(preset);- }}- >- <Trash2 className="h-3 w-3" />- </Button>- </>- )}- </div>- </div>- </div>+ <Plus className="mr-2 h-4 w-4" />+ create new preset</CommandItem>- ))}- </CommandGroup>- <CommandGroup>- <CommandItem- onSelect={() => {- setOpen(false);- setSelectedPresetToEdit(undefined);- setDialogOpen(true);- }}- >- <Plus className="mr-2 h-4 w-4" />- create new preset- </CommandItem>- </CommandGroup>+ </CommandGroup>+ </CommandList></Command></PopoverContent></Popover>diff --git a/pipes/search/src/components/ai-presets-dialog.tsx b/pipes/search/src/components/ai-presets-dialog.tsxindex e04d4bf5a..15e3c668a 100644--- a/pipes/search/src/components/ai-presets-dialog.tsx+++ b/pipes/search/src/components/ai-presets-dialog.tsx@@ -7,6 +7,7 @@ import {CommandGroup,CommandInput,CommandItem,+ CommandList,} from "./ui/command";import {Dialog,@@ -1103,13 +1104,89 @@ export const AIPresetsDialog = ({ children, recommendedPresets, pipeName, aiKey<div className="space-y-4"><Command><CommandInput placeholder="search presets..." />- <CommandEmpty>no presets found.</CommandEmpty>- {recommendedPresets && recommendedPresets.length > 0 && (- <CommandGroup heading="Recommended Presets">- {recommendedPresets.map((preset) => (+ <CommandList>+ <CommandEmpty>no presets found.</CommandEmpty>+ {recommendedPresets && recommendedPresets.length > 0 && (+ <CommandGroup heading="Recommended Presets">+ {recommendedPresets.map((preset) => (+ <CommandItem+ key={`${preset.id}-recommended`}+ value={`${preset.id}-recommended`}+ className="flex py-3"+ >+ <div className="flex w-full items-center justify-between gap-4 overflow-hidden">+ <div className="flex items-center gap-3 min-w-0">+ <Check+ className={cn(+ "h-4 w-4 shrink-0",+ selectedPreset?.id === preset.id+ ? "opacity-100"+ : "opacity-0",+ )}+ />+ <span className="font-medium truncate max-w-[180px]">+ {preset.id}+ </span>+ <span className="rounded bg-primary/10 text-primary px-1.5 py-0.5 text-xs font-medium shrink-0">+ recommended+ </span>+ </div>+ <div className="flex items-center justify-end gap-4 text-xs text-muted-foreground shrink-0">+ <div className="flex items-center gap-3">+ <span className="rounded bg-muted px-1.5 py-0.5 whitespace-nowrap">+ {preset.provider}+ </span>+ <span className="truncate max-w-[180px]">+ {preset.model}+ </span>+ </div>+ <span className="whitespace-nowrap">+ {(preset.maxContextChars / 1000).toFixed(0)}k+ </span>+ <div className="flex items-center gap-2">+ <Button+ variant="ghost"+ size="icon"+ className="h-7 w-7 shrink-0"+ onClick={(e) => {+ e.stopPropagation();+ // Create a full preset from the recommended preset with -copy suffix+ const fullPreset = {+ ...preset,+ id: `${preset.id}`,+ url: preset.provider === "openai"+ ? "https://api.openai.com/v1"+ : preset.provider === "screenpipe-cloud"+ ? "https://ai-proxy.i-f9f.workers.dev/v1"+ : preset.provider === "native-ollama"+ ? "http://localhost:11434/v1"+ : "",+ defaultPreset: false,+ } as AIPreset;+ setSelectedPresetToEdit(fullPreset);+ setPresetDialogOpen(true);+ }}+ >+ <Copy className="h-4 w-4" />+ </Button>+ </div>+ </div>+ </div>+ </CommandItem>+ ))}+ </CommandGroup>+ )}+ <CommandGroup heading="Your Presets">+ {aiPresets.map((preset) => (<CommandItem- key={`${preset.id}-recommended`}- value={`${preset.id}-recommended`}+ key={preset.id}+ value={preset.id}+ onSelect={(currentValue) => {+ updatePipeSettings({+ [aiKey]:+ currentValue === selectedPreset?.id ? "" : currentValue,+ });+ }}className="flex py-3"><div className="flex w-full items-center justify-between gap-4 overflow-hidden">@@ -1125,9 +1202,11 @@ export const AIPresetsDialog = ({ children, recommendedPresets, pipeName, aiKey<span className="font-medium truncate max-w-[180px]">{preset.id}</span>- <span className="rounded bg-primary/10 text-primary px-1.5 py-0.5 text-xs font-medium shrink-0">- recommended- </span>+ {preset.defaultPreset && (+ <span className="rounded bg-muted px-1.5 py-0.5 text-xs font-medium shrink-0">+ default+ </span>+ )}</div><div className="flex items-center justify-end gap-4 text-xs text-muted-foreground shrink-0"><div className="flex items-center gap-3">@@ -1141,149 +1220,73 @@ export const AIPresetsDialog = ({ children, recommendedPresets, pipeName, aiKey<span className="whitespace-nowrap">{(preset.maxContextChars / 1000).toFixed(0)}k</span>- <div className="flex items-center gap-2">- <Button- variant="ghost"- size="icon"- className="h-7 w-7 shrink-0"- onClick={(e) => {- e.stopPropagation();- // Create a full preset from the recommended preset with -copy suffix- const fullPreset = {- ...preset,- id: `${preset.id}`,- url: preset.provider === "openai"- ? "https://api.openai.com/v1"- : preset.provider === "screenpipe-cloud"- ? "https://ai-proxy.i-f9f.workers.dev/v1"- : preset.provider === "native-ollama"- ? "http://localhost:11434/v1"- : "",- defaultPreset: false,- } as AIPreset;- setSelectedPresetToEdit(fullPreset);- setPresetDialogOpen(true);- }}- >- <Copy className="h-4 w-4" />- </Button>- </div>+ <div className="flex items-center gap-2">+ <Button+ variant="ghost"+ size="icon"+ className="h-7 w-7 shrink-0"+ onClick={(e) => {+ e.stopPropagation();+ handleEditPreset(preset);+ }}+ >+ <Edit2 className="h-4 w-4" />+ </Button>+ <Button+ variant="ghost"+ size="icon"+ className="h-7 w-7 shrink-0"+ onClick={(e) => {+ e.stopPropagation();+ handleDuplicatePreset(preset);+ }}+ >+ <Copy className="h-4 w-4" />+ </Button>+ {!preset.defaultPreset && (+ <>+ <Button+ variant="ghost"+ size="icon"+ className="h-7 w-7 shrink-0"+ onClick={(e) => {+ e.stopPropagation();+ handleSetDefaultPreset(preset);+ }}+ >+ <Star className="h-4 w-4" />+ </Button>+ <Button+ variant="ghost"+ size="icon"+ className="h-7 w-7 shrink-0"+ onClick={(e) => {+ e.stopPropagation();+ handleRemovePreset(preset);+ }}+ >+ <Trash2 className="h-4 w-4" />+ </Button>+ </>+ )}+ </div></div></div></CommandItem>))}</CommandGroup>- )}- <CommandGroup heading="Your Presets">- {aiPresets.map((preset) => (- <CommandItem- key={preset.id}- value={preset.id}- onSelect={(currentValue) => {- updatePipeSettings({- [aiKey]:- currentValue === selectedPreset?.id ? "" : currentValue,- });- }}- className="flex py-3"- >- <div className="flex w-full items-center justify-between gap-4 overflow-hidden">- <div className="flex items-center gap-3 min-w-0">- <Check- className={cn(- "h-4 w-4 shrink-0",- selectedPreset?.id === preset.id- ? "opacity-100"- : "opacity-0",- )}- />- <span className="font-medium truncate max-w-[180px]">- {preset.id}- </span>- {preset.defaultPreset && (- <span className="rounded bg-muted px-1.5 py-0.5 text-xs font-medium shrink-0">- default- </span>- )}- </div>- <div className="flex items-center justify-end gap-4 text-xs text-muted-foreground shrink-0">- <div className="flex items-center gap-3">- <span className="rounded bg-muted px-1.5 py-0.5 whitespace-nowrap">- {preset.provider}- </span>- <span className="truncate max-w-[180px]">- {preset.model}- </span>- </div>- <span className="whitespace-nowrap">- {(preset.maxContextChars / 1000).toFixed(0)}k- </span>- <div className="flex items-center gap-2">- <Button- variant="ghost"- size="icon"- className="h-7 w-7 shrink-0"- onClick={(e) => {- e.stopPropagation();- handleEditPreset(preset);- }}- >- <Edit2 className="h-4 w-4" />- </Button>- <Button- variant="ghost"- size="icon"- className="h-7 w-7 shrink-0"- onClick={(e) => {- e.stopPropagation();- handleDuplicatePreset(preset);- }}- >- <Copy className="h-4 w-4" />- </Button>- {!preset.defaultPreset && (- <>- <Button- variant="ghost"- size="icon"- className="h-7 w-7 shrink-0"- onClick={(e) => {- e.stopPropagation();- handleSetDefaultPreset(preset);- }}- >- <Star className="h-4 w-4" />- </Button>- <Button- variant="ghost"- size="icon"- className="h-7 w-7 shrink-0"- onClick={(e) => {- e.stopPropagation();- handleRemovePreset(preset);- }}- >- <Trash2 className="h-4 w-4" />- </Button>- </>- )}- </div>- </div>- </div>- </CommandItem>- ))}- </CommandGroup>- <CommandGroup>- <CommandItem- onSelect={() => {- setSelectedPresetToEdit(undefined);- setPresetDialogOpen(true);- }}- >- <Plus className="mr-2 h-4 w-4" />- create new preset- </CommandItem>- </CommandGroup>+ <CommandGroup>+ <CommandItem+ onSelect={() => {+ setSelectedPresetToEdit(undefined);+ setPresetDialogOpen(true);+ }}+ >+ <Plus className="mr-2 h-4 w-4" />+ create new preset+ </CommandItem>+ </CommandGroup>+ </CommandList></Command></div></DialogContent>diff --git a/pipes/search/src/components/ai-presets-selector.tsx b/pipes/search/src/components/ai-presets-selector.tsxindex cb42cc49e..1068c6e4b 100644--- a/pipes/search/src/components/ai-presets-selector.tsx+++ b/pipes/search/src/components/ai-presets-selector.tsx@@ -7,6 +7,7 @@ import {CommandGroup,CommandInput,CommandItem,+ CommandList,} from "./ui/command";import { Popover, PopoverContent, PopoverTrigger } from "./ui/popover";import {@@ -1084,17 +1085,94 @@ export const AIPresetsSelector = ({ recommendedPresets, pipeName, aiKey = "aiPre<PopoverContent className="min-w-[500px] w-[--radix-popover-trigger-width] p-0"><Command><CommandInput placeholder="search presets..." />- <CommandEmpty>no presets found.</CommandEmpty>- {recommendedPresets && recommendedPresets.length > 0 && (- <CommandGroup heading="Recommended Presets">- {recommendedPresets.map((preset) => (+ <CommandList>+ <CommandEmpty>no presets found.</CommandEmpty>+ {recommendedPresets && recommendedPresets.length > 0 && (+ <CommandGroup heading="Recommended Presets">+ {recommendedPresets.map((preset) => (+ <CommandItem+ key={`${preset.id}-recommended`}+ value={`${preset.id}-recommened`}+ className="flex py-2"+ >+ <div className="flex w-full items-center justify-between gap-2 overflow-hidden">+ <div className="flex items-center gap-2 min-w-0 flex-shrink">+ <Check+ className={cn(+ "h-4 w-4 shrink-0",+ selectedPreset === preset.id+ ? "opacity-100"+ : "opacity-0",+ )}+ />+ <span className="font-medium truncate max-w-[30%]">+ {preset.id}+ </span>+ <span className="rounded bg-primary/10 text-primary px-1.5 py-0.5 text-xs font-medium shrink-0">+ recommended+ </span>+ </div>+ <div className="flex items-center justify-end gap-2 text-xs text-muted-foreground shrink-0">+ <div className="flex items-center gap-2">+ <span className="rounded bg-muted px-1.5 py-0.5 whitespace-nowrap">+ {preset.provider}+ </span>+ <span className="hidden sm:block truncate max-w-[30%]">+ {preset.model}+ </span>+ </div>+ <span className="whitespace-nowrap">+ {(preset.maxContextChars / 1000).toFixed(0)}k+ </span>+ <div className="flex items-center gap-1">+ <Button+ variant="ghost"+ size="icon"+ className="h-6 w-6 shrink-0"+ onClick={(e) => {+ e.stopPropagation();+ // Create a full preset from the recommended preset with -copy suffix+ const fullPreset = {+ ...preset,+ id: `${preset.id}`,+ url: preset.provider === "openai"+ ? "https://api.openai.com/v1"+ : preset.provider === "screenpipe-cloud"+ ? "https://ai-proxy.i-f9f.workers.dev/v1"+ : preset.provider === "native-ollama"+ ? "http://localhost:11434/v1"+ : "",+ defaultPreset: false,+ } as AIPreset;+ setSelectedPresetToEdit(fullPreset);+ setDialogOpen(true);+ }}+ >+ <Copy className="h-3 w-3" />+ </Button>+ </div>+ </div>+ </div>+ </CommandItem>+ ))}+ </CommandGroup>+ )}+ <CommandGroup>+ {aiPresets.map((preset) => (<CommandItem- key={`${preset.id}-recommended`}- value={`${preset.id}-recommened`}+ key={preset.id}+ value={preset.id}+ onSelect={(currentValue) => {+ updatePipeSettings({+ [aiKey]:+ currentValue === selectedPreset ? "" : currentValue,+ });+ setOpen(false);+ }}className="flex py-2"><div className="flex w-full items-center justify-between gap-2 overflow-hidden">- <div className="flex items-center gap-2 min-w-0 flex-shrink">+ <div className="flex items-center gap-2 min-w-0"><CheckclassName={cn("h-4 w-4 shrink-0",@@ -1103,19 +1181,21 @@ export const AIPresetsSelector = ({ recommendedPresets, pipeName, aiKey = "aiPre: "opacity-0",)}/>- <span className="font-medium truncate max-w-[30%]">+ <span className="font-medium truncate max-w-[120px]">{preset.id}</span>- <span className="rounded bg-primary/10 text-primary px-1.5 py-0.5 text-xs font-medium shrink-0">- recommended- </span>+ {preset.defaultPreset && (+ <span className="rounded bg-muted px-1.5 py-0.5 text-xs font-medium shrink-0">+ default+ </span>+ )}</div><div className="flex items-center justify-end gap-2 text-xs text-muted-foreground shrink-0"><div className="flex items-center gap-2"><span className="rounded bg-muted px-1.5 py-0.5 whitespace-nowrap">{preset.provider}</span>- <span className="hidden sm:block truncate max-w-[30%]">+ <span className="truncate max-w-[120px]">{preset.model}</span></div>@@ -1129,144 +1209,67 @@ export const AIPresetsSelector = ({ recommendedPresets, pipeName, aiKey = "aiPreclassName="h-6 w-6 shrink-0"onClick={(e) => {e.stopPropagation();- // Create a full preset from the recommended preset with -copy suffix- const fullPreset = {- ...preset,- id: `${preset.id}`,- url: preset.provider === "openai"- ? "https://api.openai.com/v1"- : preset.provider === "screenpipe-cloud"- ? "https://ai-proxy.i-f9f.workers.dev/v1"- : preset.provider === "native-ollama"- ? "http://localhost:11434/v1"- : "",- defaultPreset: false,- } as AIPreset;- setSelectedPresetToEdit(fullPreset);- setDialogOpen(true);+ handleEditPreset(preset);+ }}+ >+ <Edit2 className="h-3 w-3" />+ </Button>+ <Button+ variant="ghost"+ size="icon"+ className="h-6 w-6 shrink-0"+ onClick={(e) => {+ e.stopPropagation();+ handleDuplicatePreset(preset);}}><Copy className="h-3 w-3" /></Button>+ {!preset.defaultPreset && (+ <>+ <Button+ variant="ghost"+ size="icon"+ className="h-6 w-6 shrink-0"+ onClick={(e) => {+ e.stopPropagation();+ handleSetDefaultPreset(preset);+ }}+ >+ <Star className="h-3 w-3" />+ </Button>+ <Button+ variant="ghost"+ size="icon"+ className="h-6 w-6 shrink-0"+ onClick={(e) => {+ e.stopPropagation();+ handleRemovePreset(preset);+ }}+ >+ <Trash2 className="h-3 w-3" />+ </Button>+ </>+ )}</div></div></div></CommandItem>))}</CommandGroup>- )}- <CommandGroup>- {aiPresets.map((preset) => (+ <CommandGroup><CommandItem- key={preset.id}- value={preset.id}- onSelect={(currentValue) => {- updatePipeSettings({- [aiKey]:- currentValue === selectedPreset ? "" : currentValue,- });+ onSelect={() => {setOpen(false);+ setSelectedPresetToEdit(undefined);+ setDialogOpen(true);}}- className="flex py-2">- <div className="flex w-full items-center justify-between gap-2 overflow-hidden">- <div className="flex items-center gap-2 min-w-0">- <Check- className={cn(- "h-4 w-4 shrink-0",- selectedPreset === preset.id- ? "opacity-100"- : "opacity-0",- )}- />- <span className="font-medium truncate max-w-[120px]">- {preset.id}- </span>- {preset.defaultPreset && (- <span className="rounded bg-muted px-1.5 py-0.5 text-xs font-medium shrink-0">- default- </span>- )}- </div>- <div className="flex items-center justify-end gap-2 text-xs text-muted-foreground shrink-0">- <div className="flex items-center gap-2">- <span className="rounded bg-muted px-1.5 py-0.5 whitespace-nowrap">- {preset.provider}- </span>- <span className="truncate max-w-[120px]">- {preset.model}- </span>- </div>- <span className="whitespace-nowrap">- {(preset.maxContextChars / 1000).toFixed(0)}k- </span>- <div className="flex items-center gap-1">- <Button- variant="ghost"- size="icon"- className="h-6 w-6 shrink-0"- onClick={(e) => {- e.stopPropagation();- handleEditPreset(preset);- }}- >- <Edit2 className="h-3 w-3" />- </Button>- <Button- variant="ghost"- size="icon"- className="h-6 w-6 shrink-0"- onClick={(e) => {- e.stopPropagation();- handleDuplicatePreset(preset);- }}- >- <Copy className="h-3 w-3" />- </Button>- {!preset.defaultPreset && (- <>- <Button- variant="ghost"- size="icon"- className="h-6 w-6 shrink-0"- onClick={(e) => {- e.stopPropagation();- handleSetDefaultPreset(preset);- }}- >- <Star className="h-3 w-3" />- </Button>- <Button- variant="ghost"- size="icon"- className="h-6 w-6 shrink-0"- onClick={(e) => {- e.stopPropagation();- handleRemovePreset(preset);- }}- >- <Trash2 className="h-3 w-3" />- </Button>- </>- )}- </div>- </div>- </div>+ <Plus className="mr-2 h-4 w-4" />+ create new preset</CommandItem>- ))}- </CommandGroup>- <CommandGroup>- <CommandItem- onSelect={() => {- setOpen(false);- setSelectedPresetToEdit(undefined);- setDialogOpen(true);- }}- >- <Plus className="mr-2 h-4 w-4" />- create new preset- </CommandItem>- </CommandGroup>+ </CommandGroup>+ </CommandList></Command></PopoverContent></Popover>