Commit 6198b0ea by Seefs Committed by GitHub

Merge pull request #2156 from feitianbubu/pr/fix-tag-whitespace

fix: tag splitting by whitespace
parents 28295e01 92f7cdeb
......@@ -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;
......
......@@ -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);
......
......@@ -23,7 +23,7 @@ import { useMemo } from 'react';
const normalizeTags = (tags = '') =>
tags
.toLowerCase()
.split(/[,;|\s]+/)
.split(/[,;|]+/)
.map((t) => t.trim())
.filter(Boolean);
......
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