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: ux on chat + onboarding video

Louis Beaumont2d64d3e7433d
diff --git a/examples/apps/screenpipe-app-tauri/app/page.tsx b/examples/apps/screenpipe-app-tauri/app/page.tsx
index aa65cb9a7..f49d28c29 100644
--- a/examples/apps/screenpipe-app-tauri/app/page.tsx
+++ b/examples/apps/screenpipe-app-tauri/app/page.tsx
@@ -19,6 +19,7 @@ import Header from "@/components/header";
import { checkForAppUpdates } from "@/components/updater";
import UpdateNotification from "@/components/update-notification";
import { usePostHog } from "posthog-js/react";
+import Link from "next/link";
export default function Home() {
const { settings } = useSettings();
@@ -70,6 +71,17 @@ export default function Home() {
Make sure to run screenpipe CLI first (check status above).
Also, please, set your AI provider settings to ask questions
about your data.
+ <br />
+ <br />
+ <Link
+ // open new tab
+ href="https://youtu.be/WGnHmFFFJOc"
+ target="_blank"
+ // bold underline
+ className="font-bold underline"
+ >
+ Watch the onboarding video
+ </Link>
</CardDescription>
</CardHeader>
<CardContent>
diff --git a/examples/apps/screenpipe-app-tauri/components/chat-list-openai-v2.tsx b/examples/apps/screenpipe-app-tauri/components/chat-list-openai-v2.tsx
index 8e2d68d38..e5c37cbd0 100644
--- a/examples/apps/screenpipe-app-tauri/components/chat-list-openai-v2.tsx
+++ b/examples/apps/screenpipe-app-tauri/components/chat-list-openai-v2.tsx
@@ -7,6 +7,8 @@ import { Textarea } from "@/components/ui/textarea";
import { ChatMessage } from "./chat-message-v2";
import {
CoreMessage,
+ CoreTool,
+ GenerateTextResult,
Message,
convertToCoreMessages,
generateObject,
@@ -111,101 +113,63 @@ export function ChatList({
console.log("new Date().toLocaleString()", new Date().toLocaleString());
console.log("model", model);
- const text = await generateTextWithRetry({
- model: provider(model),
- messages: [
- {
- role: "system",
- 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.
- Based on the user request, use tools to query screenpipe to best help the user.
- Rules:
- - q should be a single keyword that would properly find in the text found on the user screen some infomation that would help answering the user question.
- - q contains a single query, again, for example instead of "life plan" just use "life"
- - Respond with only the updated JSON object
- - If you return something else than JSON the universe will come to an end
- - DO NOT add \`\`\`json at the beginning or end of your response
- - Do not use '"' around your response
- - Date & time now is ${new Date().toISOString()}. Adjust start_time and end_time to properly match the user intent time range.
- - When the user mentions specific times (e.g., "9 to 10 am"), convert these to UTC before querying. Assume the user's local timezone is ${
- Intl.DateTimeFormat().resolvedOptions().timeZone
- }.
- - If the user ask about his morning do not use morning as query that's dumb, try to infer some keywords from the user question
- - Very important: your output will be given to another LLM so make sure not to return too much data (typically each row returns lot of data)
- - Use "all" for querying the same keyword over vision and audio
- - You typically always query screenpipe in the first user message
- - ALWAYS use the "stream_response" tool to stream the final response to the user
- - ALWAYS use the "stream_response" tool to stream the final response to the user
- - ALWAYS use the "stream_response" tool to stream the final response to the user
- - ONLY USE query tool ONCE
- - Do not try to show screenshots
- - You can analyze/view/show/access videos to the user by putting .mp4 files in a code block (we'll render it) like this: \`/users/video.mp4\`
- - You can analyze/view/show/access videos BY JUST FUCKING PUTTING THE ABSOLUTE FILE PATH IN A CODE BLOCK
- `,
- },
- // add prev messages but convert all tool role messages to assistant bcs not supported in generateText
- ...messages.map((msg) => ({
- ...msg,
- role: msg.role === "tool" ? "assistant" : msg.role,
- content: JSON.stringify(msg.content),
- })),
- {
- role: "user",
- content: inputMessage,
- },
- ],
- tools: {
- query_screenpipe: {
- description:
- "Query the local screenpipe instance for relevant information. You will return multiple queries under the key 'queries'.",
- parameters: screenpipeMultiQuery,
- execute: queryScreenpipeNtimes,
- },
- },
- toolChoice: "required",
- });
-
- setIsLoading(false);
-
- console.log("text", text);
+ const hasFunctionCalls = messages.some(
+ (msg) =>
+ msg.role === "assistant" &&
+ Array.isArray(msg.content) &&
+ msg.content.some((item) => item.type === "tool-call")
+ );
- setMessages((prevMessages) => [
- ...prevMessages,
- {
- role: "assistant",
- content: [
+ let text:
+ | GenerateTextResult<Record<string, CoreTool<any, any>>>
+ | undefined;
+ if (!hasFunctionCalls) {
+ text = await generateTextWithRetry({
+ model: provider(model),
+ messages: [
{
- toolCallId: text?.toolCalls?.[0]?.toolCallId!,
- type: "tool-call",
- toolName: "query_screenpipe",
- args: text?.toolCalls?.[0]?.args ? text.toolCalls[0].args : {},
+ role: "system",
+ 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.
+ Based on the user request, use tools to query screenpipe to best help the user.
+ Rules:
+ - q should be a single keyword that would properly find in the text found on the user screen some infomation that would help answering the user question.
+ - q contains a single query, again, for example instead of "life plan" just use "life"
+ - Respond with only the updated JSON object
+ - If you return something else than JSON the universe will come to an end
+ - DO NOT add \`\`\`json at the beginning or end of your response
+ - Do not use '"' around your response
+ - If the user ask about his morning do not use morning as query that's dumb, try to infer some keywords from the user question
+ - Very important: your output will be given to another LLM so make sure not to return too much data (typically each row returns lot of data)
+ - Use "all" for querying the same keyword over vision and audio
+ `,
},
- ],
- },
- {
- role: "tool",
- content: [
+ // add prev messages but convert all tool role messages to assistant bcs not supported in generateText
+ ...messages.map((msg) => ({
+ ...msg,
+ role: msg.role === "tool" ? "assistant" : msg.role,
+ content: JSON.stringify(msg.content),
+ })),
{
- toolCallId: text?.toolCalls?.[0]?.toolCallId!,
- type: "tool-result",
- toolName: "query_screenpipe",
- result: text?.toolResults,
+ role: "user",
+ content: inputMessage,
},
],
- },
- ]);
-
- const { textStream } = await streamText({
- model: provider(model),
- messages: [
- {
- role: "user",
- content:
- messages.findLast((msg) => msg.role === "user")?.content ||
- inputMessage,
+ tools: {
+ query_screenpipe: {
+ description:
+ "Query the local screenpipe instance for relevant information. You will return multiple queries under the key 'queries'.",
+ parameters: screenpipeMultiQuery,
+ execute: queryScreenpipeNtimes,
+ },
},
+ toolChoice: "required",
+ });
+
+ setMessages((prevMessages) => [
+ ...prevMessages,
{
role: "assistant",
content: [
@@ -228,6 +192,72 @@ export function ChatList({
},
],
},
+ ]);
+ }
+
+ const { textStream } = await streamText({
+ model: provider(model),
+ messages: [
+ {
+ role: "system",
+ 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.
+
+ Rules:
+ - Date & time now is ${new Date().toISOString()}. Adjust start_time and end_time to properly match the user intent time range.
+ - When the user mentions specific times (e.g., "9 to 10 am"), convert these to UTC before querying. Assume the user's local timezone is ${
+ Intl.DateTimeFormat().resolvedOptions().timeZone
+ }.
+
+ - You typically always query screenpipe in the first user message
+ - ALWAYS use the "stream_response" tool to stream the final response to the user
+ - ALWAYS use the "stream_response" tool to stream the final response to the user
+ - ALWAYS use the "stream_response" tool to stream the final response to the user
+ - ONLY USE query tool ONCE
+ - Do not try to show screenshots
+ - You can analyze/view/show/access videos to the user by putting .mp4 files in a code block (we'll render it) like this: \`/users/video.mp4\`
+ - You can analyze/view/show/access videos BY JUST FUCKING PUTTING THE ABSOLUTE FILE PATH IN A CODE BLOCK
+ - Always use the absolute file path to access videos
+ `,
+ },
+ ...messages,
+ // @ts-expect-error
+ ...(text
+ ? [
+ {
+ role: "assistant",
+ content: [
+ {
+ toolCallId: text?.toolCalls?.[0]?.toolCallId!,
+ type: "tool-call",
+ toolName: "query_screenpipe",
+ args: text?.toolCalls?.[0]?.args
+ ? text.toolCalls[0].args
+ : {},
+ },
+ ],
+ },
+ {
+ role: "tool",
+ content: [
+ {
+ toolCallId: text?.toolCalls?.[0]?.toolCallId!,
+ type: "tool-result",
+ toolName: "query_screenpipe",
+ result: text?.toolResults,
+ },
+ ],
+ },
+ ]
+ : []),
+ {
+ role: "user",
+ content:
+ messages.findLast((msg) => msg.role === "user")?.content ||
+ inputMessage,
+ },
],
});
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 30f52beac..69eea17fa 100644
--- a/examples/apps/screenpipe-app-tauri/src-tauri/tauri.conf.json
+++ b/examples/apps/screenpipe-app-tauri/src-tauri/tauri.conf.json
@@ -90,7 +90,7 @@
},
"csp": {
"default-src": "'self' customprotocol: asset:",
- "connect-src": "ipc: http://ipc.localhost https://api.openai.com http://localhost:3030 https://web.crabnebula.cloud https://api.github.com https://eu.i.posthog.com https://github.com https://*.githubusercontent.com https://*.github.com http://*:11434 http://*:9000",
+ "connect-src": "ipc: http://ipc.localhost https://youtube.com https://api.openai.com http://localhost:3030 https://web.crabnebula.cloud https://api.github.com https://eu.i.posthog.com https://github.com https://*.githubusercontent.com https://*.github.com http://*:11434 http://*:9000",
"font-src": [
"https://fonts.gstatic.com",
"tauri://localhost",