Skip to content

Commit

Permalink
Merge branch 'development' into development
Browse files Browse the repository at this point in the history
  • Loading branch information
Keyrxng authored Oct 24, 2024
2 parents 1c4601b + dbf6c93 commit 46e0883
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 6 deletions.
3 changes: 2 additions & 1 deletion .cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@
"mixtral",
"nemo",
"Reranking",
"mistralai"
"mistralai",
"OPENROUTER_API_KEY"
],
"dictionaries": ["typescript", "node", "software-terms"],
"import": ["@cspell/dict-typescript/cspell-ext.json", "@cspell/dict-node/cspell-ext.json", "@cspell/dict-software-terms"],
Expand Down
4 changes: 3 additions & 1 deletion .dev.vars.example
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
OPENAI_API_KEY=""
SUPABASE_URL=""
SUPABASE_KEY=""
VOYAGEAI_API_KEY=""
VOYAGEAI_API_KEY=""
OPENROUTER_API_KEY=""
UBIQUITY_OS_APP_NAME=""
2 changes: 2 additions & 0 deletions .github/workflows/compute.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ jobs:
SUPABASE_KEY: ${{ secrets.SUPABASE_KEY }}
VOYAGEAI_API_KEY: ${{ secrets.VOYAGEAI_API_KEY }}
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
OPENROUTER_API_KEY: ${{ secrets.OPENROUTER_API_KEY }}
UBIQUITY_OS_APP_NAME: ${{ secrets.UBIQUITY_OS_APP_NAME }}

steps:
Expand All @@ -49,4 +50,5 @@ jobs:
SUPABASE_KEY: ${{ secrets.SUPABASE_KEY }}
VOYAGEAI_API_KEY: ${{ secrets.VOYAGEAI_API_KEY }}
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
OPENROUTER_API_KEY: ${{ secrets.OPENROUTER_API_KEY }}
UBIQUITY_OS_APP_NAME: ${{ secrets.UBIQUITY_OS_APP_NAME }}
1 change: 1 addition & 0 deletions .github/workflows/worker-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ jobs:
UBIQUITY_OS_APP_NAME: ${{ secrets.UBIQUITY_OS_APP_NAME }}
SUPABASE_URL: ${{ secrets.SUPABASE_URL }}
SUPABASE_KEY: ${{ secrets.SUPABASE_KEY }}
OPENROUTER_API_KEY: ${{ secrets.OPENROUTER_API_KEY }}

- name: Write Deployment URL to Summary
run: |
Expand Down
10 changes: 7 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,15 @@ plugins:
`.dev.vars` (for local testing):

To use the Openrouter API for fetching chat history, set the `OPENROUTER_API_KEY` in the `.dev.vars` file and specify the OpenAiBase URL in the `ubiquibot-config.yml` file. Alternatively, you can set the `OPENAI_API_KEY` in the `.dev.vars` file.

```sh
# OpenAI API key
OPENAI_API_KEY=your-api-key
OPENAI_API_KEY=your_openai_api_key
SUPABASE_URL=your_supabase_url
SUPABASE_KEY=your_supabase_key
VOYAGEAI_API_KEY=your_voyageai_api_key
OPENROUTER_API_KEY=your_openrouter_api_key
UBIQUITY_OS_APP_NAME="UbiquityOS"
```

## Testing
Expand Down
2 changes: 1 addition & 1 deletion src/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export async function plugin(inputs: PluginInputs, env: Env) {
apiKey: env.VOYAGEAI_API_KEY,
});
const openAiObject = {
apiKey: env.OPENAI_API_KEY,
apiKey: (inputs.settings.openAiBaseUrl && env.OPENROUTER_API_KEY) || env.OPENAI_API_KEY,
...(inputs.settings.openAiBaseUrl && { baseURL: inputs.settings.openAiBaseUrl }),
};
const openaiClient = new OpenAI(openAiObject);
Expand Down
1 change: 1 addition & 0 deletions src/types/env.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ export const envSchema = T.Object({
VOYAGEAI_API_KEY: T.String(),
SUPABASE_URL: T.String(),
SUPABASE_KEY: T.String(),
OPENROUTER_API_KEY: T.String(),
});

export const envValidator = new StandardValidator(envSchema);
Expand Down

0 comments on commit 46e0883

Please sign in to comment.