Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions frontend/src/components/widgets/ChatWidget.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ const ChatWidget = ({
const [apiKey, setApiKey] = useState('');
const [isLoading, setIsLoading] = useState(false);
const [error, setError] = useState(null);
const hasApiKey = useMemo(() => !!sessionStorage.getItem('openai_api_key'), []);

const [hasApiKey, setHasApiKey] = useState(!!sessionStorage.getItem('openai_api_key'));

// Add this state to store the processed context
const [sourceContext, setSourceContext] = useState(null);
Expand Down Expand Up @@ -169,7 +170,8 @@ const ChatWidget = ({
if (apiKey.trim()) {
sessionStorage.setItem('openai_api_key', apiKey.trim());
setShowSettings(false);
window.location.reload(); // Refresh to update hasApiKey state

setHasApiKey(true);
}
};

Expand Down