feat: Add Dify audio transcription with VAD chunking and SSE progress

- Add audio file upload transcription via Dify STT API
- Implement VAD-based audio segmentation in sidecar (3-min chunks)
- Add SSE endpoint for real-time transcription progress updates
- Fix chunk size enforcement for reliable uploads
- Add retry logic with exponential backoff for API calls
- Support Python 3.13+ with audioop-lts package
- Update frontend with Chinese progress messages and chunk display
- Improve start.sh health check with retry loop

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
egg
2025-12-11 21:00:27 +08:00
parent e790f48967
commit 263eb1c394
10 changed files with 1008 additions and 16 deletions

View File

@@ -173,9 +173,23 @@ start_backend() {
local backend_pid=$!
echo "BACKEND_PID=$backend_pid" >> "$PID_FILE"
# 等待啟動
sleep 2
# 等待啟動(最多等待 15 秒)
local max_wait=15
local waited=0
log_info "等待後端服務啟動..."
while [ $waited -lt $max_wait ]; do
sleep 1
waited=$((waited + 1))
# 檢查健康狀態
if curl -s http://localhost:$BACKEND_PORT/api/health > /dev/null 2>&1; then
log_success "後端服務已啟動 (PID: $backend_pid, Port: $BACKEND_PORT)"
return 0
fi
done
# 最後再檢查一次 port 狀態
if check_port $BACKEND_PORT; then
log_success "後端服務已啟動 (PID: $backend_pid, Port: $BACKEND_PORT)"
else