소스 검색

feat(pricing): 隐藏模型广场标签和端点类型筛选器

注释掉模型广场侧边栏和筛选弹窗中的 PricingTags 和 PricingEndpointTypes 组件,
添加 EndpointType 常量及相关组件的文档注释。

Co-Authored-By: Claude <noreply@anthropic.com>
master
fengsilin 4 주 전
부모
커밋
bae5c1faa5
6개의 변경된 파일41개의 추가작업 그리고 18개의 파일을 삭제
  1. +20
    -8
      constant/endpoint_type.go
  2. +6
    -0
      web/src/components/table/model-pricing/filter/PricingEndpointTypes.jsx
  3. +3
    -0
      web/src/components/table/model-pricing/filter/PricingTags.jsx
  4. +4
    -4
      web/src/components/table/model-pricing/layout/PricingSidebar.jsx
  5. +4
    -4
      web/src/components/table/model-pricing/modal/components/FilterModalContent.jsx
  6. +4
    -2
      web/src/components/table/model-pricing/view/card/PricingCardView.jsx

+ 20
- 8
constant/endpoint_type.go 파일 보기

@@ -1,17 +1,29 @@
package constant

// EndpointType 标识模型支持的 API 端点类型
// 用于模型广场筛选、渠道定价配置、请求路由判断
// 前端筛选组件: web/src/components/table/model-pricing/filter/PricingEndpointTypes.jsx
type EndpointType string

const (
EndpointTypeOpenAI EndpointType = "openai"
EndpointTypeOpenAIResponse EndpointType = "openai-response"
// OpenAI Chat Completions 格式 (/v1/chat/completions)
EndpointTypeOpenAI EndpointType = "openai"
// OpenAI Responses API 格式 (/v1/responses),用于 o3/o4-mini 等仅支持 Responses 的模型
EndpointTypeOpenAIResponse EndpointType = "openai-response"
// OpenAI Responses Compact 格式 (/v1/responses/compact),精简输出
EndpointTypeOpenAIResponseCompact EndpointType = "openai-response-compact"
EndpointTypeAnthropic EndpointType = "anthropic"
EndpointTypeGemini EndpointType = "gemini"
EndpointTypeJinaRerank EndpointType = "jina-rerank"
EndpointTypeImageGeneration EndpointType = "image-generation"
EndpointTypeEmbeddings EndpointType = "embeddings"
EndpointTypeOpenAIVideo EndpointType = "openai-video"
// Anthropic Messages API 格式 (/v1/messages)
EndpointTypeAnthropic EndpointType = "anthropic"
// Google Gemini 原生格式 (/v1beta/models/{model}:generateContent)
EndpointTypeGemini EndpointType = "gemini"
// Jina Rerank API 格式 (/v1/rerank)
EndpointTypeJinaRerank EndpointType = "jina-rerank"
// 图片生成 API (/v1/images/generations),如 DALL-E、Midjourney 代理
EndpointTypeImageGeneration EndpointType = "image-generation"
// 向量嵌入 API (/v1/embeddings)
EndpointTypeEmbeddings EndpointType = "embeddings"
// OpenAI Video API,如 Sora 视频生成
EndpointTypeOpenAIVideo EndpointType = "openai-video"
//EndpointTypeMidjourney EndpointType = "midjourney-proxy"
//EndpointTypeSuno EndpointType = "suno-proxy"
//EndpointTypeKling EndpointType = "kling"


+ 6
- 0
web/src/components/table/model-pricing/filter/PricingEndpointTypes.jsx 파일 보기

@@ -22,6 +22,11 @@ import SelectableButtonGroup from '../../../common/ui/SelectableButtonGroup';

/**
* 端点类型筛选组件
* 端点类型来源: constant.EndpointType (endpoint_type.go)
* 常见值: openai(/v1/chat/completions), anthropic(/v1/messages), gemini, embeddings,
* openai-response(/v1/responses), image-generation, jina-rerank, openai-video 等
* 模型支持的端点由渠道类型自动推断或管理员在「模型管理 → 编辑模型 → 端点」中自定义
* 注意: 端点配置仅控制模型广场展示,不影响实际路由
* @param {string|'all'} filterEndpointType 当前值
* @param {Function} setFilterEndpointType setter
* @param {Array} models 模型列表
@@ -65,6 +70,7 @@ const PricingEndpointTypes = ({
};

// 端点类型显示名称映射
// 值对应后端 constant.EndpointType 常量,如 "openai" "anthropic" "gemini" 等
const getEndpointTypeLabel = (endpointType) => {
return endpointType;
};


+ 3
- 0
web/src/components/table/model-pricing/filter/PricingTags.jsx 파일 보기

@@ -22,6 +22,9 @@ import SelectableButtonGroup from '../../../common/ui/SelectableButtonGroup';

/**
* 模型标签筛选组件
* 标签来源: Model.Meta.Tags (model_meta.go),逗号/分号/竖线分隔的自由文本
* 管理员在「模型管理 → 编辑模型 → 标签」中配置,用于模型广场的分类筛选
* 卡片渲染: PricingCardView 的 renderTags(),最多显示 3 个,颜色由 stringToColor 哈希生成
* @param {string|'all'} filterTag 当前选中的标签
* @param {Function} setFilterTag setter
* @param {Array} models 当前过滤后模型列表(用于计数)


+ 4
- 4
web/src/components/table/model-pricing/layout/PricingSidebar.jsx 파일 보기

@@ -113,14 +113,14 @@ const PricingSidebar = ({
t={t}
/>

<PricingTags
{/* <PricingTags
filterTag={filterTag}
setFilterTag={setFilterTag}
models={tagModels}
allModels={categoryProps.models}
loading={loading}
t={t}
/>
/> */}

{/* <PricingGroups
filterGroup={filterGroup}
@@ -140,14 +140,14 @@ const PricingSidebar = ({
t={t}
/>

<PricingEndpointTypes
{/* <PricingEndpointTypes
filterEndpointType={filterEndpointType}
setFilterEndpointType={setFilterEndpointType}
models={endpointTypeModels}
allModels={categoryProps.models}
loading={loading}
t={t}
/>
/> */}
</div>
);
};


+ 4
- 4
web/src/components/table/model-pricing/modal/components/FilterModalContent.jsx 파일 보기

@@ -96,14 +96,14 @@ const FilterModalContent = ({ sidebarProps, t }) => {
t={t}
/>

<PricingTags
{/* <PricingTags
filterTag={filterTag}
setFilterTag={setFilterTag}
models={tagModels}
allModels={categoryProps.models}
loading={loading}
t={t}
/>
/> */}

{/* <PricingGroups
filterGroup={filterGroup}
@@ -123,14 +123,14 @@ const FilterModalContent = ({ sidebarProps, t }) => {
t={t}
/>

<PricingEndpointTypes
{/* <PricingEndpointTypes
filterEndpointType={filterEndpointType}
setFilterEndpointType={setFilterEndpointType}
models={endpointTypeModels}
allModels={categoryProps.models}
loading={loading}
t={t}
/>
/> */}
</>
);
};


+ 4
- 2
web/src/components/table/model-pricing/view/card/PricingCardView.jsx 파일 보기

@@ -147,7 +147,9 @@ const PricingCardView = ({
return record.description || '';
};

// 渲染标签
// 渲染标签(卡片底部)
// 左侧: 计费类型标签(quota_type: 0=按量计费, 1=按次计费)
// 右侧: 自定义标签(来自 Model.tags,逗号分隔,最多显示3个,颜色由 stringToColor 哈希生成)
const renderTags = (record) => {
// 计费类型标签(左边)
let billingTag = (
@@ -169,7 +171,7 @@ const PricingCardView = ({
);
}

// 自定义标签(右边)
// 自定义标签(右边),来源: Model.Meta.Tags (model_meta.go)
const customTags = [];
if (record.tags) {
const tagArr = record.tags.split(',').filter(Boolean);


불러오는 중...
취소
저장