Skip to content

Commit

Permalink
Merge pull request #104 from Dogtiti/feature/web-search
Browse files Browse the repository at this point in the history
Feature/web search
  • Loading branch information
Dogtiti authored May 3, 2023
2 parents 4cb04cb + 253d655 commit 128f3c2
Show file tree
Hide file tree
Showing 76 changed files with 2,790 additions and 785 deletions.
2 changes: 1 addition & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/typescript-node
{
"name": "AgentGPT development container",
"name": "AutoGPT development container",
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
"image": "mcr.microsoft.com/devcontainers/typescript-node:0-18",

Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/node.js.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,6 @@ jobs:
cache: "npm"
- run: npm ci
- run: npm test
env:
OPENAI_API_KEY: sk-0000000000
- run: ./prisma/useSqlite.sh && npm run postinstall
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,7 @@ yarn-error.log*
/public/locales/$LOCALES

.eslintcache

# Sentry Auth Token
.sentryclirc
/volumes/
18 changes: 9 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ One-Click to deploy well-designed AutoGPT-Next-Web web UI on Vercel.

![cover](https://user-images.githubusercontent.com/20209191/234480921-0a8f754e-1110-47bf-9c40-25e3daed2c05.png)


## Features

1. Free one-click deployment with Vercel in 1 minute
Expand All @@ -33,17 +32,17 @@ One-Click to deploy well-designed AutoGPT-Next-Web web UI on Vercel.

## Roadmap

- [x] 1. Add support for Docker and Docker Compose
- [x] 2. Add support for Endpoint URL
- [ ] 3. Add support for Azure OpenAI API
- [ ] 4. Optimize the display of running results for easier viewing
- [ ] 5. Add support for WeChat login

- [x] 1. Add support for Docker and Docker Compose
- [x] 2. Add support for Endpoint URL
- [ ] 3. Add support for Azure OpenAI API
- [ ] 4. Optimize the display of running results for easier viewing
- [ ] 5. Add support for WeChat login

## Get Started

[Click me to view the detailed tutorial](https://autogpt-next-web.gitbook.io/autogpt-next-web/)
1. Prepare the OpenAI API Key;
[Click me to view the detailed tutorial](https://autogpt-next-web.gitbook.io/autogpt-next-web/)

1. Prepare the OpenAI API Key;
2. Click the deploy button and follow the prompts
3. We support access control capabilities, see the tutorial above for a detailed tutorial

Expand All @@ -67,6 +66,7 @@ A convenient setup script is provided to help you get started.
### Docker-compose

Using `docker-compose` deploy

```bash
./setup.sh --docker-compose
```
Expand Down
34 changes: 34 additions & 0 deletions __tests__/create-model.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
// Import the createModel function
import { GPT_35_TURBO } from "../src/utils/constants";
import { createModel } from "../src/utils/prompts";

describe("createModel", () => {
test("should use custom settings when API key is provided", () => {
const customSettings = {
customApiKey: "test_api_key",
customTemperature: 0.222,
customModelName: "Custom_Model",
customMaxTokens: 1234,
};

const model = createModel(customSettings);

expect(model.temperature).toBe(customSettings.customTemperature);
expect(model.modelName).toBe(customSettings.customModelName);
expect(model.maxTokens).toBe(customSettings.customMaxTokens);
});

test("should use default settings when API key is not provided", () => {
const customSettings = {
customTemperature: 0.222,
customModelName: "Custom_Model",
customMaxTokens: 1234,
};

const model = createModel(customSettings);

expect(model.temperature).toBe(0.9);
expect(model.modelName).toBe(GPT_35_TURBO);
expect(model.maxTokens).toBe(400);
});
});
40 changes: 40 additions & 0 deletions __tests__/extract-array.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,44 @@ describe("Strings should be extracted from arrays correctly", () => {
"Integrate with external tools and services to provide users with additional features such as task prioritization and scheduling."
);
});

it("fails with single quotes", () => {
const modelResult = ` [
'Search Reddit for current trending topics related to cats',
'Identify the most upvoted posts about cats on Reddit'
]`;

expect(extractArray(modelResult).length).toBe(0);
});

it("works with no whitespace", () => {
const modelResult = `["Item 1","Item 2","Item 3"]`;

expect(extractArray(modelResult).length).toBe(3);
expect(extractArray(modelResult).at(1)).toBe("Item 2");
});

it("returns an empty array for non-array strings", () => {
const modelResult = `This is not an array`;

expect(extractArray(modelResult)).toEqual([]);
expect(extractArray(modelResult).length).toBe(0);
});

it("returns an empty array for empty arrays", () => {
const modelResult = `[]`;

expect(extractArray(modelResult)).toEqual([]);
expect(extractArray(modelResult).length).toBe(0);
});

it("works with an array of one element", () => {
const modelResult = `[
"Only one element"
]`;

expect(extractArray(modelResult)).toEqual(["Only one element"]);
expect(extractArray(modelResult).length).toBe(1);
expect(extractArray(modelResult).at(0)).toBe("Only one element");
});
});
42 changes: 42 additions & 0 deletions __tests__/remove-task-prefix.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import { removeTaskPrefix } from "../src/utils/helpers";

describe("removeTaskPrefix", () => {
test('removes "Task: "', () => {
const input = "Task: This is a sample task";
const output = removeTaskPrefix(input);
expect(output).toBe("This is a sample task");
});

test('removes "Task {N}: "', () => {
const input =
"Task 1: Perform a comprehensive analysis of the current system's performance.";
const output = removeTaskPrefix(input);
expect(output).toBe(
"Perform a comprehensive analysis of the current system's performance."
);
});

test('removes "Task {N}. "', () => {
const input = "Task 2. Create a python script";
const output = removeTaskPrefix(input);
expect(output).toBe("Create a python script");
});

test('removes "{N} - "', () => {
const input = "5 - This is a sample task";
const output = removeTaskPrefix(input);
expect(output).toBe("This is a sample task");
});

test('removes "{N}: "', () => {
const input = "2: This is a sample task";
const output = removeTaskPrefix(input);
expect(output).toBe("This is a sample task");
});

test("does not modify strings without matching prefixes", () => {
const input = "This is a sample task without a prefix";
const output = removeTaskPrefix(input);
expect(output).toBe(input);
});
});
1 change: 0 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,3 @@ services:
volumes:
- .env.docker:/app/.env
- ./db:/app/db

1 change: 0 additions & 1 deletion entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,3 @@ fi

# run cmd
exec "$@"

27 changes: 26 additions & 1 deletion next.config.mjs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { withSentryConfig } from "@sentry/nextjs";
// @ts-check
/**
* Run `build` or `dev` with `SKIP_ENV_VALIDATION` to skip env validation.
Expand All @@ -18,4 +19,28 @@ const config = {
return config;
}
};
export default config;
export default withSentryConfig(config, {
// For all available options, see https://github.com/getsentry/sentry-webpack-plugin#options

// Suppresses source map uploading logs during build
silent: true,
org: "reworkd",
project: "autogpt",
}, {
// For all available options, see https://docs.sentry.io/platforms/javascript/guides/nextjs/manual-setup/
// Upload a larger set of source maps for prettier stack traces (increases build time)
widenClientFileUpload: true,

// Transpiles SDK to be compatible with IE11 (increases bundle size)
transpileClientSDK: false,

// Routes browser requests to Sentry through a Next.js rewrite to circumvent ad-blockers (increases server load)
tunnelRoute: "/monitoring",

// Hides source maps from generated client bundles
hideSourceMaps: true,

// Automatically tree-shake Sentry logger statements to reduce bundle size
disableLogger: true,
environment: process.env.NEXT_PUBLIC_VERCEL_ENV,
});
Loading

1 comment on commit 128f3c2

@vercel
Copy link

@vercel vercel bot commented on 128f3c2 May 3, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

auto-gpt-next-web – ./

auto-gpt-next-web-git-main-dogtiti.vercel.app
auto-agentgpt.com
auto-gpt-next-web-dogtiti.vercel.app

Please sign in to comment.