Files
yawan f7fc992f57
Anydoc / anydoc parser engine (push) Canceled after 0s
App / Format, vet, test, and build (push) Canceled after 0s
CLI / test (macos-latest / go 1.26) (push) Canceled after 0s
CLI / test (ubuntu-latest / go 1.26) (push) Canceled after 0s
CLI / test (windows-latest / go 1.26) (push) Canceled after 0s
Build and Push Docker Image / build-ui (push) Canceled after 0s
Build and Push Docker Image / build-docreader (push) Canceled after 0s
Build and Push Docker Image / build-sandbox (push) Canceled after 0s
Build and Push Docker Image / build-app (amd64, linux/amd64, ubuntu-latest) (push) Canceled after 0s
Build and Push Docker Image / build-app (arm64, linux/arm64, ubuntu-24.04-arm) (push) Canceled after 0s
DocReader / Python tests and Go client tests (push) Canceled after 0s
Build & Publish (dsh-weknora) / Typecheck, test, pack (push) Canceled after 0s
Build & Publish (dsh-weknora) / End-to-end inside dsh (pinned) (push) Canceled after 0s
Build & Publish (dsh-weknora) / End-to-end inside dsh (latest, advisory) (push) Canceled after 0s
Frontend / Test, type-check, and build (push) Canceled after 0s
Go Lint Cache / warm lint cache (.) (push) Canceled after 0s
Go Lint Cache / warm lint cache (cli) (push) Canceled after 0s
Go Lint Cache / warm lint cache (client) (push) Canceled after 0s
Build & Publish (mcp-server) / Test (Python 3.10) (push) Canceled after 0s
Build & Publish (mcp-server) / Test (Python 3.11) (push) Canceled after 0s
Build & Publish (mcp-server) / Test (Python 3.12) (push) Canceled after 0s
Build & Publish (mcp-server) / Test (Python 3.13) (push) Canceled after 0s
Build and Push Docker Image / merge (push) Canceled after 0s
Build & Publish (dsh-weknora) / Publish to npm (push) Canceled after 0s
Build & Publish (mcp-server) / Build sdist + wheel (push) Canceled after 0s
Build & Publish (mcp-server) / Publish to PyPI (push) Canceled after 0s
WeKnora deployment source with the reviewed wiki identity, summary and recovery fixes
2026-09-22 16:19:06 +08:00

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)
}