Skip to content

Commit

Permalink
Convert entire front-end to TypeScript. Add image model support. (And…
Browse files Browse the repository at this point in the history
… more!) (#252)

* Refactor: modularize response boxes into a separate component

* Type store.js. Change info to vars. NOTE: This may break backwards compat.

* Refactor addNodes in App.tsx to be simpler.

* Turn AlertModal into a Provider with useContext

* Remove fetch_from_backend.

* Add build/ to gitignore

* Add support for image models and add Dall-E models.

* Better rate limiting with Bottleneck

* Fix new Chrome bug with file import readers not appearing as arrays; and fix bug with exportCache

* Add ability to add custom right-click context menu items per node

* Convert to/from TF and Items nodes

* Add lazyloader for images

* Add compression to images by default before storing in cache

* Add image compression toggle in Global Settings

* Move Alert Provider to top level of index.js
  • Loading branch information
ianarawjo committed Mar 31, 2024
1 parent eb51d1c commit 583ea65
Show file tree
Hide file tree
Showing 75 changed files with 4,943 additions and 3,186 deletions.
4 changes: 2 additions & 2 deletions chainforge/flask_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -268,13 +268,13 @@ def index():
def executepy():
"""
Executes a Python function sent from JavaScript,
over all the `StandardizedLLMResponse` objects passed in from the front-end.
over all the `LLMResponse` objects passed in from the front-end.
POST'd data should be in the form:
{
'id': # a unique ID to refer to this information. Used when cache'ing responses.
'code': str, # the body of the lambda function to evaluate, in form: lambda responses: <body>
'responses': List[StandardizedLLMResponse] # the responses to run on.
'responses': List[LLMResponse] # the responses to run on.
'scope': 'response' | 'batch' # the scope of responses to run on --a single response, or all across each batch.
# If batch, evaluator has access to 'responses'. Only matters if n > 1 for each prompt.
'process_type': 'evaluator' | 'processor' # the type of processing to perform. Evaluators only 'score'/annotate responses. Processors change responses (e.g. text).
Expand Down
4 changes: 2 additions & 2 deletions chainforge/providers/protocol.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
from typing import Protocol, Optional, TypedDict, Dict, List, Literal, Union, Any
from typing import Protocol, Optional, Dict, Dict, List, Literal, Union, Any
import time

"""
OpenAI chat message format typing
"""
class ChatMessage(TypedDict):
class ChatMessage(Dict):
""" A single message, in OpenAI chat message format. """
role: str
content: str
Expand Down
1 change: 1 addition & 0 deletions chainforge/react-server/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ module.exports = {
"build/**",
"craco.config.js",
"src/backend/pyodide/**",
"src/backend/__test__/**",
],
extends: [
"semistandard",
Expand Down
3 changes: 3 additions & 0 deletions chainforge/react-server/.gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
# Created by https://www.toptal.com/developers/gitignore/api/node,react
# Edit at https://www.toptal.com/developers/gitignore?templates=node,react

# Ignore build folder
build/

### Node ###
# Logs
logs
Expand Down
98 changes: 98 additions & 0 deletions chainforge/react-server/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions chainforge/react-server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,14 @@
"buffer": "^6.0.3",
"codemirror": "^6.0.1",
"codemirror-readonly-ranges": "^0.1.0-alpha.1",
"compressorjs": "^1.2.1",
"crypto-browserify": "^3.12.0",
"dayjs": "^1.11.8",
"emoji-mart": "^5.5.2",
"emoji-picker-react": "^4.4.9",
"google-auth-library": "^8.8.0",
"https-browserify": "^1.0.0",
"lazysizes": "^5.3.2",
"lodash": "^4.17.21",
"lz-string": "^1.5.0",
"mantine-contextmenu": "^6.1.0",
Expand Down Expand Up @@ -130,6 +132,12 @@
},
"devDependencies": {
"@craco/craco": "^7.1.0",
"@types/lodash": "^4.17.0",
"@types/papaparse": "^5.3.14",
"@types/react-beautiful-dnd": "^13.1.8",
"@types/react-edit-text": "^5.0.4",
"@types/react-plotly.js": "^2.6.3",
"@types/styled-components": "^5.1.34",
"eslint": "^8.56.0",
"eslint-config-prettier": "^9.1.0",
"eslint-config-semistandard": "^17.0.0",
Expand Down
Loading

0 comments on commit 583ea65

Please sign in to comment.