Skip to content

Feat: Add Ollama Support#12

Open
CPritch wants to merge 41 commits into
RosettaTechnologies:mainfrom
CPritch:feat-ollama
Open

Feat: Add Ollama Support#12
CPritch wants to merge 41 commits into
RosettaTechnologies:mainfrom
CPritch:feat-ollama

Conversation

@CPritch

@CPritch CPritch commented Jun 4, 2024

Copy link
Copy Markdown

Hey there, here's a PR for adding Ollama to AnkiBrain. Had some fun during my time off to get this implemented.
I think I've covered most of the bases here and didn't want to tinker too much with your current codebase or make any sweeping changes.

I suspect you'll want to change this PR to be merged into a new 0.7.4 branch. I'm not 100% clued in on your release process so I haven't touched anything like version numbers or change logs. Just MVP as far as I can tell.

I've added the following changes:

  • Reworked Advanced Settings to use Grid layout
  • Add 'Set Ollama Host' menu item
    • For pointing at any custom Ollama hosted instance
    • Adds new setting 'ollamaHost' to settings.json
  • Added LLM Providers to Advanced Settings Page
    • OpenAI or Ollama
    • Adds new setting 'llmProvider' to settings.json
    • Available Ollama models are loaded over API
  • Updated Local ChatAI initialization
    • Now checks for provider and ollama server availability
    • Loads available ollama models over API
  • Added JSONRepair to fix nearly correct JSON returned by LLMs

I believe it should handle the settings changes pretty gracefully but I'm not 100% on whether I've missed anything. I believe I've updated the python requirements correctly etc. I haven't been able to test all behaviour though as I don't use OpenAI.

Let me know if you have any issues or want me to change/address anything about this PR.
Cool project though! Can see you've put a bunch of time into the codebase, I have a ton of suggestions for refactoring in general that I might be able to help with at some point soon. Just would help trim down the fat before adding any more functionality.

@eshahrabani

Copy link
Copy Markdown
Collaborator

Thanks for the massive pull request! It'll take me some time to get to reviewing this, but I plan to. I would like to upgrade dependencies where I can then integrate these changes. Ollama support will be great to have!

@MazingerZetto

Copy link
Copy Markdown

Hi @CPritch
I downloaded your PR (from https://github.com/CPritch/AnkiBrain/tree/feat-ollama), and unzipped it inside the addons21 folder, however, after installing it, I get a "Your file couldn't be accessed" error in the GUI. Did that happen to you as well while developing / testing?

@ashwathpalanisamy

Copy link
Copy Markdown

Hi @CPritch I downloaded your PR (from https://github.com/CPritch/AnkiBrain/tree/feat-ollama), and unzipped it inside the addons21 folder, however, after installing it, I get a "Your file couldn't be accessed" error in the GUI. Did that happen to you as well while developing / testing?

Yeah, i am also getting the same error. @CPritch can you please help me resolve that error?

@robkipa

robkipa commented Dec 28, 2024

Copy link
Copy Markdown

didn't mean to approve, can't find a way to discard.... trying to bungle my way around VScode to test these changes...

@Williamtung1

Williamtung1 commented Feb 5, 2025

Copy link
Copy Markdown

Hi @CPritch I downloaded your PR (from CPritch/AnkiBrain@feat-ollama), and unzipped it inside the addons21 folder, however, after installing it, I get a "Your file couldn't be accessed" error in the GUI. Did that happen to you as well while developing / testing?

@CPritch I am having the same issue as well, can you please give some help as to why this happening and how to solve the issue
image

@robkipa

robkipa commented Feb 5, 2025

Copy link
Copy Markdown

@Williamtung1 @ashwathpalanisamy @MazingerZetto From what I remember, this is because you need to run 'npm run build' in the webview folder.

See README.md here: https://github.com/CPritch/AnkiBrain/tree/feat-ollama/webview

@Williamtung1

Copy link
Copy Markdown

@robkipa I really appreciate that. When you say the solution out loud, to me I feel like an utter idiot for forgetting about such basics. Again, thank you very much.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants