test(runtime): wire new pricing importers into pipeline smoke and catalog mapping

This commit is contained in:
phamnazage-jpg
2026-05-23 18:35:08 +08:00
parent e757cd2dd7
commit c32661fd2a
15 changed files with 299 additions and 144 deletions

View File

@@ -8,9 +8,9 @@ import (
"strings"
)
const defaultYoudaoPricingURL = "https://ai.youdao.com/new/model-service"
const defaultYoudaoPricingURL = "https://ai.youdao.com/new/thinkflow"
var youdaoCardPattern = regexp.MustCompile(`(?s)([A-Za-z0-9.+\- ]+)\n([A-Za-z][A-Za-z0-9 ]+)\n.*?上下文长度\s*([0-9A-Za-z., ]+)\n.*?输入[:]?\s*¥?([\d.]+)\n.*?输出[:]?\s*¥?([\d.]+)\n.*?(查看详情|即将上线)`)
var youdaoCardPattern = regexp.MustCompile(`(?s)([A-Za-z0-9.+\- ]+)\n([^\n]+)\n.*?上下文长度\s*([0-9A-Za-z., ]+)\n.*?输入[:]?\s*¥?([\d.]+)\n.*?输出[:]?\s*¥?([\d.]+)\n.*?(查看详情|即将上线)`)
func parseYoudaoPricingCatalog(raw string) ([]officialPricingRecord, error) {
matches := youdaoCardPattern.FindAllStringSubmatch(raw, -1)
@@ -36,8 +36,8 @@ func parseYoudaoPricingCatalog(raw string) ([]officialPricingRecord, error) {
OperatorName: "Youdao Zhiyun MaaS",
OperatorNameCn: "有道智云 MaaS",
OperatorCountry: "CN",
OperatorWebsite: "https://sf.163.com",
OperatorType: "relay",
OperatorWebsite: defaultYoudaoPricingURL,
OperatorType: "official",
Region: "CN",
Currency: "CNY",
InputPrice: mustParseSubscriptionPrice(match[4]),
@@ -46,7 +46,7 @@ func parseYoudaoPricingCatalog(raw string) ([]officialPricingRecord, error) {
SourceURL: defaultYoudaoPricingURL,
ModelSourceURL: defaultYoudaoPricingURL,
DateConfidence: "unknown",
DateSourceKind: "official_product_page",
DateSourceKind: "official_pricing",
Modality: detectModality(modelName),
}
record.IsFree = record.InputPrice == 0 && record.OutputPrice == 0
@@ -70,6 +70,10 @@ func normalizeYoudaoProvider(raw string) string {
return "MiniMax"
case "zhipu":
return "Zhipu AI"
case "智谱":
return "Zhipu AI"
case "xiaomi", "小米":
return "Xiaomi"
default:
return strings.TrimSpace(raw)
}