fix: tag splitting by whitespace

This commit is contained in:
feitianbubu
2025-11-03 18:48:00 +08:00
parent 00782aae88
commit f6b32a664a
2 changed files with 3 additions and 3 deletions

View File

@@ -44,7 +44,7 @@ const PricingTags = ({
(allModels.length > 0 ? allModels : models).forEach((model) => {
if (model.tags) {
model.tags
.split(/[,;|\s]+/) // 逗号、分号竖线或空白字符
.split(/[,;|]+/) // 逗号、分号竖线(保留空格,允许多词标签如 "open weights"
.map((tag) => tag.trim())
.filter(Boolean)
.forEach((tag) => tagSet.add(tag.toLowerCase()));
@@ -64,7 +64,7 @@ const PricingTags = ({
if (!model.tags) return false;
return model.tags
.toLowerCase()
.split(/[,;|\s]+/)
.split(/[,;|]+/)
.map((tg) => tg.trim())
.includes(tagLower);
}).length;

View File

@@ -128,7 +128,7 @@ export const useModelPricingData = () => {
if (!model.tags) return false;
const tagsArr = model.tags
.toLowerCase()
.split(/[,;|\s]+/)
.split(/[,;|]+/)
.map((tag) => tag.trim())
.filter(Boolean);
return tagsArr.includes(tagLower);