Multi-Model Collaboration for Recreating a Web Chat Client: An Engineering Practice

    A practical engineering approach to recreating a logged-in web chat app with multiple models: split the work into product analysis, structure modeling, frontend implementation, credential-based integration, regression, and UX optimization, then control quality with a two-round prompt protocol and a shared acceptance checklist.

    In web-app recreation tasks, a single model rarely covers product analysis, UI fidelity, interaction implementation, and quality validation at once. A more workable approach is to split the work into six stages—product understanding, structure modeling, frontend implementation, credential-based integration, regression acceptance, and experience optimization—and coordinate multiple model groups with an orchestration framework.

    This article does not evaluate any specific product. From a general engineering view, it abstracts a reusable practice: given a logged-in web chat application as the target, multiple model groups produce a product report, a functional structure diagram, a high-fidelity recreation, and an improved variant. Two rounds of prompts plus a unified acceptance checklist keep delivery quality under control.

    1. Problem definition and evaluation dimensions

    The core of this task is not “have a model write a chat page.” It is reverse product analysis, UI recreation, and a closed functional loop under limited information. Typical target sites include a session list, message stream, input area, model selector, history, share entry, settings, streaming responses, code-block rendering, and error states. Recreating “function and UI as closely as possible” means visual consistency, interaction consistency, state consistency, and exception consistency.

    Split evaluation into five dimensions:

    1. Product-document completeness: feature list, user paths, state transitions, edge cases, and permission assumptions.
    2. Structure-diagram accuracy: layered pages, components, data flow, and API dependencies.
    3. Visual fidelity: layout, spacing, type scale, color, radius, shadow, and responsive breakpoints.
    4. Functional completeness: send, streaming display, stop generation, retry, copy, session switch, empty states, and error states.
    5. Maintainability: component split, state management, style organization, API wrapping, accessibility, and security handling.

    A shared acceptance standard is essential. After credentials are provided, test depth varies: some runs only check connectivity; others cover empty input, long text, network failure, double submit, and mobile sizes. Explicitly require the regression scope in the second-round prompt instead of leaving it to the model.

    2. Two-round prompt protocol

    Round one defines requirements. Round two injects credentials and drives integration. Split round one into three deliverables with a shared output template:

    1. Role: senior product manager and frontend engineer
    2. Goal: recreate a logged-in web chat app and produce an improved variant
    3. Input: target site is accessible; API docs are accessible; browser automation may observe the page
    4. Deliverables:
    5. 1. Product report: feature list, user paths, state diagram, exception states, functional structure diagram
    6. 2. Recreation: UI and interaction aligned with the target
    7. 3. Improved variant: usability and accessibility changes, with trade-offs explained
    8. Constraints: do not invent API capabilities; label every inference as "observed" or "assumed"

    Round two only adds credentials, integration requirements, and an explicit test list:

    1. Credentials are provided. Complete integration and run regression:
    2. - Normal send and streaming receive
    3. - Empty input, oversized input, repeated clicks
    4. - Stop generation, retry, copy, session switch
    5. - Invalid credentials, network failure, abnormal API responses
    6. - Desktop and mobile critical sizes
    7. Output: changes, test results, failure screenshot descriptions, remaining risks

    Separating “requirement understanding” from “integration verification” avoids unexecutable assumptions in round one and shallow connectivity-only tests in round two.

    3. Product documentation and structure diagrams

    A product report should be a verifiable functional structure, not a list of page modules. Use four layers:

    • Page: session page, history sidebar, settings, share, error pages.
    • Component: message list, bubbles, input, send, stop, model selector, code blocks, copy, loading skeletons.
    • State: idle, typing, sending, streaming, stopped, failed, retrying, empty session, history loading.
    • API: session create, message send, stream receive, history query, credential check, error-code mapping.

    A layered text diagram helps models and reviewers share one view:

    1. Chat application
    2. ├─ Session management
    3. │ ├─ New session
    4. │ ├─ History list
    5. │ └─ Switch and delete
    6. ├─ Message interaction
    7. │ ├─ Text input and send
    8. │ ├─ Streaming output and stop
    9. │ ├─ Retry and copy
    10. │ └─ Code-block render and copy
    11. ├─ Supporting features
    12. │ ├─ Model/mode selection
    13. │ ├─ Settings and theme
    14. │ └─ Share entry
    15. └─ Exceptions and edges
    16. ├─ Disable empty input
    17. ├─ Credential-failure prompt
    18. ├─ Network-failure retry
    19. └─ Truncate or warn on oversized content

    Distinguish observed facts from inferred assumptions. Mobile input position and size are observable. Whether the API supports canceling generation needs docs plus behavior checks. Cross-browser share-link behavior is an acceptance assumption and should be listed as a test.

    4. High-fidelity recreation

    Build structure first, then style, then interaction, then exceptions. Use component splits without introducing heavy global state too early. Keep message stream, input, sidebar, and settings state independent so streaming updates do not re-render the whole page.

    Align four visual systems first: spacing, type hierarchy, color semantics, and breakpoints. Frequent gaps include mobile input position, bottom safe area, bubble max width, horizontal scroll on code blocks, and long-text wrapping. Use a visual checklist, not overall screenshot feel.

    Interaction rules: disable send on empty or in-flight input; expose stop during streaming; keep user input on failure and allow retry; give light feedback on copy. For code blocks, handle overflow, copy-button placement, and theme. For history, handle skeletons, empty states, and when to clear messages on switch.

    Keep credentials on a server proxy or in a controlled environment—do not expose them in the frontend. Pseudocode:

    1. function sendMessage(sessionId, content, token):
    2. if content.trim() == "":
    3. return disabled
    4. setState("sending")
    5. response = streamRequest("/message", {sessionId, content}, token)
    6. for chunk in response:
    7. appendChunk(chunk)
    8. if response.error:
    9. setState("failed", keepInput=true)
    10. else:
    11. setState("idle")

    Three principles: validate input first, append stream chunks instead of replacing the whole message, and keep user input on failure.

    5. Regression after credential injection

    After credentials, the common failure is “only test whether it connects.” Write an executable checklist and require evidence. Cover at least:

    • Happy path: send, stream, complete, history echo.
    • Input edges: empty, whitespace, long text, special characters, multiline.
    • Interaction edges: repeated send, send while generating, retry after stop, switch session while streaming.
    • Failure paths: invalid credentials, API failure, timeout, empty payload, unknown error codes.
    • Responsive: narrow, wide, mobile keyboard, bottom safe area.
    • Accessibility: keyboard focus, readable button names, contrast, focus order.

    Acceptance script:

    1. cases = [
    2. "empty_input_disabled",
    3. "normal_stream_render",
    4. "stop_generation",
    5. "retry_after_failure",
    6. "switch_session_during_stream",
    7. "mobile_input_position"
    8. ]
    9. for case in cases:
    10. result = run(case)
    11. record(case, result, evidence)
    12. assert all_critical_cases_passed

    Unify operations, evidence, and pass/fail. Orchestration differences can be noted in the report but must not replace the standard. Shallow tests should be sent back; deep defect reports should record coverage so teams can reuse them.

    6. Directions for the improved variant

    Do not pile on features. Trade off usability, accessibility, and maintainability:

    1. Session organization: pin, search, group by time.
    2. Input experience: auto-growing multiline, shortcuts, draft persistence, retry without losing content.
    3. Stream control: stop, continue, regenerate, copy a selection.
    4. Accessibility: full keyboard use, visible focus, button semantics, sufficient contrast.
    5. Transparent errors: clear cause, retry, and fallback.
    6. Lightweight settings: surface theme, type size, and code wrapping; hide infrequent items.

    For each change, state the problem, the users affected, and the cost. Session search helps retrieval but needs indexing and empty-result design. Drafts improve recovery but need isolation across sessions and privacy cleanup.

    7. Engineering notes for multi-model orchestration

    The value of multiple models is division of labor, not voting. Assign stages: structured output for product analysis, runnable code for frontend, coverage for integration, and argued trade-offs for optimization. Unify input templates, output formats, and the acceptance checklist; validate each deliverable automatically or semi-automatically.

    Risk controls: do not invent APIs; label assumptions; minimize and redact credentials; set timeouts and rollback for browser automation; audit dependencies and scan generated code; compare screenshots at multiple sizes. Final delivery should include the product report, structure diagram, recreation, improved variant, test record, and remaining-risk list.

    8. Conclusion

    Recreating a web chat client with multiple models is a composite engineering task. The hard part is not single-point code generation, but closing the loop of requirement abstraction, structure modeling, visual recreation, integration testing, and UX optimization. A two-round prompt protocol, a shared acceptance checklist, deep regression after credential injection, and a report that separates observed facts from assumptions reduce output variance and raise quality and maintainability. The same method can transfer to high-fidelity prototype validation and frontend rewrites of other web apps.