164121836d
- 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.
29 lines
534 B
Go
29 lines
534 B
Go
package executor
|
|
|
|
import "strings"
|
|
|
|
func appendIfMissing(items []string, item string) []string {
|
|
item = strings.TrimSpace(item)
|
|
if item == "" {
|
|
return items
|
|
}
|
|
for _, existing := range items {
|
|
if strings.TrimSpace(existing) == item {
|
|
return items
|
|
}
|
|
}
|
|
return append(items, item)
|
|
}
|
|
|
|
func preview(text string, limit int) string {
|
|
text = strings.TrimSpace(text)
|
|
if text == "" || limit <= 0 {
|
|
return ""
|
|
}
|
|
runes := []rune(text)
|
|
if len(runes) <= limit {
|
|
return string(runes)
|
|
}
|
|
return string(runes[:limit]) + "..."
|
|
}
|