Skip to content

Conversation

@psychedelicious
Copy link
Contributor

fix(ui): check for metadataAccumulator before connecting to it

Fixes an edge case in graph building.

feat(ui): fix a lot of model-related crashes/bugs

We were storing all types of models by their model ID, which is a format like sd-1/main/deliberate.

This meant we had to do a lot of extra parsing, because nodes actually wants something like {base_model: 'sd-1', model_name: 'deliberate'}.

Some of this parsing was done with zod's error-throwing parse() method, and in other places it was done with brittle string parsing.

This commit refactors the state to use the object form of models.

There is still a bit of string parsing done in the to construct the ID from the object form, but it's far less complicated.

Also, the zod parsing is now done using safeParse(), which does not throw. This requires a few more conditional checks, but should prevent further crashes.

feat(ui): update node editor to use model object format

similar to the previous commit, update the node editor to not just store models as strings - instead, store the model object.

the model select components in nodes are now just kinda copy-pastes over the linear UI versions of the same components, but they were different enough that we can't just share them.

i explored adding some props to override the linear ui components' logic, but it was too brittle. so just copy/paste.

We were storing all types of models by their model ID, which is a format like `sd-1/main/deliberate`.

This meant we had to do a lot of extra parsing, because nodes actually wants something like `{base_model: 'sd-1', model_name: 'deliberate'}`.

Some of this parsing was done with zod's error-throwing `parse()` method, and in other places it was done with brittle string parsing.

This commit refactors the state to use the object form of models.

There is still a bit of string parsing done in the to construct the ID from the object form, but it's far less complicated.

Also, the zod parsing is now done using `safeParse()`, which does not throw. This requires a few more conditional checks, but should prevent further crashes.
similar to the previous commit, update the node editor to not just store models as strings - instead, store the model object.

the model select components in nodes are now just kinda copy-pastes over the linear UI versions of the same components, but they were different enough that we can't just share them.

i explored adding some props to override the linear ui components' logic, but it was too brittle. so just copy/paste.
@psychedelicious psychedelicious changed the title Fix/UI/random fixes ui: model-related fixes Jul 14, 2023
@psychedelicious psychedelicious merged commit 5c58bc6 into main Jul 14, 2023
@psychedelicious psychedelicious deleted the fix/ui/random-fixes branch July 14, 2023 06:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants