upgrade Skill system auf regitry
This commit is contained in:
@@ -234,15 +234,23 @@ fn split_message(text: &str) -> Vec<String> {
|
||||
let mut remaining = text;
|
||||
|
||||
while remaining.len() > MAX_CHUNK_SIZE {
|
||||
// Schnittpunkt suchen — bevorzugt Zeilenumbruch, dann Leerzeichen
|
||||
let cut = remaining[..MAX_CHUNK_SIZE]
|
||||
// Sicherstellen dass wir auf einer char-Grenze starten
|
||||
let safe_max = {
|
||||
let mut idx = MAX_CHUNK_SIZE;
|
||||
while !remaining.is_char_boundary(idx) {
|
||||
idx -= 1;
|
||||
}
|
||||
idx
|
||||
};
|
||||
|
||||
let cut = remaining[..safe_max]
|
||||
.rfind('\n')
|
||||
.or_else(|| remaining[..MAX_CHUNK_SIZE].rfind(". "))
|
||||
.or_else(|| remaining[..MAX_CHUNK_SIZE].rfind(' '))
|
||||
.unwrap_or(MAX_CHUNK_SIZE);
|
||||
.or_else(|| remaining[..safe_max].rfind(". "))
|
||||
.or_else(|| remaining[..safe_max].rfind(' '))
|
||||
.unwrap_or(safe_max);
|
||||
|
||||
chunks.push(remaining[..cut].trim().to_string());
|
||||
remaining = remaining[cut..].trim_start();
|
||||
remaining = &remaining[cut..].trim_start();
|
||||
}
|
||||
|
||||
if !remaining.is_empty() {
|
||||
|
||||
Reference in New Issue
Block a user