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
Rust agentsagiaiai-memoryaudio-recordingcomputer-visionhermeshermes-agentllmlocal-ailocal-firstmachine-learningmcpmultimodalopenclawprivacyrewindscreen-recordingspeech-to-textycombinator
fix: bad hallucinated timestamp in obsidian pipe
Louis Beaumont8013f7b7e1fa
diff --git a/pipes/obsidian/src/app/api/log/route.ts b/pipes/obsidian/src/app/api/log/route.tsindex 0755d88fe..61471c0d3 100644--- a/pipes/obsidian/src/app/api/log/route.ts+++ b/pipes/obsidian/src/app/api/log/route.ts@@ -11,41 +11,33 @@ const workLog = z.object({title: z.string(),description: z.string(),tags: z.array(z.string()),- startTime: z.string(),- endTime: z.string(),});-type WorkLog = z.infer<typeof workLog>;+type WorkLog = z.infer<typeof workLog> & {+ startTime: string;+ endTime: string;+};async function generateWorkLog(screenData: ContentItem[],model: string,+ startTime: Date,+ endTime: Date,customPrompt?: string): Promise<WorkLog> {- const now = new Date();- const timeZone = Intl.DateTimeFormat().resolvedOptions().timeZone;-const defaultPrompt = `Based on the following screen data, generate a concise work activity log entry.Rules:- - use the current time to generate the log entry- - use the timezone of the user to generate the log entry- use the screen data to generate the log entry- - change start and end time according to the difference between the current time and the time of the screen data+ - focus on describing the activity and tagsUser custom prompt: ${customPrompt}- todays date: ${new Date().toISOString().split("T")[0]}- local time: ${new Date().toLocaleTimeString()}- timezone: ${Intl.DateTimeFormat().resolvedOptions().timeZone}-Screen data: ${JSON.stringify(screenData)}Return a JSON object with:{"title": "Brief title of the activity","description": "Concise description of what was done",- "tags": ["#tag1", "#tag2", "#tag3"],- "startTime": "12-01-2024 10:00",- "endTime": "12-01-2024 10:05"+ "tags": ["#tag1", "#tag2", "#tag3"]}`;const provider = ollama(model);@@ -55,7 +47,22 @@ async function generateWorkLog(schema: workLog,});- return response.object;+ const formatDate = (date: Date) => {+ return date.toLocaleString("en-US", {+ year: "numeric",+ month: "2-digit",+ day: "2-digit",+ hour: "2-digit",+ minute: "2-digit",+ hour12: false,+ });+ };++ return {+ ...response.object,+ startTime: formatDate(startTime),+ endTime: formatDate(endTime),+ };}async function syncLogToObsidian(@@ -125,6 +132,8 @@ export async function GET() {const logEntry = await generateWorkLog(screenData.data,model,+ oneHourAgo,+ now,customPrompt);const _ = await syncLogToObsidian(logEntry, obsidianPath);diff --git a/pipes/obsidian/src/components/obsidian-settings.tsx b/pipes/obsidian/src/components/obsidian-settings.tsxindex c1c3eee8f..09e9424f2 100644--- a/pipes/obsidian/src/components/obsidian-settings.tsx+++ b/pipes/obsidian/src/components/obsidian-settings.tsx@@ -113,7 +113,7 @@ export function ObsidianSettings() {variant: "destructive",title: "error",description:- "your browser doesn't support directory selection. please enter the path manually.",+ "your browser doesn't support directory selection. please enter the path manually or try a different browser.",});return;}