Skip to content

Commit 128f3c2

Browse files
authored
Merge pull request #104 from Dogtiti/feature/web-search
Feature/web search
2 parents 4cb04cb + 253d655 commit 128f3c2

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

76 files changed

+2790
-785
lines changed

.devcontainer/devcontainer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
22
// README at: https://github.com/devcontainers/templates/tree/main/src/typescript-node
33
{
4-
"name": "AgentGPT development container",
4+
"name": "AutoGPT development container",
55
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
66
"image": "mcr.microsoft.com/devcontainers/typescript-node:0-18",
77

.github/workflows/node.js.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,6 @@ jobs:
1919
cache: "npm"
2020
- run: npm ci
2121
- run: npm test
22+
env:
23+
OPENAI_API_KEY: sk-0000000000
2224
- run: ./prisma/useSqlite.sh && npm run postinstall

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,3 +47,7 @@ yarn-error.log*
4747
/public/locales/$LOCALES
4848

4949
.eslintcache
50+
51+
# Sentry Auth Token
52+
.sentryclirc
53+
/volumes/

README.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ One-Click to deploy well-designed AutoGPT-Next-Web web UI on Vercel.
2222

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

25-
2625
## Features
2726

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

3433
## Roadmap
3534

36-
- [x] 1. Add support for Docker and Docker Compose
37-
- [x] 2. Add support for Endpoint URL
38-
- [ ] 3. Add support for Azure OpenAI API
39-
- [ ] 4. Optimize the display of running results for easier viewing
40-
- [ ] 5. Add support for WeChat login
41-
35+
- [x] 1. Add support for Docker and Docker Compose
36+
- [x] 2. Add support for Endpoint URL
37+
- [ ] 3. Add support for Azure OpenAI API
38+
- [ ] 4. Optimize the display of running results for easier viewing
39+
- [ ] 5. Add support for WeChat login
4240

4341
## Get Started
4442

45-
[Click me to view the detailed tutorial](https://autogpt-next-web.gitbook.io/autogpt-next-web/)
46-
1. Prepare the OpenAI API Key;
43+
[Click me to view the detailed tutorial](https://autogpt-next-web.gitbook.io/autogpt-next-web/)
44+
45+
1. Prepare the OpenAI API Key;
4746
2. Click the deploy button and follow the prompts
4847
3. We support access control capabilities, see the tutorial above for a detailed tutorial
4948

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

6968
Using `docker-compose` deploy
69+
7070
```bash
7171
./setup.sh --docker-compose
7272
```

__tests__/create-model.test.ts

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
// Import the createModel function
2+
import { GPT_35_TURBO } from "../src/utils/constants";
3+
import { createModel } from "../src/utils/prompts";
4+
5+
describe("createModel", () => {
6+
test("should use custom settings when API key is provided", () => {
7+
const customSettings = {
8+
customApiKey: "test_api_key",
9+
customTemperature: 0.222,
10+
customModelName: "Custom_Model",
11+
customMaxTokens: 1234,
12+
};
13+
14+
const model = createModel(customSettings);
15+
16+
expect(model.temperature).toBe(customSettings.customTemperature);
17+
expect(model.modelName).toBe(customSettings.customModelName);
18+
expect(model.maxTokens).toBe(customSettings.customMaxTokens);
19+
});
20+
21+
test("should use default settings when API key is not provided", () => {
22+
const customSettings = {
23+
customTemperature: 0.222,
24+
customModelName: "Custom_Model",
25+
customMaxTokens: 1234,
26+
};
27+
28+
const model = createModel(customSettings);
29+
30+
expect(model.temperature).toBe(0.9);
31+
expect(model.modelName).toBe(GPT_35_TURBO);
32+
expect(model.maxTokens).toBe(400);
33+
});
34+
});

__tests__/extract-array.test.ts

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,44 @@ describe("Strings should be extracted from arrays correctly", () => {
1616
"Integrate with external tools and services to provide users with additional features such as task prioritization and scheduling."
1717
);
1818
});
19+
20+
it("fails with single quotes", () => {
21+
const modelResult = ` [
22+
'Search Reddit for current trending topics related to cats',
23+
'Identify the most upvoted posts about cats on Reddit'
24+
]`;
25+
26+
expect(extractArray(modelResult).length).toBe(0);
27+
});
28+
29+
it("works with no whitespace", () => {
30+
const modelResult = `["Item 1","Item 2","Item 3"]`;
31+
32+
expect(extractArray(modelResult).length).toBe(3);
33+
expect(extractArray(modelResult).at(1)).toBe("Item 2");
34+
});
35+
36+
it("returns an empty array for non-array strings", () => {
37+
const modelResult = `This is not an array`;
38+
39+
expect(extractArray(modelResult)).toEqual([]);
40+
expect(extractArray(modelResult).length).toBe(0);
41+
});
42+
43+
it("returns an empty array for empty arrays", () => {
44+
const modelResult = `[]`;
45+
46+
expect(extractArray(modelResult)).toEqual([]);
47+
expect(extractArray(modelResult).length).toBe(0);
48+
});
49+
50+
it("works with an array of one element", () => {
51+
const modelResult = `[
52+
"Only one element"
53+
]`;
54+
55+
expect(extractArray(modelResult)).toEqual(["Only one element"]);
56+
expect(extractArray(modelResult).length).toBe(1);
57+
expect(extractArray(modelResult).at(0)).toBe("Only one element");
58+
});
1959
});
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
import { removeTaskPrefix } from "../src/utils/helpers";
2+
3+
describe("removeTaskPrefix", () => {
4+
test('removes "Task: "', () => {
5+
const input = "Task: This is a sample task";
6+
const output = removeTaskPrefix(input);
7+
expect(output).toBe("This is a sample task");
8+
});
9+
10+
test('removes "Task {N}: "', () => {
11+
const input =
12+
"Task 1: Perform a comprehensive analysis of the current system's performance.";
13+
const output = removeTaskPrefix(input);
14+
expect(output).toBe(
15+
"Perform a comprehensive analysis of the current system's performance."
16+
);
17+
});
18+
19+
test('removes "Task {N}. "', () => {
20+
const input = "Task 2. Create a python script";
21+
const output = removeTaskPrefix(input);
22+
expect(output).toBe("Create a python script");
23+
});
24+
25+
test('removes "{N} - "', () => {
26+
const input = "5 - This is a sample task";
27+
const output = removeTaskPrefix(input);
28+
expect(output).toBe("This is a sample task");
29+
});
30+
31+
test('removes "{N}: "', () => {
32+
const input = "2: This is a sample task";
33+
const output = removeTaskPrefix(input);
34+
expect(output).toBe("This is a sample task");
35+
});
36+
37+
test("does not modify strings without matching prefixes", () => {
38+
const input = "This is a sample task without a prefix";
39+
const output = removeTaskPrefix(input);
40+
expect(output).toBe(input);
41+
});
42+
});

docker-compose.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,3 @@ services:
99
volumes:
1010
- .env.docker:/app/.env
1111
- ./db:/app/db
12-

entrypoint.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,3 @@ fi
1818

1919
# run cmd
2020
exec "$@"
21-

next.config.mjs

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { withSentryConfig } from "@sentry/nextjs";
12
// @ts-check
23
/**
34
* Run `build` or `dev` with `SKIP_ENV_VALIDATION` to skip env validation.
@@ -18,4 +19,28 @@ const config = {
1819
return config;
1920
}
2021
};
21-
export default config;
22+
export default withSentryConfig(config, {
23+
// For all available options, see https://github.com/getsentry/sentry-webpack-plugin#options
24+
25+
// Suppresses source map uploading logs during build
26+
silent: true,
27+
org: "reworkd",
28+
project: "autogpt",
29+
}, {
30+
// For all available options, see https://docs.sentry.io/platforms/javascript/guides/nextjs/manual-setup/
31+
// Upload a larger set of source maps for prettier stack traces (increases build time)
32+
widenClientFileUpload: true,
33+
34+
// Transpiles SDK to be compatible with IE11 (increases bundle size)
35+
transpileClientSDK: false,
36+
37+
// Routes browser requests to Sentry through a Next.js rewrite to circumvent ad-blockers (increases server load)
38+
tunnelRoute: "/monitoring",
39+
40+
// Hides source maps from generated client bundles
41+
hideSourceMaps: true,
42+
43+
// Automatically tree-shake Sentry logger statements to reduce bundle size
44+
disableLogger: true,
45+
environment: process.env.NEXT_PUBLIC_VERCEL_ENV,
46+
});

0 commit comments

Comments
 (0)