fix(assessment): bound generated titles for long Chinese requests
This commit is contained in:
parent
b88e6229eb
commit
a04d113aea
|
|
@ -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")
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue