refactor: remove AgentRunLog related code and components
- Deleted AgentRunLogResponse struct from skill_response.go. - Removed agent_run_log_repository.go and agent_run_log_service.go files. - Eliminated AgentRunLogDetailDialog component and its related logic from the dashboard. - Removed agent run log fetching functions from admin API. - Updated navigation and localization files to remove references to agent run logs.
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
package runtime
|
||||
|
||||
import (
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
applicationruntime "agent-desk/internal/ai/application/runtime"
|
||||
@@ -9,64 +8,33 @@ import (
|
||||
"agent-desk/internal/pkg/toolx"
|
||||
)
|
||||
|
||||
func TestSummaryPrimaryToolCodePrefersToolSearchTarget(t *testing.T) {
|
||||
summary := &applicationruntime.Summary{
|
||||
InvokedToolCodes: []string{toolx.BuiltinToolSearch.Code},
|
||||
TraceData: `{
|
||||
"toolSearch": {
|
||||
"items": [
|
||||
{"targetToolCode":"mcp/server/tool_a"}
|
||||
]
|
||||
}
|
||||
}`,
|
||||
func TestRuntimeTraceFinalAction(t *testing.T) {
|
||||
if got := runtimeTraceFinalAction(&applicationruntime.Summary{Status: "completed", ReplyText: "ok"}); got != "reply" {
|
||||
t.Fatalf("expected reply final action, got %q", got)
|
||||
}
|
||||
|
||||
if got := summaryPrimaryToolCode(summary); got != "mcp/server/tool_a" {
|
||||
t.Fatalf("unexpected primary tool code: %q", got)
|
||||
if got := runtimeTraceFinalAction(&applicationruntime.Summary{Status: "completed"}); got != "completed" {
|
||||
t.Fatalf("expected completed final action, got %q", got)
|
||||
}
|
||||
}
|
||||
|
||||
func TestToRunLogFinalAction(t *testing.T) {
|
||||
if got := toRunLogFinalAction(&applicationruntime.Summary{WorkflowVersionID: 66, ReplyText: "ok"}); got != "workflow_reply" {
|
||||
t.Fatalf("expected workflow_reply final action, got %q", got)
|
||||
}
|
||||
|
||||
if got := toRunLogFinalAction(&applicationruntime.Summary{PlannedSkillID: 44, ReplyText: "ok"}); got != "skill" {
|
||||
t.Fatalf("expected skill final action, got %q", got)
|
||||
}
|
||||
|
||||
graphSummary := &applicationruntime.Summary{
|
||||
ReplyText: "ok",
|
||||
TraceData: `{
|
||||
"graphTools": {
|
||||
"items": [
|
||||
{"toolCode":"` + toolx.GraphAnalyzeConversation.Code + `"}
|
||||
]
|
||||
}
|
||||
}`,
|
||||
}
|
||||
if got := toRunLogFinalAction(graphSummary); got != "graph" {
|
||||
t.Fatalf("expected graph final action, got %q", got)
|
||||
}
|
||||
|
||||
if got := toRunLogFinalAction(&applicationruntime.Summary{Status: "fallback"}); got != "fallback" {
|
||||
if got := runtimeTraceFinalAction(&applicationruntime.Summary{Status: "fallback"}); got != "fallback" {
|
||||
t.Fatalf("expected fallback final action, got %q", got)
|
||||
}
|
||||
}
|
||||
|
||||
func TestBuildRunLogPlanUsesWorkflowSummary(t *testing.T) {
|
||||
plannedAction, plannedToolCode, planReason := buildRunLogPlan(&applicationruntime.Summary{
|
||||
WorkflowVersionID: 66,
|
||||
Status: "completed",
|
||||
})
|
||||
if plannedAction != "workflow" {
|
||||
t.Fatalf("expected workflow planned action, got %q", plannedAction)
|
||||
func TestExtractRuntimeToolTraces(t *testing.T) {
|
||||
summary := &applicationruntime.Summary{
|
||||
TraceData: `{
|
||||
"toolSearch": {"items": [{"targetToolCode":"mcp/server/tool_a"}]},
|
||||
"graphTools": {"items": [{"toolCode":"` + toolx.GraphAnalyzeConversation.Code + `"}]}
|
||||
}`,
|
||||
}
|
||||
if plannedToolCode != "workflow/66" {
|
||||
t.Fatalf("expected workflow planned tool code, got %q", plannedToolCode)
|
||||
if got := extractToolSearchTrace(summary); got == "" {
|
||||
t.Fatalf("expected tool search trace")
|
||||
}
|
||||
if planReason == "" {
|
||||
t.Fatalf("expected plan reason")
|
||||
if got := extractGraphToolTrace(summary); got == "" {
|
||||
t.Fatalf("expected graph tool trace")
|
||||
}
|
||||
if got := firstGraphToolCode(summary); got != toolx.GraphAnalyzeConversation.Code {
|
||||
t.Fatalf("unexpected graph tool code: %q", got)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -103,44 +71,6 @@ func TestBuildConversationInterruptStoresWorkflowCheckpointData(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestGraphPlanReason(t *testing.T) {
|
||||
summary := &applicationruntime.Summary{
|
||||
TraceData: `{
|
||||
"graphTools": {
|
||||
"items": [
|
||||
{
|
||||
"toolCode":"` + toolx.GraphTriageServiceRequest.Code + `",
|
||||
"recommendedAction":"create_ticket",
|
||||
"ticketDraftReady": true
|
||||
}
|
||||
]
|
||||
}
|
||||
}`,
|
||||
}
|
||||
got := graphPlanReason(summary)
|
||||
if !strings.Contains(got, "create_ticket") || !strings.Contains(got, "ready ticket draft") {
|
||||
t.Fatalf("unexpected graph plan reason: %q", got)
|
||||
}
|
||||
}
|
||||
|
||||
func TestExtractHandoffReason(t *testing.T) {
|
||||
summary := &applicationruntime.Summary{
|
||||
TraceData: `{
|
||||
"graphTools": {
|
||||
"items": [
|
||||
{
|
||||
"toolCode":"` + toolx.GraphHandoffConversation.Code + `",
|
||||
"arguments":{"reason":" 用户明确要求人工处理 "}
|
||||
}
|
||||
]
|
||||
}
|
||||
}`,
|
||||
}
|
||||
if got := extractHandoffReason(summary); got != "用户明确要求人工处理" {
|
||||
t.Fatalf("unexpected handoff reason: %q", got)
|
||||
}
|
||||
}
|
||||
|
||||
type fakeErr string
|
||||
|
||||
func (e fakeErr) Error() string {
|
||||
|
||||
Reference in New Issue
Block a user