mirror of
https://github.com/Ed1s0nZ/CyberStrikeAI.git
synced 2026-11-23 04:41:41 +01:00
fix(assessment): bound generated titles for long Chinese requests
This commit is contained in:
1 parent
b88e6229eb
commit
a04d113aea
2 files changed
+17
-1
No files matched your search
@@ -147,7 +147,12 @@ func (t *Task) PrepareIntake(message string) error {
|
||||
return fmt.Errorf("request must contain 1..12000 bytes")
|
||||
}
|
||||
if t.Name == "" {
|
||||
t.Name = clip(message, 60)
|
||||
title := []rune(message)
|
||||
if len(title) > 60 {
|
||||
t.Name = string(title[:60]) + "…"
|
||||
} else {
|
||||
t.Name = message
|
||||
}
|
||||
}
|
||||
providedGoal, providedScope, providedCriteria := t.Goal, t.Scope, append([]string(nil), t.Criteria...)
|
||||
if len(providedGoal) > 12000 || len(providedScope) > 12000 {
|
||||
|
||||
@@ -318,3 +318,14 @@ func TestIntakePreservesExplicitScopeAndCriteria(t *testing.T) {
|
||||
t.Fatal("model expanded explicit owner scope/criteria")
|
||||
}
|
||||
}
|
||||
|
||||
func TestIntakeLongChineseRequestProducesValidTitle(t *testing.T) {
|
||||
task := &Task{Tools: []string{"inspect"}}
|
||||
request := strings.Repeat("请整理现有材料并报告缺口。", 12)
|
||||
if err := task.PrepareIntake(request); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if len(task.Name) > 200 || task.Intake.Message != request {
|
||||
t.Fatal("title truncation corrupted request")
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user