Skip to content

[Feat] Provider backend registry for multi-backend support and better code maintenance  #55

Description

@PyDevC

Files: lua/model_cmp/modelapi/common.lua:44-57

Feature Introduction: Currently adding a new AI backend requires modifying common.lua's if-else chain. A registry pattern lets any backend register itself with a single call.

Feature Description:

-- lua/model_cmp/modelapi/init.lua
function M.register(name, provider)
    providers[name] = provider
end

-- lua/model_cmp/modelapi/codestral.lua
require("model_cmp.modelapi").register("codestral", {
    generate_request = function(prompt) ... end,
})

Benefits:

  • New backends are single-file additions
  • User can configure which backends to load
  • Clean separation of concerns

Is your feature possible with the current status of repo? Yes. Pure refactor — no behavior changes needed.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    AI genIssue was generated by AIenhancementNew feature or request

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions