Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,18 @@ export interface ModelConfigFormProps {
const SUGGESTED_MODELS = ["glm-5.2", "claude-sonnet-4-6", "qwen3.7-plus"] as const
const SUGGESTED_EMBED = ["text-embedding-v4"] as const

/**
* Disclosure 右侧摘要用短标签:本地 GGUF 常是整段绝对路径,塞进 summary
* 会把标题挤竖排(见 disclosure.tsx)。API 模型名通常本身就短,原样返回。
*/
function shortModelLabel(model: string): string {
if (model === "") return "—"
const slash = Math.max(model.lastIndexOf("/"), model.lastIndexOf("\\"))
if (slash < 0) return model
const base = model.slice(slash + 1)
return base === "" ? model : base
}

export function ModelConfigForm({ onSaved, saveLabel }: ModelConfigFormProps) {
const { t } = useDynamicTranslation("settings")
const config = useRuntimeConfig()
Expand Down Expand Up @@ -461,7 +473,7 @@ export function ModelConfigForm({ onSaved, saveLabel }: ModelConfigFormProps) {
<Disclosure
title={t("model.embed.title")}
hint={t("model.embed.hint")}
summary={`${current.embedEffective.model || "—"} · ${current.embedEffective.embeddingDim}d${
summary={`${shortModelLabel(current.embedEffective.model)} · ${current.embedEffective.embeddingDim}d${
current.embedEffective.sendDimensions ? " · dimensions" : ""
}`}
>
Expand Down
11 changes: 10 additions & 1 deletion packages/design/src/components/disclosure.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -78,14 +78,23 @@ export function Disclosure({
strokeLinejoin="round"
/>
</svg>
{/*
标题列必须能拿到正常宽度。以前 summary 写 `shrink-0`,一旦右侧塞进
无空格长串(本地 GGUF 绝对路径之类),整行被挤到只剩 ~1 字宽,
标题/说明就逐字竖排 —— 设置页「向量模型自定义」就是这个样子。
summary 改成可收缩 + truncate;完整内容靠 title 悬停看。
*/}
<span className="flex min-w-0 flex-1 flex-col">
<span className="typography-body-base-500 text-[var(--text-base-primary)]">{title}</span>
{hint === undefined ? null : (
<span className="typography-caption-400 text-[var(--text-base-tertiary)]">{hint}</span>
)}
</span>
{summary === undefined ? null : (
<span className="typography-caption-400 shrink-0 text-[var(--text-base-tertiary)]">
<span
className="typography-caption-400 min-w-0 max-w-[45%] shrink truncate text-[var(--text-base-tertiary)]"
title={typeof summary === "string" ? summary : undefined}
>
{summary}
</span>
)}
Expand Down
Loading