|
1 | | -# Burger AI Chat webapp |
| 1 | +<div align="center"> |
2 | 2 |
|
3 | | -This is a burger ordering web application with an AI chat assistant. The app allows customers to browse burger menus, ask questions about toppings, and place orders through a conversational interface. |
| 3 | +# Agent Web App (Azure Static Web Apps) |
4 | 4 |
|
5 | | -This project uses [Vite](https://vitejs.dev/) as a frontend build tool, and [Lit](https://lit.dev/) as a web components library. |
| 5 | +[](https://codespaces.new/Azure-Samples/mcp-agent-langchainjs?hide_repo_select=true&ref=main&quickstart=true) |
| 6 | + |
| 7 | +[](https://www.typescriptlang.org) |
| 8 | +[](https://lit.dev) |
6 | 9 |
|
7 | | -## Available Scripts |
| 10 | +[Overview](#overview) • [Development](#development) |
8 | 11 |
|
9 | | -In the project directory, you can run: |
| 12 | +</div> |
10 | 13 |
|
11 | | -### `npm run dev` |
| 14 | +## Overview |
12 | 15 |
|
13 | | -To start the app in dev mode. |
14 | | -Open [http://localhost:8000](http://localhost:8000) to view it in the browser. |
| 16 | +The Agent Web App provides a chat user interface for ordering burgers via the LangChain.js agent hosted in `agent-api`. It renders: |
15 | 17 |
|
16 | | -### `npm run build` |
| 18 | +- Live streaming assistant responses (token + tool step updates) |
| 19 | +- Chat session history with titles |
| 20 | +- User identity card (derived from SWA auth) |
| 21 | +- Debug panel (optional intermediate step visibility) |
17 | 22 |
|
18 | | -To build the app for production to the `dist` folder. |
| 23 | +All tool interactions are delegated to the MCP server through the API; the web app itself stays purely UI + streaming logic. |
| 24 | + |
| 25 | +<div align="center"> |
| 26 | + <img src="../../docs/images/agent-architecture.drawio.png" alt="Architecture" /> |
| 27 | +</div> |
| 28 | + |
| 29 | +### Features |
| 30 | + |
| 31 | +- **Reusable Web **Components** (`<azc-chat>`, `<azc-auth>` `<azc-history>`, `<azc-user-card>`, `<azc-debug>`): building blocks that you can customize and integrate in your own apps |
| 32 | +- **User authentication**: integrates with Azure Static Web Apps easy auth |
| 33 | +- **NDJSON streaming parser**: process JSON streams with incremental DOM updates |
| 34 | +- **Safe markdown rendering**: use DOMPurify and marked to safely render user and agent content |
| 35 | +- **Chat session history**: switch between sessions, with lazy loading of messages |
| 36 | + |
| 37 | +## Development |
| 38 | + |
| 39 | +### Getting started |
| 40 | + |
| 41 | +Follow the instructions [here](../../README.md#getting-started) to set up the development environment for the entire Burger MCP Agents project. |
| 42 | + |
| 43 | +### Run the application |
| 44 | + |
| 45 | +Use the following command to run the application locally: |
| 46 | + |
| 47 | +```bash |
| 48 | +npm start |
| 49 | +``` |
| 50 | + |
| 51 | +This command will start the [Azure Static Web Apps CLI](https://learn.microsoft.com/azure/static-web-apps/local-development?tabs=azure-cli) which in turn runs both the [Vite](https://vitejs.dev/) development server and the Azure Functions emulator with the Agent API. This will allow you to test the website locally, using the URL `http://localhost:4280`. |
| 52 | + |
| 53 | +> [!IMPORTANT] |
| 54 | +> The Agent API needs the Burger MCP server and Burger API to be running as well. You can start all the service at once by running `npm start` in the root of the project. |
| 55 | +
|
| 56 | +### Available Scripts |
| 57 | + |
| 58 | +| Script | Description | |
| 59 | +|--------|-------------| |
| 60 | +| `npm start` | Start web app + local Functions API via SWA CLI (recommended full dev) | |
| 61 | +| `npm run start:mock` | Start web app + mock API responses (from `mocks/`) | |
| 62 | +| `npm run dev` | Vite dev server only (no API auto‑start) | |
| 63 | +| `npm run build` | Production build to `dist` (code‑split + sourcemaps) | |
| 64 | +| `npm run clean` | Remove `dist` | |
| 65 | + |
| 66 | +### Configuration |
| 67 | + |
| 68 | +| Variable | Description | Default | |
| 69 | +|----------|-------------|---------| |
| 70 | +| `AGENT_API_URL_OVERRIDE` | Override base URL for Agent API (useful when pointing at a remote deployment) | `` (relative `/api`) | |
| 71 | + |
| 72 | +### Debugging intermediate agent steps |
| 73 | + |
| 74 | +By default you'll see a small button on top of the agent response panel that lets you open the debug panel. This shows the intermediate steps as they are received from the API, including LLM calls and tool invocations. |
| 75 | + |
| 76 | +Each step can be expanded to see details like the full LLM response or tool input/output. |
| 77 | + |
| 78 | +You can disable this by setting the `enableDebug` property on the `<azc-chat>` component to `false`. |
0 commit comments