Fix gemini-model node ignoring api key and model changes - #108
Open
rootkiller6788 wants to merge 1 commit into
Open
Fix gemini-model node ignoring api key and model changes#108rootkiller6788 wants to merge 1 commit into
rootkiller6788 wants to merge 1 commit into
Conversation
run() checked the new inputs against this.lastInputs, but PureFunctionNode.forcedRun() overwrites lastInputs with the current inputs before calling run(), so the comparison was always equal and the GoogleGenAI client / selected model were never rebuilt. Changing the api key or the model dropdown therefore had no effect after the first run. Remember which key the client was built with and rebuild only when that changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Changing the api key or the model dropdown on a gemini-model node did nothing after the first run -- requests kept going out with the original client and model.
Root cause: run() decided whether to rebuild by comparing the new inputs against this.lastInputs, but PureFunctionNode.forcedRun() sets lastInputs to the current inputs before it calls run(), so the comparison always matched and the rebuild branch never fired.
The node now remembers which api key its GoogleGenAI client was built with and only builds a new client when that key actually changes; the selected model is updated the same way.
Verified by running the real PureFunctionNode + GeminiModel code (GoogleGenAI stubbed) through a small harness: before the fix, switching the key K1 -> K2 still returned responses from the K1 client and switching the model A -> B still requested A; after the fix both changes take effect. tsc and eslint both pass in the gemini package.