Oneirocom / Magick

Magick is a cutting-edge toolkit for a new kind of AI builder. Make Magick with us!
https://magickml.com
Other
686 stars 112 forks source link

Remote plugin #1287

Closed michaelsharpe closed 1 year ago

michaelsharpe commented 1 year ago

What Changed:

Large graphs were problematic on the client because on every save, the whole graph would get reloaded into memory. This was because we had the nodes subscription occurring inside the worker, which would be rerun on save because of the task plugin.

Since we run all the work on the server, there was no need to have the worker hold the subscription to the node's work on the server. It also meant I could remove the task plugin completely from the client.

To do this, I wrote a new RemotePlugin which subscribes to individual node events in the builder so it only hooks in once. I got rid of the consolePlugin, SocketOverridePlugin and the EmitPlugin. I also switched from using the raw socket connection to using an event on the agent service for sending spell-running information.

I installed the remote plugin on the shared engine as well only on the server. It uses an emit function passed in which lives on the spellRunner. This currently behaves differently if loaded on the server vs on an agent. However, once we move this off the server onto an agent it should still function well.

Now there should be no lag when working with extremely large graphs on the client side.

How to test:

Use the client to run spells from the playtest. Everything should operate as expected with no changes.

Additional information:

Any other information that might be useful while reviewing.

vercel[bot] commented 1 year ago

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
magick-client ✅ Ready (Inspect) Visit Preview 💬 Add feedback Sep 5, 2023 9:08pm
magick-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Sep 5, 2023 9:08pm