Skip to content

Commit

Permalink
AI for ChainForge BETA: TextFields, Items (#191)
Browse files Browse the repository at this point in the history
* Implement autofill backend

* Add autofill to ui

* Add argument to getUID to force recalculation of UID's on every call

* Add command fill

* Move popover to the right

* Merge autofill-ui into autofill

* Add minimum rows requirement for autofilling

* Rename local variable in autofill system

* Rename autofill.ts to ai.ts

* Implement generate and replace backend function

* Add purple AI button

* Add ai popover

* Add tabs to ai popover

* Cosmetic changes to AI popover

* Move command fill UI to purple button popover

* Add 'creative' toggle to generateAndReplace

* Generate and replace UI

* Call backend for generate and replace

* Change creative to unconventional in generate and replace system

* Fix generate and replace

* Add loading states

* Cosmetic changes

* Use sparkle icon

* Cosmetic changes

* Add a clarifying sentence to the prompt when the user asks for a prompt

* Change to markdown

* Add error handling to AI system

* Improve prompt prompt

* Remove 'suggestions loading' message

* Change 'pattern' to 'generate a list of' and fix a bug where i forgot to specify unordered markdown list

* Limit output to n in decode()

* Fix bug in error handling

* TEMP: try to fix autofill

* TEMP: disable autofill

* Finally fix autofill's debouncing

* Improve autofill prompt to handle commands

* Fix typo with semicolon

* Implement autofill backend

* Add autofill to ui

* Add argument to getUID to force recalculation of UID's on every call

* Add command fill

* Move popover to the right

* Merge autofill-ui into autofill

* Add minimum rows requirement for autofilling

* Rename local variable in autofill system

* Rename autofill.ts to ai.ts

* Implement generate and replace backend function

* Add purple AI button

* Add ai popover

* Add tabs to ai popover

* Cosmetic changes to AI popover

* Move command fill UI to purple button popover

* Add 'creative' toggle to generateAndReplace

* Generate and replace UI

* Call backend for generate and replace

* Change creative to unconventional in generate and replace system

* Fix generate and replace

* Add loading states

* Cosmetic changes

* Use sparkle icon

* Cosmetic changes

* Add a clarifying sentence to the prompt when the user asks for a prompt

* Change to markdown

* Add error handling to AI system

* Improve prompt prompt

* Remove 'suggestions loading' message

* Change 'pattern' to 'generate a list of' and fix a bug where i forgot to specify unordered markdown list

* Limit output to n in decode()

* Fix bug in error handling

* TEMP: try to fix autofill

* TEMP: disable autofill

* Finally fix autofill's debouncing

* Improve autofill prompt to handle commands

* Fix typo with semicolon

* Refactor the AI Popover into a new component

* Refactor the AI Popover into a new component

* Refactor the autofill functionality into two backend files

* Minor refactoring and styling fixes

* Parse markdown using markdown library

* Add no_cache flag support in backend to ignore cache for AI popover

* trim quotation marks and escape braces in AI autofill

* Add AI Support Tab in Global Settings pane.

* Convert Jinja braces

* Fix typo in AiPopover import

* Handle template variables with Extend and Autocomplete + Check template variable correctness in outputs

* Escape the braces of generate and replace prompts

* Update prompts to strengthen AI support for multiple template variables

* Log the system message

* Reduce minimum rows required to 1 for autocomplete to begin generating

* Reduce min rows to extend to 1 and add warning below 2

* Create a defaultdict utility

* Consider null values as nonexistant in defaultdict

* Make placeholders stick to their assigned text field without using defaultdict

* Make placeholder logic more readable

* Cache rendering of text fields to avoid expensive computation

* Calculate whether to refresh suggestions based on expected suggestions instead of previous suggestions

* Fix bug where LLM was returning templates in generate and replace where none was requested

* Force re-render of text fields on Extend

* Add Sean Yang to README

* Add GenAI support to Items Node

* Pass front-end API keys to AI support features

* Escape braces on Items Node outputs

* Update package to 0.2.8

* Disable autosaving if it takes 1 second or longer to save to localStorage

* Skip autosave when browser tab is inactive

* Fetch environment API keys only once upon load

* Check for OpenAI API key in AIPopover. If not present, display Alert.

---------

Co-authored-by: Sean Yang <53060248+shawseanyang@users.noreply.github.com>
  • Loading branch information
ianarawjo and shawseanyang committed Dec 13, 2023
1 parent bacf61b commit ce583a2
Show file tree
Hide file tree
Showing 33 changed files with 1,834 additions and 131 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ For more specific details, see the [Node Guide](https://github.com/ianarawjo/Cha

# Development

ChainForge was created by [Ian Arawjo](http://ianarawjo.com/index.html), a postdoctoral scholar in Harvard HCI's [Glassman Lab](http://glassmanlab.seas.harvard.edu/) with support from the Harvard HCI community. Collaborators include PhD students [Priyan Vaithilingam](https://priyan.info) and [Chelse Swoopes](https://seas.harvard.edu/person/chelse-swoopes) and faculty members [Elena Glassman](http://glassmanlab.seas.harvard.edu/glassman.html) and [Martin Wattenberg](https://www.bewitched.com/about.html).
ChainForge was created by [Ian Arawjo](http://ianarawjo.com/index.html), a postdoctoral scholar in Harvard HCI's [Glassman Lab](http://glassmanlab.seas.harvard.edu/) with support from the Harvard HCI community. Collaborators include PhD students [Priyan Vaithilingam](https://priyan.info) and [Chelse Swoopes](https://seas.harvard.edu/person/chelse-swoopes), Harvard undergraduate [Sean Yang](https://shawsean.com), and faculty members [Elena Glassman](http://glassmanlab.seas.harvard.edu/glassman.html) and [Martin Wattenberg](https://www.bewitched.com/about.html).

This work was partially funded by the NSF grants IIS-2107391, IIS-2040880, and IIS-1955699. Any opinions, findings, and conclusions or recommendations expressed in this material are those of the author(s) and do not necessarily reflect the views of the National Science Foundation.

Expand Down
12 changes: 6 additions & 6 deletions chainforge/react-server/build/asset-manifest.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
{
"files": {
"main.css": "/static/css/main.ff59165b.css",
"main.js": "/static/js/main.760fe716.js",
"main.css": "/static/css/main.847ce933.css",
"main.js": "/static/js/main.72d00c7c.js",
"static/js/787.4c72bb55.chunk.js": "/static/js/787.4c72bb55.chunk.js",
"index.html": "/index.html",
"main.ff59165b.css.map": "/static/css/main.ff59165b.css.map",
"main.760fe716.js.map": "/static/js/main.760fe716.js.map",
"main.847ce933.css.map": "/static/css/main.847ce933.css.map",
"main.72d00c7c.js.map": "/static/js/main.72d00c7c.js.map",
"787.4c72bb55.chunk.js.map": "/static/js/787.4c72bb55.chunk.js.map"
},
"entrypoints": [
"static/css/main.ff59165b.css",
"static/js/main.760fe716.js"
"static/css/main.847ce933.css",
"static/js/main.72d00c7c.js"
]
}
2 changes: 1 addition & 1 deletion chainforge/react-server/build/index.html
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<!doctype html><html lang="en"><head><meta charset="utf-8"/><script async src="https://www.googletagmanager.com/gtag/js?id=G-RN3FDBLMCR"></script><script>function gtag(){dataLayer.push(arguments)}window.dataLayer=window.dataLayer||[],gtag("js",new Date),gtag("config","G-RN3FDBLMCR")</script><link rel="icon" href="/favicon.ico"/><meta name="viewport" content="width=device-width,initial-scale=1"/><meta name="theme-color" content="#000000"/><meta name="description" content="A visual programming environment for prompt engineering"/><link rel="apple-touch-icon" href="/logo192.png"/><link rel="manifest" href="/manifest.json"/><title>ChainForge</title><script defer="defer" src="/static/js/main.760fe716.js"></script><link href="/static/css/main.ff59165b.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div></body></html>
<!doctype html><html lang="en"><head><meta charset="utf-8"/><script async src="https://www.googletagmanager.com/gtag/js?id=G-RN3FDBLMCR"></script><script>function gtag(){dataLayer.push(arguments)}window.dataLayer=window.dataLayer||[],gtag("js",new Date),gtag("config","G-RN3FDBLMCR")</script><link rel="icon" href="/favicon.ico"/><meta name="viewport" content="width=device-width,initial-scale=1"/><meta name="theme-color" content="#000000"/><meta name="description" content="A visual programming environment for prompt engineering"/><link rel="apple-touch-icon" href="/logo192.png"/><link rel="manifest" href="/manifest.json"/><title>ChainForge</title><script defer="defer" src="/static/js/main.72d00c7c.js"></script><link href="/static/css/main.847ce933.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div></body></html>

Large diffs are not rendered by default.

Large diffs are not rendered by default.

This file was deleted.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Loading

0 comments on commit ce583a2

Please sign in to comment.