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

ai features and sidebar (#1308)

Matthew Diakonov49cb253c4486
diff --git a/pipes/meeting/bun.lockb b/pipes/meeting/bun.lockb
index 21120285f..eca7f0b74 100755
Binary files a/pipes/meeting/bun.lockb and b/pipes/meeting/bun.lockb differ
diff --git a/pipes/meeting/next.config.ts b/pipes/meeting/next.config.ts
index c253cf144..3f33dd91c 100644
--- a/pipes/meeting/next.config.ts
+++ b/pipes/meeting/next.config.ts
@@ -18,7 +18,7 @@ const nextConfig: NextConfig = {
key: 'Content-Security-Policy',
value: [
"default-src 'self'",
- "connect-src 'self' wss://api.deepgram.com https://*.posthog.com http://localhost:* ipc:*",
+ "connect-src 'self' wss://api.deepgram.com https://*.posthog.com http://localhost:* ipc:* https://ai-proxy.i-f9f.workers.dev https://api.openai.com",
"script-src 'self' 'unsafe-inline' 'unsafe-eval' 'wasm-unsafe-eval'",
"style-src 'self' 'unsafe-inline'",
"img-src 'self' data: blob:",
diff --git a/pipes/meeting/package-lock.json b/pipes/meeting/package-lock.json
index 67899e0b7..51eb5028a 100644
--- a/pipes/meeting/package-lock.json
+++ b/pipes/meeting/package-lock.json
@@ -26,6 +26,7 @@
"@radix-ui/react-tooltip": "^1.1.5",
"@screenpipe/browser": "0.1.24",
"@screenpipe/js": "1.0.7",
+ "@tauri-apps/api": "^2.2.0",
"@tiptap/extension-color": "^2.2.4",
"@tiptap/extension-list-item": "^2.2.4",
"@tiptap/extension-text-style": "^2.2.4",
@@ -1896,6 +1897,15 @@
"tslib": "^2.8.0"
}
},
+ "node_modules/@tauri-apps/api": {
+ "version": "2.2.0",
+ "resolved": "https://registry.npmjs.org/@tauri-apps/api/-/api-2.2.0.tgz",
+ "integrity": "sha512-R8epOeZl1eJEl603aUMIGb4RXlhPjpgxbGVEaqY+0G5JG9vzV/clNlzTeqc+NLYXVqXcn8mb4c5b9pJIUDEyAg==",
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/tauri"
+ }
+ },
"node_modules/@tiptap/core": {
"version": "2.11.5",
"resolved": "https://registry.npmjs.org/@tiptap/core/-/core-2.11.5.tgz",
diff --git a/pipes/meeting/package.json b/pipes/meeting/package.json
index 94bf72763..bb411ee2f 100644
--- a/pipes/meeting/package.json
+++ b/pipes/meeting/package.json
@@ -31,6 +31,7 @@
"@radix-ui/react-tooltip": "^1.1.5",
"@screenpipe/browser": "0.1.24",
"@screenpipe/js": "1.0.7",
+ "@tauri-apps/api": "^2.2.0",
"@tiptap/extension-color": "^2.2.4",
"@tiptap/extension-list-item": "^2.2.4",
"@tiptap/extension-text-style": "^2.2.4",
diff --git a/pipes/meeting/src/app/api/settings/route.ts b/pipes/meeting/src/app/api/settings/route.ts
index f15de9b31..1178137d2 100644
--- a/pipes/meeting/src/app/api/settings/route.ts
+++ b/pipes/meeting/src/app/api/settings/route.ts
@@ -8,17 +8,24 @@ export const runtime = "nodejs"; // Add this line
export const dynamic = "force-dynamic";
export async function GET() {
+ console.log("getting settings...");
const defaultSettings = getDefaultSettings();
try {
const settingsManager = pipe.settings;
if (!settingsManager) {
+ console.error("settingsManager is undefined");
throw new Error("settingsManager not found");
}
const rawSettings = await settingsManager.getAll();
+ // console.log("got settings:", rawSettings);
return NextResponse.json(rawSettings);
} catch (error) {
console.error("failed to get settings:", error);
- return NextResponse.json(defaultSettings);
+ // Return error status to help debug
+ return NextResponse.json(
+ { error: "failed to get settings", details: String(error) },
+ { status: 500 }
+ );
}
}
diff --git a/pipes/meeting/src/app/layout.tsx b/pipes/meeting/src/app/layout.tsx
index 66b679e6b..4fbaf0038 100644
--- a/pipes/meeting/src/app/layout.tsx
+++ b/pipes/meeting/src/app/layout.tsx
@@ -5,6 +5,7 @@ import { Toaster } from "@/components/ui/toaster"
import PostHogProvider from "@/components/providers/posthog-provider"
import { Analytics } from "@vercel/analytics/react"
import { ChatButton } from "@/components/chat-button"
+import { SettingsProvider } from "@/lib/hooks/use-settings"
const geistSans = Geist({
variable: "--font-geist-sans",
@@ -33,12 +34,14 @@ export default function RootLayout({
className={`${geistSans.variable} ${geistMono.variable} antialiased h-screen`}
>
<PostHogProvider>
- <main className="h-full p-4 overflow-hidden">
- {children}
- </main>
- <Toaster />
- <ChatButton />
- <Analytics mode={process.env.NODE_ENV === 'development' ? 'development' : 'production'} />
+ <SettingsProvider>
+ <main className="h-full p-4 overflow-hidden">
+ {children}
+ </main>
+ <Toaster />
+ <ChatButton />
+ <Analytics mode={process.env.NODE_ENV === "development" ? "development" : "production"} />
+ </SettingsProvider>
</PostHogProvider>
</body>
</html>
diff --git a/pipes/meeting/src/components/chat-button.tsx b/pipes/meeting/src/components/chat-button.tsx
index 6c2607611..dd07d510b 100644
--- a/pipes/meeting/src/components/chat-button.tsx
+++ b/pipes/meeting/src/components/chat-button.tsx
@@ -1,5 +1,14 @@
'use client'
+// Add this type declaration
+declare global {
+ interface Window {
+ __TAURI__?: {
+ [key: string]: unknown
+ }
+ }
+}
+
import { Button } from "@/components/ui/button"
import { MessageCircle } from "lucide-react"
import { motion } from "framer-motion"
@@ -7,6 +16,44 @@ import { motion } from "framer-motion"
export function ChatButton() {
const supportLink = "https://wa.me/16507961489"
+ const openLink = async () => {
+ try {
+ console.log('opening link:', supportLink)
+
+ const isLocalhost = window.location.hostname === 'localhost' || window.location.hostname === '127.0.0.1'
+ console.log('is localhost?', isLocalhost, 'hostname:', window.location.hostname)
+
+ const isTauri = typeof window !== 'undefined' && (
+ window.__TAURI__ ||
+ window.location.protocol === 'tauri:' ||
+ window.location.protocol === 'asset:' ||
+ isLocalhost
+ )
+ console.log('is tauri?', isTauri, 'protocol:', window.location?.protocol)
+
+ if (!isTauri) {
+ console.log('using browser')
+ window.open(supportLink, '_blank')
+ console.log('opened in browser')
+ }
+ } catch (error) {
+ console.error('failed to open link:', error)
+ }
+ }
+
+ // Don't render button in Tauri environment
+ const isTauri = typeof window !== 'undefined' && (
+ window.__TAURI__ ||
+ window.location.protocol === 'tauri:' ||
+ window.location.protocol === 'asset:' ||
+ window.location.hostname === 'localhost' ||
+ window.location.hostname === '127.0.0.1'
+ )
+
+ if (isTauri) {
+ return null
+ }
+
return (
<motion.div
className="fixed bottom-2 right-2 z-50"
@@ -15,7 +62,7 @@ export function ChatButton() {
whileHover={{ scale: 1.05 }}
>
<Button
- onClick={() => window.open(supportLink, '_blank')}
+ onClick={openLink}
size="sm"
className="rounded-full shadow-lg"
>
diff --git a/pipes/meeting/src/components/live-transcription/hooks/storage-for-live-meeting.tsx b/pipes/meeting/src/components/live-transcription/hooks/storage-for-live-meeting.tsx
index daf2d0529..546fdbe07 100644
--- a/pipes/meeting/src/components/live-transcription/hooks/storage-for-live-meeting.tsx
+++ b/pipes/meeting/src/components/live-transcription/hooks/storage-for-live-meeting.tsx
@@ -9,6 +9,9 @@ export const liveStore = localforage.createInstance({
storeName: "transcriptions"
})
+// Export the key
+export const LIVE_MEETING_KEY = 'current-live-meeting'
+
export interface LiveMeetingData {
chunks: TranscriptionChunk[]
editedChunks: Record<number, string>
@@ -38,8 +41,6 @@ interface MeetingContextType {
updateStore: (newData: LiveMeetingData) => Promise<void>
}
-const LIVE_MEETING_KEY = 'current-live-meeting'
-
// Context creation
const MeetingContext = createContext<MeetingContextType | undefined>(undefined)
@@ -50,7 +51,19 @@ export function MeetingProvider({ children }: { children: ReactNode }) {
useEffect(() => {
const loadData = async () => {
try {
+ console.log('MeetingProvider: loading data')
const stored = await liveStore.getItem<LiveMeetingData>(LIVE_MEETING_KEY)
+ console.log('MeetingProvider: loaded data:', {
+ exists: !!stored,
+ chunks: stored?.chunks?.length,
+ title: stored?.title,
+ notes: stored?.notes?.length
+ })
+
+ if (!stored) {
+ console.log('MeetingProvider: no stored data, initializing new')
+ }
+
setData(stored || {
chunks: [],
editedChunks: {},
@@ -64,7 +77,7 @@ export function MeetingProvider({ children }: { children: ReactNode }) {
selectedDevices: new Set()
})
} catch (error) {
- console.error('failed to load meeting data:', error)
+ console.error('MeetingProvider: failed to load meeting data:', error)
} finally {
setIsLoading(false)
}
@@ -180,18 +193,50 @@ export async function storeLiveChunks(chunks: TranscriptionChunk[]): Promise<voi
export async function getLiveMeetingData(): Promise<LiveMeetingData | null> {
try {
- console.log('loading live meeting data')
- return await liveStore.getItem<LiveMeetingData>(LIVE_MEETING_KEY)
+ console.log('getLiveMeetingData: loading')
+ const data = await liveStore.getItem<LiveMeetingData>(LIVE_MEETING_KEY)
+ console.log('getLiveMeetingData: result:', {
+ exists: !!data,
+ chunks: data?.chunks?.length,
+ title: data?.title,
+ notes: data?.notes?.length
+ })
+ return data
} catch (error) {
- console.error('failed to load live meeting data:', error)
+ console.error('getLiveMeetingData: failed:', error)
return null
}
}
export async function clearLiveMeetingData(): Promise<void> {
try {
- console.log('clearing live meeting data')
+ const currentData = await liveStore.getItem<LiveMeetingData>(LIVE_MEETING_KEY)
+ console.log('clearing live meeting data:', {
+ had_title: !!currentData?.title,
+ notes_count: currentData?.notes.length,
+ chunks_count: currentData?.chunks.length,
+ analysis: !!currentData?.analysis,
+ start_time: currentData?.startTime,
+ })
+
+ // Create empty state
+ const emptyState: LiveMeetingData = {
+ chunks: [],
+ editedChunks: {},
+ speakerMappings: {},
+ lastProcessedIndex: -1,
+ startTime: new Date().toISOString(),
+ title: null,
+ notes: [],
+ analysis: null,
+ deviceNames: new Set(),
+ selectedDevices: new Set()
+ }
+
+ // Set empty state first, then remove
+ await liveStore.setItem(LIVE_MEETING_KEY, emptyState)
await liveStore.removeItem(LIVE_MEETING_KEY)
+ console.log('live meeting data cleared successfully')
} catch (error) {
console.error('failed to clear live meeting data:', error)
throw error
diff --git a/pipes/meeting/src/components/live-transcription/notes-editor.tsx b/pipes/meeting/src/components/live-transcription/notes-editor.tsx
index 9ddc68f96..0da9c6d6c 100644
--- a/pipes/meeting/src/components/live-transcription/notes-editor.tsx
+++ b/pipes/meeting/src/components/live-transcription/notes-editor.tsx
@@ -1,7 +1,7 @@
'use client'
import { useState, useEffect, useRef, useMemo } from 'react'
-import { ArrowDown, ArrowLeft, List, FileText, Wand2, Sparkles, PlusCircle } from 'lucide-react'
+import { ArrowDown, ArrowLeft, List, FileText, Wand2, Sparkles, PlusCircle, ChevronDown } from 'lucide-react'
import { useAutoScroll } from './hooks/auto-scroll'
import { TextEditor } from './text-editor-within-notes-editor'
import { Note } from '../meeting-history/types'
@@ -43,6 +43,7 @@ export function NotesEditor({ onTimeClick, onBack, onNewMeeting }: Props) {
const { settings } = useSettings()
const { toast } = useToast()
const router = useRouter()
+ const [showNav, setShowNav] = useState(false)
const sortedNotes = useMemo(() => {
return [...notes].sort((a, b) => a.timestamp.getTime() - b.timestamp.getTime())
@@ -226,6 +227,16 @@ export function NotesEditor({ onTimeClick, onBack, onNewMeeting }: Props) {
const newAnalysis = await generateMeetingNotes(meeting, settings)
await setAnalysis(newAnalysis)
+ // Add just the summary as a new note
+ const summaryNote: Note = {
+ id: crypto.randomUUID(),
+ text: "\n## AI Meeting Summary\n" + newAnalysis.summary.map(line => `• ${line}`).join('\n'),
+ timestamp: new Date(),
+ isAiGenerated: true
+ }
+
+ await setNotes([...notes, summaryNote])
+
toast({
title: "notes generated",
description: "ai notes analysis completed",
@@ -306,236 +317,271 @@ export function NotesEditor({ onTimeClick, onBack, onNewMeeting }: Props) {
const handleNewMeeting = async () => {
console.log('starting new meeting from notes editor')
- await clearLiveMeetingData()
- onNewMeeting()
+ try {
+ // Save current state for logging
+ const currentTitle = title
+ const notesCount = notes.length
+
+ console.log('current meeting state:', {
+ title: currentTitle,
+ notes_count: notesCount,
+ has_analysis: !!analysis
+ })
+
+ // Clear storage first
+ await clearLiveMeetingData()
+
+ // Wait a bit to ensure storage is cleared
+ await new Promise(resolve => setTimeout(resolve, 100))
+
+ console.log('storage cleared, forcing navigation')
+ // Force a full navigation instead of client-side
+ window.location.href = '/meetings/live'
+
+ } catch (error) {
+ console.error('failed to start new meeting:', error)
+ toast({
+ title: "error",
+ description: "failed to start new meeting. please try again",
+ variant: "destructive",
+ })
+ }
}
return (
<div className="h-full flex flex-col bg-card relative">
- <div className="flex items-center justify-between">
- <div className="p-1 flex-1 flex items-center">
- <input
- type="text"
- value={title}
- onChange={(e) => setTitle(e.target.value)}
- placeholder="meeting title"
- className="w-full text-2xl font-bold bg-transparent focus:outline-none"
- />
- <button
- onClick={handleGenerateTitle}
- disabled={isGeneratingTitle}
- className="p-0 hover:bg-gray-100 rounded transition-colors"
- title="generate ai title"
- >
- <Wand2 className={`h-4 w-4 ${isGeneratingTitle ? "animate-spin" : ""}`} />
- </button>
- </div>
- <div className="flex -space-x-px">
- <button
- onClick={handleGenerateNotes}
- disabled={isGeneratingNotes}
- className="p-1 text-sm transition-colors rounded-none hover:bg-gray-50"
- title="generate ai notes"
- >
- <Sparkles className={`h-4 w-4 ${isGeneratingNotes ? "animate-spin" : ""}`} />
- </button>
+ <div
+ className="absolute top-2 right-2 z-20 group"
+ onMouseEnter={() => setShowNav(true)}
+ onMouseLeave={() => setShowNav(false)}
+ >
+ <div className={`
+ absolute top-0 right-0 transition-all duration-200 min-w-[200px]
+ ${showNav ? 'opacity-100 translate-y-0' : 'opacity-0 -translate-y-1 pointer-events-none'}
+ `}>
+ <div className="flex flex-col gap-1 bg-gray-100/80 backdrop-blur p-1 rounded-lg shadow-sm">
<button
- onClick={onBack}
- className="p-1 text-sm transition-colors rounded-none hover:bg-gray-50"
- title="back to meetings"
- >
- <ArrowLeft className="h-4 w-4" />
- </button>
- <button
- onClick={onNewMeeting}
- className="p-1 text-sm transition-colors rounded-none hover:bg-gray-50"
- title="start new meeting"
- >
- <PlusCircle className="h-4 w-4" />
- </button>
- <button
- onClick={() => setViewMode('timeline')}
- className={`p-1 text-sm transition-colors rounded-none ${
- viewMode === 'timeline'
- ? 'bg-gray-200'
- : 'hover:bg-gray-50'
- }`}
- title="timeline view"
- >
- <List className="h-4 w-4" />
- </button>
- <button
- onClick={() => setViewMode('text')}
- className={`p-1 text-sm transition-colors rounded-none ${
- viewMode === 'text'
- ? 'bg-gray-200'
- : 'hover:bg-gray-50'
- }`}
- title="document view"
- >
- <FileText className="h-4 w-4" />
- </button>
+ onClick={onBack}
+ className="flex items-center gap-2 px-3 py-1.5 text-xs hover:bg-gray-200/80 rounded transition-colors w-full text-left"
+ >
+ <ArrowLeft className="h-4 w-4" />
+ <span>back to meetings menu</span>
+ </button>
+ <button
+ onClick={handleNewMeeting}
+ className="flex items-center gap-2 px-3 py-1.5 text-xs hover:bg-gray-200/80 rounded transition-colors w-full text-left"
+ >
+ <PlusCircle className="h-4 w-4" />
+ <span>save & start new meeting</span>
+ </button>
+ <button
+ onClick={handleGenerateTitle}
+ disabled={isGeneratingTitle}
+ className="flex items-center gap-2 px-3 py-1.5 text-xs hover:bg-gray-200/80 rounded transition-colors w-full text-left"
+ >
+ <Wand2 className={`h-4 w-4 ${isGeneratingTitle ? "animate-spin" : ""}`} />
+ <span>re-generate title with AI</span>
+ </button>
+ <button
+ onClick={handleGenerateNotes}
+ disabled={isGeneratingNotes}
+ className="flex items-center gap-2 px-3 py-1.5 text-xs hover:bg-gray-200/80 rounded transition-colors w-full text-left"
+ >
+ <Sparkles className={`h-4 w-4 ${isGeneratingNotes ? "animate-spin" : ""}`} />
+ <span>append AI summary</span>
+ </button>
+
+
+ <div className="mt-1 pt-1 border-t border-gray-200">
+ <div className="px-3 py-1 text-xs text-gray-500">view type</div>
+ <button
+ onClick={() => setViewMode('timeline')}
+ className={`flex items-center gap-2 px-3 py-1.5 text-xs rounded transition-colors w-full text-left
+ ${viewMode === 'timeline' ? 'bg-gray-200/80' : 'hover:bg-gray-200/80'}`}
+ >
+ <List className="h-4 w-4" />
+ <span>timeline</span>
+ </button>
+ <button
+ onClick={() => setViewMode('text')}
+ className={`flex items-center gap-2 px-3 py-1.5 text-xs rounded transition-colors w-full text-left
+ ${viewMode === 'text' ? 'bg-gray-200/80' : 'hover:bg-gray-200/80'}`}
+ >
+ <FileText className="h-4 w-4" />
+ <span>document</span>
+ </button>
+ </div>
+ </div>
</div>
+ <ChevronDown className={`h-5 w-5 text-gray-400 transition-transform duration-200 hover:text-gray-600
+ ${showNav ? 'rotate-180' : ''}`} />
</div>
-
- {showInvalidTime && (
- <div className="absolute top-2 right-2 bg-red-100 text-red-600 px-2 py-1 rounded text-xs">
- invalid time format
- </div>
- )}
-
- {viewMode === 'timeline' ? (
- <div
- ref={scrollRef}
- onScroll={onScroll}
- className="flex-1 overflow-y-auto p-3 space-y-3"
- >
- {sortedNotes.map(note => (
- <div
- key={note.id}
- onClick={() => !editingId && onTimeClick(note.timestamp)}
- className="text-sm mb-2 hover:bg-gray-100 active:bg-gray-200 transition-colors select-text cursor-pointer group"
- >
- <div className="flex items-center justify-between">
- <div className="flex items-center gap-1">
- {editingTime === note.id ? (
- <div className="relative">
- <input
- ref={editTimeRef}
- type="text"
- id={`time-edit-${note.id}`}
- name={`time-edit-${note.id}`}
- value={editTimeText}
- onChange={(e) => setEditTimeText(e.target.value)}
- className="w-24 bg-white border rounded px-1 py-0.5 focus:outline-none text-xs text-gray-500"
- autoFocus
- onKeyDown={(e) => {
- if (e.key === 'Enter') {
- e.preventDefault()
- updateTime(note.id)
- }
- if (e.key === 'Escape') {
- setEditingTime(null)
- }
- }}
- />
- <div className="absolute -bottom-4 left-0 text-[10px] text-gray-500">
- format: HH:MM:SS
+
+ <div className="flex-1">
+ <input
+ type="text"
+ value={title}
+ onChange={(e) => setTitle(e.target.value)}
+ placeholder="meeting title"
+ className="w-full text-2xl font-bold bg-transparent focus:outline-none px-3 py-2"
+ />
+ {showInvalidTime && (
+ <div className="absolute top-2 right-2 bg-red-100 text-red-600 px-2 py-1 rounded text-xs">
+ invalid time format
+ </div>
+ )}
+
+ {viewMode === 'timeline' ? (
+ <div
+ ref={scrollRef}
+ onScroll={onScroll}
+ className="flex-1 overflow-y-auto p-3 space-y-3"
+ >
+ {sortedNotes.map(note => (
+ <div
+ key={note.id}
+ onClick={() => !editingId && onTimeClick(note.timestamp)}
+ className="text-sm mb-2 hover:bg-gray-100 active:bg-gray-200 transition-colors select-text cursor-pointer group"
+ >
+ <div className="flex items-center justify-between">
+ <div className="flex items-center gap-1">
+ {editingTime === note.id ? (
+ <div className="relative">
+ <input
+ ref={editTimeRef}
+ type="text"
+ id={`time-edit-${note.id}`}
+ name={`time-edit-${note.id}`}
+ value={editTimeText}
+ onChange={(e) => setEditTimeText(e.target.value)}
+ className="w-24 bg-white border rounded px-1 py-0.5 focus:outline-none text-xs text-gray-500"
+ autoFocus
+ onKeyDown={(e) => {
+ if (e.key === 'Enter') {
+ e.preventDefault()
+ updateTime(note.id)
+ }
+ if (e.key === 'Escape') {
+ setEditingTime(null)
+ }
+ }}
+ />
+ <div className="absolute -bottom-4 left-0 text-[10px] text-gray-500">
+ format: HH:MM:SS
+ </div>
</div>
- </div>
- ) : (
- <span className="text-gray-500 text-xs hover:underline">
- {note.timestamp.toLocaleTimeString()}
- </span>
- )}
- {!editingTime && (
+ ) : (
+ <span className="text-gray-500 text-xs hover:underline">
+ {note.timestamp.toLocaleTimeString()}
+ </span>
+ )}
+ {!editingTime && (
+ <button
+ onClick={(e) => startEditingTime(note, e)}
+ className="opacity-0 group-hover:opacity-100 transition-opacity hover:bg-gray-200 rounded text-xs text-gray-500 px-1"
+ >
+ edit
+ </button>
+ )}
+ </div>
+ <div className="flex items-center gap-2">
+ {note.editedAt && (
+ <span className="text-gray-400 text-xs">
+ edited {note.editedAt.toLocaleTimeString()}
+ </span>
+ )}
<button
- onClick={(e) => startEditingTime(note, e)}
- className="opacity-0 group-hover:opacity-100 transition-opacity hover:bg-gray-200 rounded text-xs text-gray-500 px-1"
+ onClick={async (e) => {
+ e.stopPropagation()
+ await handleImprove(note)
+ }}
+ className="opacity-0 group-hover:opacity-100 transition-opacity hover:bg-gray-200 rounded text-xs text-gray-500 px-2 py-0.5"
>
- edit
+ improve
</button>
- )}
+ </div>
</div>
- <div className="flex items-center gap-2">
- {note.editedAt && (
- <span className="text-gray-400 text-xs">
- edited {note.editedAt.toLocaleTimeString()}
- </span>
- )}
- <button
- onClick={async (e) => {
+ {editingId === note.id ? (
+ <div
+ ref={editRef}
+ className="mt-1"
+ >
+ <input
+ type="text"
+ id={`note-edit-${note.id}`}
+ name={`note-edit-${note.id}`}
+ value={editText}
+ onChange={(e) => setEditText(e.target.value)}
+ className="w-full bg-gray-50 border rounded px-2 py-1 focus:outline-none font-mono text-sm"
+ autoFocus
+ onKeyDown={(e) => {
+ if (e.key === 'Enter') {
+ e.preventDefault()
+ updateNote()
+ }
+ if (e.key === 'Escape') {
+ setEditingId(null)
+ }
+ }}
+ />
+ <div className="mt-1 text-xs text-gray-500">
+ press Enter to save • Esc to discard
+ </div>
+ </div>
+ ) : (
+ <div
+ className="mt-1 cursor-text hover:bg-gray-50 transition-colors rounded"
+ onClick={(e) => {
e.stopPropagation()
- await handleImprove(note)
+ startEditing(note, e)
}}
- className="opacity-0 group-hover:opacity-100 transition-opacity hover:bg-gray-200 rounded text-xs text-gray-500 px-2 py-0.5"
>
- improve
- </button>
- </div>
- </div>
- {editingId === note.id ? (
- <div
- ref={editRef}
- className="mt-1"
- >
- <input
- type="text"
- id={`note-edit-${note.id}`}
- name={`note-edit-${note.id}`}
- value={editText}
- onChange={(e) => setEditText(e.target.value)}
- className="w-full bg-gray-50 border rounded px-2 py-1 focus:outline-none font-mono text-sm"
- autoFocus
- onKeyDown={(e) => {
- if (e.key === 'Enter') {
- e.preventDefault()
- updateNote()
- }
- if (e.key === 'Escape') {
- setEditingId(null)
- }
- }}
- />
- <div className="mt-1 text-xs text-gray-500">
- press Enter to save • Esc to discard
+ {note.text}
</div>
- </div>
- ) : (
- <div
- className="mt-1 cursor-text hover:bg-gray-50 transition-colors rounded"
- onClick={(e) => {
- e.stopPropagation()
- startEditing(note, e)
- }}
- >
- {note.text}
- </div>
- )}
- </div>
- ))}
- </div>
- ) : (
- <TextEditor
- notes={sortedNotes}
- setNotes={(newNotes: Note[]) => setNotes(newNotes)}
- scrollRef={scrollRef}
- onScroll={onScroll}
- isEditing={true}
- analysis={analysis?.summary ? {
- summary: analysis.summary,
- facts: [],
- events: [],
- flow: [],
- decisions: []
- } : null}
- />
- )}
-
- {!isScrolledToBottom && (
- <button
- onClick={() => scrollRef.current?.scrollTo({ top: scrollRef.current.scrollHeight, behavior: 'smooth' })}
- className="absolute bottom-20 right-4 p-2 bg-black text-white rounded-full shadow-lg hover:bg-gray-800 transition-colors"
- >
- <ArrowDown className="h-4 w-4" />
- </button>
- )}
-
- {viewMode === 'timeline' && (
- <form onSubmit={sendMessage} className="p-2 bg-gray-100">
- <input
- type="text"
- id="new-note"
- name="new-note"
- value={currentMessage}
- onChange={(e) => setCurrentMessage(e.target.value)}
- className="flex-1 px-2 py-1.5 bg-transparent focus:outline-none text-sm"
- placeholder="type a note..."
+ )}
+ </div>
+ ))}
+ </div>
+ ) : (
+ <TextEditor
+ notes={sortedNotes}
+ setNotes={(newNotes: Note[]) => setNotes(newNotes)}
+ scrollRef={scrollRef}
+ onScroll={onScroll}
+ isEditing={true}
+ analysis={analysis?.summary ? {
+ summary: analysis.summary,
+ facts: [],
+ events: [],
+ flow: [],
+ decisions: []
+ } : null}
/>
- </form>
- )}
-
+ )}
+ {!isScrolledToBottom && (
+ <button
+ onClick={() => scrollRef.current?.scrollTo({ top: scrollRef.current.scrollHeight, behavior: 'smooth' })}
+ className="absolute bottom-20 right-4 p-2 bg-black text-white rounded-full shadow-lg hover:bg-gray-800 transition-colors"
+ >
+ <ArrowDown className="h-4 w-4" />
+ </button>
+ )}
+
+ {viewMode === 'timeline' && (
+ <form onSubmit={sendMessage} className="p-2 bg-gray-100">
+ <input
+ type="text"
+ id="new-note"
+ name="new-note"
+ value={currentMessage}
+ onChange={(e) => setCurrentMessage(e.target.value)}
+ className="flex-1 px-2 py-1.5 bg-transparent focus:outline-none text-sm"
+ placeholder="type a note..."
+ />
+ </form>
+ )}
+ </div>
</div>
)
}
\ No newline at end of file
diff --git a/pipes/meeting/src/components/meeting-history/types.ts b/pipes/meeting/src/components/meeting-history/types.ts
index 4fc799faa..731bb1912 100644
--- a/pipes/meeting/src/components/meeting-history/types.ts
+++ b/pipes/meeting/src/components/meeting-history/types.ts
@@ -3,6 +3,7 @@ export interface Note {
text: string;
timestamp: Date;
editedAt?: Date;
+ isAiGenerated?: boolean;
}
export interface TranscriptionChunk {
timestamp: string
diff --git a/pipes/meeting/src/lib/hooks/use-settings.tsx b/pipes/meeting/src/lib/hooks/use-settings.tsx
index 177545319..e1e7f31b8 100644
--- a/pipes/meeting/src/lib/hooks/use-settings.tsx
+++ b/pipes/meeting/src/lib/hooks/use-settings.tsx
@@ -1,13 +1,37 @@
"use client";
-import { useState, useEffect } from "react";
+import { useState, useEffect, createContext, useContext, ReactNode } from "react";
import type { Settings } from "@screenpipe/browser";
import { getDefaultSettings } from "@screenpipe/browser";
-export function useSettings() {
+interface SettingsContextType {
+ settings: Settings;
+ loading: boolean;
+ error: Error | null;
+ updateSetting: <T extends keyof Settings>(key: T, value: Settings[T]) => Promise<void>;
+ updateSettings: (newSettings: Partial<Settings>) => Promise<void>;
+ resetSettings: (settingKey?: keyof Settings) => Promise<void>;
+}
+
+const SettingsContext = createContext<SettingsContextType | null>(null);
+
+export function SettingsProvider({ children }: { children: ReactNode }) {
const defaultSettings = getDefaultSettings();
+
+ // Hardcode the token in the initial settings
+ const initialSettings = {
+ ...defaultSettings,
+ aiProviderType: "screenpipe-cloud" as const,
+ user: {
+ ...defaultSettings.user,
+ token: "eyJhbGciOiJSUzI1NiIsImNhdCI6ImNsX0I3ZDRQRDIyMkFBQSIsImtpZCI6Imluc18ycGFFR0Jxc0dEYTZXcVlyaEFySjdtS0o0elYiLCJ0eXAiOiJKV1QifQ.eyJhenAiOiJodHRwczovL3NjcmVlbnBpLnBlIiwiZXhwIjoyMDU0MzI2MDkyLCJpYXQiOjE3Mzg5NjYwOTIsImlzcyI6Imh0dHBzOi8vY2xlcmsuc2NyZWVucGkucGUiLCJqdGkiOiI3NzkxM2JlYTQxNGUxZGEyOGYyNCIsIm5iZiI6MTczODk2NjA4Nywic3ViIjoidXNlcl8yc2pQYjhlTEwyVTNTWU9TZDZkZnVsdUdrZlIifQ.FUNvk3iJVZa9JP1aq-qa6ta9DvtvW1piiUE5AQA7RydDHCkHPzQedPriLBuVKaZt9bLlPmdLOv2vK-qsB1bgVzSXUFXiPSC-OdySH7Do3WLQIEz-9YX4J-LaC8FSrOkvxjWch6uTev0k2-gdOyhClOOGpKR3qIHPDRy5eftZpw0Mc3cGmJp4AjWIAKllBKoa3F0DGN0WIUBM1GwpPw5e1nTJ3F9BDFf_dNwJmQ5MWCFXJXjC9mX4K0xbT3AkWJqQdXopP2wZlnAWwLyURWbWthZEqMCZEQQwCm5P7tW7GIAkWpiouHoaLT9C90YNYsI2j8EkPCbIPieDfncXXiWNQA"
+ },
+ aiUrl: "https://ai-proxy.i-f9f.workers.dev/v1",
+ aiModel: "gpt-4o",
+ analyticsEnabled: true
+ };
- const [settings, setSettings] = useState<Settings>(defaultSettings);
+ const [settings, setSettings] = useState<Settings>(initialSettings);
const [loading, setLoading] = useState(false);
const [error, setError] = useState<Error | null>(null);
@@ -17,17 +41,30 @@ export function useSettings() {
try {
const response = await fetch("/api/settings");
if (!response.ok) {
- // If API fails (e.g. on web), fallback to default settings
console.log("using default settings (web mode)")
- setSettings(defaultSettings);
+ setSettings(initialSettings); // Use initialSettings instead of defaultSettings
return;
}
const data = await response.json();
- setSettings({ ...defaultSettings, ...data });
+ // Preserve our hardcoded token when merging settings
+ setSettings({
+ ...initialSettings,
+ ...data,
+ aiProviderType: "screenpipe-cloud",
+ user: {
+ ...initialSettings.user,
+ ...data.user,
+ token: initialSettings.user.token,
+ clerk_id: initialSettings.user.clerk_id,
+ id: initialSettings.user.id,
+ email: initialSettings.user.email
+ },
+ aiUrl: initialSettings.aiUrl,
+ aiModel: initialSettings.aiModel
+ });
} catch (err) {
console.log("failed to load settings, using defaults:", err)
- // Fallback to default settings on error
- setSettings(defaultSettings);
+ setSettings(initialSettings); // Use initialSettings instead of defaultSettings
} finally {
setLoading(false);
}
@@ -139,7 +176,7 @@ export function useSettings() {
}
};
- return {
+ const value = {
settings,
loading,
error,
@@ -147,4 +184,18 @@ export function useSettings() {
updateSettings,
resetSettings,
};
+
+ return (
+ <SettingsContext.Provider value={value}>
+ {children}
+ </SettingsContext.Provider>
+ );
+}
+
+export function useSettings() {
+ const context = useContext(SettingsContext);
+ if (!context) {
+ throw new Error("useSettings must be used within a SettingsProvider");
+ }
+ return context;
}