mirror of
https://github.com/chriswritescode-dev/opencode-manager.git
synced 2026-12-06 04:44:21 +01:00
Add memory plugin with semantic search and session planning (#145)
* Add memory plugin with semantic search and session planning * Clarify Memory Plugin is optional in docs
This commit is contained in:
1 parent
da283a82cf
commit
3461f86556
132 files changed
+11448
-2834
No files matched your search
@@ -1,59 +0,0 @@
|
||||
import { Button } from '@/components/ui/button'
|
||||
import { Dialog, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle } from '@/components/ui/dialog'
|
||||
import { Alert, AlertDescription } from '@/components/ui/alert'
|
||||
import { AlertTriangle } from 'lucide-react'
|
||||
|
||||
interface DiscardDialogProps {
|
||||
open: boolean
|
||||
onOpenChange: (open: boolean) => void
|
||||
onConfirm: () => void
|
||||
onCancel: () => void
|
||||
fileCount: number
|
||||
isDiscarding?: boolean
|
||||
}
|
||||
|
||||
export function DiscardDialog({
|
||||
open,
|
||||
onOpenChange,
|
||||
onConfirm,
|
||||
onCancel,
|
||||
fileCount,
|
||||
isDiscarding = false
|
||||
}: DiscardDialogProps) {
|
||||
const itemText = fileCount === 1 ? '1 file' : `${fileCount} files`
|
||||
|
||||
return (
|
||||
<Dialog open={open} onOpenChange={onOpenChange}>
|
||||
<DialogContent className='max-w-[90%] sm:max-w-sm'>
|
||||
<DialogHeader>
|
||||
<DialogTitle>Discard Changes</DialogTitle>
|
||||
<DialogDescription>
|
||||
Are you sure you want to discard changes to {itemText}? This action cannot be undone.
|
||||
</DialogDescription>
|
||||
</DialogHeader>
|
||||
|
||||
<Alert className="overflow-hidden">
|
||||
<AlertTriangle className="h-4 w-4 flex-shrink-0" />
|
||||
<AlertDescription>
|
||||
This will permanently delete your uncommitted changes to {itemText}. If these changes exist in the staging area, they will also be removed.
|
||||
</AlertDescription>
|
||||
</Alert>
|
||||
|
||||
<DialogFooter className='gap-2'>
|
||||
<Button variant="outline" onClick={onCancel} disabled={isDiscarding}>
|
||||
Cancel
|
||||
</Button>
|
||||
<Button
|
||||
variant="destructive"
|
||||
onClick={onConfirm}
|
||||
disabled={isDiscarding}
|
||||
className="bg-red-600 hover:bg-red-700 text-white font-semibold border-red-600"
|
||||
>
|
||||
{isDiscarding && 'Discarding...'}
|
||||
{!isDiscarding && 'Discard'}
|
||||
</Button>
|
||||
</DialogFooter>
|
||||
</DialogContent>
|
||||
</Dialog>
|
||||
)
|
||||
}
|
||||
@@ -1,85 +0,0 @@
|
||||
import { memo, type ReactNode } from 'react'
|
||||
import { X, VolumeX, Loader2 } from 'lucide-react'
|
||||
import { cn } from '@/lib/utils'
|
||||
|
||||
type FloatingActionVariant = 'clear' | 'stop-audio' | 'custom'
|
||||
|
||||
interface FloatingActionButtonProps {
|
||||
variant: FloatingActionVariant
|
||||
onClick: () => void
|
||||
visible: boolean
|
||||
loading?: boolean
|
||||
icon?: ReactNode
|
||||
label?: string
|
||||
position?: 'top-right' | 'top-left' | 'bottom-right' | 'bottom-left'
|
||||
className?: string
|
||||
}
|
||||
|
||||
const variantConfig: Record<FloatingActionVariant, { icon: ReactNode; label: string; colors: string }> = {
|
||||
'clear': {
|
||||
icon: <X className="w-5 h-5" />,
|
||||
label: 'Clear',
|
||||
colors: 'bg-gradient-to-br from-red-600 to-red-700 hover:from-red-500 hover:to-red-600 border-2 border-red-500/60 hover:border-red-400 shadow-lg shadow-red-500/30 hover:shadow-red-500/50 ring-2 ring-red-500/20 hover:ring-red-500/40 text-destructive-foreground'
|
||||
},
|
||||
'stop-audio': {
|
||||
icon: <VolumeX className="w-5 h-5" />,
|
||||
label: 'Stop Audio',
|
||||
colors: 'bg-gradient-to-br from-red-700 to-red-800 hover:from-red-600 hover:to-red-700 border-2 border-red-600/80 hover:border-red-500 shadow-2xl shadow-red-600/40 hover:shadow-red-600/60 ring-2 ring-red-600/30 hover:ring-red-600/50 animate-[pulse_2s_cubic-bezier(0.4,0,0.6,1)_infinite] text-destructive-foreground',
|
||||
},
|
||||
'custom': {
|
||||
icon: null,
|
||||
label: '',
|
||||
colors: 'bg-muted hover:bg-muted-foreground/20 text-muted-foreground border-border'
|
||||
}
|
||||
}
|
||||
|
||||
const positionClasses: Record<NonNullable<FloatingActionButtonProps['position']>, string> = {
|
||||
'top-right': 'top-4 right-4',
|
||||
'top-left': 'top-4 left-4',
|
||||
'bottom-right': 'bottom-4 right-4',
|
||||
'bottom-left': 'bottom-4 left-4'
|
||||
}
|
||||
|
||||
export const FloatingActionButton = memo(function FloatingActionButton({
|
||||
variant,
|
||||
onClick,
|
||||
visible,
|
||||
loading = false,
|
||||
icon,
|
||||
label,
|
||||
position = 'top-right',
|
||||
className
|
||||
}: FloatingActionButtonProps) {
|
||||
const config = variantConfig[variant]
|
||||
const displayIcon = icon ?? config.icon
|
||||
const displayLabel = label ?? config.label
|
||||
|
||||
if (!visible) return null
|
||||
|
||||
return (
|
||||
<button
|
||||
onClick={onClick}
|
||||
disabled={loading}
|
||||
className={cn(
|
||||
'fixed z-50 flex items-center gap-2 px-4 py-2 rounded-xl backdrop-blur-md transition-all duration-200',
|
||||
'min-w-[48px] min-h-[48px]',
|
||||
'active:scale-95 hover:scale-105',
|
||||
'transition-transform',
|
||||
config.colors,
|
||||
positionClasses[position],
|
||||
loading && 'opacity-70 cursor-not-allowed grayscale',
|
||||
className
|
||||
)}
|
||||
aria-label={displayLabel}
|
||||
>
|
||||
{loading ? (
|
||||
<Loader2 className="w-5 h-5 animate-spin" />
|
||||
) : (
|
||||
displayIcon
|
||||
)}
|
||||
{displayLabel && (
|
||||
<span className="text-sm font-medium hidden sm:inline">{displayLabel}</span>
|
||||
)}
|
||||
</button>
|
||||
)
|
||||
})
|
||||
Reference in new issue
Block a user