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

reenable intelligence in obsidian pipe

Louis Beaumont89c61d992be9
diff --git a/pipes/obsidian/src/app/api/intelligence/route.ts b/pipes/obsidian/src/app/api/intelligence/route.ts
index 679e7b0ea..67bfaa4e6 100644
--- a/pipes/obsidian/src/app/api/intelligence/route.ts
+++ b/pipes/obsidian/src/app/api/intelligence/route.ts
@@ -37,14 +37,40 @@ async function analyzeRelationships(
- finding patterns in topics discussed
recent logs: ${recentLogs}
+
+ todays date: ${new Date().toISOString().split("T")[0]}
+ local time: ${new Date().toLocaleTimeString()}
+ timezone: ${Intl.DateTimeFormat().resolvedOptions().timeZone}
+
+ return a detailed json object following this structure for relationship intelligence.
+
+ example response from you:
- return a detailed json object following this structure for relationship intelligence.`;
+ {
+ "contacts": [
+ {
+ "name": "John Doe",
+ "company": "Acme Inc.",
+ "lastInteraction": "2024-01-01",
+ "sentiment": 0.8,
+ "topics": ["sales", "marketing"],
+ "nextSteps": ["schedule a call", "send a follow-up email"]
+ }
+ ],
+ "insights": {
+ "followUps": ["schedule a call", "send a follow-up email"],
+ "opportunities": ["schedule a call", "send a follow-up email"]
+ }
+ }
+ `;
const provider = ollama(model);
+ console.log("prompt", prompt);
const response = await generateObject({
model: provider,
messages: [{ role: "user", content: prompt }],
schema: relationshipIntelligence,
+ maxRetries: 5,
});
console.log(response.object);
@@ -131,12 +157,13 @@ ${intelligence.insights.opportunities.map((o) => `- ${o}`).join("\n")}
await fs.writeFile(path.join(graphPath, filename), content, "utf8");
// get vault name safely for windows paths
- const vaultName = path.basename(path.resolve(normalizedPath));
-
+ const relativePath = obsidianPath
+ .replace(normalizedPath, "")
+ .replace(/^\//, "");
// Return the deep link
- return `obsidian://open?vault=${encodeURIComponent(
- vaultName
- )}&file=${encodeURIComponent(`relationship-graph/${filename}`)}`;
+ return `obsidian://search?vault=${encodeURIComponent(
+ relativePath
+ )}&query=relationship-intelligence`;
}
async function readRecentLogs(
diff --git a/pipes/obsidian/src/app/api/log/route.ts b/pipes/obsidian/src/app/api/log/route.ts
index 60cb65dfb..0755d88fe 100644
--- a/pipes/obsidian/src/app/api/log/route.ts
+++ b/pipes/obsidian/src/app/api/log/route.ts
@@ -33,7 +33,10 @@ async function generateWorkLog(
- change start and end time according to the difference between the current time and the time of the screen data
User custom prompt: ${customPrompt}
- Current time: ${now.toLocaleString()} (${timeZone})
+ 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:
diff --git a/pipes/obsidian/src/components/obsidian-settings.tsx b/pipes/obsidian/src/components/obsidian-settings.tsx
index 64873885c..c1c3eee8f 100644
--- a/pipes/obsidian/src/components/obsidian-settings.tsx
+++ b/pipes/obsidian/src/components/obsidian-settings.tsx
@@ -155,6 +155,7 @@ export function ObsidianSettings() {
try {
const res = await fetch("/api/intelligence");
const data = await res.json();
+ console.log("data", data);
setIntelligence(data.intelligence);
setIntelligenceDeepLink(data.deepLink);
@@ -172,7 +173,7 @@ export function ObsidianSettings() {
description: `analyzed ${data.summary.logsAnalyzed} logs, found ${data.summary.contacts} contacts`,
});
} catch (err) {
- console.error("error testing intelligence:", err);
+ console.warn("error testing intelligence:", err);
toast({
variant: "destructive",
title: "error",
@@ -244,9 +245,7 @@ export function ObsidianSettings() {
<Tabs defaultValue="logs">
<TabsList className="grid w-full grid-cols-2">
<TabsTrigger value="logs">logs</TabsTrigger>
- <TabsTrigger disabled value="intelligence">
- intelligence (soon)
- </TabsTrigger>
+ <TabsTrigger value="intelligence">intelligence (beta)</TabsTrigger>
</TabsList>
<TabsContent value="logs">
@@ -395,7 +394,7 @@ remember: you're analyzing screen ocr text & audio, etc. from my computer, so fo
variant="outline"
size="sm"
onClick={() => window.open(logDeepLink, "_blank")}
- className="ml-2"
+ className="ml-2 my-2"
>
<ExternalLink className="h-4 w-4 mr-2" />
open in obsidian
@@ -410,7 +409,9 @@ remember: you're analyzing screen ocr text & audio, etc. from my computer, so fo
<Button
onClick={testIntelligence}
variant="outline"
- disabled={intelligenceLoading}
+ disabled={
+ intelligenceLoading || !settings.customSettings?.obsidian?.path
+ }
>
<Brain className="mr-2 h-4 w-4" />
{intelligenceLoading ? "analyzing..." : "analyze relationships"}
@@ -534,6 +535,7 @@ remember: you're analyzing screen ocr text & audio, etc. from my computer, so fo
open in obsidian
</Button>
)}
+ <div className="my-4 h-16"/>
</TabsContent>
</Tabs>
</div>