ianarawjo b33397930b
TypeScript backend, HuggingFace models, JavaScript evaluators, Comment Nodes, and more (#81)
* Beginning to convert Python backend to Typescript

* Change all fetch() calls to fetch_from_backend switcher

* wip converting query.py to query.ts

* wip started utils.js conversion. Tested that OpenAI API call works

* more progress on converting utils.py to Typescript

* jest tests for query, utils, template.ts. Confirmed PromptPipeline works.

* wip converting queryLLM in flask_app to TS

* Tested queryLLM and StorageCache compressed saving/loading

* wip execute() in backend.ts

* Added execute() and tested w concrete func. Need to test eval()

* Added craco for optional webpack config. Config'd for TypeScript with Node.js packages browserify'd

* Execute JS code on iframe sandbox

* Tested and working JS Evaluator execution.

* wip swapping backends

* Tested TypeScript backendgit status! :) woot

* Added fetchEnvironAPIKeys to Flask server to fetch os.environ keys when running locally

* Route Anthropic calls through Flask when running locally

* Added info button to Eval nodes. Rebuilt react

* Edits to info modal on Eval node

* Remove/error out on Python eval nodes when not running locally.

* Check browser compat and display error if not supported

* Changed all example flows to use JS. Bug fix in query.ts

* Refactored to LLMProvider to streamline model additions

* Added HuggingFace models API

* Added back Dalai call support, routing through Flask

* Remove flask app calls and socketio server that are no longer used

* Added Comment Nodes. Rebuilt react.

* Fix PaLM temp=0 build, update package vers and rebuild react
2023-06-30 15:11:20 -04:00

63 lines
1.8 KiB
JavaScript

const webpack = require("webpack");
// const dotenv = require('dotenv').config({ path: __dirname + '/.env' })
const isDevelopment = process.env.NODE_ENV !== 'production';
module.exports = {
webpack: {
configure: {
resolve: {
fallback: {
"process": require.resolve("process/browser"),
"buffer": require.resolve("buffer"),
"https": require.resolve("https-browserify"),
"querystring": require.resolve("querystring-es3"),
"url": require.resolve("url/"),
"os": require.resolve("os-browserify/browser"),
"stream": require.resolve("stream-browserify"),
"path": require.resolve("path-browserify"),
"util": require.resolve("util/"),
"crypto": require.resolve("crypto-browserify"),
"assert": require.resolve("assert/"),
"http": require.resolve("stream-http"),
"net": require.resolve("net-browserify"),
"zlib": require.resolve("browserify-zlib"),
"fs": false,
"child_process": false,
},
},
},
module: {
rules: [
{
test: /node_modules\/https-proxy-agent\//,
use: 'null-loader',
},
]
},
plugins: {
add: [
new webpack.ProvidePlugin({
process: 'process/browser.js',
}),
// Work around for Buffer is undefined:
// https://github.com/webpack/changelog-v5/issues/10
new webpack.ProvidePlugin({
Buffer: ['buffer', 'Buffer'],
}),
]
},
// plugins: {add: [
// new webpack.DefinePlugin({
// // 'process': "{}",
// 'process.env': "{}", // JSON.stringify(dotenv.parsed),
// // 'process.env.NODE_ENV': JSON.stringify(isDevelopment ? 'development' : 'production'),
// }),
// ]},
},
};