Recreating an AI Chat Web App with an LLM Agent: A Practical Implementation and Evaluation Guide
This guide explains how to use an LLM agent to recreate a conversational AI web application. It covers the three-stage delivery model, two-round prompt design, API integration, streaming response handling, session state management, responsive UI implementation, and a five-dimensional evaluation framework for measuring product, visual, engineering, and optimization quality.
1. Why Recreating an AI Product Is a Strong Test of LLM Capabilities
As large language models become increasingly capable of generating code, a common evaluation approach has emerged: instead of relying only on isolated algorithm problems or code-completion tasks, give the model a complete, realistic engineering assignment and observe its performance across the entire workflow—from understanding requirements and gathering information to designing a solution and delivering working code.
Recreating the web interface of a conversational AI product is a representative task of this kind because it covers several important capabilities:
- Product understanding: Extracting the feature set, information architecture, and interaction flows from an existing web application.
- Information retrieval: Reading public API documentation and understanding request parameters, authentication methods, and streaming responses.
- Frontend implementation: Matching the original interface visually, including layout, color schemes, component styles, and responsive behavior.
- Engineering execution: Organizing an appropriate project structure, state management strategy, and error-handling process.
- Critical thinking: Proposing meaningful improvements in the optimized version instead of simply adding decorative features.
As a result, this type of assignment is both a model evaluation method and a practical guide that can be developed into a repeatable engineering methodology for a team.
2. Task Design: A Three-Stage Delivery Model
A structured recreation task is typically divided into three progressively more advanced deliverables.
1. Product Feature Report and Information Architecture
At this stage, the model acts as both a product manager and a systems analyst. It must produce a feature inventory and a product structure diagram. The purpose is to make the model understand the product before it starts writing code.
A high-quality feature report should include:
- Core modules such as multi-turn conversations, new conversations, conversation history, conversation renaming and deletion, message copying, a deep-thinking mode toggle, and a web-search toggle.
- Page hierarchy and navigation relationships.
- Key interaction states, including the empty-conversation onboarding screen, generation-in-progress state, error messages, collapsed sidebar state, and mobile layouts.
2. A High-Fidelity Web Recreation
The second stage uses the report as the basis for recreating the original UI and functionality. The main evaluation criterion is visual and behavioral fidelity.
Details such as the desktop sidebar width, input field radius and height, spacing between message bubbles, and the position and dimensions of the mobile input field all contribute to the quality of the recreation.
The model should use its built-in browser tools to inspect the target page rather than relying on a vague visual impression and inventing an approximate interface.
3. An Experience-Based Optimized Version
In the third stage, the model is allowed to research common interaction patterns and industry best practices in order to create an improved version.
This stage best reflects the model’s product judgment. Strong implementations focus on real user pain points, such as:
- Conversation branch management
- Message-level regeneration and editing
- Keyword search within a conversation
- Progress visualization during generation
- Clearer error recovery and fallback states
Weaker implementations usually focus on superficial changes, such as replacing the color palette or adding animations without addressing meaningful usability problems.
3. Prompt Engineering: Designing and Analyzing a Two-Round Prompt
In practice, a two-round prompt structure is often used. The structure itself is worth examining.
Round One: Injecting the Requirements
The first prompt establishes the role, defines the objective, and grants access to relevant information sources. A typical structure looks like this:
Assume you are a senior product manager and full-stack engineer. Your goal is to recreate the web interface of a conversational AI product.You may use the built-in browser tool to inspect the reference page and public API documentation.Deliverables:1. A product feature report and product structure diagram;2. A recreation that matches the original in both functionality and UI;3. A new version optimized based on your own understanding.Ignore previous context and predefined skills, and begin execution directly.
The instruction to ignore previous memories, skills, and predefined workflows is not merely formal. During a long conversation, an LLM may bring in habits from an earlier workflow—for example, skipping information gathering and immediately writing code. Explicitly resetting the context can make the execution path more predictable.
Round Two: Providing Credentials and Performing Real Integration Testing
The second prompt provides the available API key and asks the model to upgrade the project from a static interface to a working application that can make real conversational API requests.
This stage is a major dividing line in engineering maturity. Different execution strategies often emerge:
- Conservative strategy: Some models perform only the most basic validation after receiving the key. They send one message, receive a response, and declare the task complete, without addressing interrupted streams, error codes, timeouts, or retry behavior.
- In-depth strategy: Other models conduct more systematic tests. They send long-context inputs, ask multiple follow-up questions, and intentionally trigger rate limits or invalid parameters. This can expose hidden issues in stream parsing and conversation-state synchronization, which the model may then fix independently.
This difference shows that the same prompt can produce different planning strategies depending on the combination of model and execution framework. The execution framework—the surrounding system for tool calls, task decomposition, and self-checking loops—can affect the final quality as much as the model itself.
4. Evaluation Framework for Recreation Quality
To make this type of practice repeatable and comparable, it is necessary to define clear evaluation dimensions. A useful framework includes the following five areas:
- Information architecture fidelity: Whether the feature modules are complete and the page hierarchy matches the original.
- Visual fidelity: Whether desktop and mobile layouts, spacing, and component styles are aligned. The exact positioning of the mobile input field is a common source of significant differences.
- API integration correctness: Whether the implementation correctly handles authentication headers, incremental parsing of streaming responses such as SSE-formatted data, and context-length assembly strategies.
- Error and edge-case handling: Whether it handles network failures, interrupted generation, empty responses, and state cleanup when users switch conversations.
- Value of the optimized version: Whether new features address real user problems rather than being added merely to make the product appear more creative.
The acceptance process also includes practical details that are easy to overlook. For example, a conversation-sharing feature typically generates a link containing a conversation ID. To verify that link properly, it should be opened in a logged-out or completely fresh browser environment. Otherwise, local storage and the existing login state may create the illusion that the feature works correctly.
High-quality model output should explicitly state such acceptance conditions in its delivery notes. Doing so demonstrates a deeper understanding of the product’s semantics and validation requirements.
5. Key Implementation Details
From an engineering perspective, the most important implementation work is usually concentrated in three areas.
Streaming Response Parsing
A simplified example is shown below:
async function streamChat(messages, onDelta) {const resp = await fetch('/api/chat', {method: 'POST',headers: { 'Content-Type': 'application/json', 'Authorization': `Bearer ${key}` },body: JSON.stringify({ messages, stream: true })});const reader = resp.body.getReader();const decoder = new TextDecoder();let buffer = '';while (true) {const { done, value } = await reader.read();if (done) break;buffer += decoder.decode(value, { stream: true });// Split by SSE delimiters, extract incremental content, and invoke the rendering callbackconst chunks = buffer.split('\n\n');buffer = chunks.pop();for (const c of chunks) {const delta = parseSsePayload(c);if (delta) onDelta(delta);}}}
Conversation State Management
The application needs to maintain three core pieces of state:
- The current conversation ID
- The message array
- A generation-in-progress flag
When the user switches conversations, any active request should be cancelled and the rendering queue should be cleared. Otherwise, messages from different conversations may become mixed together.
Mobile Responsiveness
The input field should remain fixed to the bottom of the viewport while also handling viewport changes caused by the on-screen keyboard.
This is a classic detail that distinguishes a carefully implemented recreation from a superficial one.
6. Practical Lessons
This complete recreation exercise leads to three transferable conclusions.
1. Starting with a Report Significantly Improves the Result
Asking the model to produce a feature structure diagram first gives it a self-created implementation blueprint. The resulting code generally has more complete module coverage than code produced when the model starts coding immediately.
2. A Two-Round Prompt Is a Low-Cost, High-Value Evaluation Design
The first round evaluates the model’s ability to understand and recreate a product without credentials. The second evaluates its ability to perform real API integration and conduct meaningful self-testing.
Together, the two rounds provide a practical way to distinguish the actual capability of different combinations of models and execution frameworks.
3. The Execution Framework Sets the Floor, While the Model Sets the Ceiling
With the same prompt, a framework with stronger task planning and self-checking loops can encourage the model to perform deeper testing and repairs. A framework without effective self-evaluation may cause even a capable model to stop at a minimally functional delivery.
For teams planning to introduce LLM-driven development into their engineering workflows, this methodology can be reused directly:
- Three deliverables
- Two prompt rounds
- Five evaluation dimensions
The process can first be validated on small and medium-sized frontend tasks before being extended to more complex full-stack projects. Combined with common cloud capabilities such as object storage, logging, monitoring, and alerting, it can form a sustainable workflow for LLM-assisted software development.
