Extend prompt execution contract
This commit is contained in:
@@ -78,3 +78,15 @@ func boundText(value string, limit int) string {
|
||||
}
|
||||
return value
|
||||
}
|
||||
|
||||
func boundCodePoints(value string, limit int) string {
|
||||
if limit <= 0 || value == "" {
|
||||
return ""
|
||||
}
|
||||
value = strings.ToValidUTF8(value, "<22>")
|
||||
runes := []rune(value)
|
||||
if len(runes) <= limit {
|
||||
return value
|
||||
}
|
||||
return string(runes[:limit])
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user