Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions api/organize.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ export default async function handler(req, res) {
return res.status(400).json({ error: "No notes sent" });
}

const prompt = `You help a college student organize quick voice notes taken right after talking to a recruiter at AfroTech 2026, a tech conference in Houston. The notes may be messy dictated speech.
const prompt = `You help a college student organize quick voice notes taken right after talking to a recruiter at AfroTech 2026, a tech conference in Houston. The notes may be messy dictated speech, or a rough live transcript of the whole conversation that includes the student’s own words. Pull out the details about the person the student met.


Notes:
"""${notes.slice(0, 4000)}"""
"""${notes.slice(0, 12000)}"""

Reply with ONLY a JSON object, no other text, in exactly this shape.
Use "" for anything the notes don't say. Never invent names or facts.
Expand Down
115 changes: 115 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
}

* { box-sizing: border-box; }
[hidden] { display: none !important; } /* hidden always wins over display rules */
html { -webkit-text-size-adjust: 100%; }
body {
margin: 0; background: var(--fog); color: var(--ink);
Expand Down Expand Up @@ -93,6 +94,21 @@
#status { margin: 0; min-height: 1.5em; color: var(--ink-soft); }
#status.ok { color: var(--green); font-weight: 700; }

/* ---------- Live notes ---------- */
.live-btn { display: flex; align-items: center; justify-content: center; gap: 8px; border: 2px solid var(--mic);
background: transparent; color: var(--mic); border-radius: 14px; padding: 12px 16px; font-weight: 700; cursor: pointer; }
.live-panel { display: flex; flex-direction: column; gap: 10px; padding: 14px; border-radius: 14px; background: var(--wash); }
.live-panel p { margin: 0; }
.live-panel .ask { font-weight: 700; }
.live-row { display: flex; gap: 8px; flex-wrap: wrap; }
.live-on { display: flex; align-items: center; gap: 10px; font-weight: 700; color: var(--mic); }
.live-on .dot { width: 12px; height: 12px; border-radius: 50%; background: var(--mic); flex: none; }
@media (prefers-reduced-motion: no-preference) {
.live-on .dot { animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .3; } }
}
.live-time { font-variant-numeric: tabular-nums; margin-left: auto; color: var(--ink); }

/* ---------- Badges ---------- */
#list { display: flex; flex-direction: column; gap: 22px; }
.badge {
Expand Down Expand Up @@ -224,6 +240,23 @@ <h1>Booth Buddy</h1>
<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" aria-hidden="true"><rect x="9" y="3" width="6" height="11" rx="3"/><path d="M5 11a7 7 0 0 0 14 0M12 18v3"/></svg>
Tap the mic on your keyboard and talk. Stop whenever you're done.
</p>
<button class="live-btn" id="liveBtn" hidden>
<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round" aria-hidden="true"><rect x="9" y="3" width="6" height="11" rx="3"/><path d="M5 11a7 7 0 0 0 14 0M12 18v3"/></svg>
Live notes during a conversation
</button>
<div class="live-panel" id="liveAsk" hidden>
<p class="ask">Ask first: "Mind if my app takes notes while we talk?"</p>
<p>Only start if they say yes. The app writes text only and never saves audio.</p>
<div class="live-row">
<button class="btn main" id="liveStart">They said yes, start</button>
<button class="btn quiet" id="liveCancel">Cancel</button>
</div>
</div>
<div class="live-panel" id="liveOn" hidden>
<div class="live-on" role="status"><span class="dot" aria-hidden="true"></span>Taking notes<span class="live-time" id="liveTime">0:00</span></div>
<p>Keep the phone in your hand or on the table with the screen on. Words appear in the box above.</p>
<div class="live-row"><button class="btn main" id="liveStop">Stop</button></div>
</div>
<button class="go" id="saveBtn">Organize and save</button>
<p id="status" role="status"></p>
</section>
Expand Down Expand Up @@ -351,6 +384,88 @@ <h1>Booth Buddy</h1>
saveBtn.textContent = "Organize and save";
};

// ---------- Live notes: the phone's own speech recognition, with the other person's OK ----------
const Recognition = window.SpeechRecognition || window.webkitSpeechRecognition;
const liveBtn = document.getElementById("liveBtn");
const liveAsk = document.getElementById("liveAsk");
const liveOn = document.getElementById("liveOn");
const liveTime = document.getElementById("liveTime");
const LIVE_MAX_MS = 10 * 60 * 1000; // stop on its own after 10 minutes
let live = null; // { rec, start, finalText, base, timer, wakeLock }

if (Recognition) liveBtn.hidden = false;

function showLive(panel) {
liveBtn.hidden = panel !== "button" || !Recognition;
liveAsk.hidden = panel !== "ask";
liveOn.hidden = panel !== "on";
saveBtn.hidden = panel === "on";
}

liveBtn.onclick = () => showLive("ask");
document.getElementById("liveCancel").onclick = () => showLive("button");
document.getElementById("liveStart").onclick = startLive;
document.getElementById("liveStop").onclick = () => stopLive();

function startLive() {
const rec = new Recognition();
rec.continuous = true;
rec.interimResults = true;
rec.lang = "en-US";

const base = notesBox.value.trim();
live = { rec, start: Date.now(), finalText: "", base: base ? base + "\n\n" : "", timer: null, wakeLock: null };

rec.onresult = (event) => {
let interim = "";
for (let i = event.resultIndex; i < event.results.length; i++) {
const piece = event.results[i][0].transcript;
if (event.results[i].isFinal) live.finalText += piece.trim() + " ";
else interim += piece;
}
notesBox.value = live.base + "Conversation notes: " + live.finalText + interim;
notesBox.dispatchEvent(new Event("input")); // keep the draft saved as it grows
};
rec.onerror = (event) => {
if (event.error === "not-allowed" || event.error === "service-not-allowed") {
stopLive("The microphone is blocked. Allow it for this site in your browser settings, then try again.");
}
};
// Phones end recognition after pauses; keep listening until Stop is tapped.
rec.onend = () => { if (live && live.rec === rec) { try { rec.start(); } catch {} } };

try { rec.start(); } catch { live = null; showLive("button"); setStatus("Live notes couldn't start. Try again, or use the keyboard mic."); return; }

live.timer = setInterval(() => {
if (!live) return;
const ms = Date.now() - live.start;
const sec = Math.floor(ms / 1000);
liveTime.textContent = Math.floor(sec / 60) + ":" + String(sec % 60).padStart(2, "0");
if (ms >= LIVE_MAX_MS) stopLive("Stopped after 10 minutes. Tap Organize and save.");
}, 500);

// Keep the screen awake while listening (not every browser allows this).
if (navigator.wakeLock) {
navigator.wakeLock.request("screen").then((lock) => { if (live) live.wakeLock = lock; else lock.release(); }).catch(() => {});
}

setStatus("");
showLive("on");
}

function stopLive(message) {
if (!live) { showLive("button"); return; }
const { rec, timer, wakeLock } = live;
live = null; // cleared first so onend doesn't restart listening
clearInterval(timer);
try { rec.stop(); } catch {}
if (wakeLock) wakeLock.release().catch(() => {});
notesBox.value = notesBox.value.trim();
notesBox.dispatchEvent(new Event("input"));
showLive("button");
setStatus(message || (notesBox.value ? "Notes captured. Check them, then tap Organize and save." : "Didn't catch anything. Try again closer to the person speaking."));
}

// Ctrl/Cmd + Enter also saves on a laptop.
notesBox.addEventListener("keydown", (e) => {
if (e.key === "Enter" && (e.metaKey || e.ctrlKey)) saveBtn.click();
Expand Down
Loading