Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
198 changes: 0 additions & 198 deletions webapp/Deploying_on_Firebase.md

This file was deleted.

64 changes: 48 additions & 16 deletions webapp/EXTENSION_EXAMPLE.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,12 @@ The new endpoint will be available at `POST /extensions/echo` and will be merged

## 2) Add the Echo page

Create `webapp/packages/webui/src/pages/EchoPage.jsx`:
Create `webapp/packages/webui/src/extensions/echo/EchoPage.jsx`:

```jsx
import React, { useState } from 'react';
import { Box, Button, Stack, TextField, Typography } from '@mui/material';
import config from '../config';
import config from '../../config';

const EchoPage = () => {
const [value, setValue] = useState('');
Expand Down Expand Up @@ -107,11 +107,29 @@ const EchoPage = () => {
export default EchoPage;
```

Also add the EchoCard.
Create `webapp/packages/webui/src/extensions/echo/EchoCard.jsx`:
```jsx
// webapp/packages/webui/src/extensions/echo/EchoCard.jsx
import CampaignIcon from '@mui/icons-material/Campaign';

export const card = {
id: 'echo',
title: 'Echo Chamber',
description: 'An example of a custom card that links to a new page and API.',
buttonText: 'Try It',
icon: <CampaignIcon />,
iconColor: 'primary.main',
onAction: ({ navigate }) => navigate('/echo'),
};

```

## 3) Extend the frontend routes

Append the new route inside `webapp/packages/webui/src/extensions/echo.routes.js`:
Append the new route inside `webapp/packages/webui/src/extensions/echo.routes.jsx`:

```javascript
```jsx
import EchoPage from '../../pages/EchoPage';

export const route = {
Expand All @@ -125,20 +143,34 @@ All routes defined here are merged with `src/config/routesConfig.jsx`, so the Ec

## 4) Register the Echo card

Create `webapp/packages/webui/src/extensions/echo.card.js`:
Create `webapp/packages/webui/src/extensions/echo.card.jsx`:

```javascript
import CampaignIcon from '@mui/icons-material/Campaign';
```jsx
import React from 'react';
import { Button, Card, CardActions, CardContent, Typography } from '@mui/material';
import { Link } from 'react-router-dom';

export const card = {
id: 'echo',
title: 'Echo',
description: 'Send text to the Echo API and see it mirrored back.',
buttonText: 'Open Echo',
icon: <CampaignIcon />,
defaultOrder: 7,
onAction: ({ navigate }) => navigate('/echo'),
};
const EchoCard = () => {
return (
<Card>
<CardContent>
<Typography variant="h5" component="div">
Echo Extension
</Typography>
<Typography sx={{ mt: 1.5 }} color="text.secondary">
An example of a custom card that links to a new page and API.
</Typography>
</CardContent>
<CardActions>
<Button component={Link} to="/echo" size="small">
Try It
</Button>
</CardActions>
</Card>
);
};

export default EchoCard;
```

(Optional) If you want to control the card’s order or grouping, add an entry to `CARD_CONFIG_OVERRIDES` (for example via `.env` or `window.__CARD_CONFIG_OVERRIDES__`).
Expand Down
13 changes: 13 additions & 0 deletions webapp/packages/api/user-service/extensions/echo_router.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
from fastapi import APIRouter
from pydantic import BaseModel

router = APIRouter()


class EchoRequest(BaseModel):
message: str


@router.post("/echo")
async def echo(request: EchoRequest):
return {"echo": request.message}
10 changes: 10 additions & 0 deletions webapp/packages/api/user-service/extensions/echo_router_config.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
from config.routes_config import RouterConfig

ROUTER_CONFIG_MODE = "append"
ROUTER_CONFIGS = [
{
"router": "extensions.echo_router:router",
"prefix": "/extensions", # becomes /extensions/echo
"tags": ["echo-demo"],
}
]
14 changes: 0 additions & 14 deletions webapp/packages/api/user-service/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,7 @@
import litellm
import traceback
import httpx
import firebase_admin
import yaml
from firebase_admin import credentials, auth
from fastapi.security import OAuth2PasswordBearer

from services.database_service import get_database_service, DatabaseService
Expand Down Expand Up @@ -46,17 +44,6 @@
from agent_factory.remote_mcp_client import RemoteMCPClient


# --- Firebase Admin SDK Initialization ---
if settings.APP_ENV == "firebase":
try:
# In a Cloud Function environment, GOOGLE_APPLICATION_CREDENTIALS is set automatically.
# For local emulation, you'd need to set this env var to your service account key file.
cred = credentials.ApplicationDefault()
firebase_admin.initialize_app(cred)
print("Firebase Admin SDK initialized successfully.")
except Exception as e:
print(f"Error initializing Firebase Admin SDK: {e}")

app = FastAPI()
router = APIRouter()

Expand Down Expand Up @@ -804,7 +791,6 @@ async def delete_demo_app(demo_id: str, db: DatabaseService = Depends(get_db), u

# This is an unseemly hack to adapt FastAPI to Google Cloud Functions.
# TODO refactor all of this into microservices.
from firebase_functions import https_fn, options
from a2wsgi import ASGIMiddleware

wsgi_app = ASGIMiddleware(app)
Expand Down
Loading