Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initial React Frontend #1819

Merged
merged 5 commits into from
Oct 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
76 changes: 76 additions & 0 deletions .github/workflows/frontend.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
name: Frontend

on:
push:
branches:
- '*'
paths:
- 'src/helm-frontend/**'
pull_request:
branches:
- '*'
paths:
- 'src/helm-frontend/**'

jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: '18'
- name: Install dependencies
working-directory: ./src/helm-frontend
run: npm ci
- name: Run lint
working-directory: ./src/helm-frontend
run: npm run lint
- name: Run tests
working-directory: ./src/helm-frontend
run: npm run test

build:
runs-on: ubuntu-latest
# Deploy to only run on pushes to master
# if: github.event_name == 'push' && github.ref == 'refs/heads/main'
if: github.event_name == 'push' && github.ref == 'refs/heads/react_frontend'
needs: test
environment:
name: github-pages
env:
VITE_HELM_BENCHMARKS_ENDPOINT: ${{ vars.VITE_HELM_BENCHMARKS_ENDPOINT }}
VITE_HELM_BENCHMARKS_SUITE: ${{ vars.VITE_HELM_BENCHMARKS_SUITE }}
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: '18'
- name: Install dependencies
working-directory: ./src/helm-frontend
run: npm ci
- name: Build app
working-directory: ./src/helm-frontend
run: npm run build
- name: Upload artifact
uses: actions/upload-pages-artifact@v2
with:
path: ./src/helm/benchmark/static_build/

deploy:
runs-on: ubuntu-latest
needs: build
permissions:
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v2
25 changes: 25 additions & 0 deletions src/helm-frontend/.eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
module.exports = {
root: true,
env: { browser: true, es2020: true },
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/recommended-type-checked',
'plugin:react-hooks/recommended',
],
ignorePatterns: ['dist', '.eslintrc.cjs'],
parser: '@typescript-eslint/parser',
plugins: ['react-refresh'],
rules: {
'react-refresh/only-export-components': [
'warn',
{ allowConstantExport: true },
],
'@typescript-eslint/ban-ts-comment': 'off',
},
parserOptions: {
ecmaVersion: 'latest',
sourceType: 'module',
project: ['./tsconfig.json', './tsconfig.node.json'],
tsconfigRootDir: __dirname,
},
}
24 changes: 24 additions & 0 deletions src/helm-frontend/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*

node_modules
dist
dist-ssr
*.local

# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
59 changes: 59 additions & 0 deletions src/helm-frontend/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
React Frontend for HELM
-------------------------

This directory contains the files for building and developing an alternative React based frontend for HELM. If you are looking for the current frontend deployed to https://crfm.stanford.edu/helm/latest/ you will want to look in `helm/benchmark/static` and `helm/benchmark/proxy/static`. If you are looking to make changes to the alternative React frontend, then you are in the correct place.

This app makes use of [React](https://react.dev/) + [TypeScript](https://www.typescriptlang.org/) and built with [vite](https://vitejs.dev/). [Tailwindcss](https://tailwindcss.com/) is used for CSS along with some help from the UI frameworks [daisyUI](https://daisyui.com/) and [tremor](https://www.tremor.so/). [React Testing Library](https://testing-library.com/docs/react-testing-library/intro/) is used for tests.



### Installation
```bash
npm Install
```

### Develop

This will open a development server

```bash
npm run dev
```

You will also want to start `helm-server` locally as well. In the `src/helm` directory run the following

```
helm-server
```

### Testing

```
npm run test
```

### Build

```bash
npm run build
```

### Environment Variables

Requires the following environment variables for development and deployment. In development these can be placed in a `.env.local` file with the following:

```
# The default location of local `helm-server`
VITE_HELM_BENCHMARKS_ENDPOINT="http://localhost:8000/"
# The suites available based on local runs
VITE_HELM_BENCHMARKS_SUITE="v1"
```

This can instead be pointed to the public HELM data to avoid needing to run `helm-server` locally.

```
# Example
VITE_HELM_BENCHMARKS_ENDPOINT="https://storage.googleapis.com/crfm-helm-public/"
# Change to current version
VITE_HELM_BENCHMARKS_SUITE="v0.2.3"
```
14 changes: 14 additions & 0 deletions src/helm-frontend/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/helm.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Holistic Evaluation of Language Models (HELM)</title>
<meta name="description" content="The Holistic Evaluation of Language Models (HELM) serves as a living benchmark for transparency in language models. Providing broad coverage and recognizing incompleteness, multi-metric measurements, and standardization. All data and analysis are freely accessible on the website for exploration and study." />
</head>
<body class="block">
<div id="root"></div>
<script type="module" src="/src/main.tsx"></script>
</body>
</html>
Loading
Loading