Skip to content

Commit

Permalink
add supabase, add some docs, fix some ts errors and type issues, pull…
Browse files Browse the repository at this point in the history
… migration
  • Loading branch information
lalalune committed Feb 23, 2024
1 parent 81043b0 commit 4ea63a5
Show file tree
Hide file tree
Showing 31 changed files with 1,404 additions and 33 deletions.
4 changes: 2 additions & 2 deletions .dev.vars.example
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
SUPABASE_URL=https://<your id>.supabase.co
SUPABASE_SERVICE_API_KEY=
SUPABASE_URL=http://127.0.0.1:54321
SUPABASE_SERVICE_API_KEY=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZS1kZW1vIiwicm9sZSI6InNlcnZpY2Vfcm9sZSIsImV4cCI6MTk4MzgxMjk5Nn0.EGIM96RAZx35lJzdJsyH-qQwv8Hdp7fsn3W0YpN81IU
OPENAI_API_KEY=sk-<your api key>
NODE_ENV=development
32 changes: 23 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,24 +49,38 @@ SUPABASE_SERVICE_API_KEY="your-supabase-service-api-key"
OPENAI_API_KEY="your-openai-api-key"
```

### Supabase Local Setup

First, you will need to install the Supabase CLI. You can install it using the instructions [here](https://supabase.com/docs/guides/cli/getting-started).

Once you have the CLI installed, you can run the following commands to set up a local Supabase instance:

```bash
supabase start
```

You can now start the bgent project with `npm run dev` and it will connect to the local Supabase instance by default.

### Supabase Cloud Setup

This library uses Supabase as a database. You can set up a free account at [supabase.io](https://supabase.io) and create a new project.
Step 1: On the Subase All Projects Dashboard, select “New Project”.
Step 2: Select the organization to store the new project in, assign a database name, password and region.
Step 3: Select “Create New Project”.
Step 4: Wait for the database to setup. This will take a few minutes as supabase setups various directories.
Step 5: Select the “SQL Editor” tab from the left navigation menu.
Step 6: Copy in your own SQL dump file or optionally use the provided file in the bgent directory at: "src/supabase/db.sql". Note: You can use the command "supabase db dump" if you have a pre-exisiting supabase database to generate the SQL dump file.
Step 7: Paste the SQL code into the SQL Editor and hit run in the bottom right.
Step 8: Select the “Databases” tab from the left navigation menu to verify all of the tables have been added properly.

- Step 1: On the Subase All Projects Dashboard, select “New Project”.
- Step 2: Select the organization to store the new project in, assign a database name, password and region.
- Step 3: Select “Create New Project”.
- Step 4: Wait for the database to setup. This will take a few minutes as supabase setups various directories.
- Step 5: Select the “SQL Editor” tab from the left navigation menu.
- Step 6: Copy in your own SQL dump file or optionally use the provided file in the bgent directory at: "src/supabase/db.sql". Note: You can use the command "supabase db dump" if you have a pre-exisiting supabase database to generate the SQL dump file.
- Step 7: Paste the SQL code into the SQL Editor and hit run in the bottom right.
- Step 8: Select the “Databases” tab from the left navigation menu to verify all of the tables have been added properly.

Once you've set up your Supabase project, you can find your API key by going to the "Settings" tab and then "API". You will need to set the `SUPABASE_URL` and `SUPABASE_SERVICE_API_KEY` environment variables in your `.dev.vars` file.

## Development

```
npm run dev # start the server
npm run shell:dev # start the shell in another terminal
npm run shell # start the shell in another terminal to talk to the default agent
```

## Usage
Expand Down
22 changes: 22 additions & 0 deletions docs/docs/functions/createRelationship.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
---
id: "createRelationship"
title: "Function: createRelationship"
sidebar_label: "createRelationship"
sidebar_position: 0
custom_edit_url: null
---

**createRelationship**(`«destructured»`): `Promise`\<`boolean`\>

#### Parameters

| Name | Type |
| :------ | :------ |
| `«destructured»` | `Object` |
| › `runtime` | [`BgentRuntime`](../classes/BgentRuntime.md) |
| › `userA` | \`$\{string}-$\{string}-$\{string}-$\{string}-$\{string}\` |
| › `userB` | \`$\{string}-$\{string}-$\{string}-$\{string}-$\{string}\` |

#### Returns

`Promise`\<`boolean`\>
21 changes: 21 additions & 0 deletions docs/docs/functions/formatRelationships.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
---
id: "formatRelationships"
title: "Function: formatRelationships"
sidebar_label: "formatRelationships"
sidebar_position: 0
custom_edit_url: null
---

**formatRelationships**(`«destructured»`): `Promise`\<\`$\{string}-$\{string}-$\{string}-$\{string}-$\{string}\`[]\>

#### Parameters

| Name | Type |
| :------ | :------ |
| `«destructured»` | `Object` |
| › `runtime` | [`BgentRuntime`](../classes/BgentRuntime.md) |
| › `userId` | `string` |

#### Returns

`Promise`\<\`$\{string}-$\{string}-$\{string}-$\{string}-$\{string}\`[]\>
22 changes: 22 additions & 0 deletions docs/docs/functions/getRelationship.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
---
id: "getRelationship"
title: "Function: getRelationship"
sidebar_label: "getRelationship"
sidebar_position: 0
custom_edit_url: null
---

**getRelationship**(`«destructured»`): `Promise`\<`any`\>

#### Parameters

| Name | Type |
| :------ | :------ |
| `«destructured»` | `Object` |
| › `runtime` | [`BgentRuntime`](../classes/BgentRuntime.md) |
| › `userA` | `string` |
| › `userB` | `string` |

#### Returns

`Promise`\<`any`\>
21 changes: 21 additions & 0 deletions docs/docs/functions/getRelationships.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
---
id: "getRelationships"
title: "Function: getRelationships"
sidebar_label: "getRelationships"
sidebar_position: 0
custom_edit_url: null
---

**getRelationships**(`«destructured»`): `Promise`\<`Relationship`[]\>

#### Parameters

| Name | Type |
| :------ | :------ |
| `«destructured»` | `Object` |
| › `runtime` | [`BgentRuntime`](../classes/BgentRuntime.md) |
| › `userId` | `string` |

#### Returns

`Promise`\<`Relationship`[]\>
2 changes: 1 addition & 1 deletion docs/docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ Step 8: Select the “Databases” tab from the left navigation menu to verify a

```
npm run dev # start the server
npm run shell:dev # start the shell in another terminal
npm run shell # start the shell in another terminal
```

## Usage
Expand Down
4 changes: 4 additions & 0 deletions docs/docs/modules.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ custom_edit_url: null
- [composeActionExamples](functions/composeActionExamples.md)
- [composeContext](functions/composeContext.md)
- [createGoal](functions/createGoal.md)
- [createRelationship](functions/createRelationship.md)
- [finishGoal](functions/finishGoal.md)
- [finishGoalObjective](functions/finishGoalObjective.md)
- [formatActionConditions](functions/formatActionConditions.md)
Expand All @@ -65,8 +66,11 @@ custom_edit_url: null
- [formatGoalsAsString](functions/formatGoalsAsString.md)
- [formatLore](functions/formatLore.md)
- [formatMessages](functions/formatMessages.md)
- [formatRelationships](functions/formatRelationships.md)
- [getActorDetails](functions/getActorDetails.md)
- [getFormattedActions](functions/getFormattedActions.md)
- [getGoals](functions/getGoals.md)
- [getLore](functions/getLore.md)
- [getRelationship](functions/getRelationship.md)
- [getRelationships](functions/getRelationships.md)
- [updateGoals](functions/updateGoals.md)
Loading

0 comments on commit 4ea63a5

Please sign in to comment.