Skip to content

Fix gemini-model node ignoring api key and model changes - #108

Open
rootkiller6788 wants to merge 1 commit into
google:mainfrom
rootkiller6788:fix-gemini-model-rebuild
Open

Fix gemini-model node ignoring api key and model changes#108
rootkiller6788 wants to merge 1 commit into
google:mainfrom
rootkiller6788:fix-gemini-model-rebuild

Conversation

@rootkiller6788

Copy link
Copy Markdown

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.

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.
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.

1 participant