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: encoding + ollama first msg

Louis Beaumont88770df4ae67
diff --git a/screenpipe-app-tauri/components/notification-handler.tsx b/screenpipe-app-tauri/components/notification-handler.tsx
index 9e54f82d2..50c1fec19 100644
--- a/screenpipe-app-tauri/components/notification-handler.tsx
+++ b/screenpipe-app-tauri/components/notification-handler.tsx
@@ -25,20 +25,14 @@ const NotificationHandler: React.FC = () => {
}
if (permission) {
- const lastNotificationTime = localStorage.getItem(
- "lastNotificationTime"
- );
- const currentTime = Date.now();
+ const welcomeShown = localStorage.getItem("welcomeNotificationShown");
- if (
- !lastNotificationTime ||
- currentTime - parseInt(lastNotificationTime) > 3600000
- ) {
+ if (!welcomeShown) {
sendNotification({
- title: "Welcome to Screenpipe",
- body: "Thank you for using Screenpipe! We're dedicated to help you get the most out of screenpipe.",
+ title: "welcome to screenpipe",
+ body: "thank you for using screenpipe! we're dedicated to help you get the most out of screenpipe.",
});
- localStorage.setItem("lastNotificationTime", currentTime.toString());
+ localStorage.setItem("welcomeNotificationShown", "true");
}
}
diff --git a/screenpipe-app-tauri/components/search-chat.tsx b/screenpipe-app-tauri/components/search-chat.tsx
index 02554d217..1af62ef0e 100644
--- a/screenpipe-app-tauri/components/search-chat.tsx
+++ b/screenpipe-app-tauri/components/search-chat.tsx
@@ -217,6 +217,8 @@ ${queryParams.toString().replace(/&/g, "\\\n&")}" | jq`;
const calculateSelectedContentLength = () => {
return Array.from(selectedResults).reduce((total, index) => {
const item = results[index];
+ if (!item || !item.type) return total; // Add this check
+
const contentLength =
item.type === "OCR"
? item.content.text.length
@@ -276,7 +278,9 @@ ${queryParams.toString().replace(/&/g, "\\\n&")}" | jq`;
content: `You are a helpful assistant.
The user is using a product called "screenpipe" which records
his screen and mics 24/7. The user ask you questions
- and you use his screenpipe recordings to answer him.
+ and you use his screenpipe recordings to answer him.
+ The user will provide you with a list of search results
+ and you will use them to answer his questions.
Rules:
- Current time (JavaScript Date.prototype.toString): ${new Date().toString()}. Adjust start/end times to match user intent.
@@ -288,11 +292,6 @@ ${queryParams.toString().replace(/&/g, "\\\n&")}" | jq`;
- You must reformat timestamps to a human-readable format in your response to the user.
- Never output UTC time unless explicitly asked by the user.
- Do not try to embed videos in table (would crash the app)
-
- Based on the following selected search results:
- ${JSON.stringify(
- results.filter((_, index) => selectedResults.has(index))
- )}
`,
},
...chatMessages.map((msg) => ({
@@ -301,7 +300,11 @@ ${queryParams.toString().replace(/&/g, "\\\n&")}" | jq`;
})),
{
role: "user" as const,
- content: userMessage.content,
+ content: `Context data: ${JSON.stringify(
+ results.filter((_, index) => selectedResults.has(index))
+ )}
+
+ User query: ${floatingInput}`,
},
];
diff --git a/screenpipe-app-tauri/lib/screenpipe.ts b/screenpipe-app-tauri/lib/screenpipe.ts
index 69af4af9c..4eb235a0a 100644
--- a/screenpipe-app-tauri/lib/screenpipe.ts
+++ b/screenpipe-app-tauri/lib/screenpipe.ts
@@ -143,23 +143,26 @@ export async function queryScreenpipe(
): Promise<ScreenpipeResponse | null> {
try {
console.log("params", params);
- const queryParams = new URLSearchParams();
-
- // properly encode each parameter
- if (params.q) queryParams.append("q", encodeURIComponent(params.q));
- queryParams.append("offset", params.offset.toString());
- queryParams.append("limit", params.limit.toString());
- queryParams.append("start_time", encodeURIComponent(params.start_time));
- queryParams.append("end_time", encodeURIComponent(params.end_time));
- queryParams.append("content_type", params.content_type);
- if (params.app_name)
- queryParams.append("app_name", encodeURIComponent(params.app_name));
- if (params.window_name)
- queryParams.append("window_name", encodeURIComponent(params.window_name));
- queryParams.append("include_frames", params.include_frames.toString());
- queryParams.append("min_length", params.min_length.toString());
- queryParams.append("max_length", params.max_length.toString());
+ const queryParams = new URLSearchParams(
+ Object.entries({
+ q: params.q ? encodeURIComponent(params.q) : undefined,
+ offset: params.offset.toString(),
+ limit: params.limit.toString(),
+ start_time: params.start_time,
+ end_time: params.end_time,
+ content_type: params.content_type,
+ app_name: params.app_name
+ ? encodeURIComponent(params.app_name)
+ : undefined,
+ window_name: params.window_name
+ ? encodeURIComponent(params.window_name)
+ : undefined,
+ include_frames: params.include_frames.toString(),
+ min_length: params.min_length.toString(),
+ max_length: params.max_length.toString(),
+ }).filter(([_, v]) => v != null) as [string, string][]
+ );
console.log("calling screenpipe", JSON.stringify(params));
const response = await fetch(`http://localhost:3030/search?${queryParams}`);
if (!response.ok) {
diff --git a/screenpipe-app-tauri/src-tauri/Cargo.toml b/screenpipe-app-tauri/src-tauri/Cargo.toml
index b37bab670..1184488f2 100644
--- a/screenpipe-app-tauri/src-tauri/Cargo.toml
+++ b/screenpipe-app-tauri/src-tauri/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "screenpipe-app"
-version = "0.2.46"
+version = "0.2.47"
description = ""
authors = ["you"]
license = ""