39 lines
1.7 KiB
Go
39 lines
1.7 KiB
Go
package workbench
|
|||
|
|
|
||
|
|
import "fmt"
|
||
|
|
|
||
|
|
// Zero preserves tasks created before duration selection was available.
|
||
|
|
func validateTaskDuration(minutes int) error {
|
||
|
|
if minutes < 0 || minutes > 1440 {
|
||
|
|
return fmt.Errorf("%w: 直播时长应为 1 到 1440 分钟的整数", ErrInvalid)
|
||
|
|
}
|
||
|
|
return nil
|
||
|
|
}
|
||
|
|
|
||
|
|
func taskDurationInstructions(d TaskData, targetIndex int) string {
|
||
|
|
if d.DurationMinutes <= 0 {
|
||
|
|
return ""
|
||
|
|
}
|
||
|
|
text := fmt.Sprintf("\n直播目标总时长:%d 分钟。", d.DurationMinutes)
|
||
|
|
if targetIndex < 0 {
|
||
|
|
return text + "按目标时长安排内容段数量、讲解深度与节奏,给互动和过渡留出时间;较长的内容拆为多个连续段落,避免单段过长。不得靠重复内容或空话凑时长。"
|
||
|
|
}
|
||
|
|
count := 0
|
||
|
|
for _, segment := range d.Segments {
|
||
|
|
if segment.Status != "skipped" {
|
||
|
|
count++
|
||
|
|
}
|
||
|
|
}
|
||
|
|
if count == 0 {
|
||
|
|
return text
|
||
|
|
}
|
||
|
|
return text + fmt.Sprintf("当前共 %d 个未跳过的内容段,本段参考时长约 %.1f 分钟(包含讲解、互动和过渡)。根据本段主题深度合理控制篇幅,保持前后节奏一致,不得重复或恢复已跳过内容来凑时长。", count, float64(d.DurationMinutes)/float64(count))
|
||
|
|
}
|
||
|
|
|
||
|
|
func taskDurationReviewInstructions(d TaskData) string {
|
||
|
|
if d.DurationMinutes <= 0 {
|
||
|
|
return ""
|
||
|
|
}
|
||
|
|
return fmt.Sprintf("\n完整任务的直播目标总时长为 %d 分钟,此目标不是每一段或每一组质检窗口的时长。只根据本次收到的正文检查讲解、互动与过渡的节奏,不得把局部窗口视作完整任务判断总时长。实际语速与互动时长未知,不能声称验证了精确播放时长,也不得仅凭估算时长判为 blocking。", d.DurationMinutes)
|
||
|
|
}
|