feat: clarify admin model type labels
This commit is contained in:
parent
947af6d26f
commit
7e7c7f3a1a
@ -105,6 +105,10 @@ import {
|
||||
getCanvasSkillIconComponent,
|
||||
} from "@/components/canvas/canvas-skill-icons";
|
||||
import { fetchUploadWithRetry } from "@/lib/client/upload-with-retry";
|
||||
import {
|
||||
isImageGenerationModelDescriptor,
|
||||
isVideoModelDescriptor,
|
||||
} from "@/lib/ai/model-classification";
|
||||
import type { AgentWorkflowUiConfig } from "@/types/agent";
|
||||
|
||||
const fetcher = (url: string) => fetch(url).then((res) => res.json());
|
||||
@ -1556,14 +1560,24 @@ export function AdminSettingsClient() {
|
||||
|
||||
const selectedModelProviderType =
|
||||
providersData?.providers?.find((p) => p.id === modelForm.providerId)?.type || "";
|
||||
const isVideoProviderForModelConfig = [
|
||||
"volcano-video",
|
||||
"doubao-video",
|
||||
"qianwen-video",
|
||||
"fal-video",
|
||||
"ruxa-video",
|
||||
"runway",
|
||||
].includes(selectedModelProviderType);
|
||||
const isVideoProviderForModelConfig = isVideoModelDescriptor({
|
||||
providerType: selectedModelProviderType,
|
||||
modelId: modelForm.modelId,
|
||||
supportsImageGen: modelForm.supportsImageGen,
|
||||
});
|
||||
const isImageProviderForModelConfig = isImageGenerationModelDescriptor({
|
||||
providerType: selectedModelProviderType,
|
||||
modelId: modelForm.modelId,
|
||||
supportsImageGen: modelForm.supportsImageGen,
|
||||
});
|
||||
const modelKindHint =
|
||||
selectedModelProviderType === "runway" && !modelForm.modelId.trim()
|
||||
? "Runway 同时支持图片与视频模型,填写模型 ID 后系统会自动识别标签。"
|
||||
: isVideoProviderForModelConfig
|
||||
? "当前识别为视频模型,将使用视频能力、视频积分和视频路由。"
|
||||
: isImageProviderForModelConfig
|
||||
? "当前识别为图片模型,将使用生图能力、图片积分和生图路由。"
|
||||
: "当前识别为对话/分析模型。";
|
||||
|
||||
// 存储配置状态
|
||||
const [storageForm, setStorageForm] = useState({
|
||||
@ -7050,6 +7064,7 @@ export function AdminSettingsClient() {
|
||||
onChange={(e) => setModelForm({ ...modelForm, modelId: e.target.value })}
|
||||
placeholder="例如: qwen-turbo"
|
||||
/>
|
||||
<p className="text-xs text-muted-foreground">{modelKindHint}</p>
|
||||
</div>
|
||||
<div className="space-y-2">
|
||||
<Label>显示名称</Label>
|
||||
@ -7233,7 +7248,7 @@ export function AdminSettingsClient() {
|
||||
</div>
|
||||
|
||||
{/* 🆕 图片生成模型特性配置 */}
|
||||
{(modelForm.supportsImageGen || isVideoProviderForModelConfig) && (
|
||||
{(isImageProviderForModelConfig || isVideoProviderForModelConfig) && (
|
||||
<div className="border rounded-lg p-4 space-y-4 bg-muted/30">
|
||||
<div className="font-medium text-sm">生成配置</div>
|
||||
|
||||
@ -7448,6 +7463,18 @@ export function AdminSettingsClient() {
|
||||
<div className="space-y-4">
|
||||
{modelsData?.models?.map((model) => {
|
||||
const provider = providersData?.providers?.find((p) => p.id === model.providerId);
|
||||
const isVideoModel = isVideoModelDescriptor({
|
||||
providerType: provider?.type,
|
||||
modelId: model.modelId,
|
||||
capabilities: (model as any).capabilities,
|
||||
supportsImageGen: model.supportsImageGen,
|
||||
});
|
||||
const isImageModel = isImageGenerationModelDescriptor({
|
||||
providerType: provider?.type,
|
||||
modelId: model.modelId,
|
||||
capabilities: (model as any).capabilities,
|
||||
supportsImageGen: model.supportsImageGen,
|
||||
});
|
||||
return (
|
||||
<div key={model.id} className="flex items-center justify-between p-4 border rounded-lg">
|
||||
<div className="flex flex-1 items-center gap-3">
|
||||
@ -7465,6 +7492,9 @@ export function AdminSettingsClient() {
|
||||
<span className="truncate">{model.displayName}</span>
|
||||
{model.isDefault && <span className="text-xs bg-blue-100 text-blue-800 px-2 py-0.5 rounded">默认</span>}
|
||||
{model.isAgentModel && <span className="text-xs bg-violet-100 text-violet-800 px-2 py-0.5 rounded">Agent</span>}
|
||||
{isImageModel && <span className="text-xs bg-sky-100 text-sky-800 px-2 py-0.5 rounded">图片模型</span>}
|
||||
{isVideoModel && <span className="text-xs bg-red-100 text-red-800 px-2 py-0.5 rounded">视频模型</span>}
|
||||
{!isImageModel && !isVideoModel && <span className="text-xs bg-slate-100 text-slate-700 px-2 py-0.5 rounded">对话模型</span>}
|
||||
{model.isMultimodal && <span className="text-xs bg-emerald-100 text-emerald-800 px-2 py-0.5 rounded">多模态</span>}
|
||||
{model.isHidden && <span className="text-xs bg-amber-100 text-amber-800 px-2 py-0.5 rounded">前台隐藏</span>}
|
||||
{(model as any).excludeFromFailover && <span className="text-xs bg-rose-100 text-rose-700 px-2 py-0.5 rounded">不参与故障迁移</span>}
|
||||
|
||||
@ -98,17 +98,19 @@ export function isImageGenerationModelDescriptor(params: {
|
||||
}): boolean {
|
||||
const providerType = normalizeText(params.providerType);
|
||||
|
||||
if (params.supportsImageGen === true) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (providerType === "runway") {
|
||||
return inferRunwayModelKind(params.modelId) === "image";
|
||||
const runwayModelKind = inferRunwayModelKind(params.modelId);
|
||||
if (runwayModelKind === "image") return true;
|
||||
if (runwayModelKind === "video") return false;
|
||||
}
|
||||
|
||||
if (isVideoModelDescriptor(params)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (params.supportsImageGen === true) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return STATIC_IMAGE_PROVIDER_TYPES.has(providerType);
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user