diff --git a/pipes/memories/src/components/obsidian-settings.tsx b/pipes/memories/src/components/obsidian-settings.tsx deleted file mode 100644 index 7eba639a9..000000000 --- a/pipes/memories/src/components/obsidian-settings.tsx +++ /dev/null @@ -1,229 +0,0 @@ -"use client"; - -import { useState } from "react"; -import { useSettings } from "@/lib/hooks/use-settings"; -import { Button } from "@/components/ui/button"; -import { Input } from "@/components/ui/input"; -import { Label } from "@/components/ui/label"; -import { FolderOpen, FileCheck } from "lucide-react"; -import { useToast } from "@/components/ui/use-toast"; - -export function ObsidianSettings() { - const { settings, updateSettings } = useSettings(); - const [lastLog, setLastLog] = useState(null); - const [loading, setLoading] = useState(false); - const { toast } = useToast(); - - const handleSave = async (e: React.FormEvent) => { - e.preventDefault(); - const formData = new FormData(e.target as HTMLFormElement); - - try { - await updateSettings( - { - // @ts-ignore - path: formData.get("path") as string, - interval: parseInt(formData.get("interval") as string) * 60000, - pageSize: parseInt(formData.get("pageSize") as string), - aiModel: formData.get("aiModel") as string, - prompt: formData.get("prompt") as string, - }, - "obsidian" - ); - - toast({ - title: "settings saved", - description: "your obsidian settings have been updated", - }); - } catch (err) { - toast({ - variant: "destructive", - title: "error", - description: "failed to save settings", - }); - } - }; - - const testLog = async () => { - setLoading(true); - try { - const res = await fetch("/api/log"); - const data = await res.json(); - setLastLog(data); - } catch (err) { - console.error("error testing log:", err); - } finally { - setLoading(false); - } - }; - - const openPath = async () => { - try { - // Check if File System Access API is supported - if (!("showDirectoryPicker" in window)) { - toast({ - variant: "destructive", - title: "error", - description: - "your browser doesn't support directory selection. please enter the path manually.", - }); - return; - } - - // Open directory picker dialog - const dirHandle = await (window as any).showDirectoryPicker(); - const path = dirHandle.name; - - // Update the input value and settings - const input = document.getElementById("path") as HTMLInputElement; - if (input) { - input.value = path; - } - - await updateSettings( - { - ...settings.customSettings?.obsidian, - path, - }, - "obsidian" - ); - - toast({ - title: "path updated", - description: "obsidian vault path has been set", - }); - } catch (err) { - console.error("failed to open directory picker:", err); - toast({ - variant: "destructive", - title: "error", - description: "failed to select directory", - }); - } - }; - - return ( -
-
-
- -
- - -
-
- -
- - -
- -
- - -
- -
- - -
- -
- -