mirror of
https://github.com/mudler/LocalAI.git
synced 2026-11-07 04:53:24 -05:00
feat(addons): GitHub add-on skeleton and read tools
Add the github add-on: manifest with a credential slot, a read-only tool set (code search, files, trees, issues, pull requests and diffs) with size caps and untrusted-content framing, rate-limit mapping, a connector route that checks the token, and a fake GitHub API for tests. Assisted-by: Claude:claude-sonnet-5-5 [go]
This commit is contained in:
7 files changed
+886
No files matched your search
@@ -0,0 +1,35 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
// Command github is the executable of the GitHub add-on. It reads repositories
|
||||
// for the chats and the agents with a token that the host keeps for the person
|
||||
// and hands over with each call. The add-on stores no token and writes nothing
|
||||
// to GitHub.
|
||||
package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"os"
|
||||
|
||||
"github.com/mudler/LocalAI/addons/github/internal/ghapi"
|
||||
"github.com/mudler/LocalAI/addons/github/internal/platform"
|
||||
"github.com/mudler/LocalAI/addons/github/internal/tools"
|
||||
"github.com/mudler/LocalAI/addons/internal/connector"
|
||||
"github.com/mudler/LocalAI/addons/internal/protocol"
|
||||
"github.com/mudler/LocalAI/pkg/addons/contract"
|
||||
)
|
||||
|
||||
type runtime struct {
|
||||
*tools.Runtime
|
||||
platform platform.Platform
|
||||
}
|
||||
|
||||
func (r runtime) Connector(ctx context.Context, req contract.ConnectorRequest) (contract.ConnectorResponse, error) {
|
||||
return connector.Serve(ctx, r.platform, req)
|
||||
}
|
||||
|
||||
func main() {
|
||||
os.Exit(protocol.Run(os.Args, func(protocol.Startup) contract.Runtime {
|
||||
api := ghapi.New()
|
||||
return runtime{Runtime: tools.New(api), platform: platform.Platform{API: api}}
|
||||
}))
|
||||
}
|
||||
Reference in new issue
Block a user