gptscript-ai / gptscript

Build AI assistants that interact with your systems
https://gptscript.ai
Apache License 2.0
3.07k stars 270 forks source link

fix: modify credential refresh to support stacked contexts #856

Closed g-linville closed 1 month ago

g-linville commented 1 month ago

The stacked credentials feature was not working with credential refresh until this PR. The refreshed credential used to be stored into the highest priority context, even if it previously existed in a different context.

For example, say I had credential cred in context one, and then I do gptscript --credential-context two,one <script>. The script uses the cred credential, so it gets refreshed. GPTScript was storing the new refreshed credential in the context two, even though it previously existed in one.

This PR changes it so that refreshed credentials are always stored in the context from which they came.