Replicating a Multi-Model Chat Application: An End-to-End Engineering Practice

    This article presents a reproducible engineering approach for replicating a mature conversational web application end to end using different models and agent frameworks through exposed model capabilities. It defines three deliverables (a product feature document with a structure diagram, a high-fidelity replica page, and an improved page), a two-round prompting design, and consistent acceptance criteria. It also covers key implementation points such as streaming output, request interruption, rate-limit backoff, and backend key proxying, along with evaluation metrics, common pitfalls, and best practices. Readers will learn how to run a consistent evaluation and turn the results into engineering decisions.

    1. Background and Problem Definition

    The industry has recently seen a trend toward opening up model capability interfaces and encouraging developers to build complete conversational applications on their own. Some platforms expose interface capabilities such as deep search, file input, speech synthesis, and speech recognition, and explicitly state that developers can use these capabilities to build a fully functional conversational product. These platforms then introduce quota policies such as daily conversation limits and maximum input length per request. From an engineering perspective, this is entirely normal: the goal of opening capabilities is to grow the ecosystem, while the platform itself still needs to ensure the stability and resource controllability of its core services.

    For developers, this raises a valuable technical question: when underlying model capabilities are exposed as interfaces, how can you use different models and agent frameworks to replicate a mature conversational web application end to end, and improve the experience on top of that? This article abstracts that question into a reproducible engineering practice and does not target any specific vendor product.

    2. Evaluation Design: Three Deliverables and Two Prompt Rounds

    To make the evaluation comparable, the input, process, and acceptance criteria must be fixed. This article uses the following design.

    2.1 Three Deliverables

    1. Product feature document and feature structure diagram: describe what capabilities the target application has, and provide a hierarchical feature structure diagram;
    2. High-fidelity replica page: the UI and interactions should match the original page as closely as possible;
    3. Improved page: based on an understanding of the original product and common industry best practices, redesign the UI/UX and features.

    2.2 Two Prompt Rounds

    • Round one: provide only the requirements, without keys, to observe the model’s planning and implementation ability;
    • Round two: add the interface keys and calling instructions, to observe how deeply the model self-tests under runnable conditions.

    Testing reveals differences in strategy: some models only perform minimal connectivity verification after receiving the keys; others proactively construct boundary cases, find defects, and iterate. These are strategy differences between models and frameworks. The evaluation should keep operations consistent and only record results.

    2.3 Reference Prompt (Neutralized Rewrite)

    1. You are a senior product manager and front-end engineer who needs to replicate a conversational web application.
    2. The reference site and API documentation are provided locally by the user (already logged in).
    3. Please complete:
    4. 1) Output a product report: feature list + feature structure diagram;
    5. 2) Replica page: UI and interactions consistent with the reference site;
    6. 3) Improved page: optimize UI/UX and features based on industry best practices.
    7. Ignore historical memory and existing plugin configuration, and start executing immediately.

    3. Key Implementation Points

    3.1 Product Feature Document and Structure Diagram

    The feature document should include capability domains (session management, input and attachments, retrieval augmentation, speech capabilities, account and settings), the inputs and outputs of each domain, state transitions, and exception branches. The structure diagram can be expressed with Mermaid for easier version management:

    1. graph TD
    2. A[Chat Application] --> B[Session Management]
    3. A --> C[Input and Attachments]
    4. A --> D[Retrieval Augmentation]
    5. A --> E[Speech Capabilities]
    6. A --> F[Account and Settings]
    7. B --> B1[Create/Rename/Delete]
    8. B --> B2[History and Search]
    9. C --> C1[Text Input]
    10. C --> C2[File Upload and Parsing]
    11. D --> D1[Web Search]
    12. D --> D2[Citations and Attribution]
    13. E --> E1[Speech Synthesis]
    14. E --> E2[Speech Recognition]

    3.2 Engineering Constraints for High-Fidelity Replication

    High fidelity is not “pixel-level stacking”; it means capturing verifiable structural features: the overall grid and breakpoints, the position and size of the mobile input box, the alignment and maximum width of message bubbles, scrolling and bottom-sticking behavior, the typing rhythm of streaming output, and the placement of error and retry messages. It is better to accept the result with a responsive breakpoint checklist plus a key element size table than to rely on visual inspection alone.

    3.3 API Integration and Streaming Rendering

    The core of a conversational application is streaming output. The common approach is as follows:

    1. async function streamChat(payload, onDelta) {
    2. const resp = await fetch(chatEndpoint, {
    3. method: 'POST',
    4. headers: { 'Content-Type': 'application/json' },
    5. body: JSON.stringify(payload)
    6. });
    7. const reader = resp.body.getReader();
    8. const decoder = new TextDecoder();
    9. while (true) {
    10. const { done, value } = await reader.read();
    11. if (done) break;
    12. onDelta(decoder.decode(value, { stream: true }));
    13. }
    14. }

    Engineering work also needs to handle: request interruption (AbortController), timeouts and retries, rate-limit backoff, and keeping keys out of the front end (proxied and forwarded by the backend).

    3.4 Design Direction for the Improved Version

    The improved version can focus on four common best practices: first, traceability (clickable and copyable citation sources); second, recoverability (local persistence of session drafts and automatic resumption after exceptions); third, accessibility (keyboard reachability, contrast, focus management); fourth, observability (front-end instrumentation + logging service + monitoring alerts, forming a closed loop).

    4. Evaluation Records and Observations

    Under a unified process, three types of metrics can be recorded: feature coverage (how well the structure diagram entries match the implemented entries), fidelity (the proportion of key sizes and interactions that are consistent), and self-test depth (whether defects are proactively found and fixed in round two). A pattern usually emerges: the best overall stability often does not come from the most outstanding single capability, but from rigorous documentation, high fidelity, and a willingness to perform deep verification after receiving the keys. For example, one implementation proactively noted in the report that “the share link needs to be verified in a different browser,” and its replica matched the reference site closely in mobile input box position and size, with complete coverage of core features.

    5. Common Pitfalls and Best Practices

    • Key security: proxy uniformly through the backend; the front end only accesses your own services;
    • Quota adaptation: perform upfront validation and friendly prompts for daily limits and maximum input length;
    • File parsing: limit size and type, and provide a fallback path when parsing fails;
    • Speech pipeline: run both synthesis and recognition as asynchronous tasks to avoid blocking the main thread;
    • Evaluation consistency: fix the prompts, acceptance table, and environment to avoid drifting conclusions.

    6. Conclusion

    “Replicating a conversational application” is an excellent comprehensive test: it assesses requirement abstraction, UI fidelity, API integration, and self-test iteration at the same time. Making the evaluation a reproducible process and running the runtime on common cloud capabilities (object storage, message queues, container platforms, logging services, monitoring alerts) is what makes the conclusions truly serve engineering decisions. Using the relevant common capabilities of Baidu AI Cloud to carry the above pipeline can also deliver a consistent elastic and observable experience.