Skip to content

Commit

Permalink
Added better error display for bart
Browse files Browse the repository at this point in the history
  • Loading branch information
frianasoa committed Dec 18, 2023
1 parent dc0ad1e commit 7dd3ba1
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 15 deletions.
2 changes: 0 additions & 2 deletions content/notes/menus.js
Original file line number Diff line number Diff line change
Expand Up @@ -418,8 +418,6 @@ Menus = {
data = Table.tabledata(td.closest("tr"));
}



if(Zotero.ZeNotes.Prefs.getb("bard-api-key")=="")
{
alert("Please set API key first.\nGo to ZeNotes > Settings > General Settings > AI API settings");
Expand Down
16 changes: 11 additions & 5 deletions core/ai.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,19 @@ Ai={
return Promise.resolve(data.candidates.map(function(v){return v.content.parts.map(function(w){return w.text })}));
}
catch(e) {
if(data.candidates[0].finishReason=="OTHER")
{
return Promise.resolve(["Error: No results found!"]);
try {
if(data.candidates[0].finishReason=="OTHER")
{
return Promise.resolve(["Error: No results found!"]);
}
else
{
return Promise.resolve([e, JSON.stringify(data)]);
}
}
else
catch(e)
{
return Promise.resolve([e]);
return Promise.resolve([e, JSON.stringify(data)]);
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion install.rdf
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<Description about="urn:mozilla:install-manifest">
<em:id>[email protected]</em:id>
<em:name>ZeNotes</em:name>
<em:version>0.6.4.3</em:version>
<em:version>0.6.5</em:version>
<em:multiprocessCompatible>true</em:multiprocessCompatible>
<em:updateURL>https://raw.githubusercontent.com/frianasoa/zenotes/main/zenote-update.json</em:updateURL>
<em:homepageURL>https://github.com/frianasoa/zenotes</em:homepageURL>
Expand Down
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"manifest_version": 2,
"name": "Ze Notes",
"version": "0.6.4.3",
"version": "0.6.5",
"description": "Advanced notes manager",
"homepage_url": "https://github.com/frianasoa/zenotes",
"author": "Fanantenana Rianasoa Andriariniaina",
Expand Down
6 changes: 3 additions & 3 deletions zenote-update.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
"[email protected]": {
"updates": [
{
"version": "0.6.4.3",
"update_link": "https://github.com/frianasoa/Ze-Notes/releases/download/v0.6.4.3/zenotes-v0.6.4.3.xpi",
"update_hash": "sha256:880a362c4c6404d1f093aa7bcd11c1ad9e298cc915ff5d83136eea9137f94ccd",
"version": "0.6.5",
"update_link": "https://github.com/frianasoa/Ze-Notes/releases/download/v0.6.5/zenotes-v0.6.5.xpi",
"update_hash": "sha256:16a72706ada3e65f6125324804f97ef9042a5819598c08947ccc078735a535f1",
"applications": {
"gecko": {
"strict_min_version": "60.0"
Expand Down
6 changes: 3 additions & 3 deletions zenote-update.rdf
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@
<rdf:Seq>
<rdf:li>
<rdf:Description>
<ns1:version>0.6.4.3</ns1:version>
<ns1:version>0.6.5</ns1:version>
<ns1:targetApplication>
<rdf:Description>
<ns1:id>[email protected]</ns1:id>
<ns1:minVersion>5.0.0</ns1:minVersion>
<ns1:maxVersion>6.*</ns1:maxVersion>
<ns1:updateLink>https://github.com/frianasoa/Ze-Notes/releases/download/v0.6.4.3/zenotes-v0.6.4.3.xpi</ns1:updateLink>
<ns1:updateLink>https://github.com/frianasoa/Ze-Notes/releases/download/v0.6.5/zenotes-v0.6.5.xpi</ns1:updateLink>
</rdf:Description>
</ns1:targetApplication>

Expand All @@ -20,7 +20,7 @@
<ns1:id>[email protected]</ns1:id>
<ns1:minVersion>4.999</ns1:minVersion>
<ns1:maxVersion>6.*</ns1:maxVersion>
<ns1:updateLink>https://github.com/frianasoa/Ze-Notes/releases/download/v0.6.4.3/zenotes-v0.6.4.3.xpi</ns1:updateLink>
<ns1:updateLink>https://github.com/frianasoa/Ze-Notes/releases/download/v0.6.5/zenotes-v0.6.5.xpi</ns1:updateLink>
</rdf:Description>
</ns1:targetApplication>

Expand Down

0 comments on commit 7dd3ba1

Please sign in to comment.