Skip to content

Commit

Permalink
local version of interface
Browse files Browse the repository at this point in the history
  • Loading branch information
husseinmozannar committed Nov 3, 2024
1 parent ceb6beb commit 3b1d5d7
Show file tree
Hide file tree
Showing 68 changed files with 37,110 additions and 13,728 deletions.
16 changes: 15 additions & 1 deletion interface/.firebaserc
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
{
"projects": {
"default": "codeonline-ee37b"
}
},
"targets": {
"codeonline-ee37b": {
"hosting": {
"test": [
"proactive-test"
],
"proactive": [
"code-proactive-chat"
]
}
}
},
"etags": {},
"dataconnectEmulatorConfig": {}
}
2 changes: 1 addition & 1 deletion interface/.gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

.vscode
# dependencies
/node_modules
/.pnp
Expand Down
76 changes: 17 additions & 59 deletions interface/README.md
Original file line number Diff line number Diff line change
@@ -1,49 +1,32 @@

# Getting Started
# RealHumanEval Interface

RealHumanEval is built as a React app using Google Firebase for hosting, data storage, and API calling. However, it can be run locally by configuring certain flags and inputting the API keys.
This is a local version of RealHumanEval, however, by replacing the API calls to be non-local in [app/functions/cloud_functions_helper.js](app/functions/cloud_functions_helper.js) and task loading in [app/functions/task_logic.js](app/functions/task_logic.js) and [app/page.tsx](app/page.tsx) you can host this with Firebase as we did for the actual user study.

## Requirements
The repo is organized as follows:

- [app](app): Contains the frontend code for the project.

For the required packages:
```
npm install next react react-dom
npm install firebase
npm install axios
```
You will need API keys for the following services to run the app:

OpenAI: https://openai.com/api/
Together.ai: https://api.together.xyz/
One compiler: https://rapidapi.com/onecompiler-onecompiler-default/api/onecompiler-apis


### Firebase

To recreate the same functionality, you need to link your web app with a Firebase project.
- [app/components](app/components): Contains the React components for the project.

Once you create your Firebase project, make sure to enable Cloud Firestore. In Firestore, create an empty collection called “responses”. Then create a collection called “tasks”, each entry in tasks must have three items: task_descriptions, function_signatures and unit_tests. Each of the three items are a list of strings. We include a copy of our tasks collection.
- [app/functions](app/functions): Contains the helper functions for the project.

In the Firebase console, under “Project Settings”, make sure to create an app, then copy the Firebase config to initialize_firebase.js in interface/app/functions.
- The main page is [app/page.tsx](app/page.tsx).

Make sure to login to your firebase project under the folder of interface, following https://firebase.google.com/docs/web/setup.
### Installation
This is a [Next.js](https://nextjs.org/) project bootstrapped with [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app).

Now in react, for firebase functionality, you need to enable it:
```
firebase experiments:enable webframeworks
```
Follow the instructions below to install the necessary dependencies.

Then you need to set the API keys one by one:

```
firebase functions:secrets:set OPENAI_KEY
firebase functions:secrets:set TOGETHER_KEY
firebase functions:secrets:set RAPIDAPI_KEY
npm install next react react-dom
npm install axios
npm install openai
```


### Deployment
You need to your API keys to [app/components/settings.tsx](app/components/settings.tsx) file. For now this is well tested with OpenAI API and OneCompiler API.


First, run the development server:
Expand All @@ -60,34 +43,9 @@ bun dev

Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.

To deploy online using firebase:

```bash
Firebase deploy
```




# Roadmap of Features

- Adding multiple tabs to editor: currently it is easy to add tabs by setting the "useTabs" variable to true in Editor.tsx, however, you cannot import code from one tab to another. Moreover, you cannot choose which tab to execute.

- Adding a console: currently you can only run the code in the editor, but you cannot use interactive input "input()".

- Moving beyond OneCompiler: it would be good to have a simple python environment as a console to allow for installing different packages and so on.

- Adding a file system: it would be good to have a file system to allow for saving and loading files.

- Display online statistics about AI usage and participant performance (e.g., acceptance rate of suggestions, percentage of upvoted messages, …)








This is what you will see:

![image](public/final_interface.png)


![image](public/integrate_proactive1.gif)
Loading

0 comments on commit 3b1d5d7

Please sign in to comment.