Files
ai-agent/internal/ai/application/runtime/summary_builder.go
T
mlogclub 164121836d Refactor runtime executor integration and introduce eino package
- Replaced the existing runtime executor with a new eino package for better modularity.
- Updated Service struct to use the new RuntimeExecutor from eino.
- Adjusted Run and Resume methods to accommodate changes in input types and execution logic.
- Introduced new types in the eino package to align with the previous executor's functionality.
- Refactored tooling preparation logic to streamline tool definitions and improve clarity.
- Added new context builders and event consumers to enhance runtime event handling.
- Removed legacy executor code and ensured all references are updated to the new eino package.
2026-04-14 09:33:49 +08:00

47 lines
1.6 KiB
Go

package runtime
import (
"strings"
runtimeeino "cs-agent/internal/ai/infra/eino"
)
func toSummary(summary *runtimeeino.RunResult) *Summary {
if summary == nil {
return nil
}
ret := &Summary{
RunID: summary.RunID,
Status: summary.Status,
ReplyText: summary.ReplyText,
PlannedSkillCode: strings.TrimSpace(summary.SelectedSkillCode),
PlannedSkillName: strings.TrimSpace(summary.SelectedSkillName),
PlanReason: strings.TrimSpace(summary.SkillRouteReason),
SkillRouteTrace: strings.TrimSpace(summary.SkillRouteTrace),
SkillAllowedToolCodes: append([]string(nil), summary.SkillAllowedToolCodes...),
ModelName: summary.ModelName,
PromptTokens: summary.PromptTokens,
CompletionTokens: summary.CompletionTokens,
HistoryMessageCount: summary.HistoryMessageCount,
RetrieverCount: summary.RetrieverCount,
ToolCallCount: summary.ToolCallCount,
ToolCodes: append([]string(nil), summary.ToolCodes...),
InvokedToolCodes: append([]string(nil), summary.InvokedToolCodes...),
CheckPointID: summary.CheckPointID,
Interrupted: summary.Interrupted,
TraceData: summary.TraceData,
ErrorMessage: summary.ErrorMessage,
}
if len(summary.Interrupts) > 0 {
ret.Interrupts = make([]InterruptContextSummary, 0, len(summary.Interrupts))
for _, item := range summary.Interrupts {
ret.Interrupts = append(ret.Interrupts, InterruptContextSummary{
Type: item.Type,
ID: item.ID,
InfoPreview: item.InfoPreview,
})
}
}
return ret
}