7.4 billion tokens per month. 34 free LLM providers. 635 free model endpoints. All behind one /v1 endpoint, plus any custom OpenAI-compatible endpoint. Smart routing, automatic failover, encrypted keys. Personal experimentation only.
TypeScript
feat(dashboard): drag-and-drop reorder for embeddings providers
Tashfeenc9c312a03987
diff --git a/client/src/components/model-table.tsx b/client/src/components/model-table.tsxindex edb4126d..c02e2897 100644--- a/client/src/components/model-table.tsx+++ b/client/src/components/model-table.tsx@@ -143,7 +143,9 @@ export function RowContent({)}-const dragDots = (+// Shared drag-handle glyph (also used by the Embeddings provider list, so the+// two reorder surfaces look identical).+export const dragDots = (<svg width="14" height="14" viewBox="0 0 24 24" fill="currentColor"><circle cx="9" cy="6" r="1.5" /><circle cx="15" cy="6" r="1.5" /><circle cx="9" cy="12" r="1.5" /><circle cx="15" cy="12" r="1.5" />diff --git a/client/src/i18n/locales/en.json b/client/src/i18n/locales/en.jsonindex 8472b612..ede4ac49 100644--- a/client/src/i18n/locales/en.json+++ b/client/src/i18n/locales/en.json@@ -403,7 +403,8 @@"savingChanges": "Saving…","tokMax": "{tokens} tok max","emptyTitle": "No embedding models yet",- "emptyDesc": "Embedding families appear here once you add a provider key that supports embeddings."+ "emptyDesc": "Embedding families appear here once you add a provider key that supports embeddings.",+ "dragToReorder": "Drag to reorder provider"},"fusion": {"title": "Fusion",diff --git a/client/src/i18n/locales/es.json b/client/src/i18n/locales/es.jsonindex d6180896..7e287241 100644--- a/client/src/i18n/locales/es.json+++ b/client/src/i18n/locales/es.json@@ -385,7 +385,8 @@"savingChanges": "Guardando…","tokMax": "{tokens} tok máx.","emptyTitle": "Aún no hay modelos de embeddings",- "emptyDesc": "Las familias de embeddings aparecen aquí cuando añades una clave de proveedor compatible con embeddings."+ "emptyDesc": "Las familias de embeddings aparecen aquí cuando añades una clave de proveedor compatible con embeddings.",+ "dragToReorder": "Arrastra para reordenar el proveedor"},"fusion": {"title": "Fusión",diff --git a/client/src/i18n/locales/fr.json b/client/src/i18n/locales/fr.jsonindex a4c6fc78..17d0a5dc 100644--- a/client/src/i18n/locales/fr.json+++ b/client/src/i18n/locales/fr.json@@ -385,7 +385,8 @@"savingChanges": "Enregistrement…","tokMax": "{tokens} tok max.","emptyTitle": "Aucun modèle d'embeddings pour l'instant",- "emptyDesc": "Les familles d'embeddings apparaissent ici dès que vous ajoutez une clé de fournisseur prenant en charge les embeddings."+ "emptyDesc": "Les familles d'embeddings apparaissent ici dès que vous ajoutez une clé de fournisseur prenant en charge les embeddings.",+ "dragToReorder": "Glisser pour réorganiser le fournisseur"},"fusion": {"title": "Fusion",diff --git a/client/src/i18n/locales/it.json b/client/src/i18n/locales/it.jsonindex a666fb93..ecdc29c6 100644--- a/client/src/i18n/locales/it.json+++ b/client/src/i18n/locales/it.json@@ -385,7 +385,8 @@"savingChanges": "Salvataggio…","tokMax": "{tokens} tok max","emptyTitle": "Ancora nessun modello di embedding",- "emptyDesc": "Le famiglie di embedding compaiono qui quando aggiungi una chiave provider che supporta gli embedding."+ "emptyDesc": "Le famiglie di embedding compaiono qui quando aggiungi una chiave provider che supporta gli embedding.",+ "dragToReorder": "Trascina per riordinare il provider"},"fusion": {"title": "Fusion",diff --git a/client/src/i18n/locales/pt-BR.json b/client/src/i18n/locales/pt-BR.jsonindex d23808f4..ddf308bb 100644--- a/client/src/i18n/locales/pt-BR.json+++ b/client/src/i18n/locales/pt-BR.json@@ -385,7 +385,8 @@"savingChanges": "Salvando…","tokMax": "{tokens} tok máx.","emptyTitle": "Ainda sem modelos de embeddings",- "emptyDesc": "As famílias de embeddings aparecem aqui quando você adiciona uma chave de provedor com suporte a embeddings."+ "emptyDesc": "As famílias de embeddings aparecem aqui quando você adiciona uma chave de provedor com suporte a embeddings.",+ "dragToReorder": "Arraste para reordenar o provedor"},"fusion": {"title": "Fusão",diff --git a/client/src/i18n/locales/zh-CN.json b/client/src/i18n/locales/zh-CN.jsonindex 7b8de2db..8329c972 100644--- a/client/src/i18n/locales/zh-CN.json+++ b/client/src/i18n/locales/zh-CN.json@@ -385,7 +385,8 @@"savingChanges": "保存中…","tokMax": "最多 {tokens} tok","emptyTitle": "暂无嵌入模型",- "emptyDesc": "添加支持嵌入的提供商密钥后,嵌入系列会显示在这里。"+ "emptyDesc": "添加支持嵌入的提供商密钥后,嵌入系列会显示在这里。",+ "dragToReorder": "拖动以重新排序提供方"},"fusion": {"title": "融合",diff --git a/client/src/pages/EmbeddingsPage.tsx b/client/src/pages/EmbeddingsPage.tsxindex abeef7d7..9b0451ac 100644--- a/client/src/pages/EmbeddingsPage.tsx+++ b/client/src/pages/EmbeddingsPage.tsx@@ -1,8 +1,20 @@import { useState } from 'react'import { Link } from 'react-router-dom'import { useQuery, useMutation, useQueryClient } from '@tanstack/react-query'+import {+ DndContext,+ closestCenter,+ KeyboardSensor,+ PointerSensor,+ useSensor,+ useSensors,+ type DragEndEvent,+} from '@dnd-kit/core'+import { arrayMove, SortableContext, sortableKeyboardCoordinates, useSortable, verticalListSortingStrategy } from '@dnd-kit/sortable'+import { CSS } from '@dnd-kit/utilities'import { ArrowDown, ArrowUp, Layers } from 'lucide-react'import { apiFetch } from '@/lib/api'+import { dragDots } from '@/components/model-table'import { Button } from '@/components/ui/button'import { ConfirmButton } from '@/components/confirm-button'import { EmptyState } from '@/components/empty-state'@@ -48,6 +60,90 @@ function formatTokens(n: number): string {return String(n)}+// One provider row: draggable (same handle as the chat routing table) plus+// arrow buttons for one-step keyboard-free moves.+function SortableProviderRow({+ provider: p,+ index: i,+ count,+ onMove,+ onToggle,+ onDelete,+ deleting,+}: {+ provider: ProviderEntry+ index: number+ count: number+ onMove: (dir: -1 | 1) => void+ onToggle: (checked: boolean) => void+ onDelete: () => void+ deleting: boolean+}) {+ const { t } = useI18n()+ const { attributes, listeners, setNodeRef, transform, transition, isDragging } = useSortable({ id: p.id })+ return (+ <div+ ref={setNodeRef}+ style={{ transform: CSS.Transform.toString(transform), transition }}+ className={`flex items-center gap-3 py-2 bg-card ${p.enabled ? '' : 'opacity-50'} ${isDragging ? 'opacity-50 relative z-10' : ''}`}+ >+ {count > 1 && (+ <button+ {...attributes}+ {...listeners}+ aria-label={t('embeddings.dragToReorder')}+ className="cursor-grab active:cursor-grabbing text-muted-foreground/50 hover:text-foreground transition-colors"+ >+ {dragDots}+ </button>+ )}+ <span className="w-5 text-center font-mono text-xs text-muted-foreground tabular-nums">{i + 1}</span>+ <div className="min-w-0 flex-1">+ <div className="flex items-center gap-2">+ <span className="text-sm font-medium">{p.platform}</span>+ <span className="truncate font-mono text-[11px] text-muted-foreground">{p.modelId}</span>+ {p.keyCount === 0 && (+ <span className="text-[10px] rounded-full px-1.5 py-0.5 bg-amber-600/15 text-amber-700 dark:bg-amber-400/15 dark:text-amber-400">+ {t('models.noKey')}+ </span>+ )}+ </div>+ <div className="text-[11px] text-muted-foreground/70">{p.quotaLabel}</div>+ </div>+ {count > 1 && (+ <div className="flex gap-0.5">+ <button+ onClick={() => onMove(-1)}+ disabled={i === 0}+ aria-label={t('embeddings.moveUp')}+ className="rounded-md p-1 text-muted-foreground/60 hover:text-foreground disabled:opacity-25 transition-colors"+ >+ <ArrowUp className="size-3.5" />+ </button>+ <button+ onClick={() => onMove(1)}+ disabled={i === count - 1}+ aria-label={t('embeddings.moveDown')}+ className="rounded-md p-1 text-muted-foreground/60 hover:text-foreground disabled:opacity-25 transition-colors"+ >+ <ArrowDown className="size-3.5" />+ </button>+ </div>+ )}+ <Switch checked={p.enabled} onCheckedChange={onToggle} />+ {p.isCustom && (+ <ConfirmButton+ className="text-muted-foreground hover:text-destructive"+ onConfirm={onDelete}+ disabled={deleting}+ >+ {t('common.remove')}+ </ConfirmButton>+ )}+ </div>+ )+}+export default function EmbeddingsPage() {const { t } = useI18n()const queryClient = useQueryClient()@@ -109,6 +205,25 @@ export default function EmbeddingsPage() {}))}+ // Same reorder metaphor as the chat routing table: drag anywhere, arrows for+ // one-step moves. Both buffer into the same unsaved-changes bar.+ const sensors = useSensors(+ useSensor(PointerSensor),+ useSensor(KeyboardSensor, { coordinateGetter: sortableKeyboardCoordinates }),+ )++ function handleDragEnd(familyName: string, event: DragEndEvent) {+ const { active, over } = event+ if (!over || active.id === over.id) return+ setLocalFamilies(families.map(f => {+ if (f.family !== familyName) return f+ const oldIndex = f.providers.findIndex(p => p.id === active.id)+ const newIndex = f.providers.findIndex(p => p.id === over.id)+ if (oldIndex < 0 || newIndex < 0) return f+ return { ...f, providers: arrayMove(f.providers, oldIndex, newIndex).map((p, i) => ({ ...p, priority: i + 1 })) }+ }))+ }+function handleSave() {saveMutation.mutate({...(localDefault !== null ? { defaultFamily: localDefault } : {}),@@ -188,58 +303,24 @@ export default function EmbeddingsPage() {</span></div>- <div className="divide-y">- {f.providers.map((p, i) => (- <div key={p.id} className={`flex items-center gap-3 py-2 ${p.enabled ? '' : 'opacity-50'}`}>- <span className="w-5 text-center font-mono text-xs text-muted-foreground tabular-nums">{i + 1}</span>- <div className="min-w-0 flex-1">- <div className="flex items-center gap-2">- <span className="text-sm font-medium">{p.platform}</span>- <span className="truncate font-mono text-[11px] text-muted-foreground">{p.modelId}</span>- {p.keyCount === 0 && (- <span className="text-[10px] rounded-full px-1.5 py-0.5 bg-amber-600/15 text-amber-700 dark:bg-amber-400/15 dark:text-amber-400">- {t('models.noKey')}- </span>- )}- </div>- <div className="text-[11px] text-muted-foreground/70">{p.quotaLabel}</div>- </div>- {f.providers.length > 1 && (- <div className="flex gap-0.5">- <button- onClick={() => moveProvider(f.family, i, -1)}- disabled={i === 0}- aria-label={t('embeddings.moveUp')}- className="rounded-md p-1 text-muted-foreground/60 hover:text-foreground disabled:opacity-25 transition-colors"- >- <ArrowUp className="size-3.5" />- </button>- <button- onClick={() => moveProvider(f.family, i, 1)}- disabled={i === f.providers.length - 1}- aria-label={t('embeddings.moveDown')}- className="rounded-md p-1 text-muted-foreground/60 hover:text-foreground disabled:opacity-25 transition-colors"- >- <ArrowDown className="size-3.5" />- </button>- </div>- )}- <Switch- checked={p.enabled}- onCheckedChange={(c) => updateProvider(f.family, p.id, { enabled: c })}- />- {p.isCustom && (- <ConfirmButton- className="text-muted-foreground hover:text-destructive"- onConfirm={() => deleteCustom.mutate(p.id)}- disabled={deleteCustom.isPending}- >- {t('common.remove')}- </ConfirmButton>- )}+ <DndContext sensors={sensors} collisionDetection={closestCenter} onDragEnd={e => handleDragEnd(f.family, e)}>+ <SortableContext items={f.providers.map(p => p.id)} strategy={verticalListSortingStrategy}>+ <div className="divide-y">+ {f.providers.map((p, i) => (+ <SortableProviderRow+ key={p.id}+ provider={p}+ index={i}+ count={f.providers.length}+ onMove={dir => moveProvider(f.family, i, dir)}+ onToggle={c => updateProvider(f.family, p.id, { enabled: c })}+ onDelete={() => deleteCustom.mutate(p.id)}+ deleting={deleteCustom.isPending}+ />+ ))}</div>- ))}- </div>+ </SortableContext>+ </DndContext></section>)})