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

fix: /health endpoint

Louis Beaumontd9a33f786d1f
diff --git a/examples/apps/screenpipe-app-tauri/app/page.tsx b/examples/apps/screenpipe-app-tauri/app/page.tsx
index 23eaab5ac..de35f8403 100644
--- a/examples/apps/screenpipe-app-tauri/app/page.tsx
+++ b/examples/apps/screenpipe-app-tauri/app/page.tsx
@@ -1,9 +1,6 @@
"use client";
import { ChatList } from "@/components/chat-list-openai-v2";
-import Image from "next/image";
-import { Button } from "@/components/ui/button";
-import RagExample from "@/components/rag-example";
import { Settings } from "@/components/settings";
import { useSettings } from "@/lib/hooks/use-settings";
import {
@@ -14,125 +11,11 @@ import {
CardTitle,
} from "@/components/ui/card";
import { Skeleton } from "@/components/ui/skeleton";
-import { PrettyLink } from "@/components/pretty-link";
-import HealthStatus from "@/components/screenpipe-status";
-function IconNewChat() {
- return (
- <svg
- width="15"
- height="15"
- viewBox="0 0 15 15"
- fill="none"
- xmlns="http://www.w3.org/2000/svg"
- >
- <path
- d="M12.1464 1.14645C12.3417 0.951184 12.6583 0.951184 12.8535 1.14645L14.8535 3.14645C15.0488 3.34171 15.0488 3.65829 14.8535 3.85355L10.9109 7.79618C10.8349 7.87218 10.7471 7.93543 10.651 7.9835L6.72359 9.94721C6.53109 10.0435 6.29861 10.0057 6.14643 9.85355C5.99425 9.70137 5.95652 9.46889 6.05277 9.27639L8.01648 5.34897C8.06455 5.25283 8.1278 5.16507 8.2038 5.08907L12.1464 1.14645ZM12.5 2.20711L8.91091 5.79618L7.87266 7.87267L8.12731 8.12732L10.2038 7.08907L13.7929 3.5L12.5 2.20711ZM9.99998 2L8.99998 3H4.9C4.47171 3 4.18056 3.00039 3.95552 3.01877C3.73631 3.03668 3.62421 3.06915 3.54601 3.10899C3.35785 3.20487 3.20487 3.35785 3.10899 3.54601C3.06915 3.62421 3.03669 3.73631 3.01878 3.95552C3.00039 4.18056 3 4.47171 3 4.9V11.1C3 11.5283 3.00039 11.8194 3.01878 12.0445C3.03669 12.2637 3.06915 12.3758 3.10899 12.454C3.20487 12.6422 3.35785 12.7951 3.54601 12.891C3.62421 12.9309 3.73631 12.9633 3.95552 12.9812C4.18056 12.9996 4.47171 13 4.9 13H11.1C11.5283 13 11.8194 12.9996 12.0445 12.9812C12.2637 12.9633 12.3758 12.9309 12.454 12.891C12.6422 12.7951 12.7951 12.6422 12.891 12.454C12.9309 12.3758 12.9633 12.2637 12.9812 12.0445C12.9996 11.8194 13 11.5283 13 11.1V6.99998L14 5.99998V11.1V11.1207C14 11.5231 14 11.8553 13.9779 12.1259C13.9549 12.407 13.9057 12.6653 13.782 12.908C13.5903 13.2843 13.2843 13.5903 12.908 13.782C12.6653 13.9057 12.407 13.9549 12.1259 13.9779C11.8553 14 11.5231 14 11.1207 14H11.1H4.9H4.87934C4.47686 14 4.14468 14 3.87409 13.9779C3.59304 13.9549 3.33469 13.9057 3.09202 13.782C2.7157 13.5903 2.40973 13.2843 2.21799 12.908C2.09434 12.6653 2.04506 12.407 2.0221 12.1259C1.99999 11.8553 1.99999 11.5231 2 11.1207V11.1206V11.1V4.9V4.87935V4.87932V4.87931C1.99999 4.47685 1.99999 4.14468 2.0221 3.87409C2.04506 3.59304 2.09434 3.33469 2.21799 3.09202C2.40973 2.71569 2.7157 2.40973 3.09202 2.21799C3.33469 2.09434 3.59304 2.04506 3.87409 2.0221C4.14468 1.99999 4.47685 1.99999 4.87932 2H4.87935H4.9H9.99998Z"
- fill="currentColor"
- fillRule="evenodd"
- clipRule="evenodd"
- ></path>
- </svg>
- );
-}
-
-import {
- Tooltip,
- TooltipContent,
- TooltipProvider,
- TooltipTrigger,
-} from "@/components/ui/tooltip";
import React from "react";
-import PipeDialog from "@/components/pipe-store";
import NotificationHandler from "@/components/notification-handler";
-
-function Header() {
- return (
- <div>
- <div className="absolute left-8 top-8">
- <TooltipProvider>
- <Tooltip>
- <TooltipTrigger asChild>
- <Button
- variant="secondary"
- onClick={() => {
- location.reload();
- }}
- >
- <IconNewChat />
- </Button>
- </TooltipTrigger>
- <TooltipContent>
- <p>New chat</p>
- </TooltipContent>
- </Tooltip>
- </TooltipProvider>
- </div>
- <div className="mb-16 relative z-[-1] flex flex-col items-center">
- <div className="relative flex flex-col items-center before:absolute before:h-[300px] before:w-full before:-translate-x-1/2 before:rounded-full before:bg-gradient-radial before:from-white before:to-transparent before:blur-2xl before:content-[''] after:absolute after:-z-20 after:h-[180px] after:w-full after:translate-x-1/3 after:bg-gradient-conic after:from-sky-200 after:via-blue-200 after:blur-2xl after:content-[''] before:dark:bg-gradient-to-br before:dark:from-transparent before:dark:to-blue-700 before:dark:opacity-10 after:dark:from-sky-900 after:dark:via-[#0141ff] after:dark:opacity-40 sm:before:w-[480px] sm:after:w-[240px] before:lg:h-[360px] gap-4">
- <Image
- className="relative dark:drop-shadow-[0_0_0.3rem_#ffffff70] dark:invert"
- src="/screenpipe.svg"
- alt="Screenpipe Logo"
- width={180}
- height={37}
- priority
- />
- <p className="absolute left-0 top-0 flex w-full justify-center border-b border-gray-300 bg-gradient-to-b from-zinc-200 pb-6 pt-8 backdrop-blur-2xl dark:border-neutral-800 dark:bg-zinc-800/30 dark:from-inherit lg:static lg:w-auto lg:rounded-xl lg:border lg:bg-gray-200 lg:p-4 lg:dark:bg-zinc-800/30">
- Personalized AI powered by what you have seen, said, or heard.
- </p>
- </div>
- </div>
- <div className="mt-4 flex space-x-4 absolute top-4 right-4">
- {" "}
- {/* Added margin-top for spacing */}
- <HealthStatus className="mt-3" />
- <Settings />
- <PipeDialog />
- {/* <LogViewer /> */}
- {/* <PrettyLink href="https://github.com/louis030195/screen-pipe/tree/main/examples/ts">
- <span className="mr-2">Examples</span>
- <svg
- xmlns="http://www.w3.org/2000/svg"
- width="16"
- height="16"
- viewBox="0 0 24 24"
- fill="none"
- stroke="currentColor"
- strokeWidth="2"
- strokeLinecap="round"
- strokeLinejoin="round"
- >
- <path d="M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6" />
- <polyline points="15 3 21 3 21 9" />
- <line x1="10" y1="14" x2="21" y2="3" />
- </svg>
- </PrettyLink> */}
- <PrettyLink
- variant="outline"
- href="mailto:[email protected]?subject=Screenpipe%20Feedback&body=Please%20enter%20your%20feedback%20here...%0A%0A...%20or%20let's%20chat?%0Ahttps://cal.com/louis030195/screenpipe"
- >
- <span className="mr-2">Send feedback</span>
- <svg
- xmlns="http://www.w3.org/2000/svg"
- width="16"
- height="16"
- viewBox="0 0 24 24"
- fill="none"
- stroke="currentColor"
- strokeWidth="2"
- strokeLinecap="round"
- strokeLinejoin="round"
- >
- <path d="M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6" />
- <polyline points="15 3 21 3 21 9" />
- <line x1="10" y1="14" x2="21" y2="3" />
- </svg>
- </PrettyLink>
- </div>
- </div>
- );
-}
+import ScreenpipeInstanceChecker from "@/components/screenpipe-instance-checker";
+import Header from "@/components/header";
export default function Home() {
const { settings } = useSettings();
@@ -140,7 +23,7 @@ export default function Home() {
return (
<main className="flex min-h-screen flex-col items-center p-8">
<NotificationHandler />
-
+ {/* <ScreenpipeInstanceChecker /> */}
<Header />
{settings.isLoading ? (
<div className="flex flex-col items-center justify-center h-full space-y-4">
diff --git a/examples/apps/screenpipe-app-tauri/components/header.tsx b/examples/apps/screenpipe-app-tauri/components/header.tsx
new file mode 100644
index 000000000..214d09d75
--- /dev/null
+++ b/examples/apps/screenpipe-app-tauri/components/header.tsx
@@ -0,0 +1,119 @@
+import Image from "next/image";
+import { Button } from "@/components/ui/button";
+import { Settings } from "@/components/settings";
+import { PrettyLink } from "@/components/pretty-link";
+import HealthStatus from "@/components/screenpipe-status";
+import {
+ Tooltip,
+ TooltipContent,
+ TooltipProvider,
+ TooltipTrigger,
+} from "@/components/ui/tooltip";
+import React from "react";
+import PipeDialog from "@/components/pipe-store";
+
+function IconNewChat() {
+ return (
+ <svg
+ width="15"
+ height="15"
+ viewBox="0 0 15 15"
+ fill="none"
+ xmlns="http://www.w3.org/2000/svg"
+ >
+ <path
+ d="M12.1464 1.14645C12.3417 0.951184 12.6583 0.951184 12.8535 1.14645L14.8535 3.14645C15.0488 3.34171 15.0488 3.65829 14.8535 3.85355L10.9109 7.79618C10.8349 7.87218 10.7471 7.93543 10.651 7.9835L6.72359 9.94721C6.53109 10.0435 6.29861 10.0057 6.14643 9.85355C5.99425 9.70137 5.95652 9.46889 6.05277 9.27639L8.01648 5.34897C8.06455 5.25283 8.1278 5.16507 8.2038 5.08907L12.1464 1.14645ZM12.5 2.20711L8.91091 5.79618L7.87266 7.87267L8.12731 8.12732L10.2038 7.08907L13.7929 3.5L12.5 2.20711ZM9.99998 2L8.99998 3H4.9C4.47171 3 4.18056 3.00039 3.95552 3.01877C3.73631 3.03668 3.62421 3.06915 3.54601 3.10899C3.35785 3.20487 3.20487 3.35785 3.10899 3.54601C3.06915 3.62421 3.03669 3.73631 3.01878 3.95552C3.00039 4.18056 3 4.47171 3 4.9V11.1C3 11.5283 3.00039 11.8194 3.01878 12.0445C3.03669 12.2637 3.06915 12.3758 3.10899 12.454C3.20487 12.6422 3.35785 12.7951 3.54601 12.891C3.62421 12.9309 3.73631 12.9633 3.95552 12.9812C4.18056 12.9996 4.47171 13 4.9 13H11.1C11.5283 13 11.8194 12.9996 12.0445 12.9812C12.2637 12.9633 12.3758 12.9309 12.454 12.891C12.6422 12.7951 12.7951 12.6422 12.891 12.454C12.9309 12.3758 12.9633 12.2637 12.9812 12.0445C12.9996 11.8194 13 11.5283 13 11.1V6.99998L14 5.99998V11.1V11.1207C14 11.5231 14 11.8553 13.9779 12.1259C13.9549 12.407 13.9057 12.6653 13.782 12.908C13.5903 13.2843 13.2843 13.5903 12.908 13.782C12.6653 13.9057 12.407 13.9549 12.1259 13.9779C11.8553 14 11.5231 14 11.1207 14H11.1H4.9H4.87934C4.47686 14 4.14468 14 3.87409 13.9779C3.59304 13.9549 3.33469 13.9057 3.09202 13.782C2.7157 13.5903 2.40973 13.2843 2.21799 12.908C2.09434 12.6653 2.04506 12.407 2.0221 12.1259C1.99999 11.8553 1.99999 11.5231 2 11.1207V11.1206V11.1V4.9V4.87935V4.87932V4.87931C1.99999 4.47685 1.99999 4.14468 2.0221 3.87409C2.04506 3.59304 2.09434 3.33469 2.21799 3.09202C2.40973 2.71569 2.7157 2.40973 3.09202 2.21799C3.33469 2.09434 3.59304 2.04506 3.87409 2.0221C4.14468 1.99999 4.47685 1.99999 4.87932 2H4.87935H4.9H9.99998Z"
+ fill="currentColor"
+ fillRule="evenodd"
+ clipRule="evenodd"
+ ></path>
+ </svg>
+ );
+}
+export default function Header() {
+ return (
+ <div>
+ <div className="absolute left-8 top-8">
+ <TooltipProvider>
+ <Tooltip>
+ <TooltipTrigger asChild>
+ <Button
+ variant="secondary"
+ onClick={() => {
+ location.reload();
+ }}
+ >
+ <IconNewChat />
+ </Button>
+ </TooltipTrigger>
+ <TooltipContent>
+ <p>New chat</p>
+ </TooltipContent>
+ </Tooltip>
+ </TooltipProvider>
+ </div>
+ <div className="mb-16 relative z-[-1] flex flex-col items-center">
+ <div className="relative flex flex-col items-center before:absolute before:h-[300px] before:w-full before:-translate-x-1/2 before:rounded-full before:bg-gradient-radial before:from-white before:to-transparent before:blur-2xl before:content-[''] after:absolute after:-z-20 after:h-[180px] after:w-full after:translate-x-1/3 after:bg-gradient-conic after:from-sky-200 after:via-blue-200 after:blur-2xl after:content-[''] before:dark:bg-gradient-to-br before:dark:from-transparent before:dark:to-blue-700 before:dark:opacity-10 after:dark:from-sky-900 after:dark:via-[#0141ff] after:dark:opacity-40 sm:before:w-[480px] sm:after:w-[240px] before:lg:h-[360px] gap-4">
+ <Image
+ className="relative dark:drop-shadow-[0_0_0.3rem_#ffffff70] dark:invert"
+ src="/screenpipe.svg"
+ alt="Screenpipe Logo"
+ width={180}
+ height={37}
+ priority
+ />
+ <p className="absolute left-0 top-0 flex w-full justify-center border-b border-gray-300 bg-gradient-to-b from-zinc-200 pb-6 pt-8 backdrop-blur-2xl dark:border-neutral-800 dark:bg-zinc-800/30 dark:from-inherit lg:static lg:w-auto lg:rounded-xl lg:border lg:bg-gray-200 lg:p-4 lg:dark:bg-zinc-800/30">
+ Personalized AI powered by what you have seen, said, or heard.
+ </p>
+ </div>
+ </div>
+ <div className="mt-4 flex space-x-4 absolute top-4 right-4">
+ {" "}
+ {/* Added margin-top for spacing */}
+ <HealthStatus className="mt-3" />
+ <Settings />
+ <PipeDialog />
+ {/* <LogViewer /> */}
+ {/* <PrettyLink href="https://github.com/louis030195/screen-pipe/tree/main/examples/ts">
+ <span className="mr-2">Examples</span>
+ <svg
+ xmlns="http://www.w3.org/2000/svg"
+ width="16"
+ height="16"
+ viewBox="0 0 24 24"
+ fill="none"
+ stroke="currentColor"
+ strokeWidth="2"
+ strokeLinecap="round"
+ strokeLinejoin="round"
+ >
+ <path d="M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6" />
+ <polyline points="15 3 21 3 21 9" />
+ <line x1="10" y1="14" x2="21" y2="3" />
+ </svg>
+ </PrettyLink> */}
+ <PrettyLink
+ variant="outline"
+ href="mailto:[email protected]?subject=Screenpipe%20Feedback&body=Please%20enter%20your%20feedback%20here...%0A%0A...%20or%20let's%20chat?%0Ahttps://cal.com/louis030195/screenpipe"
+ >
+ <span className="mr-2">Send feedback</span>
+ <svg
+ xmlns="http://www.w3.org/2000/svg"
+ width="16"
+ height="16"
+ viewBox="0 0 24 24"
+ fill="none"
+ stroke="currentColor"
+ strokeWidth="2"
+ strokeLinecap="round"
+ strokeLinejoin="round"
+ >
+ <path d="M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6" />
+ <polyline points="15 3 21 3 21 9" />
+ <line x1="10" y1="14" x2="21" y2="3" />
+ </svg>
+ </PrettyLink>
+ </div>
+ </div>
+ );
+}
diff --git a/examples/apps/screenpipe-app-tauri/components/screenpipe-instance-checker.tsx b/examples/apps/screenpipe-app-tauri/components/screenpipe-instance-checker.tsx
new file mode 100644
index 000000000..8562ae73b
--- /dev/null
+++ b/examples/apps/screenpipe-app-tauri/components/screenpipe-instance-checker.tsx
@@ -0,0 +1,77 @@
+import React, { useEffect } from "react";
+import {
+ isPermissionGranted,
+ onAction,
+ registerActionTypes,
+ requestPermission,
+ sendNotification,
+} from "@tauri-apps/plugin-notification";
+import { invoke } from "@tauri-apps/api/core";
+
+const ScreenpipeInstanceChecker: React.FC = () => {
+ useEffect(() => {
+ const checkInstances = async () => {
+ try {
+ // Check notification permission
+ let permissionGranted = await isPermissionGranted();
+ if (!permissionGranted) {
+ const permission = await requestPermission();
+ permissionGranted = permission === "granted";
+ }
+
+ onAction(async (event) => {
+ console.log("Action received:", event);
+ if (event.actionTypeId === "is_running_multiple_instances") {
+ console.log("Action received:", event);
+
+ await invoke("kill_all_screenpipes");
+ // sleep 2s
+ await new Promise((resolve) => setTimeout(resolve, 2000));
+ await invoke("spawn_screenpipe");
+ sendNotification({
+ title: "Screenpipe Restarted",
+ body: "All instances have been stopped and Screenpipe has been restarted.",
+ });
+ }
+ });
+
+ registerActionTypes([
+ {
+ id: "is_running_multiple_instances",
+ actions: [
+ {
+ id: "stop_all_and_restart",
+ title: "Stop All and Restart",
+ },
+ ],
+ },
+ ]);
+
+ if (!permissionGranted) {
+ console.log("Notification permission not granted");
+ return;
+ }
+
+ const multipleInstances = await invoke<boolean>(
+ "is_running_multiple_instances"
+ );
+
+ if (multipleInstances) {
+ sendNotification({
+ title: "Multiple Screenpipe Instances Detected",
+ body: "Stop all and restart?",
+ actionTypeId: "is_running_multiple_instances",
+ });
+ }
+ } catch (error) {
+ console.error("Error checking instances:", error);
+ }
+ };
+
+ checkInstances();
+ }, []);
+
+ return null;
+};
+
+export default ScreenpipeInstanceChecker;
diff --git a/examples/apps/screenpipe-app-tauri/src-tauri/src/main.rs b/examples/apps/screenpipe-app-tauri/src-tauri/src/main.rs
index 6b3dfdba0..4e8b75a26 100755
--- a/examples/apps/screenpipe-app-tauri/src-tauri/src/main.rs
+++ b/examples/apps/screenpipe-app-tauri/src-tauri/src/main.rs
@@ -32,6 +32,43 @@ mod logs;
struct SidecarState(Arc<Mutex<Option<CommandChild>>>);
+#[tauri::command]
+async fn is_running_multiple_instances(
+ _state: State<'_, SidecarState>,
+ _app: tauri::AppHandle,
+) -> Result<u32, String> {
+ debug!("is_running_multiple_instances");
+
+ // list screenpipe processes
+ let output = if cfg!(windows) {
+ tokio::process::Command::new("tasklist")
+ .output()
+ .await
+ .map_err(|e| e.to_string())?
+ } else {
+ tokio::process::Command::new("ps")
+ .arg("-e")
+ .arg("-o")
+ .arg("pid,comm")
+ .output()
+ .await
+ .map_err(|e| e.to_string())?
+ };
+
+ // filter by screenpipe
+ let output = String::from_utf8_lossy(&output.stdout);
+ let lines = output.split('\n');
+ let mut count = 0;
+ for line in lines {
+ debug!("line: {}", line);
+ if line.contains("screenpipe") {
+ count += 1;
+ }
+ }
+
+ Ok(count)
+}
+
#[tauri::command]
async fn kill_all_sreenpipes(
state: State<'_, SidecarState>,
@@ -74,7 +111,7 @@ fn spawn_sidecar(app: &tauri::AppHandle) -> Result<CommandChild, String> {
let sidecar = app.shell().sidecar("screenpipe").unwrap();
let (_, child) = sidecar
- .args(["--port", "3030", "--debug"])
+ .args(["--port", "3030", "--debug", "--self-healing"])
.spawn()
.map_err(|e| e.to_string())?;
@@ -122,7 +159,8 @@ async fn main() {
.manage(sidecar_state)
.invoke_handler(tauri::generate_handler![
spawn_screenpipe,
- kill_all_sreenpipes
+ kill_all_sreenpipes,
+ is_running_multiple_instances
])
.setup(move |app| {
// run this on windows only
diff --git a/examples/apps/screenpipe-app-tauri/src-tauri/tauri.conf.json b/examples/apps/screenpipe-app-tauri/src-tauri/tauri.conf.json
index 87d7afe72..daa4c45a9 100644
--- a/examples/apps/screenpipe-app-tauri/src-tauri/tauri.conf.json
+++ b/examples/apps/screenpipe-app-tauri/src-tauri/tauri.conf.json
@@ -82,6 +82,12 @@
"$HOME/.screenpipe/*",
"$APP/*"
]
+ },
+ "updater": {
+ "endpoints": [
+ "https://cdn.crabnebula.app/update/mediar/screenpipe/{{target}}-{{arch}}/{{current_version}}"
+ ],
+ "pubkey": "dW50cnVzdGVkIGNvbW1lbnQ6IG1pbmlzaWduIHB1YmxpYyBrZXk6IDIyQjQ2RkQzMUNBOUFDMTcKUldRWHJLa2MwMiswSWl3RlBGUW5zYUE0Zm0vNFFRRTltNUZZTUVxR2FxUDNtSWdUSHgyL3JNcmcK"
}
},
"app": {
diff --git a/screenpipe-server/src/core.rs b/screenpipe-server/src/core.rs
index 4c30fbd46..d8cbe3e3a 100644
--- a/screenpipe-server/src/core.rs
+++ b/screenpipe-server/src/core.rs
@@ -298,13 +298,15 @@ async fn process_audio_result(db: &DatabaseManager, result: TranscriptionResult)
return;
}
let transcription = result.transcription.unwrap();
- // if audio text is empty skip, add debug log
- if transcription.is_empty() {
- return;
- }
+
info!("Inserting audio chunk: {:?}", transcription);
match db.insert_audio_chunk(&result.input.path).await {
Ok(audio_chunk_id) => {
+ // if audio text is empty skip transcription insertion
+ if transcription.is_empty() {
+ return;
+ }
+
if let Err(e) = db
.insert_audio_transcription(audio_chunk_id, &transcription, 0)
.await
diff --git a/screenpipe-server/src/db.rs b/screenpipe-server/src/db.rs
index b067e7606..19b1cf345 100644
--- a/screenpipe-server/src/db.rs
+++ b/screenpipe-server/src/db.rs
@@ -86,8 +86,9 @@ impl DatabaseManager {
pub async fn insert_audio_chunk(&self, file_path: &str) -> Result<i64, sqlx::Error> {
let mut tx = self.pool.begin().await?;
- let id = sqlx::query("INSERT INTO audio_chunks (file_path) VALUES (?1)")
+ let id = sqlx::query("INSERT INTO audio_chunks (file_path, timestamp) VALUES (?1, ?2)")
.bind(file_path)
+ .bind(Utc::now())
.execute(&mut *tx)
.await?
.last_insert_rowid();
@@ -591,7 +592,7 @@ impl DatabaseManager {
.await?;
let latest_audio: Option<(DateTime<Utc>,)> = sqlx::query_as(
- "SELECT timestamp FROM audio_transcriptions ORDER BY timestamp DESC LIMIT 1"
+ "SELECT timestamp FROM audio_chunks ORDER BY timestamp DESC LIMIT 1"
)
.fetch_optional(&self.pool)
.await?;
diff --git a/screenpipe-server/src/migrations/20240716120003_add_timestampt_to_audio_chunks.sql b/screenpipe-server/src/migrations/20240716120003_add_timestampt_to_audio_chunks.sql
new file mode 100644
index 000000000..1c9c27c34
--- /dev/null
+++ b/screenpipe-server/src/migrations/20240716120003_add_timestampt_to_audio_chunks.sql
@@ -0,0 +1,6 @@
+-- Add migration script here
+-- Add timestamp column to audio_chunks table
+ALTER TABLE audio_chunks ADD COLUMN timestamp TIMESTAMP;
+
+-- Create an index on the new timestamp column
+CREATE INDEX idx_audio_chunks_timestamp ON audio_chunks(timestamp);
\ No newline at end of file