address parsing of product
Google Gemini always wants to return in MarkDown, so let's fix that.
This commit is contained in:
parent
4e05c31dd0
commit
902da8f8fc
1 changed files with 6 additions and 1 deletions
|
@ -105,7 +105,12 @@ export default class product {
|
|||
PROMPT.push({"text": JSON.stringify(this.details)});
|
||||
|
||||
// Return the analysis
|
||||
this.analysis = JSON.stringify(await analyzer.generate(PROMPT));
|
||||
await analyzer.generate(PROMPT);
|
||||
|
||||
// Remove all markdown formatting.
|
||||
if (analyzer.candidate) {
|
||||
this.analysis = JSON.parse(analyzer.candidate.replace(/(```json|```|`)/g, ''));
|
||||
};
|
||||
};
|
||||
|
||||
return(this.analysis);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue