magic-commit icon indicating copy to clipboard operation
magic-commit copied to clipboard

📦 new: add ollama as model provider

Open promiseer opened this issue 1 year ago • 10 comments

This pull request includes changes to the package.json, source/app.js, source/utils/commit.js, source/utils/config.json, and source/utils/openai.js files to enhance code readability, promote a component-based structure, remove unused code, and adhere to the DRY principle.

As suggested, we introduced modifications for the Ollama provider, necessitating substantial changes that I believe are essential. Additionally, we added source/utils/ollama.js and source/utils/modelSelection.js.

Enhancements:

  • package.json: Improved script condition to handle missing directories.
  • source/app.js: Moved OpenAI configuration to utils/openAI.js for better readability; implemented a modal selection component for choosing the provider.
  • source/utils/commit.js: Consolidated all Git-related functions and modules into this file.
  • source/utils/config.json: Enhanced configuration with clearer names and added support for additional models.
  • source/utils/generateCommitMessage.js: Created a separate module for prompt generation based on provider.
  • source/utils/modelSelection.js: Developed a component for provider selection.
  • source/utils/ollama.js: Integrated Ollama configuration and prompt response handling.
  • source/utils/openai.js: Updated existing OpenAI configuration for improved readability.

@warengonzaga, I'm awaiting your code review and would appreciate your feedback to enhance the code.

promiseer avatar Oct 16 '24 13:10 promiseer

You have some git conflicts @promiseer also I think it's time to make another folder called "models" so we can keep adding supported models for the tool.

warengonzaga avatar Oct 16 '24 14:10 warengonzaga

You have some git conflicts @promiseer also I think it's time to make another folder called "models" so we can keep adding supported models for the tool.

Merge conflicts are fixed; now I'm adding the models folder.

promiseer avatar Oct 16 '24 15:10 promiseer

All the mentioned changes have been completed, @warengonzaga.

promiseer avatar Oct 16 '24 15:10 promiseer

Hey @promiseer, did you add an option to the CLI for which model to use? Do you have a demo?

warengonzaga avatar Oct 17 '24 15:10 warengonzaga

@warengonzaga here is the demo video

https://github.com/user-attachments/assets/bf257b82-35e3-494e-b076-c9d2fa3cc5dc

promiseer avatar Oct 17 '24 15:10 promiseer

Interesting, does that mean @promiseer everytime you command "magicc" it will ask for which model? I'm thinking of adding a flag for selecting modal then save the config with "Conf" so that everytime we use "magicc" command it will not ask for model.

warengonzaga avatar Oct 18 '24 04:10 warengonzaga

You are correct, as users to click each time will lead to a poor experience. let me fix this

promiseer avatar Oct 18 '24 05:10 promiseer

You are correct, as users to click each time will lead to a poor experience. let me fix this

You can use the package "Conf" to save configuration we can use that to store some data of the user.

warengonzaga avatar Oct 18 '24 06:10 warengonzaga

What's the update here, @promiseer? Let's add the ability to select a model by defining it as a flag.

warengonzaga avatar Oct 19 '24 17:10 warengonzaga

Hey, @promiseer, just checking if we can add it to your PR. Otherwise, I will continue it.

warengonzaga avatar Feb 10 '25 08:02 warengonzaga

Okay I will merge this to the dev branch and then from there I will fix your update.

warengonzaga avatar Jul 13 '25 03:07 warengonzaga