Skip to content

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

Open

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

  1. added
    enhancement
    AI gen
    on May 24, 2026
  2. changed the title [-][Feat] Provider registry — register backends instead of if-else dispatch[/-] [+][Feat] Provider backend registry for multi-backend support and better code maintenance [/+] on May 26, 2026
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 genenhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions