Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions src/pkg/agent/plugins/compat_oai/generate.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import (
"encoding/json"
"errors"
"fmt"
"strings"

"github.com/DefangLabs/defang/src/pkg/term"
"github.com/firebase/genkit/go/ai"
Expand Down Expand Up @@ -244,11 +245,11 @@ func (g *ModelGenerator) Generate(ctx context.Context, req *ai.ModelRequest, han

// concatenateContent concatenates text content into a single string
func (g *ModelGenerator) concatenateContent(parts []*ai.Part) string {
content := ""
var content strings.Builder
for _, part := range parts {
content += part.Text
content.WriteString(part.Text)
}
return content
return content.String()
}

// generateStream generates a streaming model response
Expand Down
9 changes: 6 additions & 3 deletions src/pkg/cli/client/byoc/gcp/byoc.go
Original file line number Diff line number Diff line change
Expand Up @@ -842,15 +842,18 @@ func LogEntryToString(logEntry *loggingpb.LogEntry) (string, string, error) {
}

func LogEntriesToString(logEntries []*loggingpb.LogEntry) string {
result := ""
var result strings.Builder
for _, logEntry := range logEntries {
logTimestamp, msg, err := LogEntryToString(logEntry)
if err != nil {
continue
}
result += logTimestamp + " " + msg + "\n"
result.WriteString(logTimestamp)
result.WriteByte(' ')
result.WriteString(msg)
result.WriteByte('\n')
}
return result
return result.String()
}

func (b *ByocGcp) query(ctx context.Context, query string) ([]*loggingpb.LogEntry, error) {
Expand Down
12 changes: 7 additions & 5 deletions src/pkg/cli/client/byoc/parse.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,18 +25,20 @@ type PulumiState struct {
}

func (ps PulumiState) String() string {
var org, pending string
var org string
var pending strings.Builder
if len(ps.Pending) != 0 {
pending = " (pending"
pending.WriteString(" (pending")
for _, p := range ps.Pending {
pending += " " + strconv.Quote(p)
pending.WriteByte(' ')
pending.WriteString(strconv.Quote(p))
}
pending += ")"
pending.WriteByte(')')
}
if ps.DefangOrg != "" {
org = " {" + string(ps.DefangOrg) + "}"
}
return fmt.Sprintf("%s/%s%s%s", ps.Project, ps.Name, org, pending)
return fmt.Sprintf("%s/%s%s%s", ps.Project, ps.Name, org, pending.String())
}

func ParsePulumiStateFile(ctx context.Context, obj BucketObj, bucket string, objLoader func(ctx context.Context, bucket, object string) ([]byte, error)) (*PulumiState, error) {
Expand Down
Loading
Loading