114 行
11 KiB
Vue
114 行
11 KiB
Vue
|
|
<script setup lang="ts">
|
|||
|
|
import { computed, onMounted, ref } from "vue"
|
|||
|
|
import { getJson } from "../../../../shared/api/client"
|
|||
|
|
import { endpoints } from "../../../../shared/api/endpoints"
|
|||
|
|
import type { CapabilityProfile } from "../../../../shared/types/discovery"
|
|||
|
|
|
|||
|
|
type Assignment = {
|
|||
|
|
key: string
|
|||
|
|
title: string
|
|||
|
|
description: string
|
|||
|
|
recommendation: string
|
|||
|
|
kind: "image" | "vision" | "text"
|
|||
|
|
runtime: "active" | "rules"
|
|||
|
|
}
|
|||
|
|
type AdapterOption = { name: string; route: string; model: string; enabled: boolean }
|
|||
|
|
|
|||
|
|
const props = defineProps<{
|
|||
|
|
modelValue: Record<string, unknown>
|
|||
|
|
adapters: AdapterOption[]
|
|||
|
|
visionRoute: string
|
|||
|
|
disabled: boolean
|
|||
|
|
}>()
|
|||
|
|
const emit = defineEmits<{ "update:modelValue": [value: Record<string, unknown>] }>()
|
|||
|
|
const profiles = ref<CapabilityProfile[]>([])
|
|||
|
|
|
|||
|
|
const cards: Assignment[] = [
|
|||
|
|
{ key: "material_recognition", title: "素材导入解析", description: "识别素材类别、描述、标签和生成提示词。", recommendation: "建议选择支持图片理解与结构化 JSON 输出的视觉模型;优先稳定和低成本,通常不需要最强推理模型。", kind: "vision", runtime: "active" },
|
|||
|
|
{ key: "profile_parse", title: "外部角色导入解析", description: "将外部角色文本拆成结构化角色字段。", recommendation: "建议选择指令遵循稳定、长文本处理好且支持 JSON 输出的文本模型;角色资料很长时关注上下文长度。", kind: "text", runtime: "rules" },
|
|||
|
|
{ key: "persona_split", title: "角色设定拆解", description: "拆解身份、外观、服装、关系和世界观。", recommendation: "建议使用语义理解和信息抽取能力较强的文本模型,重点避免遗漏设定或把推测内容当成事实。", kind: "text", runtime: "rules" },
|
|||
|
|
{ key: "prompt_planning", title: "提示词规划与扩写", description: "生成阶段提示词矩阵和负面提示词。", recommendation: "建议选择熟悉生图提示词、风格词和负面词的文本模型;创意能力优先于纯推理速度。", kind: "text", runtime: "rules" },
|
|||
|
|
{ key: "quick_generation", title: "快速生图", description: "单图生成和快速角色预览。", recommendation: "建议选择低延迟、低单价且提示词响应稳定的模型,以快速出草图为主,不必追求最高分辨率。", kind: "image", runtime: "active" },
|
|||
|
|
{ key: "portrait_generation", title: "头像草稿", description: "头像与面部细节候选生成。", recommendation: "建议选择人脸、眼睛和发型细节稳定的模型,并具备较好的角色一致性;优先测试近景表现。", kind: "image", runtime: "active" },
|
|||
|
|
{ key: "halfbody_generation", title: "半身角色图", description: "上半身服装、姿态和轮廓。", recommendation: "建议选择服装细节、手部和姿态表现均衡的模型,适合中景构图和角色立绘。", kind: "image", runtime: "active" },
|
|||
|
|
{ key: "fullbody_generation", title: "全身角色图", description: "全套服装、比例和全身设计。", recommendation: "建议选择人体比例、脚部、复杂服装结构较稳定的模型;优先支持纵向高分辨率。", kind: "image", runtime: "active" },
|
|||
|
|
{ key: "sheet_generation", title: "设定图与姿势图", description: "表情、动作和角色设定图。", recommendation: "建议选择多视图排版、角色一致性和动作控制能力强的模型,能稳定生成设定表或姿势组图。", kind: "image", runtime: "active" },
|
|||
|
|
{ key: "hires_fix", title: "高清修复", description: "最终放大、细节修复和风格统一。", recommendation: "建议选择支持高分辨率、图生图或重绘的模型,重点保留原角色身份与构图,避免放大时改变面部和服装。", kind: "image", runtime: "active" },
|
|||
|
|
]
|
|||
|
|
|
|||
|
|
const discovered = computed(() => profiles.value.map(item => `${item.provider_id}/${item.model_id}`))
|
|||
|
|
const reviewRoutes = computed(() => {
|
|||
|
|
const configured = props.modelValue.cross_review_routes
|
|||
|
|
if (Array.isArray(configured) && configured.length) return configured.map(String)
|
|||
|
|
return [String(props.modelValue.cross_review_primary || ""), String(props.modelValue.cross_review_secondary || "")]
|
|||
|
|
})
|
|||
|
|
function value(key: string) { return String(props.modelValue[key] || "") }
|
|||
|
|
function options(card: Assignment) {
|
|||
|
|
const adapterRoutes = props.adapters.filter(item => item.enabled && item.route).map(item => item.route)
|
|||
|
|
if (card.kind === "image") return Array.from(new Set(adapterRoutes))
|
|||
|
|
if (card.kind === "vision") return Array.from(new Set([props.visionRoute, ...adapterRoutes, ...discovered.value].filter(Boolean)))
|
|||
|
|
return Array.from(new Set([...adapterRoutes, ...discovered.value].filter(Boolean)))
|
|||
|
|
}
|
|||
|
|
function optionLabel(route: string) {
|
|||
|
|
const adapter = props.adapters.find(item => item.route === route)
|
|||
|
|
if (!adapter) return route
|
|||
|
|
return `${adapter.name}${adapter.model ? ` · ${adapter.model}` : ""} (${route})`
|
|||
|
|
}
|
|||
|
|
function update(key: string, next: string) { emit("update:modelValue", { ...props.modelValue, [key]: next }) }
|
|||
|
|
function updateReview(index: number, route: string) {
|
|||
|
|
const next = [...reviewRoutes.value]
|
|||
|
|
next[index] = route
|
|||
|
|
emit("update:modelValue", { ...props.modelValue, cross_review_routes: next, cross_review_primary: next[0] || "", cross_review_secondary: next[1] || "" })
|
|||
|
|
}
|
|||
|
|
function addReviewRoute() {
|
|||
|
|
emit("update:modelValue", { ...props.modelValue, cross_review_routes: [...reviewRoutes.value, ""] })
|
|||
|
|
}
|
|||
|
|
function removeReviewRoute(index: number) {
|
|||
|
|
if (reviewRoutes.value.length <= 2) return
|
|||
|
|
const next = reviewRoutes.value.filter((_, itemIndex) => itemIndex !== index)
|
|||
|
|
emit("update:modelValue", { ...props.modelValue, cross_review_routes: next, cross_review_primary: next[0] || "", cross_review_secondary: next[1] || "" })
|
|||
|
|
}
|
|||
|
|
function reviewOptions(index: number) {
|
|||
|
|
const selected = new Set(reviewRoutes.value.filter((route, itemIndex) => itemIndex !== index && route))
|
|||
|
|
const visionCard: Assignment = { key: "review", title: "", description: "", recommendation: "", kind: "vision", runtime: "rules" }
|
|||
|
|
return options(visionCard).filter(route => !selected.has(route) || route === reviewRoutes.value[index])
|
|||
|
|
}
|
|||
|
|
onMounted(async () => {
|
|||
|
|
try { profiles.value = await getJson<CapabilityProfile[]>(endpoints.apiDiscoveryCapabilities) }
|
|||
|
|
catch { profiles.value = [] }
|
|||
|
|
})
|
|||
|
|
</script>
|
|||
|
|
|
|||
|
|
<template>
|
|||
|
|
<section class="assignments">
|
|||
|
|
<header><div><span>模型分工</span><strong>按功能节点选择模型路由</strong><p>生图与素材识别配置会立即进入运行链;标记为“规则引擎”的节点当前保留模型路由,启用远程 LLM 后无需重新调整界面。</p></div></header>
|
|||
|
|
<div class="grid">
|
|||
|
|
<article v-for="card in cards" :key="card.key">
|
|||
|
|
<div class="card-head"><span :class="card.kind">{{ card.kind === 'image' ? '生图' : card.kind === 'vision' ? '视觉' : '文本' }}</span><em :class="card.runtime">{{ card.runtime === 'active' ? '已接入运行时' : '当前规则引擎' }}</em></div>
|
|||
|
|
<strong>{{ card.title }}</strong>
|
|||
|
|
<p>{{ card.description }}</p>
|
|||
|
|
<div class="recommendation"><b>选型建议</b><span>{{ card.recommendation }}</span></div>
|
|||
|
|
<label><span>模型路由</span><select :value="value(card.key)" :disabled="disabled" @change="update(card.key, ($event.target as HTMLSelectElement).value)"><option value="">自动选择默认路由</option><option v-for="route in options(card)" :key="route" :value="route">{{ optionLabel(route) }}</option></select></label>
|
|||
|
|
<small>{{ card.key }}</small>
|
|||
|
|
</article>
|
|||
|
|
<article class="review-group">
|
|||
|
|
<div class="card-head"><span class="vision">视觉</span><em class="rules">当前规则引擎</em></div>
|
|||
|
|
<div><strong>交叉审核</strong><p>使用多个不同模型独立检查候选图,综合角色一致性、构图、手部和服装缺陷。</p></div>
|
|||
|
|
<div class="recommendation"><b>选型建议</b><span>主审与复核建议选择不同厂商或不同模型家族,减少同源偏差。至少配置两路;继续添加可提高可靠性,但会增加审核成本。</span></div>
|
|||
|
|
<div class="review-routes">
|
|||
|
|
<label v-for="(route, index) in reviewRoutes" :key="index">
|
|||
|
|
<span>{{ index === 0 ? '主审核模型' : index === 1 ? '复核模型' : `附加审核模型 ${index}` }}</span>
|
|||
|
|
<div class="review-select"><select :value="route" :disabled="disabled" @change="updateReview(index, ($event.target as HTMLSelectElement).value)"><option value="">请选择不同的模型路由</option><option v-for="option in reviewOptions(index)" :key="option" :value="option">{{ optionLabel(option) }}</option></select><button v-if="index > 1" type="button" :disabled="disabled" title="移除此审核路由" @click="removeReviewRoute(index)">×</button></div>
|
|||
|
|
</label>
|
|||
|
|
</div>
|
|||
|
|
<button class="add-review" type="button" :disabled="disabled" @click="addReviewRoute">+ 添加审核路由</button>
|
|||
|
|
<small>cross_review_routes</small>
|
|||
|
|
</article>
|
|||
|
|
</div>
|
|||
|
|
</section>
|
|||
|
|
</template>
|
|||
|
|
|
|||
|
|
<style scoped>
|
|||
|
|
.assignments{display:grid;gap:14px}.assignments>header{border:1px solid var(--border);border-radius:10px;padding:15px;background:linear-gradient(105deg,var(--primary-soft),var(--panel-muted))}.assignments header>div{display:grid;gap:4px}.assignments header span{color:var(--text-soft);font-size:11px;font-weight:800}.assignments header p,.grid p{margin:0;color:var(--text-soft);line-height:1.5}.grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:11px}.grid article{display:grid;gap:9px;border:1px solid var(--border);border-radius:10px;padding:14px;background:var(--panel-muted)}.card-head{display:flex;justify-content:space-between}.card-head span,.card-head em{border-radius:5px;padding:3px 7px;font-size:10px;font-style:normal}.card-head span.image{color:#7757e8;background:var(--primary-soft)}.card-head span.vision{color:#25845a;background:color-mix(in srgb,#39aa72 13%,var(--panel))}.card-head span.text{color:#a06a12;background:color-mix(in srgb,#e1a53a 15%,var(--panel))}.card-head em{color:var(--text-soft);background:var(--panel)}.card-head em.active{color:#25845a}.recommendation{display:grid;grid-template-columns:auto 1fr;align-items:start;gap:8px;border-left:3px solid var(--primary);border-radius:4px;padding:8px 10px;background:color-mix(in srgb,var(--primary-soft) 55%,var(--panel))}.recommendation b{white-space:nowrap;color:var(--primary);font-size:11px}.recommendation span{color:var(--text-soft);font-size:12px;line-height:1.55}.grid label{display:grid;gap:5px}.grid label>span,.grid article>small{color:var(--text-soft);font-size:11px}.grid select{width:100%;min-height:39px;border:1px solid var(--border);border-radius:7px;padding:0 34px 0 10px;color:var(--text);background:var(--panel);font:inherit;cursor:pointer}.grid select:disabled{cursor:not-allowed;opacity:.65}.review-group{grid-column:1/-1}.review-routes{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}.review-select{display:flex;gap:7px}.review-select button{flex:0 0 39px;border:1px solid var(--border);border-radius:7px;color:#c45151;background:var(--panel);font-size:20px}.add-review{justify-self:start;border:1px dashed var(--primary);border-radius:7px;padding:8px 13px;color:var(--primary);background:var(--panel);cursor:pointer}@media(max-width:760px){.grid,.review-routes{grid-template-columns:1fr}.recommendation{grid-template-columns:1fr}}
|
|||
|
|
</style>
|