Skip to content

Commit

Permalink
Add logic to handle empty API key and create OpenAI instance
Browse files Browse the repository at this point in the history
  • Loading branch information
felri committed Dec 11, 2023
1 parent 5dc853f commit a1bc3f2
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/components/FlowComponents/apiKey.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,15 @@ function ApiKeyNode({ id }) {

const onChange = (e) => {
setApiKey(e.target.value);
if (e.target.value.length === 0) {
store((state) => {
state.openAIInstance = null;
});
}

if (e.target.value.length > 0) {
createOpenAIInstance();
}
};

useEffect(() => {
Expand Down

0 comments on commit a1bc3f2

Please sign in to comment.