building out the business tasks
This commit is contained in:
@@ -30,6 +30,18 @@ ok() { printf "${GRN}✓ %s${RST}\n" "$*" >&2; }
|
||||
warn() { printf "${YEL}⚠ %s${RST}\n" "$*" >&2; }
|
||||
step() { printf "\n${BOLD}${CYN}── %s ──${RST}\n" "$*" >&2; }
|
||||
|
||||
# Format seconds into human-readable time (e.g., "1m 23s" or "45s")
|
||||
format_time() {
|
||||
local secs="$1" minutes seconds
|
||||
minutes=$((secs / 60))
|
||||
seconds=$((secs % 60))
|
||||
if [[ $minutes -gt 0 ]]; then
|
||||
printf "%dm %ds" "$minutes" "$seconds"
|
||||
else
|
||||
printf "%ds" "$seconds"
|
||||
fi
|
||||
}
|
||||
|
||||
banner() {
|
||||
cat <<'BAN'
|
||||
|
||||
@@ -450,6 +462,10 @@ cmd_process() {
|
||||
# Load config BEFORE flag parsing, so flags can override
|
||||
load_config
|
||||
|
||||
# Start timer
|
||||
local start_time
|
||||
start_time=$(date +%s)
|
||||
|
||||
while [[ $# -gt 0 ]]; do
|
||||
case "$1" in
|
||||
--stt) STT_ENGINE="$2"; shift 2 ;;
|
||||
@@ -502,11 +518,19 @@ cmd_process() {
|
||||
|
||||
# ── step 1: convert ──
|
||||
step "Step 1/4 — Converting audio"
|
||||
local step_start step_end step_elapsed
|
||||
step_start=$(date +%s)
|
||||
local wav_file="$outdir/audio_16k.wav"
|
||||
convert_audio "$input_file" "$wav_file"
|
||||
step_end=$(date +%s)
|
||||
step_elapsed=$((step_end - step_start))
|
||||
local time1
|
||||
time1=$(format_time "$step_elapsed")
|
||||
ok "Completed in ${time1}"
|
||||
|
||||
# ── step 2: transcribe ──
|
||||
step "Step 2/4 — Transcribing with $STT_ENGINE"
|
||||
step_start=$(date +%s)
|
||||
local transcript
|
||||
case "$STT_ENGINE" in
|
||||
whisper) transcript="$(transcribe_whisper "$wav_file" "$model" "$binary")" ;;
|
||||
@@ -522,9 +546,15 @@ cmd_process() {
|
||||
local word_count
|
||||
word_count=$(echo "$transcript" | wc -w | tr -d ' ')
|
||||
ok "Transcript: $word_count words"
|
||||
step_end=$(date +%s)
|
||||
step_elapsed=$((step_end - step_start))
|
||||
local time2
|
||||
time2=$(format_time "$step_elapsed")
|
||||
ok "Completed in ${time2}"
|
||||
|
||||
# ── step 3: summarize ──
|
||||
step "Step 3/4 — Summarizing ($OLLAMA_MODEL)"
|
||||
step_start=$(date +%s)
|
||||
local summarize_prompt
|
||||
summarize_prompt="Please provide a clear, concise summary of the following meeting transcript.
|
||||
Structure the summary with:
|
||||
@@ -540,9 +570,15 @@ $transcript"
|
||||
summary="$(ollama_generate "$summarize_prompt" "You are an expert meeting summarizer. Be concise but thorough. Always use markdown formatting.")"
|
||||
echo "$summary" > "$outdir/summary.md"
|
||||
ok "Summary saved"
|
||||
step_end=$(date +%s)
|
||||
step_elapsed=$((step_end - step_start))
|
||||
local time3
|
||||
time3=$(format_time "$step_elapsed")
|
||||
ok "Completed in ${time3}"
|
||||
|
||||
# ── step 4: action items ──
|
||||
step "Step 4/4 — Extracting action items ($OLLAMA_MODEL)"
|
||||
step_start=$(date +%s)
|
||||
local actions_prompt
|
||||
actions_prompt="Extract all action items, tasks, and commitments from the following meeting transcript.
|
||||
For each action item, provide:
|
||||
@@ -561,6 +597,11 @@ $transcript"
|
||||
actions="$(ollama_generate "$actions_prompt" "You are an expert at extracting action items from meeting notes. Be thorough and specific. Always use markdown formatting.")"
|
||||
echo "$actions" > "$outdir/action_items.md"
|
||||
ok "Action items saved"
|
||||
step_end=$(date +%s)
|
||||
step_elapsed=$((step_end - step_start))
|
||||
local time4
|
||||
time4=$(format_time "$step_elapsed")
|
||||
ok "Completed in ${time4}"
|
||||
|
||||
# ── combine report ──
|
||||
cat > "$outdir/report.md" <<REPORT
|
||||
@@ -603,6 +644,23 @@ REPORT
|
||||
head -50 "$outdir/report.md" | tail -35 >&2
|
||||
echo "" >&2
|
||||
echo "(showing preview — full report at $outdir/report.md)" >&2
|
||||
|
||||
# Display elapsed time breakdown
|
||||
local end_time elapsed minutes seconds
|
||||
end_time=$(date +%s)
|
||||
elapsed=$((end_time - start_time))
|
||||
minutes=$((elapsed / 60))
|
||||
seconds=$((elapsed % 60))
|
||||
echo "" >&2
|
||||
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━" >&2
|
||||
echo "⏱ Processing Time Breakdown:" >&2
|
||||
echo " Step 1 (Convert audio): ${time1:-N/A}" >&2
|
||||
echo " Step 2 (Transcribe): ${time2:-N/A}" >&2
|
||||
echo " Step 3 (Summarize): ${time3:-N/A}" >&2
|
||||
echo " Step 4 (Action items): ${time4:-N/A}" >&2
|
||||
echo " ─────────────────────────────────────" >&2
|
||||
printf " TOTAL: %dm %ds\n" "$minutes" "$seconds" >&2
|
||||
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━" >&2
|
||||
}
|
||||
|
||||
# ─── entry point ────────────────────────────────────────────────────
|
||||
|
||||
Reference in New Issue
Block a user