fix(pricing): support Perplexity/Vertex price format without dollar sign
- official_pricing_import_common.go: make dollar sign optional in firstDollarPrice regex - perplexity_pricing_lib.go: fix column detection to match 'Input ($/1M)' format - also updated vertex and perplexity baseline snapshots
This commit is contained in:
@@ -362,7 +362,7 @@ func cleanHTMLText(raw string) string {
|
||||
}
|
||||
|
||||
func firstDollarPrice(raw string) (float64, bool) {
|
||||
pattern := regexp.MustCompile(`\$ ?([0-9]+(?:\.[0-9]+)?)`)
|
||||
pattern := regexp.MustCompile(`\$? ?([0-9]+(?:\.[0-9]+)?)`)
|
||||
match := pattern.FindStringSubmatch(raw)
|
||||
if len(match) != 2 {
|
||||
return 0, false
|
||||
|
||||
@@ -120,9 +120,9 @@ func detectPerplexityTableColumns(header []string) (int, int, int, int) {
|
||||
switch {
|
||||
case strings.Contains(lower, "model") && modelIndex == -1:
|
||||
modelIndex = i
|
||||
case strings.Contains(lower, "input") && strings.Contains(lower, "price") && inputIndex == -1:
|
||||
case strings.Contains(lower, "input") && (strings.Contains(lower, "price") || strings.Contains(lower, "$") || strings.Contains(lower, "/1m")) && inputIndex == -1:
|
||||
inputIndex = i
|
||||
case strings.Contains(lower, "output") && strings.Contains(lower, "price") && outputIndex == -1:
|
||||
case strings.Contains(lower, "output") && (strings.Contains(lower, "price") || strings.Contains(lower, "$") || strings.Contains(lower, "/1m")) && outputIndex == -1:
|
||||
outputIndex = i
|
||||
case (strings.Contains(lower, "documentation") || strings.Contains(lower, "docs")) && docIndex == -1:
|
||||
docIndex = i
|
||||
|
||||
Reference in New Issue
Block a user