Improve code documentation and maintainer notes

- Add a top-level doc comment to useStreamingGeneration.ts and document the streaming lifecycle.
- Add docstrings to helper functions in useStreamingGeneration.ts.
- Add section comments to web/app/page.tsx around reducer state, server health polling, and generation handling.
- Add file-level comments to API proxy routes explaining the security architecture.
- Add a file map / maintainer guide comment to server/vibevoice_server.py.
- Add docstrings for key internal helpers in server/vibevoice_server.py.
- Document environment variables used by the server in server/vibevoice_server.py.
- Add comments identifying VibePod-specific patches around VibeVoice internals.
- Format server/vibevoice_server.py with black.

Co-authored-by: LyAhn <27559362+LyAhn@users.noreply.github.com>
This commit is contained in:
google-labs-jules[bot]
2026-05-02 16:44:38 +00:00
parent 0236807928
commit e64048e500
5 changed files with 219 additions and 50 deletions
+11
View File
@@ -1,3 +1,14 @@
/**
* API Proxy Route: POST /api/generate
*
* This route proxies requests from the frontend to the FastAPI backend's /generate endpoint.
*
* Security Architecture:
* The FastAPI backend is configured to bind only to localhost (127.0.0.1). This prevents
* unauthenticated public access to the model inference engine. Next.js acts as a secure
* proxy, allowing the frontend to interact with the backend while maintaining a
* single public-facing origin.
*/
import { NextRequest, NextResponse } from "next/server";
export const dynamic = "force-dynamic";
+11
View File
@@ -1,3 +1,14 @@
/**
* API Proxy Route: GET /api/health
*
* This route proxies health check requests from the frontend to the FastAPI backend's /health endpoint.
*
* Security Architecture:
* The FastAPI backend is configured to bind only to localhost (127.0.0.1). This prevents
* unauthenticated public access to the server status and configuration. Next.js acts as a secure
* proxy, allowing the frontend to poll for server readiness and adaptive configuration
* while maintaining a single public-facing origin.
*/
import { NextResponse } from "next/server";
const OFFLINE_RESPONSE = { status: "offline" };
+6
View File
@@ -24,6 +24,8 @@ export interface ServerConfig {
default_inference_steps: number;
}
// --- State Management ---
interface AppState {
script: string;
speaker: string;
@@ -199,6 +201,8 @@ export default function HomePage() {
resumeThresholdSecs: state.resumeThresholdSecs,
});
// --- Server Health & Status Polling ---
// Server health polling — fast while not ready, slow when online
useEffect(() => {
let timeoutId: ReturnType<typeof setTimeout>;
@@ -246,6 +250,8 @@ export default function HomePage() {
};
}, []);
// --- Generation Handling ---
const handleGenerate = useCallback(async () => {
if (!state.script.trim() || state.isGenerating) return;
addLog(`${wordCount} words queued`);