setQuery(e.target.value)}
placeholder="Search or ask a question..."
/>
{answer && (
)}
{results.map((r, i) => (
{r.title}
{r.snippet}
{r.category}
))}
);
}
```
***
## Integrations
### Sync from Notion
```python theme={null}
from notion_client import Client
notion = Client(auth=os.environ["NOTION_TOKEN"])
def sync_notion_pages(database_id: str, kb: KnowledgeBase):
"""Sync pages from a Notion database."""
pages = notion.databases.query(database_id=database_id)
for page in pages["results"]:
# Extract content
title = page["properties"]["Name"]["title"][0]["plain_text"]
blocks = notion.blocks.children.list(page["id"])
content = extract_text_from_blocks(blocks)
kb.add_document(
title=title,
content=content,
category="notion",
tags=["notion", "synced"]
)
```
### Sync from Google Drive
```python theme={null}
from googleapiclient.discovery import build
def sync_google_drive(folder_id: str, kb: KnowledgeBase, creds):
"""Sync documents from Google Drive."""
service = build('drive', 'v3', credentials=creds)
results = service.files().list(
q=f"'{folder_id}' in parents",
fields="files(id, name, mimeType)"
).execute()
for file in results.get('files', []):
# Download and add to KB
content = download_file(service, file['id'])
kb.add_document(
title=file['name'],
content=content,
category="google-drive"
)
```
***
## Deployment
### Docker Compose
```yaml theme={null}
version: '3.8'
services:
api:
build: .
ports:
- "8000:8000"
volumes:
- ./data:/app/data
environment:
- MEMVID_FILE=/app/data/knowledge.mv2
web:
build: ./frontend
ports:
- "3000:3000"
depends_on:
- api
```
***
## Next Steps