Compare commits

...

5 Commits

Author SHA1 Message Date
mudler
7d1e9647d9 chore: return more results to the LLM of the action that was done
Signed-off-by: mudler <mudler@localai.io>
2025-04-14 19:55:00 +02:00
Richard Palethorpe
77189b6114 fix(test): Encourage LLM to plan multiple searches (#36)
Signed-off-by: Richard Palethorpe <io@richiejp.com>
2025-04-14 17:35:19 +02:00
Richard Palethorpe
c32d315910 fix(ui): Proxy avatars endpoint in dev mode (#32)
Signed-off-by: Richard Palethorpe <io@richiejp.com>
2025-04-14 16:09:57 +02:00
Richard Palethorpe
606ffd8275 fix(ui): Don't try to pass unserializable Go objects to status UI (#28)
Signed-off-by: Richard Palethorpe <io@richiejp.com>
2025-04-14 16:09:42 +02:00
mudler
601dba3fc4 chore(tests): try to be more expressive
Signed-off-by: mudler <mudler@localai.io>
2025-04-14 16:08:54 +02:00
5 changed files with 24 additions and 24 deletions

View File

@@ -238,7 +238,7 @@ var _ = Describe("Agent test", func() {
defer agent.Stop()
result := agent.Ask(
types.WithText("plan a trip to San Francisco from Venice, Italy"),
types.WithText("Thoroughly plan a trip to San Francisco from Venice, Italy; check flight times, visa requirements and whether electrical items are allowed in cabin luggage."),
)
Expect(len(result.State)).To(BeNumerically(">", 1))
@@ -275,7 +275,7 @@ var _ = Describe("Agent test", func() {
EnableStandaloneJob,
EnableHUD,
WithPeriodicRuns("1s"),
WithPermanentGoal("use the new_conversation tool"),
WithPermanentGoal("use the new_conversation tool to initiate a conversation with the user"),
// EnableStandaloneJob,
// WithRandomIdentity(),
)

View File

@@ -128,11 +128,13 @@ func (g *GithubPRReviewer) Run(ctx context.Context, params types.ActionParams) (
}
actionResult := fmt.Sprintf(
"Pull request https://github.com/%s/%s/pull/%d reviewed successfully with status: %s",
"Pull request https://github.com/%s/%s/pull/%d reviewed successfully with status: %s, comments: %v, message: %s",
result.Owner,
result.Repository,
result.PRNumber,
strings.ToLower(result.ReviewAction),
result.Comments,
result.ReviewComment,
)
return types.ActionResult{Result: actionResult}, nil

View File

@@ -1,13 +1,12 @@
import { useState, useEffect } from 'react';
import { useParams, Link, useNavigate } from 'react-router-dom';
import { useParams, Link } from 'react-router-dom';
function AgentStatus() {
const { name } = useParams();
const navigate = useNavigate();
const [statusData, setStatusData] = useState(null);
const [loading, setLoading] = useState(true);
const [error, setError] = useState(null);
const [eventSource, setEventSource] = useState(null);
const [_eventSource, setEventSource] = useState(null);
const [liveUpdates, setLiveUpdates] = useState([]);
// Update document title
@@ -49,7 +48,7 @@ function AgentStatus() {
const data = JSON.parse(event.data);
setLiveUpdates(prev => [data, ...prev.slice(0, 19)]); // Keep last 20 updates
} catch (err) {
console.error('Error parsing SSE data:', err);
setLiveUpdates(prev => [event.data, ...prev.slice(0, 19)]);
}
});
@@ -129,23 +128,9 @@ function AgentStatus() {
<h2 className="text-sm font-semibold mb-2">Agent Action:</h2>
<div className="status-details">
<div className="status-row">
<span className="status-label">Result:</span>
<span className="status-value">{formatValue(item.Result)}</span>
<span className="status-label">{index}</span>
<span className="status-value">{formatValue(item)}</span>
</div>
<div className="status-row">
<span className="status-label">Action:</span>
<span className="status-value">{formatValue(item.Action)}</span>
</div>
<div className="status-row">
<span className="status-label">Parameters:</span>
<span className="status-value pre-wrap">{formatValue(item.Params)}</span>
</div>
{item.Reasoning && (
<div className="status-row">
<span className="status-label">Reasoning:</span>
<span className="status-value reasoning">{formatValue(item.Reasoning)}</span>
</div>
)}
</div>
</div>
</div>

View File

@@ -30,6 +30,7 @@ export default defineConfig(({ mode }) => {
'/status': backendUrl,
'/action': backendUrl,
'/actions': backendUrl,
'/avatars': backendUrl
}
}
}

View File

@@ -4,6 +4,7 @@ import (
"crypto/subtle"
"embed"
"errors"
"fmt"
"math/rand"
"net/http"
"path/filepath"
@@ -238,9 +239,20 @@ func (app *App) registerRoutes(pool *state.AgentPool, webapp *fiber.App) {
history = &state.Status{ActionResults: []types.ActionState{}}
}
entries := []string{}
for _, h := range Reverse(history.Results()) {
entries = append(entries, fmt.Sprintf(
"Result: %v Action: %v Params: %v Reasoning: %v",
h.Result,
h.Action.Definition().Name,
h.Params,
h.Reasoning,
))
}
return c.JSON(fiber.Map{
"Name": c.Params("name"),
"History": Reverse(history.Results()),
"History": entries,
})
})