Compare commits

..

5 Commits

Author SHA1 Message Date
Ettore Di Giacinto
a33425c707 fix(github*): pass by correctly owner and repository
Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
2025-04-17 22:58:59 +02:00
Ettore Di Giacinto
784a4c7969 fix(githubreader): do not use pointers (#53)
Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
2025-04-17 22:45:24 +02:00
dependabot[bot]
43a2a142fa chore(deps-dev): bump globals from 15.15.0 to 16.0.0 in /webui/react-ui (#45)
Bumps [globals](https://github.com/sindresorhus/globals) from 15.15.0 to 16.0.0.
- [Release notes](https://github.com/sindresorhus/globals/releases)
- [Commits](https://github.com/sindresorhus/globals/compare/v15.15.0...v16.0.0)

---
updated-dependencies:
- dependency-name: globals
  dependency-version: 16.0.0
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-04-17 19:53:13 +02:00
Ettore Di Giacinto
8ee5956bdb fix: correct image name, switch to sd-1.5-ggml as default (#51)
* fix: correct image name, switch to flux.1-dev-ggml as default

Signed-off-by: mudler <mudler@localai.io>

* standardize around sd-1.5-ggml since it's smaller

Signed-off-by: mudler <mudler@localai.io>

---------

Signed-off-by: mudler <mudler@localai.io>
2025-04-17 19:52:10 +02:00
Richard Palethorpe
4888dfcdca chore(ui): Switch to text-based Bun lock file to allow diffing (#50)
Signed-off-by: Richard Palethorpe <io@richiejp.com>
2025-04-17 14:43:52 +02:00
9 changed files with 44 additions and 35 deletions

View File

@@ -60,7 +60,7 @@ MODEL_NAME=gemma-3-12b-it docker compose up
# NVIDIA GPU setup with custom multimodal and image models
MODEL_NAME=gemma-3-12b-it \
MULTIMODAL_MODEL=minicpm-v-2_6 \
IMAGE_MODEL=flux.1-dev \
IMAGE_MODEL=flux.1-dev-ggml \
docker compose -f docker-compose.nvidia.yaml up
```
@@ -116,7 +116,7 @@ LocalAGI supports multiple hardware configurations through Docker Compose profil
- Default models:
- Text: `arcee-agent`
- Multimodal: `minicpm-v-2_6`
- Image: `flux.1-dev`
- Image: `sd-1.5-ggml`
- Environment variables:
- `MODEL_NAME`: Text model to use
- `MULTIMODAL_MODEL`: Multimodal model to use
@@ -150,7 +150,7 @@ MODEL_NAME=gemma-3-12b-it docker compose up
# NVIDIA GPU with custom models
MODEL_NAME=gemma-3-12b-it \
MULTIMODAL_MODEL=minicpm-v-2_6 \
IMAGE_MODEL=flux.1-dev \
IMAGE_MODEL=flux.1-dev-ggml \
docker compose -f docker-compose.nvidia.yaml up
# Intel GPU with custom models
@@ -163,7 +163,7 @@ docker compose -f docker-compose.intel.yaml up
If no models are specified, it will use the defaults:
- Text model: `arcee-agent`
- Multimodal model: `minicpm-v-2_6`
- Image model: `flux.1-dev` (NVIDIA) or `sd-1.5-ggml` (Intel)
- Image model: `sd-1.5-ggml`
Good (relatively small) models that have been tested are:

View File

@@ -11,11 +11,6 @@ services:
# On a system with integrated GPU and an Arc 770, this is the Arc 770
- /dev/dri/card1
- /dev/dri/renderD129
command:
- ${MODEL_NAME:-arcee-agent}
- ${MULTIMODAL_MODEL:-minicpm-v-2_6}
- ${IMAGE_MODEL:-sd-1.5-ggml}
- granite-embedding-107m-multilingual
localrecall:
extends:

View File

@@ -6,7 +6,9 @@ services:
environment:
- LOCALAI_SINGLE_ACTIVE_BACKEND=true
- DEBUG=true
image: localai/localai:master-sycl-f32-ffmpeg-core
image: localai/localai:master-cublas-cuda12-ffmpeg-core
# For images with python backends, use:
# image: localai/localai:master-cublas-cuda12-ffmpeg
deploy:
resources:
reservations:

View File

@@ -9,7 +9,7 @@ services:
command:
- ${MODEL_NAME:-arcee-agent}
- ${MULTIMODAL_MODEL:-minicpm-v-2_6}
- ${IMAGE_MODEL:-flux.1-dev}
- ${IMAGE_MODEL:-sd-1.5-ggml}
- granite-embedding-107m-multilingual
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8080/readyz"]

View File

@@ -49,7 +49,8 @@ func (g *GithubIssuesReader) Run(ctx context.Context, params types.ActionParams)
return types.ActionResult{
Result: fmt.Sprintf(
"Issue %d Repository: %s\nTitle: %s\nBody: %s",
*issue.Number, *issue.Repository.FullName, *issue.Title, *issue.Body)}, nil
issue.GetNumber(), issue.GetRepository().GetFullName(), issue.GetTitle(), issue.GetBody()),
}, nil
}
if err != nil {
return types.ActionResult{Result: fmt.Sprintf("Error fetching issue: %s", err.Error())}, err

View File

@@ -18,38 +18,49 @@ type GithubPRCreator struct {
func NewGithubPRCreator(config map[string]string) *GithubPRCreator {
client := github.NewClient(nil).WithAuthToken(config["token"])
defaultBranch := config["defaultBranch"]
if defaultBranch == "" {
defaultBranch = "main" // Default to "main" if not specified
}
return &GithubPRCreator{
client: client,
token: config["token"],
repository: config["repository"],
owner: config["owner"],
customActionName: config["customActionName"],
defaultBranch: config["defaultBranch"],
defaultBranch: defaultBranch,
}
}
func (g *GithubPRCreator) createOrUpdateBranch(ctx context.Context, branchName string) error {
func (g *GithubPRCreator) createOrUpdateBranch(ctx context.Context, branchName string, owner string, repository string) error {
// Get the latest commit SHA from the default branch
ref, _, err := g.client.Git.GetRef(ctx, g.owner, g.repository, "refs/heads/"+g.defaultBranch)
ref, _, err := g.client.Git.GetRef(ctx, owner, repository, "refs/heads/"+g.defaultBranch)
if err != nil {
return fmt.Errorf("failed to get reference: %w", err)
return fmt.Errorf("failed to get reference for default branch %s: %w", g.defaultBranch, err)
}
// Try to get the branch if it exists
_, resp, err := g.client.Git.GetRef(ctx, g.owner, g.repository, "refs/heads/"+branchName)
_, resp, err := g.client.Git.GetRef(ctx, owner, repository, "refs/heads/"+branchName)
if err != nil {
// If branch doesn't exist, create it
if resp != nil && resp.StatusCode == 404 {
if resp == nil {
return fmt.Errorf("failed to check branch existence: %w", err)
}
// If branch doesn't exist (404), create it
if resp.StatusCode == 404 {
newRef := &github.Reference{
Ref: github.String("refs/heads/" + branchName),
Object: &github.GitObject{SHA: ref.Object.SHA},
}
_, _, err = g.client.Git.CreateRef(ctx, g.owner, g.repository, newRef)
_, _, err = g.client.Git.CreateRef(ctx, owner, repository, newRef)
if err != nil {
return fmt.Errorf("failed to create branch: %w", err)
}
return nil
}
// For other errors, return the error
return fmt.Errorf("failed to check branch existence: %w", err)
}
@@ -58,7 +69,7 @@ func (g *GithubPRCreator) createOrUpdateBranch(ctx context.Context, branchName s
Ref: github.String("refs/heads/" + branchName),
Object: &github.GitObject{SHA: ref.Object.SHA},
}
_, _, err = g.client.Git.UpdateRef(ctx, g.owner, g.repository, updateRef, true)
_, _, err = g.client.Git.UpdateRef(ctx, owner, repository, updateRef, true)
if err != nil {
return fmt.Errorf("failed to update branch: %w", err)
}
@@ -66,10 +77,10 @@ func (g *GithubPRCreator) createOrUpdateBranch(ctx context.Context, branchName s
return nil
}
func (g *GithubPRCreator) createOrUpdateFile(ctx context.Context, branch string, filePath string, content string, message string) error {
func (g *GithubPRCreator) createOrUpdateFile(ctx context.Context, branch string, filePath string, content string, message string, owner string, repository string) error {
// Get the current file content if it exists
var sha *string
fileContent, _, _, err := g.client.Repositories.GetContents(ctx, g.owner, g.repository, filePath, &github.RepositoryContentGetOptions{
fileContent, _, _, err := g.client.Repositories.GetContents(ctx, owner, repository, filePath, &github.RepositoryContentGetOptions{
Ref: branch,
})
if err == nil && fileContent != nil {
@@ -77,7 +88,7 @@ func (g *GithubPRCreator) createOrUpdateFile(ctx context.Context, branch string,
}
// Create or update the file
_, _, err = g.client.Repositories.CreateFile(ctx, g.owner, g.repository, filePath, &github.RepositoryContentFileOptions{
_, _, err = g.client.Repositories.CreateFile(ctx, owner, repository, filePath, &github.RepositoryContentFileOptions{
Message: &message,
Content: []byte(content),
Branch: &branch,
@@ -118,14 +129,14 @@ func (g *GithubPRCreator) Run(ctx context.Context, params types.ActionParams) (t
}
// Create or update branch
err = g.createOrUpdateBranch(ctx, result.Branch)
err = g.createOrUpdateBranch(ctx, result.Branch, result.Owner, result.Repository)
if err != nil {
return types.ActionResult{}, fmt.Errorf("failed to create/update branch: %w", err)
}
// Create or update files
for _, file := range result.Files {
err = g.createOrUpdateFile(ctx, result.Branch, file.Path, file.Content, fmt.Sprintf("Update %s", file.Path))
err = g.createOrUpdateFile(ctx, result.Branch, file.Path, file.Content, fmt.Sprintf("Update %s", file.Path), result.Owner, result.Repository)
if err != nil {
return types.ActionResult{}, fmt.Errorf("failed to update file %s: %w", file.Path, err)
}

View File

@@ -28,11 +28,11 @@ func NewGithubRepositoryGetAllContent(config map[string]string) *GithubRepositor
}
}
func (g *GithubRepositoryGetAllContent) getContentRecursively(ctx context.Context, path string) (string, error) {
func (g *GithubRepositoryGetAllContent) getContentRecursively(ctx context.Context, path string, owner string, repository string) (string, error) {
var result strings.Builder
// Get content at the current path
_, directoryContent, _, err := g.client.Repositories.GetContents(ctx, g.owner, g.repository, path, nil)
_, directoryContent, _, err := g.client.Repositories.GetContents(ctx, owner, repository, path, nil)
if err != nil {
return "", fmt.Errorf("error getting content at path %s: %w", path, err)
}
@@ -41,14 +41,14 @@ func (g *GithubRepositoryGetAllContent) getContentRecursively(ctx context.Contex
for _, item := range directoryContent {
if item.GetType() == "dir" {
// Recursively get content for subdirectories
subContent, err := g.getContentRecursively(ctx, item.GetPath())
subContent, err := g.getContentRecursively(ctx, item.GetPath(), owner, repository)
if err != nil {
return "", err
}
result.WriteString(subContent)
} else if item.GetType() == "file" {
// Get file content
fileContent, _, _, err := g.client.Repositories.GetContents(ctx, g.owner, g.repository, item.GetPath(), nil)
fileContent, _, _, err := g.client.Repositories.GetContents(ctx, owner, repository, item.GetPath(), nil)
if err != nil {
return "", fmt.Errorf("error getting file content for %s: %w", item.GetPath(), err)
}
@@ -89,7 +89,7 @@ func (g *GithubRepositoryGetAllContent) Run(ctx context.Context, params types.Ac
result.Path = "."
}
content, err := g.getContentRecursively(ctx, result.Path)
content, err := g.getContentRecursively(ctx, result.Path, result.Owner, result.Repository)
if err != nil {
return types.ActionResult{}, err
}

View File

@@ -15,9 +15,9 @@
"eslint": "^9.24.0",
"eslint-plugin-react-hooks": "^5.2.0",
"eslint-plugin-react-refresh": "^0.4.19",
"globals": "^15.15.0",
"globals": "^16.0.0",
"react-router-dom": "^7.5.0",
"vite": "^6.2.6",
"vite": "^6.3.1",
},
},
},
@@ -296,7 +296,7 @@
"glob-parent": ["glob-parent@6.0.2", "", { "dependencies": { "is-glob": "^4.0.3" } }, "sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A=="],
"globals": ["globals@15.15.0", "", {}, "sha512-7ACyT3wmyp3I61S4fG682L0VA2RGD9otkqGJIwNUMF1SWUombIIk+af1unuDYgMm082aHYwD+mzJvv9Iu8dsgg=="],
"globals": ["globals@16.0.0", "", {}, "sha512-iInW14XItCXET01CQFqudPOWP2jYMl7T+QRQT+UNcR/iQncN/F0UNpgd76iFkBPgNQb4+X3LV9tLJYzwh+Gl3A=="],
"has-flag": ["has-flag@4.0.0", "", {}, "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ=="],

View File

@@ -21,7 +21,7 @@
"eslint": "^9.24.0",
"eslint-plugin-react-hooks": "^5.2.0",
"eslint-plugin-react-refresh": "^0.4.19",
"globals": "^15.15.0",
"globals": "^16.0.0",
"react-router-dom": "^7.5.0",
"vite": "^6.3.1"
}