Commit a1f9a1c8 by feitianbubu

fix: tag splitting by whitespace

parent 564e45ce
...@@ -44,7 +44,7 @@ const PricingTags = ({ ...@@ -44,7 +44,7 @@ const PricingTags = ({
(allModels.length > 0 ? allModels : models).forEach((model) => { (allModels.length > 0 ? allModels : models).forEach((model) => {
if (model.tags) { if (model.tags) {
model.tags model.tags
.split(/[,;|\s]+/) // 逗号、分号、竖线或空白字符 .split(/[,;|]+/) // 逗号、分号或竖线(保留空格,允许多词标签如 "open weights")
.map((tag) => tag.trim()) .map((tag) => tag.trim())
.filter(Boolean) .filter(Boolean)
.forEach((tag) => tagSet.add(tag.toLowerCase())); .forEach((tag) => tagSet.add(tag.toLowerCase()));
...@@ -64,7 +64,7 @@ const PricingTags = ({ ...@@ -64,7 +64,7 @@ const PricingTags = ({
if (!model.tags) return false; if (!model.tags) return false;
return model.tags return model.tags
.toLowerCase() .toLowerCase()
.split(/[,;|\s]+/) .split(/[,;|]+/)
.map((tg) => tg.trim()) .map((tg) => tg.trim())
.includes(tagLower); .includes(tagLower);
}).length; }).length;
......
...@@ -128,7 +128,7 @@ export const useModelPricingData = () => { ...@@ -128,7 +128,7 @@ export const useModelPricingData = () => {
if (!model.tags) return false; if (!model.tags) return false;
const tagsArr = model.tags const tagsArr = model.tags
.toLowerCase() .toLowerCase()
.split(/[,;|\s]+/) .split(/[,;|]+/)
.map((tag) => tag.trim()) .map((tag) => tag.trim())
.filter(Boolean); .filter(Boolean);
return tagsArr.includes(tagLower); return tagsArr.includes(tagLower);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment