Skip to content

Commit

Permalink
Add docs
Browse files Browse the repository at this point in the history
Signed-off-by: Daishan Peng <[email protected]>
  • Loading branch information
StrongMonkey committed Aug 1, 2024
1 parent c000586 commit dc75626
Show file tree
Hide file tree
Showing 18 changed files with 9,653 additions and 66 deletions.
20 changes: 20 additions & 0 deletions docs/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Dependencies
/node_modules

# Production
/build

# Generated files
.docusaurus
.cache-loader

# Misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local

npm-debug.log*
yarn-debug.log*
yarn-error.log*
41 changes: 41 additions & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Website

This website is built using [Docusaurus](https://docusaurus.io/), a modern static website generator.

### Installation

```
$ yarn
```

### Local Development

```
$ yarn start
```

This command starts a local development server and opens up a browser window. Most changes are reflected live without having to restart the server.

### Build

```
$ yarn build
```

This command generates static content into the `build` directory and can be served using any static contents hosting service.

### Deployment

Using SSH:

```
$ USE_SSH=true yarn deploy
```

Not using SSH:

```
$ GIT_USER=<Your GitHub username> yarn deploy
```

If you are using GitHub pages for hosting, this command is a convenient way to build the website and push to the `gh-pages` branch.
3 changes: 3 additions & 0 deletions docs/babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
presets: [require.resolve('@docusaurus/core/lib/babel/preset')],
};
16 changes: 16 additions & 0 deletions docs/docs/01-overview.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
title: Overview
slug: /
---

[![Discord](https://img.shields.io/discord/1204558420984864829?label=Discord)](https://discord.gg/9sSf4UyAMC)

<img alt="Knowledge Logo" src="img/logo.png" style={{width: 400}}/>

**Mail-Assistant** is an AI-powered application that can help you check others' availability and send email invites. It leverages [GPTScript](https://docs.gptscript.ai/) to provide a chatbot interface through a UI to assist you with various O365 tasks.

It has the following features:

1. Integrates with Microsoft Azure OAuth to assist users with office tasks.
2. Provides a task management system to help users manage tasks and chat sessions.
3. Offers customization of each task with different contexts and rulesets.
137 changes: 137 additions & 0 deletions docs/docs/02-installation.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
# Installation

### Create Microsoft App Registration

Follow the [instructions](https://learn.microsoft.com/en-us/entra/identity-platform/quickstart-register-app?tabs=certificate) here.

After creating the app, [create a secret](https://learn.microsoft.com/en-us/entra/identity-platform/quickstart-register-app?tabs=certificate#add-credentials) and copy the secret value.

Make sure you obtain the following values that are needed in the next step:

| Key | Description |
|---------------|-------------------------|
| CLIENT_ID | Microsoft client ID |
| CLIENT_SECRET | Microsoft client secret |
| TENANT_ID | Microsoft tenant ID |

:::note

Make sure the Redirect URL is configured to `http://localhost:8080`. This ensures Microsoft will redirect to the localhost server (which is where the Copilot server listens) and complete the OAuth workflow.

:::

### Prepare Other Environment Variables

| Key | Description |
|-------------------|---------------------------------------------------------------------------------------------------------------------------|
| OPENAI_API_KEY | Provide your OPENAI_API_KEY. |
| MICROSOFT_JWT_KEY | Provide a secret value used as a JWT key. This is used to sign JWT tokens issued on behalf of a user. Keep this a secret. |
| PUBLIC_URL | Public URL that your local server is listening to. |

:::note

Since everything is running locally, you need to expose your app server publicly so that webhook events can be delivered to the app. The easiest way is to run `ngrok`. Check the docs on [ngrok](https://ngrok.com/docs/getting-started/) on how to forward your local port publicly.

:::

:::note

You can use `openssl rand -base64 32` to generate a random value for the JWT secret key.

:::

### Running with Docker Compose

Use the docker-compose file below with the .env file.

```yaml
version: '3.8'

services:
db:
image: postgres:12-alpine
container_name: postgres_db
environment:
POSTGRES_DB: ${DB_NAME}
POSTGRES_USER: ${DB_USER}
POSTGRES_PASSWORD: ${DB_PASSWORD}
ports:
- "5432"
volumes:
- db_data:/var/lib/postgresql/data
env_file:
- .env
restart: always

ui:
image: "ghcr.io/gptscript-ai/mail-assistant/ui:latest"
ports:
- "3000"
restart: always

server:
image: "ghcr.io/gptscript-ai/mail-assistant/server:latest"
ports:
- "8080:8080"
restart: always
environment:
MICROSOFT_CLIENT_ID: ${MICROSOFT_CLIENT_ID}
MICROSOFT_CLIENT_SECRET: ${MICROSOFT_CLIENT_SECRET}
MICROSOFT_JWT_KEY: ${MICROSOFT_JWT_KEY}
MICROSOFT_TENANT_ID: ${MICROSOFT_TENANT_ID}
PG_DBNAME: ${DB_NAME}
PG_HOST: ${DB_HOST}
PG_USER: ${DB_USER}
PG_PASSWORD: ${DB_PASSWORD}
PUBLIC_URL: ${PUBLIC_URL}
UI_SERVER: ${UI_SERVER}
OPENAI_API_KEY: ${OPENAI_API_KEY}
DEVELOPMENT: "true"
env_file:
- .env

volumes:
db_data:
```
Replace the .env placeholder with the values you obtained in the previous step.
```
DB_NAME=copilot
DB_USER=admin
DB_PASSWORD=admin123
DB_HOST=db

MICROSOFT_CLIENT_ID=${CLIENT_ID}
OPENAI_API_KEY=${OPENAI_API_KEY}
MICROSOFT_CLIENT_SECRET=${CLIENT_SECRET}
MICROSOFT_JWT_KEY=${JWT_SECRET_KEY}
MICROSOFT_TENANT_ID=${TENANT_ID}

DEVELOPMENT=true

PUBLIC_URL=${PUBLIC_URL}
UI_SERVER=http://ui:3000
```

Then run docker-compose:

```bash
docker compose up -d
```

Go to `http://localhost:8080` and you can start logging in and using the app.

---

### Use Other LLM

The default model is `gpt-4o`. To use a different OpenAI model, update the `DEFAULT_MODEL` in the `.env` file.

To connect to an OpenAI-compatible local model server, such as llama.cpp, ollama, or Rubra's tool.cpp, update the `OPENAI_API_KEY`, `OPENAI_BASE_URL`, and `DEFAULT_MODEL` accordingly. For example:

```
OPENAI_API_KEY=sk-123
OPENAI_BASE_URL=http://host.docker.internal:1234/v1
DEFAULT_MODEL=rubra-meta-llama-3-8b-instruct.Q8_0.gguf
```
58 changes: 58 additions & 0 deletions docs/docs/03-guide.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# Guide

First, you need to sign in to the app using Microsoft OAuth.

Click on the link to sign in, and you will be redirected to the Microsoft OAuth page, where you need to agree to grant permission to this app.

## Exploring the Dashboard

Once you are signed in, you will land on the Dashboard page. It mainly has two resources:

- **Tasks**

Tasks allow you to create and manage tasks. Each task maintains its own chat session, helping you with some O365 tasks with the chatbot. It can be paused and resumed at any time, keeping the chat history and session.

- **Rule Sets**

Rule sets allow you to define rules for each task. It is basically adding more context to the chat session. You can create a rule like "When meeting with X, always meet in the afternoon" and attach it to a task. When the task runs, it will remember the rule you gave when you interact with it.

## Creating Tasks

1. Click on `Tasks` on the left panel.
2. Click on `Add`. Fill in the name, description, and additional rules (if any).

:::note

You can attach pre-configured rule sets to your task.

:::

## Creating Rule Sets

You can create pre-configured rule sets and attach them to a task.

1. Click on `Rule Sets` on the left panel.
2. Click on `Add`.

## Running a Task

Simply click on the task name to start running a task in a chat session.

## Automatic Task Creation

The `Mail-Assistant` app watches your inbox and detects if other people want to meet with you. If so, it will automatically create a task and remind you that you can start scheduling a meeting with them.

You can see the notification from the app once a new task is created.

## Cold Email Detection

:::warning

This feature is currently experimental.

:::

`Mail-Assistant` can help you detect cold emails for marketing and move them to a `Cold Email` folder. To enable it:

1. Go to `Accounts` and enable `Cold Email Detection`.
2. Any email marked as a cold email will appear under `Cold Email`. You can move it back to the inbox if it has been falsely detected.
3 changes: 3 additions & 0 deletions docs/docs/04-demo.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Demo

Here is a quick [demo](https://www.loom.com/share/ff3aefb360214ee59bbc1c756da2c313) on how to create and run tasks, and also schedule meetings in the chatbot.
98 changes: 98 additions & 0 deletions docs/docusaurus.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
// @ts-check
// `@type` JSDoc annotations allow editor autocompletion and type checking
// (when paired with `@ts-check`).
// There are various equivalent ways to declare your Docusaurus config.
// See: https://docusaurus.io/docs/api/docusaurus-config

import { themes as prismThemes } from "prism-react-renderer";

/** @type {import('@docusaurus/types').Config} */
const config = {
title: "Mail-Assistant Docs",
tagline: "Welcome to the Mail-Assistant Docs",
favicon: "img/favicon.ico",
baseUrl: "/mail-assistant/",
url: "https://gptscript-ai.github.io",
organizationName: "gptscript-ai",
projectName: "mail-assistant",
onBrokenLinks: "throw",
onBrokenMarkdownLinks: "warn",
trailingSlash: false,

i18n: {
defaultLocale: "en",
locales: ["en"],
},

presets: [
[
"classic",
/** @type {import('@docusaurus/preset-classic').Options} */
({
docs: {
sidebarPath: "./sidebars.js",
editUrl: "https://github.com/gptscript-ai/mail-assistant/tree/main/docs/",
routeBasePath: "/", // Serve the docs at the site's root
showLastUpdateTime: true,
},
theme: {
customCss: "./src/css/custom.css",
},
blog: false,
}),
],
],

themeConfig:
/** @type {import('@docusaurus/preset-classic').ThemeConfig} */
({
// Replace with your project's social card
image: "img/docusaurus-social-card.jpg",
navbar: {
title: "Mail-Assistant",
style: "dark",
logo: {
alt: "Mail-Assistant Logo",
src: "img/logo.png",
},
items: [
{
href: "https://github.com/gptscript-ai/mail-assistant",
label: "GitHub",
position: "right",
},
{
href: "https://discord.gg/9sSf4UyAMC",
label: "Discord",
position: "right",
},
],
},
footer: {
style: "dark",
links: [
{
label: "GitHub",
to: "https://github.com/gptscript-ai/mail-assistant",
},
{
label: "Discord",
to: "https://discord.gg/9sSf4UyAMC",
},
],
copyright: `Copyright © ${new Date().getFullYear()} Acorn Labs, Inc`,
},
prism: {
theme: prismThemes.github,
darkTheme: prismThemes.dracula,
additionalLanguages: ["cue", "docker"],
},
// algolia: {
// apiKey: "c886c827d4057d15ab11efbc59b94a49",
// appId: "CLLI98NP9G",
// indexName: "gptscript",
// },
}),
};

export default config;
Loading

0 comments on commit dc75626

Please sign in to comment.