Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error popup with message: 'results' #1

Open
pickleton89 opened this issue Feb 18, 2023 · 8 comments
Open

Error popup with message: 'results' #1

pickleton89 opened this issue Feb 18, 2023 · 8 comments
Labels
bug Something isn't working

Comments

@pickleton89
Copy link

Hello,
I installed smoothbrain as you outlined, however on my first run, I get the attached 'results' error. I am on ANKI 2.1.54. I double checked and it looks like everything is set up according to your specs. API keys are put in the add-on dialog box between the double quotes.
Screenshot of Anki (2-18-23, 9-10-08 AM)

@alexbowe alexbowe added the bug Something isn't working label Feb 19, 2023
@alexbowe
Copy link
Collaborator

@pickleton89 Thanks for submitting the first ticket for this project :) and I appreciate all the details you've given me.

Anki seems to have a default exception handler that unfortunately removes a lot of useful information, but since the only time a string "results" is being used in the code is in the Readwise API query, I think it is to do with that (and "results" not being present in the response).

I think the correct approach for me is to intercept their exception handler and make it print more information.

But in the meantime, if you run this in your terminal what is the output?

curl -X GET \
  "https://readwise.io/api/v2/export/" \
  -H "Authorization: Token <your token from https://readwise.io/access_token>"

@alexbowe alexbowe changed the title Error on running 'results Feb 19, 2023
@alexbowe alexbowe changed the title 'results Error popup with message: 'results' Feb 19, 2023
@pickleton89
Copy link
Author

I ran the command and looks like I got the full content of my readwise library. Here are a few lines:
{"count": 517, "nextPageCursor": 21417544, "results": [{"user_book_id": 24584489, "title": "To Teach Computers Math, Researchers Merge AI Approaches", "author": "Kevin Hartnett", "readable_title": "To Teach Computers Math, Researchers Merge AI Approaches", "source": "reader", "cover_image_url": "https://d2r55xnwy6nx47.cloudfront.net/uploads/2023/02/QuantitativeLLMs-byValentinTkach-Social.webp", "unique_url": "https://read.readwise.io/read/01gsqpqmhz5mrth7074ds3676j", "book_tags": [{"id": 3461170, "name": "math"}, {"id": 3461169, "name": "ai"}], "category": "articles", "document_note": null, "readwise_url": "https://readwise.io/bookreview/24584489", "source_url": "https://www.quantamagazine.org/to-teach-computers-math-researchers-merge-ai-approaches-20230215?ref=refind", "asin": null, "highlights": [{"id": 479394054, "text": "Machine learning models based on a technique called reinforcement learning allow computers to learn from their mistakes to become prodigies at games like chess and Go.", "location": 7538, "location_type": "offset", "note": "", "color": "", "highlighted_at": "2023-02-20T15:24:18.506Z", "created_at": "2023-02-20T15:24:18.538Z", "updated_at": "2023-02-20T15:24:18.538Z", "external_id": "01gsqpsy2srb4yrz5c6rg2tz39", "end_location": null, "url": "https://read.readwise.io/read/01gsqpsy2srb4yrz5c6rg2tz39", "book_id": 24584489, "tags": []....

@alexbowe
Copy link
Collaborator

Thanks for that. It looks like it isn't a problem with your Readwise then. I think fixing this is blocked on #2, otherwise I'd be debugging blind. I'll update you when I have that implemented.

@alexbowe
Copy link
Collaborator

@pickleton89 I improved logging (for the Readwise query at least) in #8. If you have some time, please update to 0.2.0 and try again, then send me the smoothbrain.log file in the plugin root directory so I can see what's happening. Thanks!

@alexbowe
Copy link
Collaborator

Thanks @pickleton89. That seems to be a log for an Obsidian OCR plugin though. This is for the Smoothbrain Anki plugin (where you were getting the "results" popup error). Would you mind sending the log for that?

Cheers!

@pickleton89
Copy link
Author

Stupid me. Working on too many things and getting confused. I updated to the new version. Ran it and got this in the anki error:
Error
An error occurred. Please start Anki while holding down the shift key, which will temporarily disable the add-ons you have installed.
If the issue only occurs when add-ons are enabled, please use the Tools > Add-ons menu item to disable some add-ons and restart Anki, repeating until you discover the add-on that is causing the problem.
When you've discovered the add-on that is causing the problem, please report the issue to the add-on author.
Debug info:
Anki 2.1.54 (b6a7760c) Python 3.9.7 Qt 6.3.1 PyQt 6.3.1
Platform: Mac 13.2.1
Flags: frz=True ao=True sv=3
Add-ons, last update check: 2023-02-24 08:19:50
Add-ons possibly involved: ⁨smoothbrain⁩

Caught exception:
Traceback (most recent call last):
File "/Users/jeffkiefer/Library/Application Support/Anki2/addons21/smoothbrain/vendor/openai/openai_object.py", line 59, in getattr
return self[k]
KeyError: 'choices'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "aqt.taskman", line 122, in _on_closures_pending
File "aqt.taskman", line 71, in
File "aqt.operations", line 257, in wrapped_done
File "/Users/jeffkiefer/Library/Application Support/Anki2/addons21/smoothbrain/init.py", line 112, in update_card
completions = [c.choices[0].text.strip() for c in completions]
File "/Users/jeffkiefer/Library/Application Support/Anki2/addons21/smoothbrain/init.py", line 112, in
completions = [c.choices[0].text.strip() for c in completions]
File "/Users/jeffkiefer/Library/Application Support/Anki2/addons21/smoothbrain/vendor/openai/openai_object.py", line 61, in getattr
raise AttributeError(*err.args)
AttributeError: choices

@alexbowe
Copy link
Collaborator

No problem! I'm struggling to stay on top of everything too ;)

That is a super helpful stack trace. I'll have to look into why GPT might not have a choices field. I wonder if it is rate limiting?
At least the Readwise query seems to be completing now though.

Will get back to you soon!

@Strangeluv
Copy link

Could you solve the issue? Im getting a very similar error:

Anki 2.1.66 (70506aeb) Python 3.9.15 Qt 6.5.0 PyQt 6.5.0
Platform: macOS-13.4-x86_64-i386-64bit
Flags: frz=True ao=True sv=2
Add-ons, last update check: 2023-11-28 23:38:10
Add-ons possibly involved: ⁨smoothbrain⁩

Caught exception:
Traceback (most recent call last):
File "aqt.taskman", line 122, in _on_closures_pending
File "aqt.taskman", line 71, in
File "aqt.operations", line 250, in wrapped_done
File "/Users/abc/Library/Application Support/Anki2/addons21/smoothbrain/init.py", line 117, in update_card
note = mw.col.new_note(model)
File "anki.collection", line 567, in new_note
File "anki.notes", line 52, in init
File "anki._backend_generated", line 1030, in new_note
File "anki._backend", line 151, in _run_command
anki.errors.NotFoundError: Your database appears to be in an inconsistent state. Please use the Check Database action.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants