forked from niuniu/llm-intelligence
chore: prepare repository for publishing
This commit is contained in:
77
scripts/generate_video_digest_test.go
Normal file
77
scripts/generate_video_digest_test.go
Normal file
@@ -0,0 +1,77 @@
|
||||
//go:build llm_script
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"testing"
|
||||
)
|
||||
|
||||
const sampleDailyReport = `# Daily Report
|
||||
|
||||
**报告日期**: 2026-05-11
|
||||
|
||||
## 📊 数据质量摘要
|
||||
|
||||
| 指标 | 数值 |
|
||||
|------|------|
|
||||
| 模型总数 | 501 |
|
||||
| CNY定价 | 126 |
|
||||
| USD定价 | 375 |
|
||||
|
||||
## 🌍 国际推荐模型 TOP 5
|
||||
|
||||
| 排名 | 模型 | 厂商 | 场景 | 输入(原价) | 输出(原价) | 上下文 |
|
||||
|------|------|------|------|-----------|-----------|--------|
|
||||
| 1 | GPT-5.4 Mini | OpenAI | 代码 | $0.75 | $4.50 | 200000 |
|
||||
| 2 | DeepSeek-V3 | DeepSeek | 推理 | ¥1.00 | ¥2.00 | 64000 |
|
||||
| 3 | Qwen3-VL-32B | Alibaba | 视觉 | ¥0.50 | ¥1.00 | 32000 |
|
||||
|
||||
## 🇨🇳 国内模型 TOP 10
|
||||
|
||||
| 排名 | 模型 | 厂商 | 场景 | 输入(CNY) | 输出(CNY) | 上下文 |
|
||||
|------|------|------|------|-----------|-----------|--------|
|
||||
| 1 | DeepSeek V4 Flash | DeepSeek | 对话 | ¥1.02 | ¥2.03 | 1000000 |
|
||||
| 2 | GLM-4.6V-FlashX | Zhipu AI | 视觉 | ¥0.15 | ¥1.50 | 8000 |
|
||||
| 3 | doubao-seed-code | ByteDance | 代码 | ¥1.20 | ¥2.40 | 32000 |
|
||||
| 4 | deepseek-r1 | ByteDance | 推理 | ¥4.00 | ¥8.00 | 32000 |
|
||||
`
|
||||
|
||||
func TestExtractDigestCardsBuildsFiveCategories(t *testing.T) {
|
||||
report, err := parseDailyReport([]byte(sampleDailyReport))
|
||||
if err != nil {
|
||||
t.Fatalf("parseDailyReport returned error: %v", err)
|
||||
}
|
||||
|
||||
cards := buildDigestCards(report)
|
||||
if len(cards) != 5 {
|
||||
t.Fatalf("expected 5 digest cards, got %d", len(cards))
|
||||
}
|
||||
|
||||
if cards[0].Slug != "code" {
|
||||
t.Fatalf("expected first card slug code, got %q", cards[0].Slug)
|
||||
}
|
||||
if len(cards[0].BulletLines) == 0 {
|
||||
t.Fatal("expected code card to contain bullet lines")
|
||||
}
|
||||
if cards[4].Slug != "global" {
|
||||
t.Fatalf("expected last card slug global, got %q", cards[4].Slug)
|
||||
}
|
||||
}
|
||||
|
||||
func TestBuildNarrationAudioProducesWAV(t *testing.T) {
|
||||
audio, err := buildNarrationAudio([]DigestCard{
|
||||
{Slug: "code", Narration: "Code digest update"},
|
||||
{Slug: "global", Narration: "Global digest update"},
|
||||
})
|
||||
if err != nil {
|
||||
t.Fatalf("buildNarrationAudio returned error: %v", err)
|
||||
}
|
||||
|
||||
if len(audio) < 44 {
|
||||
t.Fatalf("expected wav payload, got %d bytes", len(audio))
|
||||
}
|
||||
if !bytes.HasPrefix(audio, []byte("RIFF")) {
|
||||
t.Fatalf("expected RIFF header, got %q", audio[:4])
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user