@bobmatnyc/ai-code-review
Version:
A TypeScript-based tool for automated code reviews using AI models from Google Gemini, Anthropic Claude, and OpenRouter
45 lines (44 loc) • 1.6 kB
TypeScript
/**
* @fileoverview Handler for streaming AI model responses to the console.
*
* This module provides a handler for processing streaming responses from the Gemini API
* and displaying them in real-time to the console. It supports interactive mode where
* users can see review feedback as it's being generated rather than waiting for the
* complete response.
*
* Key responsibilities:
* - Processing streaming chunks from the Gemini API
* - Displaying content to the console in real-time with formatting
* - Accumulating content for final storage
* - Providing progress indicators and timing information
* - Handling different review types with appropriate formatting
*
* The StreamHandler improves the user experience by providing immediate feedback
* during the review process, especially for larger codebases where reviews may
* take significant time to complete.
*/
import { ReviewType } from '../types/review';
/**
* Handler for streaming review content to the console
*/
export declare class StreamHandler {
private content;
private startTime;
private modelName;
/**
* Create a new stream handler
* @param reviewType Type of review being performed
* @param modelName Name of the model being used
*/
constructor(reviewType: ReviewType, modelName: string);
/**
* Handle a chunk of streamed content
* @param chunk Text chunk from the stream
*/
handleChunk(chunk: string): void;
/**
* Complete the stream and return the full content
* @returns The complete content
*/
complete(): string;
}