Skip to content

Commit

Permalink
Fix previewer for azure OpenAI embeddings provider.
Browse files Browse the repository at this point in the history
  • Loading branch information
iamdharmesh committed Sep 18, 2024
1 parent cdddf5a commit 14fcc4c
Showing 1 changed file with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -261,11 +261,11 @@ function PostSelector( { placeholder = '', showLabel = true } ) {
const { setSelectedPostId } = useContext( PreviewerProviderContext );
const [ searchText, setSearchText ] = useState( '' );
const [ searchResults, setSearchResults ] = useState( [] );
const [ shouldSearch, setShoudlSearch ] = useState( true );
const [ shouldSearch, setShouldSearch ] = useState( true );
const debouncedSearch = useDebounce( setSearchText, 1000 );

function selectPost( post ) {
setShoudlSearch( false );
setShouldSearch( false );
setSelectedPostId( post.id );
setSearchText( post.title );
setSearchResults( [] );
Expand Down Expand Up @@ -335,14 +335,14 @@ function PostSelector( { placeholder = '', showLabel = true } ) {
__( 'Search a post by title…', 'classifai' )
}
onChange={ ( text ) => {
setShoudlSearch( true );
setShouldSearch( true );
debouncedSearch( text );
} }
onClose={ () => {
setSearchText( '' );
setSelectedPostId( 0 );
setSearchResults( [] );
setShoudlSearch( true );
setShouldSearch( true );
} }
/>
{ searchResults.length ? (
Expand Down Expand Up @@ -371,10 +371,10 @@ function PreviewerResults() {

return (
<div className="classifai__classification-previewer-search-result-container">
{ 'azure_openai_embeddings' === activeProvider ||
( 'openai_embeddings' === activeProvider && (
<AzureOpenAIEmbeddingsResults postId={ selectedPostId } />
) ) }
{ ( 'azure_openai_embeddings' === activeProvider ||
'openai_embeddings' === activeProvider ) && (
<AzureOpenAIEmbeddingsResults postId={ selectedPostId } />
) }
{ 'ibm_watson_nlu' === activeProvider && (
<IBMWatsonNLUResults postId={ selectedPostId } />
) }
Expand Down

0 comments on commit 14fcc4c

Please sign in to comment.