ChuloAI / BrainChulo

Harnessing the Memory Power of the Camelids
MIT License
145 stars 11 forks source link

Backend Plugin Creation #41

Closed iGavroche closed 1 year ago

iGavroche commented 1 year ago

Backend Plugins, in this iteration, allow the creation of routes, controllers, and models.

The next iteration should address Views, followed by "framework" hooks and better documentation.

iGavroche commented 1 year ago

Should be a step in the right direction for #33

paolorechia commented 1 year ago

Hi, @iGavroche not sure if I follow the idea on this PR.

From what I see from the PR, you describe a process to add:

  1. new database tables to the app
  2. add a new HTTP router to the app

This is pretty cool, but I don't see yet how this enables users to modify the current behaviour of the system.

Also, I think in general the process should be simpler for the plugin developer. A few common patterns I used to see when working with integrations:

  1. Webhooks, when you and to add functionality in the backend.
  2. Iframes, when you want to allow users to extend the current UI.

Of course, then for webhooks we'd need to also define some hooking API. When does each web hook get called. Is it when the LLM thinks? Is it before it process the user input? Is it after the LLM answers but before displaying etc

The same thinking applies to iframes - what components should be extensible by design. Obviously, the more extensible it is, the harder it gets to engineer it properly.

I would argue that coming with the hooking API is more important than allowing users to implement additional tables.

iGavroche commented 1 year ago

@paolorechia very valid points! I agree with all of them. My current approach is to first allow Models & Controllers, followed by Views. Views will necessarily bring a concept of hooks so we can add components in the different parts of the UI, as well as defining new pages.

For the backend, hooks are a must-have too.

The way I'm mind-mapping this is I want to design the ability to create blog posts and push them to an existing wordpress site. This will require new models to store API credential settings, known posts and other metadata; a UI settings page, an interface to push bot-created content through the wordpress API, via backend REST endpoints :)

paolorechia commented 1 year ago

Alright, I suppose it makes sense the way you're planning, since we're always running this locally.

iGavroche commented 1 year ago

@paolorechia oh i now understand why you were reluctant about it. Oh yes, the approach is very opinionated with the "local" mindset. You own and operate your own service, there is no cloud concept here, and not external central source of truth.