Replicating a Conversational AI Web App with Multiple Coding AI Models: A Practical Guide

    This article shares an internal technical experiment in which multiple AI coding tools with different strengths were tasked with replicating the web frontend of a conversational AI product under unified constraints. It explains the evaluation framework, the differences observed across two prompt rounds (with and without API credentials), and the engineering essentials of building a modern web app with streaming chat, context management, and secure key handling. Readers will find practical guidance on functional documentation, layered architecture, streaming implementation, self-test checklists, common pitfalls, and team roles for shipping verifiable, maintainable AI applications.

    1. Experiment Background and Goals

    In an internal technical validation, we set up a task that mirrors a real development scenario: multiple intelligent coding tools, each with different capability focuses, were asked to replicate the web frontend of a conversational AI product under unified constraints. The task was not simple page imitation. Participants had to deliver three things: product functional documentation with a structure diagram, a runnable web implementation, and an independently improved version built on an understanding of the original product logic.

    The value of this design is that it expands “code generation” from a single-point capability into an assessment of the full chain: requirement understanding, information architecture, API integration, quality validation, and experience optimization. For enterprise R&D teams, a real project is never a single code completion. It is the result of multiple iterations, cross-role collaboration, and continuous validation. Therefore, the evaluation should not stop at “can it be written,” but should focus on whether what is written is maintainable, extensible, and verifiable.

    It is worth emphasizing that this article does not evaluate or recommend any specific third-party product. Instead, it abstracts the experiment into a general technical question: how to use intelligent coding tools to efficiently build a modern web application with streaming chat, context management, and secure key integration. When cloud-side capabilities are involved, only generic categories are used, such as object storage, logging services, monitoring and alerting, and container platforms.

    2. Designing a Unified Evaluation Framework

    To keep results comparable, the experiment used strict, unified variable control. All participants faced the same input materials: a URL of a reference page in a logged-in state, and a generic chat API invocation guide. The task was split into two prompt rounds. The first round provided only requirements, with no access credentials. The second round added key information to observe behavioral differences once tools had real invocation conditions.

    The unified evaluation dimensions included four items:

    • Delivery completeness: whether documentation, a structure diagram, and a runnable page were all produced;
    • Architecture soundness: whether component division, state management, and routing design were clear;
    • API correctness: whether the request body, streaming response parsing, and error code handling conformed to generic conventions;
    • Autonomous optimization: whether, after receiving the key, the tool proactively performed deep validation and fixed defects.

    The benefit of this framework is that it decouples “model capability” from “toolchain strategy.” The same model paired with different execution frameworks can perform noticeably differently. Under the same execution framework, different models also break down requirements at different granularities. The conclusion is therefore no longer a vague “who is stronger,” but “which combination is more stable under a given task structure.”

    3. Key Differences Between the Two Prompt Rounds

    The core of the first-round prompt was role and boundary setting: participants were asked to act as senior product managers, first completing information architecture and functional breakdown, then moving to implementation. No key was provided at this stage. The goal was to observe whether the tool would proactively reserve configuration slots and build a previewable skeleton with mock data, rather than hardcoding credentials into the code.

    The second-round prompt added only one piece of key information. Small as it seems, it exposed significant differences. Some tools performed only the most basic connectivity check, ending once a result was returned. Others entered deep self-testing, covering scenarios such as stream interruption, extra-long context, error code branches, and concurrent requests, and used the findings to fix defects at the code level.

    This difference shows that the “proactiveness” of intelligent coding tools is a variable easily overlooked in evaluation. When a tool only performs shallow validation, the team must build automated tests and manual review on top. When a tool has a strong self-driven validation tendency, it can be incorporated into the continuous integration process to shorten the feedback loop.

    4. From Requirements to Structure: Functional Docs and Structure Diagram

    High-quality delivery usually starts with documentation. A qualified replication plan should at least include the following modules:

    1. Session management: create, switch, rename, and delete sessions; persist the session list.
    2. Message flow: user input, streaming output, stop generation, regenerate.
    3. Context control: history trimming strategy and maximum context length hints.
    4. Attachment and multimodal entry points: reserve upload and parsing slots without hard-binding specific capabilities in the first version.
    5. Configuration center: centralized management of API address, key, and model parameters, with environment variable injection.
    6. Observability: request logs, latency statistics, and error reporting.

    The structure diagram should use a layered expression: the presentation layer handles components and interactions, the state layer handles sessions and messages, the service layer encapsulates requests and stream parsing, and the config layer manages environment and keys. A sketch is shown below:

    1. UI Layer -> ChatView / SessionList / Composer
    2. State Layer -> SessionStore / MessageStore
    3. Service Layer -> ChatClient / StreamParser / RetryPolicy
    4. Config Layer -> env / secrets / modelParams

    The documentation should also make “non-goals” explicit, for example that the first version will not implement an account system, billing, or complex permissions. Clear boundaries keep later iterations from getting out of control.

    5. Page Implementation: Engineering Essentials of Streaming Chat

    The technical difficulty of the web frontend centers on streaming rendering and state consistency. A robust implementation should include:

    • Incremental rendering: append text by data chunk to avoid full-section redraws that cause flicker;
    • Interruption: users can stop at any time; the frontend must cancel the request and keep already-generated content;
    • Error recovery: retry with exponential backoff on network jitter, and show a readable message once a threshold is exceeded;
    • Context trimming: when approaching the length limit, keep system instructions and the most recent turns per policy;
    • Key security: never write keys into the frontend repository; inject them uniformly on the server side or via the environment.

    A sample request wrapper:

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

    This snippet only expresses a generic idea and is not bound to any specific API fields. In a real project, field naming and error codes should follow the generic conventions being integrated with.

    6. Keys and Context: Engineering Discipline Exposed in Round Two

    After the key was added in the second round, what truly separated the tools was “validation depth.” Shallow validation usually sends only the shortest request. Deep validation covers:

    • Three error branches: invalid, expired, and insufficient-permission keys;
    • State rollback after a streaming output is interrupted midway;
    • Trimming and hints under extra-long context;
    • Isolation and rate limiting across concurrent sessions;
    • Whether sensitive information appears in logs and frontend build artifacts.

    An example of an executable self-test checklist:

    1. [ ] Does it reject real requests without a key and give configuration guidance?
    2. [ ] Does an invalid key return a readable error instead of a blank screen?
    3. [ ] Is already-generated content preserved after a stream interruption?
    4. [ ] Does exceeding the context limit trigger the trimming strategy?
    5. [ ] Do build artifacts contain no credentials?

    Enterprises can turn this checklist into pipeline gates. If the tool can pass it automatically before commit, the team can focus its energy on experience and business logic.

    7. Autonomous Improvement: From Replication to Surpassing

    The third deliverable required “improvement based on experience.” Common, low-risk directions include clearer message status indicators, session search, quick prompts, collapsible long outputs, keyboard-first operation, and better accessibility labels. Improvement should follow the order “testable first, optional next, intelligent last”: first ensure automated validation, then provide user-configurable options, and only then introduce more complex intelligent recommendations.

    Improvement also needs measurement. It is recommended to set baseline metrics: time to interactive first screen, streaming first-token latency, error rate, and session recovery success rate. Compare against the baseline on each iteration to avoid “optimizing by feeling.”

    8. Common Pitfalls and How to Avoid Them

    • Hardcoded credentials: any key entering the repository is treated as an incident and must be purged from history and rotated.
    • Validating only the success path: missing error branches make production failures impossible to diagnose.
    • Coupling state with the view: writing session logic into components makes it hard to reuse and test later.
    • Over-engineering: introducing a complex plugin system in the first version slows delivery.
    • Ignoring observability: without logs and monitoring, problems can only be surfaced by user feedback.

    The way to avoid these is to make “documentation, implementation, validation” a closed loop: documentation defines acceptance criteria, implementation follows layering, and validation is shared by the tool and the pipeline.

    9. Implementation Advice and Team Roles

    To deploy a similar application in an environment such as Baidu AI Cloud, a generic cloud capability combination can be used: a container platform hosts the frontend and gateway, object storage holds static assets, a logging service collects runtime logs, and monitoring and alerting cover error rate and latency. Keys are injected uniformly by configuration or key management capabilities and never enter the code repository.

    For roles, the product manager owns functional documentation and acceptance criteria, the frontend engineer owns interaction and state, the backend engineer owns streaming proxy and rate limiting, and testing and operations turn the self-test checklist into pipeline gates. Intelligent coding tools are well suited to skeleton generation, unit test completion, and first-draft documentation, but key reviews are still done by people.

    10. Conclusion

    The real lesson from this multi-tool replication experiment is not which tool ranks higher, but a reusable engineering path: use a unified framework to control variables, use two prompt rounds to observe proactiveness, use a layered architecture to ensure maintainability, and use a self-test checklist and pipeline to ensure quality. Solidifying this path lets a team reliably produce verifiable, iterable conversational AI applications at a controlled cost.