Skip to content

Commit

Permalink
Fix title generation
Browse files Browse the repository at this point in the history
  • Loading branch information
dkotter committed Oct 16, 2024
1 parent cd7514c commit 3457370
Showing 1 changed file with 7 additions and 11 deletions.
18 changes: 7 additions & 11 deletions src/js/features/title-generation/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,17 +68,13 @@ const TitleGenerationPlugin = () => {
} ).then(
async ( res ) => {
// Support calling a function from the response for browser AI.
if ( typeof res === 'object' ) {
if ( res.hasOwnProperty( 'func' ) ) {
res = await browserAITextGeneration(
res.func,
res?.prompt,
res?.content
);
res = [ res.trim() ];
} else {
res = [];
}
if ( typeof res === 'object' && res.hasOwnProperty( 'func' ) ) {
res = await browserAITextGeneration(
res.func,
res?.prompt,
res?.content
);
res = [ res.trim() ];
}

setData( res );
Expand Down

0 comments on commit 3457370

Please sign in to comment.