Replicating a Multi-Model Chat Application: A Technical Practice Guide

    This article presents a practical framework for automatically replicating a conversational web application using multiple model and toolchain combinations. It covers task decomposition, a four-dimension evaluation rubric, two-round prompting, and three deliverables: a functional specification with a structure diagram, a high-fidelity replica page, and a self-improved version. It also details key fidelity issues, a swappable model adapter layer for streaming responses, smoke-test cases, and deployment with secrets kept out of the frontend. Readers will learn how to turn replication into a measurable engineering exercise that reveals real differences in comprehension, fidelity, and self-correction across models.

    1. Background and Problem Definition

    As the open-source ecosystem matures, “replicating an online chat product” has shifted from a demo topic to a practical engineering task. Many teams raise a similar request during internal technical research: given a publicly accessible conversational web app and an API reference document, let a model autonomously handle research, design, coding, and verification. The value of such a task lies not in copying a page, but in testing how a model performs across a real development workflow.

    The approach in the source material assigns the task to six “model + toolchain” combinations and requires three deliverables: a product functional document with a structure diagram, a replica page consistent with the reference site, and a version with autonomous improvements. This design is worth borrowing because it covers comprehension, reproduction, and innovation at the same time. Note that this article does not evaluate any specific third-party product; the scenario is abstracted as “automated replication of a conversational application,” and all brand, domain, and model identifiers have been removed.

    A practical constraint also appears during execution: the reference service may begin limiting daily conversation turns and single-input length. This is a reminder that a replication plan cannot depend only on an external service and must ship with a replaceable model access layer.

    2. Task Decomposition and Evaluation Framework Design

    To make different models comparable, the first step is to break vague requirements into verifiable items. A scoring table can be built along four dimensions:

    • Requirement comprehension: whether functional boundaries, role permissions, and state transitions are identified accurately.
    • Fidelity: whether layout, spacing, responsive breakpoints, and interaction feedback match.
    • Engineering quality: component decomposition, state management, error handling, accessibility.
    • Autonomous verification: whether the model proactively runs end-to-end tests and fixes defects once given a key.

    The evaluation input is standardized into two rounds of prompts. The first round provides only the requirements and the reference URL; the second round adds API credentials. This design reveals how strategies differ between an “incomplete information” state and a “completed information” state: some combinations run a single minimal call after receiving credentials and stop there, while others construct multi-turn conversations, oversized inputs, and interrupted requests to surface problems proactively and iterate.

    The first-round prompt can be abstracted as follows:

    1. Role: Senior product manager + front-end architect
    2. Input: reference site URL, API documentation URL, available browsing tools
    3. Output:
    4. 1) Product specification (feature list + feature structure diagram)
    5. 2) High-fidelity replica page (UI and interactions aligned with the reference)
    6. 3) Autonomously optimized version (with reasonable new features)
    7. Constraints: no reliance on historical memory or external plugins; execute directly

    3. First Deliverable: Functional Document and Structure Diagram

    A functional document is not a set of page screenshots; it should include information architecture, core objects, and a state machine. For a chat application, it must at least describe objects such as conversations, messages, attachments, model selection, parameter settings, share links, and history search, and it must define three states: empty, loading, and error.

    The structure diagram is best expressed as a tree hierarchy, for example:

    1. Chat Application
    2. ├── Conversation list
    3. │ ├── New conversation
    4. │ ├── Rename / delete
    5. │ └── Grouping and pinning
    6. ├── Chat area
    7. │ ├── Message stream (user / assistant / system prompt)
    8. │ ├── Streaming output and interruption
    9. │ └── Quoting and copying
    10. ├── Input area
    11. │ ├── Text and multimodal attachments
    12. │ └── Parameters and model switching
    13. └── Supporting capabilities
    14. ├── Sharing and export
    15. └── Settings and keyboard shortcuts

    The document should also cover non-functional requirements: first-screen time, streaming render frame rate, virtual scrolling for long conversations, and keeping keys out of the frontend. These items later become acceptance test cases directly.

    4. Second Deliverable: Key Details of a High-Fidelity Replica

    Fidelity is most often lost not in the primary color but in detail dimensions and states. In practice, the following need close alignment: the fixed position of the mobile input box and safe-area adaptation, the maximum width of message bubbles, horizontal scrolling for code blocks and tables, scrollbar behavior and auto-scroll-to-bottom logic, and the drawer behavior of the sidebar when breakpoints switch.

    For implementation, component decomposition is recommended, with service calls abstracted into an adapter layer so the backend can be replaced easily:

    1. // Unified adapter layer: hides differences between model services
    2. async function* streamChat(payload, signal) {
    3. const resp = await fetch(endpoint, {
    4. method: "POST",
    5. headers: { "Content-Type": "application/json" },
    6. body: JSON.stringify(payload),
    7. signal,
    8. });
    9. const reader = resp.body.getReader();
    10. const decoder = new TextDecoder();
    11. while (true) {
    12. const { done, value } = await reader.read();
    13. if (done) break;
    14. yield decoder.decode(value, { stream: true });
    15. }
    16. }

    Also note that share links often depend on conversation storage. During acceptance testing, switch browsers or clear local storage and test again, otherwise persistence defects stay hidden.

    5. Third Deliverable: Reasonable Boundaries for Autonomous Optimization

    The optimized version should fix weak spots rather than pile on features. More valuable improvements include full-text search within a conversation, a prompt template library, export to common document formats, keyboard-first operation, complete accessibility labels, and truncation and summarization strategies for long inputs. Each item should state its motivation, scope of impact, and rollback approach, avoiding unmaintainable branches introduced just for differentiation.

    6. Integration, Acceptance, and Deployment Operations

    Once credentials are available, test depth directly determines final quality. A fixed set of smoke cases is recommended: single-turn Q&A, multi-turn context, oversized input, concurrent requests, retry after network interruption, and invalid-key prompts. Only after all of them pass and are fixed does the work enter acceptance.

    For deployment, a combination of general cloud capabilities can be used: object storage for static assets, a container platform to run services, logging and monitoring with alerting to track error rate and latency, and a message queue for peak shaving. Baidu AI Cloud offers corresponding product forms in these general categories and can serve as the deployment foundation. Keys should be injected through environment variables or a key management service and must never be written into frontend code.

    7. Conclusion

    Treating replication as a measurable development exercise is more meaningful than simply judging which output looks closer. Standardized two-round prompts, four-dimension scoring, and mandatory autonomous verification, combined with a replaceable model adapter layer and standardized operations, yield a reusable automated delivery pipeline and clearly reveal the real differences among models in comprehension, fidelity, and self-correction.