chore: small fixes

Kujtim Hoxha created

Change summary

internal/agent/agent.go       |  6 ------
internal/agent/coordinator.go | 17 ++++++++++++-----
2 files changed, 12 insertions(+), 11 deletions(-)

Detailed changes

internal/agent/agent.go 🔗

@@ -3,7 +3,6 @@ package agent
 import (
 	"context"
 	_ "embed"
-	"encoding/json"
 	"errors"
 	"fmt"
 	"log/slog"
@@ -619,14 +618,9 @@ func (a *sessionAgent) generateTitle(ctx context.Context, session *session.Sessi
 		return
 	}
 
-	data, _ := json.Marshal(resp)
-
-	slog.Info("Title Response")
-	slog.Info(string(data))
 	title := resp.Response.Content.Text()
 
 	title = strings.ReplaceAll(title, "\n", " ")
-	slog.Info(title)
 
 	// remove thinking tags if present
 	if idx := strings.Index(title, "</think>"); idx > 0 {

internal/agent/coordinator.go 🔗

@@ -1,10 +1,12 @@
 package agent
 
 import (
+	"bytes"
 	"cmp"
 	"context"
 	"encoding/json"
 	"errors"
+	"io"
 	"log/slog"
 	"slices"
 	"strings"
@@ -126,24 +128,29 @@ func (c *coordinator) Run(ctx context.Context, sessionID string, prompt string,
 func getProviderOptions(model Model) ai.ProviderOptions {
 	options := ai.ProviderOptions{}
 
-	cfgOpts := "{}"
-	catwalkOpts := "{}"
+	cfgOpts := []byte("{}")
+	catwalkOpts := []byte("{}")
 
 	if model.ModelCfg.ProviderOptions != nil {
 		data, err := json.Marshal(model.ModelCfg.ProviderOptions)
 		if err == nil {
-			cfgOpts = string(data)
+			cfgOpts = data
 		}
 	}
 
 	if model.CatwalkCfg.Options.ProviderOptions != nil {
 		data, err := json.Marshal(model.CatwalkCfg.Options.ProviderOptions)
 		if err == nil {
-			catwalkOpts = string(data)
+			catwalkOpts = data
 		}
 	}
 
-	got, err := jsons.Merge([]string{catwalkOpts, cfgOpts})
+	readers := []io.Reader{
+		bytes.NewReader(catwalkOpts),
+		bytes.NewReader(cfgOpts),
+	}
+
+	got, err := jsons.Merge(readers)
 	if err != nil {
 		slog.Error("Could not merge call config", "err", err)
 		return options