fix: align settings layouts and tolerate existing migration objects (#4164)

* fix(frontend): unify settings layouts and compact integration guides

* fix(migrations): tolerate existing browser memory and catalog objects
main
lyingbug 2026-10-11 22:48:57 +08:00 committed by GitHub
parent 5343ac47b7
commit 00474f734d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
16 changed files with 1358 additions and 1502 deletions

View File

@ -95,3 +95,62 @@
color: var(--td-success-color);
}
}
// 标题旁的补充说明入口,保持设置页标题本身的字号与字重。
.settings-title-help() {
display: inline-flex;
align-items: center;
justify-content: center;
flex-shrink: 0;
width: 24px;
height: 24px;
padding: 0;
border: 0;
border-radius: var(--app-radius-sm);
background: transparent;
color: var(--td-text-color-placeholder);
cursor: help;
&:hover {
color: var(--td-text-color-secondary);
background: var(--td-bg-color-container-hover);
}
&:focus-visible {
outline: 2px solid var(--td-brand-color);
outline-offset: 2px;
}
}
// 资源管理类设置页:固定顶部工具栏,列表在剩余空间内滚动。
.settings-list-page() {
width: 100%;
height: 100%;
min-height: 0;
display: flex;
flex-direction: column;
color: var(--td-text-color-primary);
}
.settings-list-action() {
flex-shrink: 0;
min-height: 32px;
padding: 0 12px;
border: 1px solid var(--td-component-stroke);
border-radius: var(--app-radius-sm);
background: var(--td-bg-color-container);
color: var(--td-text-color-primary);
font-size: var(--app-text-md);
font-weight: 400;
&:hover:not(:disabled) {
background: var(--td-bg-color-container-hover);
}
&:focus-visible {
outline: 2px solid var(--td-brand-color);
outline-offset: 2px;
}
:deep(.t-icon) { color: var(--td-brand-color); }
}

View File

@ -1334,9 +1334,9 @@ const resizeSidebar = (delta: number, keyboard: boolean) => {
display: flex;
align-items: center;
justify-content: space-between;
// 抵消 .aside_box 顶部内边距,使行中线与主区 .chat-header 标题中线(距顶 19.5px)齐平
// 保留侧栏顶部留白,让 Logo 和操作按钮与窗口顶边保持舒适间距
height: 39px;
margin: -8px 0 4px;
margin: 0 0 4px;
flex-shrink: 0;
padding: 0 2px 0 var(--sidebar-inset-x);
}

View File

@ -100,7 +100,7 @@ const badgeStyle = computed((): Record<string, string> => (
}
.sandbox-badge--xs.sandbox-badge--mono::before {
width: 10px;
height: 10px;
width: 16px;
height: 16px;
}
</style>

View File

@ -2,6 +2,7 @@
<IntegrationLandingLayout
:title="$t('integrations.cli.title')"
:subtitle="$t('integrations.cli.subtitle')"
variant="cli"
>
<template #actions>
<IntegrationExternalCta

View File

@ -1,15 +1,15 @@
<template>
<div class="integration-landing" :class="{ 'integration-landing--claw': variant === 'claw' }">
<div class="integration-landing" :class="`integration-landing--${variant}`">
<header class="landing-hero">
<div class="landing-hero__content">
<div class="landing-hero__top">
<h2 class="landing-hero__title">{{ title }}</h2>
<p v-if="subtitle" class="landing-hero__subtitle">{{ subtitle }}</p>
<div v-if="$slots.tags" class="landing-hero__tags">
<slot name="tags" />
<div v-if="$slots.actions" class="landing-hero__actions">
<slot name="actions" />
</div>
</div>
<div v-if="$slots.actions" class="landing-hero__actions">
<slot name="actions" />
<p v-if="subtitle" class="landing-hero__subtitle">{{ subtitle }}</p>
<div v-if="$slots.tags" class="landing-hero__tags">
<slot name="tags" />
</div>
</header>
@ -17,9 +17,9 @@
<section class="landing-main">
<slot name="main" />
</section>
<aside class="landing-aside">
<section class="landing-aside">
<slot name="aside" />
</aside>
</section>
</div>
<footer v-if="$slots.footer" class="landing-footer">
@ -33,7 +33,7 @@ withDefaults(
defineProps<{
title: string
subtitle?: string
variant?: 'chrome' | 'claw'
variant?: 'chrome' | 'claw' | 'cli'
}>(),
{ variant: 'chrome' },
)

View File

@ -2,565 +2,256 @@
@claw-accent-dark: #c44d1f;
.integration-landing {
--integration-accent: var(--td-brand-color);
container-type: inline-size;
container-name: integration-landing;
display: flex;
flex-direction: column;
gap: 24px;
// TDesign 按钮内 icon / 文案垂直居中(落地页局部修正)
:deep(.t-button) {
display: inline-flex;
align-items: center;
justify-content: center;
}
:deep(.t-button .t-icon) {
display: inline-flex;
align-items: center;
justify-content: center;
vertical-align: middle;
}
}
// ── 页头:与设置页对齐,通过入口图标和局部主题色区分集成 ──
.landing-hero {
flex-shrink: 0;
display: flex;
flex-direction: column;
gap: 16px;
// 给弹窗右上角的关闭按钮留出空间。
padding: 0 16px 24px 0;
border-bottom: 1px solid var(--td-component-stroke);
&__content {
min-width: 0;
}
&--claw { --integration-accent: @claw-accent-dark; }
&__title {
margin: 0 0 8px;
font-size: var(--app-text-3xl);
font-weight: 600;
line-height: 28px;
color: var(--td-text-color-primary);
}
&__subtitle {
margin: 0;
font-size: var(--app-text-base);
line-height: 1.7;
color: var(--td-text-color-secondary);
}
&__tags {
display: flex;
flex-wrap: wrap;
gap: 8px;
margin-top: 14px;
}
&__actions {
display: flex;
flex-wrap: wrap;
gap: 12px;
min-width: 0;
}
}
.ext-cta {
--integration-cta-accent: var(--td-brand-color);
--integration-cta-foreground: var(--td-brand-color);
display: inline-flex;
align-items: center;
gap: 8px;
max-width: 100%;
min-height: 32px;
padding: 4px 0;
border-radius: var(--app-radius-xs);
border: none;
background: transparent;
cursor: pointer;
text-align: left;
font: inherit;
color: var(--integration-cta-foreground);
box-sizing: border-box;
&:hover &__label {
text-decoration: underline;
text-underline-offset: 4px;
}
&:focus-visible {
outline: 2px solid var(--integration-cta-accent);
outline-offset: 2px;
}
&--claw {
--integration-cta-accent: @claw-accent;
--integration-cta-foreground: @claw-accent-dark;
}
&__badge {
flex-shrink: 0;
width: 18px;
height: 18px;
display: inline-flex;
align-items: center;
justify-content: center;
font-size: var(--app-text-2xl);
line-height: 0;
.t-icon {
display: inline-flex;
align-items: center;
justify-content: center;
line-height: 0;
}
}
&__label {
min-width: 0;
font-size: var(--app-text-base);
font-weight: 500;
line-height: 1.5;
overflow-wrap: anywhere;
}
&__arrow-wrap {
flex-shrink: 0;
width: 16px;
height: 16px;
display: inline-flex;
align-items: center;
justify-content: center;
}
&__arrow {
font-size: var(--app-text-base);
line-height: 0;
display: inline-flex;
align-items: center;
justify-content: center;
}
}
.ext-cta-emoji {
font-size: 17px;
line-height: 1;
display: block;
}
// ── Claw / 龙虾主题色 ──
.integration-landing--claw {
.landing-group {
.setting-drawer__section-title::before {
background: @claw-accent;
}
.section-head-extra {
color: @claw-accent-dark;
background: color-mix(in srgb, @claw-accent 12%, var(--td-bg-color-secondarycontainer));
}
}
.capability-card__icon {
color: @claw-accent-dark;
background: color-mix(in srgb, @claw-accent 10%, var(--td-bg-color-container));
}
.landing-step-num {
background: color-mix(in srgb, @claw-accent 14%, transparent);
color: @claw-accent-dark;
}
.landing-footer-bar {
border-color: color-mix(in srgb, @claw-accent 22%, var(--td-component-stroke));
background: color-mix(in srgb, @claw-accent 6%, var(--td-bg-color-secondarycontainer));
}
.landing-meta {
color: color-mix(in srgb, @claw-accent-dark 55%, var(--td-text-color-placeholder));
}
:deep(.t-button--variant-outline) {
color: @claw-accent-dark;
border-color: color-mix(in srgb, @claw-accent 38%, var(--td-component-border));
&:hover,
&:focus-visible {
color: @claw-accent-dark;
border-color: @claw-accent;
background-color: color-mix(in srgb, @claw-accent 8%, transparent);
}
}
:deep(.t-button--variant-text) {
color: @claw-accent-dark;
&:hover,
&:focus-visible {
color: @claw-accent-dark;
background-color: color-mix(in srgb, @claw-accent 10%, transparent);
}
}
:deep(.t-button--variant-text .t-icon) {
color: inherit;
}
}
.scenario-tag {
padding: 4px 10px;
border-radius: var(--app-radius-xs);
font-size: var(--app-text-md);
line-height: 1.45;
color: var(--td-text-color-secondary);
background: color-mix(in srgb, var(--td-bg-color-container) 70%, transparent);
border: 1px solid color-mix(in srgb, var(--td-component-stroke) 80%, transparent);
}
// ── 双栏:面板等高,内容保持自然高度 ──
.landing-body {
display: grid;
grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
gap: 24px;
align-items: stretch;
@container integration-landing (max-width: 880px) {
grid-template-columns: 1fr;
}
}
.landing-main,
.landing-aside {
display: flex;
width: 100%;
min-width: 0;
}
// ── Group 面板(对齐 IM / SettingDrawer section)──
.landing-group {
flex: 1;
width: 100%;
display: flex;
flex-direction: column;
padding: 24px;
border: 1px solid var(--td-component-stroke);
border-radius: var(--app-radius-lg);
background: var(--td-bg-color-container);
box-sizing: border-box;
.setting-drawer__section {
padding: 24px 0;
border-bottom: 1px solid var(--td-component-stroke);
.landing-hero {
display: flex;
flex-direction: column;
gap: 20px;
flex: 1;
&:first-child {
padding-top: 0;
}
&:last-child {
border-bottom: none;
padding-bottom: 0;
}
}
.setting-drawer__section-title {
font-size: var(--app-text-xl);
line-height: 1.5;
font-weight: 600;
color: var(--td-text-color-primary);
margin: 0;
user-select: none;
display: flex;
align-items: center;
gap: 8px;
flex-shrink: 0;
&::before {
content: '';
width: 3px;
height: 18px;
background: var(--td-brand-color);
border-radius: 2px;
flex-shrink: 0;
&__top {
display: flex;
align-items: center;
justify-content: space-between;
flex-wrap: wrap;
gap: 12px;
padding-right: 24px;
}
}
.section-head-extra {
margin-left: auto;
padding: 1px 7px;
border-radius: var(--app-radius-lg);
font-size: var(--app-text-xs);
font-weight: 500;
color: var(--td-text-color-disabled);
background: var(--td-bg-color-secondarycontainer);
}
}
// ── 能力卡片 ──
.capability-grid {
display: grid;
grid-template-columns: repeat(2, minmax(0, 1fr));
grid-auto-rows: auto;
gap: 16px;
@container integration-landing (max-width: 520px) {
grid-template-columns: 1fr;
}
&--claw {
.capability-card:last-child:nth-child(odd) {
grid-column: 1 / -1;
&__title {
margin: 0;
font-size: var(--app-text-3xl);
font-weight: 600;
line-height: 28px;
color: var(--td-text-color-primary);
}
&__subtitle {
margin: 0;
font-size: var(--app-text-base);
line-height: 1.5;
color: var(--td-text-color-secondary);
}
&__tags { display: flex; flex-wrap: wrap; gap: 6px; }
&__actions { display: flex; flex-wrap: wrap; gap: 8px; }
}
}
.capability-card {
display: flex;
flex-direction: column;
gap: 12px;
padding: 18px;
border: 1px solid var(--td-component-stroke);
border-radius: var(--app-radius-md);
background: var(--td-bg-color-secondarycontainer);
box-sizing: border-box;
&__icon {
width: 30px;
height: 30px;
border-radius: 7px;
.ext-cta {
display: inline-flex;
align-items: center;
justify-content: center;
gap: 6px;
max-width: 100%;
min-height: 32px;
padding: 0 10px;
border: 1px solid var(--td-component-stroke);
border-radius: var(--app-radius-sm);
background: var(--td-bg-color-container);
color: var(--td-brand-color);
line-height: 0;
flex-shrink: 0;
color: var(--td-text-color-primary);
font: inherit;
font-size: var(--app-text-md);
cursor: pointer;
:deep(.t-icon) {
&:hover { background: var(--td-bg-color-container-hover); }
&:focus-visible { outline: 2px solid var(--integration-accent); outline-offset: 2px; }
&__badge, &__arrow-wrap {
display: inline-flex; align-items: center; justify-content: center;
flex-shrink: 0; width: 16px; height: 16px;
}
&__badge { color: var(--integration-accent); }
&__label { line-height: 1.5; overflow-wrap: anywhere; }
&__arrow { font-size: var(--app-text-base); color: var(--td-text-color-placeholder); }
}
.ext-cta-emoji { font-size: var(--app-text-xl); line-height: 1; }
.scenario-tag {
padding: 2px 8px;
border-radius: var(--app-radius-sm);
font-size: var(--app-text-sm);
line-height: 18px;
color: var(--td-text-color-secondary);
background: var(--td-bg-color-secondarycontainer);
}
.landing-body {
display: flex;
flex-direction: column;
gap: 16px;
}
.landing-main, .landing-aside { min-width: 0; }
.landing-group {
display: flex;
flex-direction: column;
padding: 16px;
border: 1px solid var(--td-component-stroke);
border-radius: var(--app-radius-lg);
background: var(--td-bg-color-container);
.setting-drawer__section {
display: flex;
flex-direction: column;
gap: 12px;
padding: 16px 0;
border-bottom: 1px solid var(--td-component-stroke);
flex: none;
animation: none;
&:first-child { padding-top: 0; }
&:last-child { padding-bottom: 0; border-bottom: none; }
}
.setting-drawer__section-title {
display: flex;
align-items: center;
gap: 8px;
margin: 0;
color: var(--td-text-color-primary);
font-size: var(--app-text-lg);
font-weight: 600;
line-height: 22px;
&::before { display: none; }
}
.section-head-extra {
padding: 0 6px;
border-radius: var(--app-radius-pill);
background: var(--td-bg-color-secondarycontainer);
color: var(--td-text-color-secondary);
font-size: var(--app-text-xs);
font-weight: 400;
line-height: 20px;
}
}
// 功能介绍采用图文条目,避免面板内再套大卡片。
.capability-grid { display: flex; flex-direction: column; }
.capability-card {
display: grid;
grid-template-columns: 28px minmax(0, 1fr);
column-gap: 10px;
row-gap: 3px;
padding: 12px 0;
border-bottom: 1px solid var(--td-component-stroke);
&:first-child { padding-top: 0; }
&:last-child { padding-bottom: 0; border-bottom: none; }
&__icon {
grid-row: 1 / 3;
display: inline-flex;
align-items: center;
justify-content: center;
line-height: 0;
width: 28px;
height: 28px;
border-radius: var(--app-radius-sm);
background: color-mix(in srgb, var(--integration-accent) 8%, transparent);
color: var(--integration-accent);
.t-icon { font-size: var(--app-text-xl); }
}
&__title {
margin: 0;
color: var(--td-text-color-primary);
font-size: var(--app-text-md);
font-weight: 500;
line-height: 22px;
}
&__desc {
margin: 0;
color: var(--td-text-color-secondary);
font-size: var(--app-text-sm);
line-height: 1.6;
overflow-wrap: anywhere;
}
}
&__title {
margin: 0;
font-size: var(--app-text-lg);
font-weight: 600;
line-height: 1.4;
.landing-steps { display: flex; flex-direction: column; list-style: none; margin: 0; padding: 0; }
.landing-step {
display: flex;
align-items: flex-start;
gap: 10px;
padding: 12px 0;
border-bottom: 1px solid var(--td-component-stroke);
&:first-child { padding-top: 0; }
&:last-child { padding-bottom: 0; border-bottom: none; }
}
.landing-step-num {
display: flex;
align-items: center;
justify-content: center;
flex-shrink: 0;
width: 22px;
height: 22px;
border-radius: 50%;
font-size: var(--app-text-sm);
font-weight: 500;
color: var(--integration-accent);
background: color-mix(in srgb, var(--integration-accent) 10%, transparent);
}
.landing-step-body { flex: 1; min-width: 0; }
.landing-step-title {
margin-bottom: 3px;
font-size: var(--app-text-md);
font-weight: 500;
line-height: 22px;
color: var(--td-text-color-primary);
}
&__desc {
.landing-step-desc, .field-desc {
margin: 0;
font-size: var(--app-text-base);
line-height: 1.7;
font-size: var(--app-text-md);
line-height: 1.6;
overflow-wrap: anywhere;
color: var(--td-text-color-secondary);
}
}
.landing-step-action, .landing-step-embed { margin-top: 8px; }
.landing-hint {
display: flex;
align-items: flex-start;
gap: 8px;
padding: 10px 12px;
border-radius: var(--app-radius-md);
background: var(--td-bg-color-secondarycontainer);
border: 1px solid var(--td-component-stroke);
&__icon {
flex-shrink: 0;
margin-top: 1px;
font-size: var(--app-text-base);
.api-key-control.landing-api-control {
display: flex; align-items: center; gap: 4px; width: 100%;
.t-input__wrap { flex: 1; min-width: 0; }
.t-button { flex-shrink: 0; }
input { font-family: var(--app-font-family-mono, monospace); font-size: var(--app-text-sm); }
}
.code-toolbar {
display: flex;
align-items: flex-start;
border: 1px solid var(--td-component-stroke);
border-radius: var(--app-radius-sm);
background: var(--td-bg-color-secondarycontainer);
overflow: hidden;
&__code {
flex: 1;
min-width: 0;
margin: 0;
padding: 10px 12px;
font-family: var(--app-font-family-mono, ui-monospace, SFMono-Regular, Menlo, monospace);
font-size: var(--app-text-sm);
line-height: 1.6;
color: var(--td-text-color-primary);
overflow-x: auto;
white-space: pre;
background: transparent;
}
&__copy {
flex-shrink: 0;
margin: 4px;
width: 28px;
height: 28px;
padding: 0 !important;
}
}
.landing-footer { flex-shrink: 0; }
.landing-footer-bar { display: flex; flex-direction: column; gap: 4px; }
.landing-footer-bar__note, .landing-meta {
margin: 0;
font-size: var(--app-text-sm);
line-height: 1.5;
color: var(--td-text-color-placeholder);
}
p {
margin: 0;
font-size: var(--app-text-sm);
line-height: 1.55;
color: var(--td-text-color-secondary);
@container integration-landing (max-width: 720px) {
.landing-hero__top { align-items: flex-start; }
}
}
.landing-note {
flex-shrink: 0;
margin-top: auto;
}
.integration-landing .field-desc {
margin: 0;
font-size: var(--app-text-base);
line-height: 1.7;
color: var(--td-text-color-secondary);
}
.credential-row {
display: flex;
flex-direction: column;
gap: 8px;
:deep(.mono-text-input input) {
font-family: var(--app-font-family-mono, ui-monospace, SFMono-Regular, Menlo, monospace);
font-size: var(--app-text-sm);
}
}
.api-key-control.landing-api-control {
width: 100%;
display: flex;
gap: 4px;
align-items: center;
:deep(.t-input) {
flex: 1;
min-width: 0;
}
:deep(.t-button) {
flex-shrink: 0;
width: 32px;
height: 32px;
padding: 0;
}
}
.code-toolbar {
display: flex;
align-items: center;
gap: 0;
border-radius: var(--app-radius-md);
border: 1px solid var(--td-component-stroke);
overflow: hidden;
background: var(--td-bg-color-secondarycontainer);
&__code {
flex: 1;
min-width: 0;
margin: 0;
padding: 14px 16px;
font-family: var(--app-font-family-mono, ui-monospace, SFMono-Regular, Menlo, monospace);
font-size: var(--app-text-md);
line-height: 1.7;
color: var(--td-text-color-primary);
overflow-x: auto;
white-space: pre;
background: transparent;
}
&__copy {
flex-shrink: 0;
align-self: center;
margin: 0 4px;
width: 32px;
height: 32px;
padding: 0 !important;
}
}
.landing-steps {
list-style: none;
margin: 0;
padding: 0;
display: flex;
flex-direction: column;
}
.landing-step {
display: flex;
gap: 12px;
align-items: flex-start;
padding: 18px 0;
border-bottom: 1px solid var(--td-component-stroke);
&:first-child {
padding-top: 0;
}
&:last-child {
border-bottom: none;
padding-bottom: 0;
}
}
.landing-step-num {
flex-shrink: 0;
width: 26px;
height: 26px;
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
font-size: var(--app-text-md);
font-weight: 600;
background: color-mix(in srgb, var(--td-brand-color) 12%, transparent);
color: var(--td-brand-color);
}
.landing-step-body {
flex: 1;
min-width: 0;
}
.landing-step-title {
font-size: var(--app-text-lg);
font-weight: 600;
line-height: 1.6;
color: var(--td-text-color-primary);
margin-bottom: 6px;
}
.landing-step-desc {
margin: 0;
font-size: var(--app-text-base);
line-height: 1.7;
overflow-wrap: anywhere;
color: var(--td-text-color-secondary);
}
.landing-step-action,
.landing-step-embed {
margin-top: 12px;
}
.landing-step-embed.credential-row {
margin-top: 12px;
}
.landing-footer {
display: flex;
align-items: center;
flex-shrink: 0;
padding-top: 0;
}
.landing-footer-bar {
display: flex;
flex-direction: column;
gap: 8px;
width: 100%;
padding: 16px 18px;
border-radius: var(--app-radius-md);
border: 1px solid var(--td-component-stroke);
background: var(--td-bg-color-secondarycontainer);
box-sizing: border-box;
&__note {
margin: 0;
font-size: var(--app-text-base);
line-height: 1.7;
color: var(--td-text-color-secondary);
}
}
.landing-meta {
font-size: var(--app-text-md);
line-height: 1.6;
color: var(--td-text-color-placeholder);
}

View File

@ -4,17 +4,17 @@
<div class="section-header-titlewrap">
<h2>{{ t('memorySettings.title') }}</h2>
<t-popup
placement="bottom-start"
placement="bottom-left"
trigger="hover"
show-arrow
overlay-class-name="memory-usage-popup-overlay"
>
<button
type="button"
class="usage-trigger-btn"
:aria-label="t('memorySettings.usage.iconHint')"
:title="t('memorySettings.usage.iconHint')"
>
<t-icon name="info-circle" size="16px" />
<t-icon name="help-circle" size="16px" />
</button>
<template #content>
<div class="usage-popup">
@ -157,12 +157,13 @@
<span class="status-tab-label">
<t-icon :name="tabIcon(value)" size="14px" />
<span>{{ tabLabel(value) }}</span>
<span class="status-tab-count">{{ tabCount(value) }}</span>
</span>
</template>
</t-tab-panel>
</t-tabs>
<t-loading :loading="loading">
<t-loading :loading="loading" class="memory-results">
<div v-if="listIsEmpty" class="empty">
<p class="empty-title">
{{ emptyTitle }}
@ -259,22 +260,7 @@
<ul v-else-if="isItems && items.length > 0" class="memory-list">
<li v-for="item in items" :key="item.id" class="memory-item">
<div class="memory-main">
<div v-if="editingId === item.id" class="memory-edit">
<t-textarea
v-model="editingContent"
:autosize="{ minRows: 2, maxRows: 6 }"
@keydown.enter.ctrl="handleSaveEdit(item)"
/>
<div class="memory-edit-actions">
<t-button size="small" variant="outline" @click="editingId = ''">
{{ t('common.cancel') }}
</t-button>
<t-button size="small" theme="primary" @click="handleSaveEdit(item)">
{{ t('common.save') }}
</t-button>
</div>
</div>
<p v-else class="memory-content" :class="{ inactive: isRetired(item) }">
<p class="memory-content" :class="{ inactive: isRetired(item) }">
{{ item.content }}
</p>
<div class="memory-meta">
@ -307,18 +293,51 @@
{{ t('memorySettings.rejectGuess') }}
</t-button>
</template>
<t-button
<t-popup
v-if="item.status === 'active'"
size="small"
theme="default"
variant="text"
shape="square"
:disabled="!canWrite"
:title="t('common.edit')"
@click="startEdit(item)"
:visible="editingId === item.id"
trigger="click"
placement="bottom-right"
destroy-on-close
@visible-change="(visible: boolean) => { if (visible) startEdit(item); else editingId = '' }"
>
<template #icon><t-icon name="edit" /></template>
</t-button>
<t-button
size="small"
theme="default"
variant="text"
shape="square"
:disabled="!canWrite"
:title="t('common.edit')"
:aria-label="t('common.edit')"
>
<template #icon><t-icon name="edit" /></template>
</t-button>
<template #content>
<div class="memory-edit-popup" @click.stop @keydown.esc="editingId = ''">
<div class="memory-edit-title">{{ t('common.edit') }}</div>
<t-textarea
v-model="editingContent"
:aria-label="t('memorySettings.addContentLabel')"
:autosize="{ minRows: 3, maxRows: 8 }"
autofocus
@keydown.enter.ctrl.prevent="handleSaveEdit(item)"
@keydown.enter.meta.prevent="handleSaveEdit(item)"
/>
<div class="memory-edit-footer">
<span class="memory-edit-kind">{{ kindLabel(item.kind) }}</span>
<div class="memory-edit-actions">
<t-button size="small" theme="default" variant="text" @click="editingId = ''">
{{ t('common.cancel') }}
</t-button>
<t-button size="small" theme="primary" :disabled="!editingContent.trim()"
@click="handleSaveEdit(item)">
{{ t('common.save') }}
</t-button>
</div>
</div>
</div>
</template>
</t-popup>
<!-- Rejecting a guess already drops it and remembers the refusal, so a
delete button on a pending row is a weaker duplicate of "No". -->
<t-popconfirm
@ -335,6 +354,7 @@
theme="danger"
variant="text"
shape="square"
:style="{ visibility: editingId === item.id ? 'hidden' : undefined }"
:title="t('common.delete')"
>
<template #icon><t-icon name="delete" /></template>
@ -448,13 +468,15 @@ const listIsEmpty = computed(() => {
})
const tabLabel = (value: MemoryListTab) => {
if (value === 'tracking') {
return `${t('memorySettings.statusTracking')}(${trackingCount.value})`
}
if (value === 'documents') {
return `${t('memorySettings.statusDocuments')}(${documentCount.value})`
}
return `${t(statusLabelKeys[value])}(${counts.value[value]})`
if (value === 'tracking') return t('memorySettings.statusTracking')
if (value === 'documents') return t('memorySettings.statusDocuments')
return t(statusLabelKeys[value])
}
const tabCount = (value: MemoryListTab) => {
if (value === 'tracking') return trackingCount.value
if (value === 'documents') return documentCount.value
return counts.value[value]
}
const tabIcons: Record<MemoryListTab, string> = {
@ -861,51 +883,30 @@ onMounted(async () => {
<style lang="less" scoped>
@import (reference) '@/components/css/settings-section.less';
@import (reference) '@/components/css/settings-table.less';
.memory-settings {
width: 100%;
.settings-list-page();
}
.section-header {
.settings-section-header();
flex-shrink: 0;
margin-bottom: 12px;
padding-right: 32px;
}
.section-header-titlewrap {
display: inline-flex;
display: flex;
align-items: center;
gap: 8px;
gap: 6px;
margin-bottom: 8px;
h2 { margin: 0; }
}
.usage-trigger-btn {
display: inline-flex;
align-items: center;
justify-content: center;
flex-shrink: 0;
width: 22px;
height: 22px;
margin: 0;
padding: 0;
border: none;
border-radius: var(--app-radius-sm);
background: transparent;
color: var(--td-text-color-secondary);
cursor: pointer;
line-height: 0;
transition: background-color var(--app-motion-base) ease, color var(--app-motion-base) ease;
:deep(.t-icon) {
display: block;
}
&:hover {
background-color: var(--td-bg-color-secondarycontainer);
color: var(--td-brand-color);
}
&:focus-visible {
outline: 2px solid var(--td-brand-color-focus);
outline-offset: 1px;
}
.settings-title-help();
}
.notice {
@ -928,12 +929,14 @@ onMounted(async () => {
}
.settings-group {
flex-shrink: 0;
display: flex;
flex-direction: column;
}
.setting-row {
.setting-row();
padding: 12px 0;
}
.setting-info {
@ -942,13 +945,27 @@ onMounted(async () => {
.setting-control {
.setting-control();
min-width: 0;
}
.list-section {
margin-top: 28px;
flex: 1;
min-height: 0;
display: flex;
flex-direction: column;
margin-top: 16px;
}
.memory-results {
display: block;
flex: 1;
min-height: 0;
overflow-y: auto;
padding: 16px 0 32px;
}
.list-toolbar {
flex-shrink: 0;
display: flex;
align-items: center;
justify-content: space-between;
@ -978,11 +995,18 @@ onMounted(async () => {
.list-actions {
display: flex;
align-items: center;
gap: 4px;
gap: 8px;
flex-wrap: wrap;
:deep(.t-button) { .settings-list-action(); }
:deep(.t-button--theme-danger) {
color: var(--td-error-color);
.t-icon { color: inherit; }
}
}
.status-tabs {
flex-shrink: 0;
margin-top: 0;
:deep(.t-tabs__header) {
@ -1015,6 +1039,11 @@ onMounted(async () => {
height: 2px;
}
:deep(.t-tabs__nav-scroll) {
overflow-x: auto;
scrollbar-width: none;
}
:deep(.t-tabs__operations) {
display: none;
}
@ -1028,7 +1057,27 @@ onMounted(async () => {
}
}
.status-tab-count {
min-width: 20px;
padding: 0 6px;
box-sizing: border-box;
border-radius: var(--app-radius-pill);
background: var(--td-bg-color-secondarycontainer);
color: var(--td-text-color-secondary);
font-size: var(--app-text-xs);
line-height: 20px;
text-align: center;
font-variant-numeric: tabular-nums;
}
.status-tabs :deep(.t-is-active) .status-tab-count {
background: var(--td-brand-color-light);
color: var(--td-brand-color);
}
.memory-list {
.settings-data-table();
overflow: hidden;
list-style: none;
margin: 0;
padding: 0;
@ -1039,12 +1088,11 @@ onMounted(async () => {
align-items: flex-start;
justify-content: space-between;
gap: 16px;
padding: 16px 0;
padding: 12px 24px;
border-bottom: 1px solid var(--td-component-stroke);
&:last-child {
border-bottom: none;
}
&:last-child { border-bottom: 0; }
&:hover { background: var(--td-bg-color-container-hover); }
}
.memory-main {
@ -1107,17 +1155,44 @@ onMounted(async () => {
}
}
.memory-edit {
.memory-edit-popup {
box-sizing: border-box;
width: min(400px, calc(100vw - 64px));
padding: 8px;
display: flex;
flex-direction: column;
gap: 8px;
margin-bottom: 8px;
gap: 12px;
:deep(.t-textarea__inner) {
border-radius: var(--app-radius-sm);
font-size: var(--app-text-base);
line-height: 1.6;
}
}
.memory-edit-title {
color: var(--td-text-color-primary);
font-size: var(--app-text-md);
font-weight: 600;
line-height: 20px;
}
.memory-edit-footer {
display: flex;
align-items: center;
justify-content: space-between;
gap: 12px;
}
.memory-edit-kind {
color: var(--td-text-color-placeholder);
font-size: var(--app-text-sm);
}
.memory-edit-actions {
display: flex;
justify-content: flex-end;
gap: 8px;
align-items: center;
gap: 6px;
}
.memory-actions {
@ -1129,6 +1204,7 @@ onMounted(async () => {
}
.memory-pagination {
flex-shrink: 0;
margin-top: 16px;
}

View File

@ -2,18 +2,37 @@
<div class="model-settings">
<div class="section-header">
<div class="section-header__top">
<div>
<div class="model-title">
<h2>{{ $t('modelSettings.title') }}</h2>
<p class="section-description">{{ $t('modelSettings.description') }}</p>
<t-popup placement="bottom-left" trigger="hover" show-arrow>
<button type="button" class="model-title-help" :aria-label="$t('modelSettings.builtinModels.title')">
<t-icon name="help-circle" size="16px" />
</button>
<template #content>
<div class="builtin-models-hint" role="note">
<p class="builtin-hint-label">{{ $t('modelSettings.builtinModels.title') }}</p>
<p class="builtin-hint-text">
{{ $t(authStore.isSystemAdmin
? 'modelSettings.builtinModels.descriptionAdmin'
: 'modelSettings.builtinModels.description') }}
</p>
<a class="doc-link" :href="docsUrl('models')" target="_blank"
rel="noopener noreferrer">
{{ $t('modelSettings.builtinModels.viewGuide') }}
<t-icon name="link" class="link-icon" />
</a>
</div>
</template>
</t-popup>
</div>
<div class="model-header-actions">
<t-button
v-if="authStore.isSystemAdmin"
type="button"
theme="primary"
theme="default"
variant="text"
size="medium"
class="model-test-trigger"
size="small"
class="model-header-action"
@click="uiStore.openSettings('model-catalog')"
>
<template #icon><t-icon name="control-platform" /></template>
@ -22,141 +41,147 @@
<t-button
v-if="authStore.hasRole('admin')"
type="button"
theme="primary"
theme="default"
variant="text"
size="medium"
class="model-test-trigger"
size="small"
class="model-header-action"
@click="showDebugDrawer = true"
>
<template #icon><play-circle-icon /></template>
{{ $t('modelSettings.actions.debugModel') }}
</t-button>
<t-button v-if="authStore.hasRole('admin')" theme="default" variant="text" size="small"
class="model-header-action" @click="openAddDialog">
<template #icon><add-icon /></template>
{{ $t('modelSettings.actions.addModel') }}
</t-button>
</div>
</div>
<div class="builtin-models-hint" role="note">
<p class="builtin-hint-label">{{ $t('modelSettings.builtinModels.title') }}</p>
<p class="builtin-hint-text">
{{ $t(authStore.isSystemAdmin
? 'modelSettings.builtinModels.descriptionAdmin'
: 'modelSettings.builtinModels.description') }}
</p>
<a class="doc-link" :href="docsUrl('models')" target="_blank"
rel="noopener noreferrer">
{{ $t('modelSettings.builtinModels.viewGuide') }}
<t-icon name="link" class="link-icon" />
</a>
</div>
<p class="section-description">{{ $t('modelSettings.description') }}</p>
</div>
<t-tabs v-model="activeTypeFilter" class="model-type-tabs" data-guide="settings-models">
<t-tab-panel value="all" :label="`${$t('common.all')}(${allLegacyModels.length})`" />
<t-tab-panel value="chat" :label="`${$t('modelSettings.typeShort.chat')}(${countByType('chat')})`" />
<t-tab-panel value="embedding"
:label="`${$t('modelSettings.typeShort.embedding')}(${countByType('embedding')})`" />
<t-tab-panel value="rerank" :label="`${$t('modelSettings.typeShort.rerank')}(${countByType('rerank')})`" />
<t-tab-panel value="vllm" :label="`${$t('modelSettings.typeShort.vllm')}(${countByType('vllm')})`" />
<t-tab-panel value="asr" :label="`${$t('modelSettings.typeShort.asr')}(${countByType('asr')})`" />
</t-tabs>
<div class="model-tabbar" data-guide="settings-models">
<t-tabs v-model="activeTypeFilter" class="model-type-tabs">
<t-tab-panel v-for="tab in modelTypeTabs" :key="tab.value" :value="tab.value">
<template #label>
<span class="model-type-tab">
<t-icon :name="tab.icon" size="16px" />
<span>{{ tab.label }}</span>
<span class="model-tab-count">{{ tab.count }}</span>
</span>
</template>
</t-tab-panel>
</t-tabs>
<t-input v-model="modelQuery" class="model-search" :placeholder="$t('menu.search')"
:aria-label="$t('menu.search')" clearable>
<template #prefix-icon><t-icon name="search" size="16px" /></template>
</t-input>
</div>
<t-loading :loading="loading" size="small" class="model-list-loading">
<div v-if="!loading && filteredModels.length === 0 && !authStore.hasRole('admin')" class="empty-state">
<t-empty :description="emptyHint" />
</div>
<div v-else-if="!loading" class="model-grid">
<div v-for="model in filteredModels" :key="`${model._modelType}-${model.id}`" class="model-card" :class="[
`model-card--${model._modelType}`,
{
'model-card--builtin': model.isBuiltin,
'model-card--clickable': isModelCardClickable(model),
},
]" :role="isModelCardClickable(model) ? 'button' : undefined"
:tabindex="isModelCardClickable(model) ? 0 : undefined"
@click="onModelCardClick($event, model._modelType, model)"
@keydown.enter="onModelCardClick($event, model._modelType, model)">
<div class="model-card__badge" :aria-label="typeLabel(model._modelType)">
<t-icon :name="typeIcon(model._modelType)" size="18px" />
</div>
<div class="model-card__body">
<div class="model-card__header">
<h3 class="model-card__title">{{ modelDisplayName(model) }}</h3>
<span v-if="model.isBuiltin" class="model-card__lock" :title="$t('modelSettings.builtinTag')"
:aria-label="$t('modelSettings.builtinTag')">
<t-icon :name="authStore.isSystemAdmin ? 'edit-1' : 'lock-on'" />
</span>
<div v-if="canManageModel(model)" class="model-card__actions" @click.stop>
<t-dropdown :options="getModelOptions(model._modelType, model)" placement="bottom-right" attach="body"
trigger="click"
@click="(data: any) => handleMenuAction({ value: data.value }, model._modelType, model)">
<t-button variant="text" shape="square" size="small" class="model-card__action-btn model-card__more">
<t-icon name="ellipsis" />
</t-button>
</t-dropdown>
<t-popconfirm
v-if="canDeleteModel(model)"
:content="$t('modelSettings.confirmDelete', { name: modelDisplayName(model) })"
:confirm-btn="{ content: $t('common.delete'), theme: 'danger' }"
:cancel-btn="{ content: $t('common.cancel') }"
placement="bottom-right"
@confirm="deleteModel(model._modelType, model.id)"
>
<t-tooltip :content="$t('common.delete')" placement="top">
<t-button
theme="danger"
shape="square"
variant="text"
size="small"
class="model-card__action-btn model-card__delete"
@click.stop
>
<template #icon><t-icon name="delete" /></template>
</t-button>
</t-tooltip>
</t-popconfirm>
</div>
</div>
<p class="model-card__subtitle">
<span class="model-card__vendor">
<img v-if="vendorIcon(model)" :src="vendorIcon(model)" class="model-card__vendor-icon" alt="" />
<span>{{ vendorLabel(model) }}</span>
</span>
<template v-if="model._modelType === 'embedding' && model.dimension">
<span class="model-card__sep">·</span>
<span>{{ $t('model.editor.dimensionLabel') }} {{ model.dimension }}</span>
</template>
<template v-if="model._modelType === 'chat' || model._modelType === 'vllm'">
<span class="model-card__sep">·</span>
<span
class="model-card__ctx"
:class="{ 'model-card__ctx--default': isDefaultContextWindow(model.contextWindow) }"
:title="contextWindowTitle(model.contextWindow)"
>{{ formatContextWindow(model.contextWindow) }}</span>
</template>
<template v-if="(model._modelType === 'chat' && model.supportsVision)
|| (model._modelType === 'embedding' && model.capabilities?.input?.includes('image'))">
<span class="model-card__sep">·</span>
<span class="model-card__vision" :title="$t('model.editor.supportsVisionLabel')"
:aria-label="$t('model.editor.supportsVisionLabel')">
<t-icon name="image" size="12px" />
</span>
</template>
</p>
</div>
<div class="model-list">
<t-loading :loading="loading" size="small" class="model-list-loading">
<div v-if="!loading && filteredModels.length === 0 && modelQuery.trim()" class="empty-state">
<t-empty :description="$t('common.noResult')" />
<t-button variant="outline" @click="modelQuery = ''">{{ $t('common.clear') }}</t-button>
</div>
<button
v-if="authStore.hasRole('admin')"
type="button"
class="model-card model-card--add"
data-guide="settings-add-model"
@click="openAddDialog"
>
<span class="model-card--add__icon" aria-hidden="true">
<add-icon />
</span>
<span class="model-card--add__label">{{ $t('modelSettings.actions.addModel') }}</span>
</button>
</div>
</t-loading>
<div v-else-if="!loading && filteredModels.length === 0 && !authStore.hasRole('admin')" class="empty-state">
<t-empty :description="emptyHint" />
</div>
<div v-else-if="!loading" class="model-grid">
<div v-for="model in filteredModels" :key="`${model._modelType}-${model.id}`" class="model-card" :class="[
`model-card--${model._modelType}`,
{
'model-card--builtin': model.isBuiltin,
'model-card--clickable': isModelCardClickable(model),
},
]" :role="isModelCardClickable(model) ? 'button' : undefined"
:tabindex="isModelCardClickable(model) ? 0 : undefined"
@click="onModelCardClick($event, model._modelType, model)"
@keydown.enter="onModelCardClick($event, model._modelType, model)">
<div class="model-card__badge" :aria-label="typeLabel(model._modelType)">
<t-icon :name="typeIcon(model._modelType)" size="16px" />
</div>
<div class="model-card__body">
<div class="model-card__header">
<h3 class="model-card__title" :title="modelDisplayName(model)">{{ modelDisplayName(model) }}</h3>
<span v-if="model.isBuiltin" class="model-card__lock" :title="$t('modelSettings.builtinTag')"
:aria-label="$t('modelSettings.builtinTag')">
<t-icon :name="authStore.isSystemAdmin ? 'edit-1' : 'lock-on'" />
</span>
<div v-if="canManageModel(model)" class="model-card__actions" @click.stop>
<t-dropdown :options="getModelOptions(model._modelType, model)" placement="bottom-right" attach="body"
trigger="click"
@click="(data: any) => handleMenuAction({ value: data.value }, model._modelType, model)">
<t-button variant="text" shape="square" size="small" class="model-card__action-btn model-card__more">
<t-icon name="ellipsis" />
</t-button>
</t-dropdown>
<t-popconfirm
v-if="canDeleteModel(model)"
:content="$t('modelSettings.confirmDelete', { name: modelDisplayName(model) })"
:confirm-btn="{ content: $t('common.delete'), theme: 'danger' }"
:cancel-btn="{ content: $t('common.cancel') }"
placement="bottom-right"
@confirm="deleteModel(model._modelType, model.id)"
>
<t-tooltip :content="$t('common.delete')" placement="top">
<t-button
theme="danger"
shape="square"
variant="text"
size="small"
class="model-card__action-btn model-card__delete"
@click.stop
>
<template #icon><t-icon name="delete" /></template>
</t-button>
</t-tooltip>
</t-popconfirm>
</div>
</div>
<p class="model-card__subtitle">
<span class="model-card__vendor">
<img v-if="vendorIcon(model)" :src="vendorIcon(model)" class="model-card__vendor-icon" alt="" />
<span>{{ vendorLabel(model) }}</span>
</span>
<template v-if="model._modelType === 'embedding' && model.dimension">
<span class="model-card__sep">·</span>
<span>{{ $t('model.editor.dimensionLabel') }} {{ model.dimension }}</span>
</template>
<template v-if="model._modelType === 'chat' || model._modelType === 'vllm'">
<span class="model-card__sep">·</span>
<span
class="model-card__ctx"
:class="{ 'model-card__ctx--default': isDefaultContextWindow(model.contextWindow) }"
:title="contextWindowTitle(model.contextWindow)"
>{{ formatContextWindow(model.contextWindow) }}</span>
</template>
<template v-if="(model._modelType === 'chat' && model.supportsVision)
|| (model._modelType === 'embedding' && model.capabilities?.input?.includes('image'))">
<span class="model-card__sep">·</span>
<span class="model-card__vision" :title="$t('model.editor.supportsVisionLabel')"
:aria-label="$t('model.editor.supportsVisionLabel')">
<t-icon name="image" size="12px" />
</span>
</template>
</p>
</div>
</div>
<button
v-if="authStore.hasRole('admin')"
type="button"
class="model-card model-card--add"
data-guide="settings-add-model"
@click="openAddDialog"
>
<span class="model-card--add__icon" aria-hidden="true">
<add-icon />
</span>
<span class="model-card--add__label">{{ $t('modelSettings.actions.addModel') }}</span>
</button>
</div>
</t-loading>
</div>
<t-dialog
v-model:visible="showUsageDialog"
@ -315,6 +340,7 @@ import { focusKbEditorSection } from '@/config/contextualGuides'
import { useChatResourcesStore } from '@/stores/chatResources'
import { useModelProvidersStore } from '@/stores/modelProviders'
import { docsUrl } from '@/utils/docsUrl'
import { matchesResourceQuery } from '@/utils/resourceListSearch'
import {
formatContextWindow,
isDefaultContextWindow,
@ -339,8 +365,9 @@ const currentModelType = ref<ModelType>('chat')
const editingModel = ref<any>(null)
const loading = ref(true)
const activeTypeFilter = ref<FilterType>('all')
const modelQuery = ref('')
const MODEL_TAB_TYPES: FilterType[] = ['chat', 'embedding', 'rerank', 'vllm', 'asr']
const MODEL_TAB_TYPES: ModelType[] = ['chat', 'embedding', 'rerank', 'vllm', 'asr']
const KNOWLEDGE_BASE_EDITOR_HOST_ROUTES = new Set([
'home',
'knowledgeBaseList',
@ -352,7 +379,7 @@ const KNOWLEDGE_BASE_EDITOR_HOST_ROUTES = new Set([
watch(
() => uiStore.settingsInitialSubSection,
(sub) => {
if (sub && MODEL_TAB_TYPES.includes(sub as FilterType)) {
if (sub && MODEL_TAB_TYPES.includes(sub as ModelType)) {
activeTypeFilter.value = sub as FilterType
}
},
@ -413,10 +440,15 @@ function convertToLegacyFormat(model: ModelConfig) {
// 平铺 + 过滤
const allLegacyModels = computed(() => allModels.value.map(convertToLegacyFormat))
const filteredModels = computed(() => {
if (activeTypeFilter.value === 'all') return allLegacyModels.value
return allLegacyModels.value.filter(m => m._modelType === activeTypeFilter.value)
})
const filteredModels = computed(() => allLegacyModels.value.filter(model =>
(activeTypeFilter.value === 'all' || model._modelType === activeTypeFilter.value)
&& matchesResourceQuery({ name: modelDisplayName(model), description: vendorLabel(model) }, modelQuery.value),
))
const modelTypeTabs = computed(() => [
{ value: 'all', label: t('common.all'), icon: 'view-module', count: allLegacyModels.value.length },
...MODEL_TAB_TYPES.map(value => ({ value, label: typeLabel(value), icon: typeIcon(value), count: countByType(value) })),
])
const countByType = (type: ModelType) => allLegacyModels.value.filter(m => m._modelType === type).length
@ -886,131 +918,247 @@ onMounted(() => {
<style lang="less" scoped>
@import (reference) '@/components/css/provider-card.less';
@import (reference) '@/components/css/settings-section.less';
.model-settings {
width: 100%;
height: 100%;
min-height: 0;
display: flex;
flex-direction: column;
color: var(--td-text-color-primary);
container-type: inline-size;
}
.section-header {
.settings-section-header();
display: flex;
flex-direction: column;
gap: 4px;
margin-bottom: 12px;
flex-shrink: 0;
&__top {
display: flex;
align-items: center;
justify-content: space-between;
flex-wrap: wrap;
gap: 12px;
// 为设置弹窗右上角的关闭按钮留出空间。
padding-right: 32px;
}
h2 {
margin: 0;
}
}
.model-title {
display: flex;
align-items: center;
gap: 6px;
}
.model-title-help {
.settings-title-help();
}
.model-header-actions {
display: flex;
align-items: center;
gap: 20px;
flex-shrink: 0;
flex-wrap: wrap;
gap: 8px;
}
.model-test-trigger {
--td-bg-color-container-hover: transparent;
.model-header-action.t-button {
flex-shrink: 0;
padding-left: 0;
padding-right: 0;
font-weight: 600;
min-height: 32px;
padding: 0 12px;
gap: 6px;
border: 1px solid var(--td-component-stroke);
border-radius: var(--app-radius-sm);
background: var(--td-bg-color-container);
color: var(--td-text-color-primary);
font-size: var(--app-text-md);
&:hover,
&:focus,
&.t-is-active,
&:active {
background-color: transparent !important;
color: var(--td-brand-color-hover);
&:hover:not(:disabled) {
background: var(--td-bg-color-container-hover);
}
&:active {
color: var(--td-brand-color-active);
&:focus-visible {
outline: 2px solid var(--td-brand-color);
outline-offset: 2px;
}
:deep(.t-icon) {
color: var(--td-brand-color);
}
}
.builtin-models-hint {
margin-top: 12px;
padding: 10px 12px;
background: var(--td-bg-color-secondarycontainer);
border: 1px solid var(--td-component-stroke);
border-radius: var(--app-radius-sm);
display: flex;
flex-direction: column;
gap: 6px;
max-width: min(320px, calc(100vw - 64px));
padding: 4px;
color: var(--td-text-color-secondary);
font-size: var(--app-text-sm);
line-height: 20px;
}
.builtin-hint-label {
margin: 0 0 4px 0;
font-size: var(--app-text-sm);
margin: 0;
color: var(--td-text-color-primary);
font-weight: 500;
color: var(--td-text-color-placeholder);
letter-spacing: 0.02em;
}
.builtin-hint-text {
margin: 0 0 6px 0;
font-size: var(--app-text-md);
line-height: 1.55;
color: var(--td-text-color-secondary);
margin: 0;
}
.builtin-models-hint .doc-link {
font-size: var(--app-text-md);
display: inline-flex;
align-items: center;
gap: 4px;
color: var(--td-brand-color);
text-decoration: none;
&:hover { text-decoration: underline; }
}
.model-list-loading {
min-height: 120px;
.model-tabbar {
flex-shrink: 0;
display: flex;
align-items: center;
gap: 16px;
border-bottom: 1px solid var(--td-component-stroke);
}
.model-type-tabs {
margin-bottom: 16px;
flex: 1;
min-width: 0;
background: transparent;
:deep(.t-tabs__nav-container) { background: transparent; }
:deep(.t-tabs__nav-container.t-is-top::after) { display: none; }
:deep(.t-tabs__nav-item) {
font-size: var(--app-text-md);
}
height: 44px;
padding: 0;
margin-right: 24px;
font-size: var(--app-text-base);
font-weight: 500;
color: var(--td-text-color-secondary);
:deep(.t-tabs__nav-item-wrapper) {
padding: 0 12px;
margin: 0;
&:last-child { margin-right: 0; }
&:hover { background: transparent; color: var(--td-text-color-primary); }
}
:deep(.t-tabs__operations) {
display: none;
:deep(.t-tabs__nav-item-wrapper) { padding: 0 2px; margin: 0; }
:deep(.t-tabs__nav-item:not(.t-is-disabled):hover .t-tabs__nav-item-wrapper) { background: transparent; }
:deep(.t-tabs__bar) { display: none; }
:deep(.t-tabs__nav-item.t-is-active) {
color: var(--td-text-color-primary);
text-shadow: none;
&::after {
content: '';
position: absolute;
left: 0;
right: 0;
bottom: 0;
height: 2px;
border-radius: var(--app-radius-pill);
background: var(--td-brand-color);
}
.t-icon { color: var(--td-brand-color); }
.model-tab-count {
background: var(--td-brand-color-light);
color: var(--td-brand-color);
}
}
:deep(.t-tabs__operations) { display: none; }
:deep(.t-tabs__nav-scroll) {
overflow-x: auto;
scrollbar-width: none;
&::-webkit-scrollbar {
display: none;
}
&::-webkit-scrollbar { display: none; }
}
:deep(.t-tabs__content) { display: none; }
}
:deep(.t-tabs__content) {
display: none;
}
.model-type-tab {
display: inline-flex;
align-items: center;
gap: 6px;
}
.model-tab-count {
min-width: 20px;
height: 20px;
box-sizing: border-box;
padding: 0 6px;
border-radius: var(--app-radius-pill);
background: var(--td-bg-color-secondarycontainer);
color: var(--td-text-color-secondary);
font-size: var(--app-text-xs);
font-weight: 500;
line-height: 20px;
text-align: center;
font-variant-numeric: tabular-nums;
}
.model-search {
flex: 0 0 240px;
width: 240px;
:deep(.t-input) { border-radius: var(--app-radius-sm); }
}
.model-list {
flex: 1;
min-height: 0;
overflow-y: auto;
overflow-x: hidden;
padding: var(--app-space-4) 0 var(--app-space-8);
}
.model-list-loading {
display: block;
min-height: 120px;
}
.model-grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
gap: 12px;
grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr));
gap: 10px;
align-items: stretch;
.model-card--add {
width: 100%;
height: 100%;
}
.model-card--add { width: 100%; height: 100%; }
}
// 模型卡片 —— 可选类型徽章(仅「全部」Tab)+ 标题 + 一行副标题
@container (max-width: 900px) {
.model-tabbar { flex-wrap: wrap; gap: 0; }
.model-type-tabs { flex-basis: 100%; }
.model-search { flex: 1 1 100%; width: 100%; margin: 8px 0; }
}
// 模型卡片沿用工具箱的紧凑间距、圆角和悬浮反馈。
.model-card {
.provider-card();
.provider-card-interactive();
align-items: center;
min-height: 88px;
padding: 12px;
gap: 10px;
box-sizing: border-box;
border-radius: var(--app-radius-md);
&--add {
.provider-card-add();
min-height: 88px;
gap: 6px;
&:hover,
&:focus-visible {
box-shadow: none;
}
&__icon {
display: flex;
align-items: center;
@ -1018,8 +1166,8 @@ onMounted(() => {
width: 32px;
height: 32px;
border-radius: var(--app-radius-md);
background: color-mix(in srgb, var(--td-brand-color) 10%, transparent);
color: var(--td-brand-color);
background: var(--td-bg-color-secondarycontainer);
color: var(--td-text-color-secondary);
font-size: var(--app-text-2xl);
}
@ -1030,24 +1178,18 @@ onMounted(() => {
}
}
&--builtin {
background: var(--td-bg-color-secondarycontainer);
&:hover {
box-shadow: none;
border-color: var(--td-component-stroke);
}
}
&--clickable {
.provider-card-interactive();
&:hover {
border-color: color-mix(in srgb, var(--td-brand-color) 40%, var(--td-component-stroke));
box-shadow: 0 3px 12px color-mix(in srgb, var(--td-text-color-primary) 6%, transparent);
}
}
}
.model-card__badge {
.provider-card-badge();
.provider-card-badge(28px, 8px);
.provider-card-badge-color(#0052d9);
}

View File

@ -2,31 +2,35 @@
<div class="sandbox-settings">
<div class="section-header">
<div class="section-header__top">
<div>
<div class="section-header__main">
<div class="section-header__titlewrap">
<h2>{{ $t('settings.sandbox.title') }}</h2>
<t-popup placement="bottom-start" trigger="hover" :overlay-inner-style="{ maxWidth: '380px' }">
<t-popup placement="bottom-left" trigger="hover" show-arrow :overlay-inner-style="{ maxWidth: 'min(380px, calc(100vw - 64px))' }">
<button type="button" class="hint-trigger"
:aria-label="$t('settings.sandbox.pageHintTitle')">
<t-icon name="info-circle" size="16px" />
<t-icon name="help-circle" size="16px" />
</button>
<template #content>
<div class="hint-popover">
<p class="hint-popover__title">{{ $t('settings.sandbox.pageHintTitle') }}</p>
<p class="hint-popover__text">{{ $t('settings.sandbox.pageHint') }}</p>
<a class="hint-popover__link" :href="sandboxGuideUrl" target="_blank" rel="noopener noreferrer">
{{ $t('settings.sandbox.viewClusterGuide') }}
<t-icon name="jump" size="14px" />
</a>
</div>
</template>
</t-popup>
</div>
<p class="section-description">{{ $t('settings.sandbox.description') }}</p>
</div>
<div class="header-actions">
<a class="header-action-link" :href="sandboxGuideUrl" target="_blank" rel="noopener noreferrer">
<t-icon name="help-circle" />
{{ $t('settings.sandbox.viewClusterGuide') }}
</a>
<t-button v-if="canCreateOnTab" variant="text" class="header-action" @click="openCreate">
<template #icon><t-icon name="add" /></template>
{{ $t('settings.sandbox.addConfig') }}
</t-button>
</div>
</div>
<p class="section-description">{{ $t('settings.sandbox.description') }}</p>
</div>
<!--
@ -57,81 +61,89 @@
<div class="sandbox-tabs-row">
<t-tabs v-model="activeType" class="sandbox-type-tabs">
<t-tab-panel value="all" :label="`${$t('common.all')}(${records.length})`" />
<t-tab-panel v-for="type in backendTypes" :key="type" :value="type"
:label="`${backendLabel(type)}(${countByType(type)})`" />
<t-tab-panel value="all">
<template #label>
<span class="sandbox-tab-label"><t-icon name="view-list" size="16px" />
{{ $t('common.all') }}<span class="sandbox-tab-count">{{ records.length }}</span>
</span>
</template>
</t-tab-panel>
<t-tab-panel v-for="type in backendTypes" :key="type" :value="type">
<template #label>
<span class="sandbox-tab-label"><SandboxBackendBadge :type="type" size="xs" />
{{ backendLabel(type) }}<span class="sandbox-tab-count">{{ countByType(type) }}</span>
</span>
</template>
</t-tab-panel>
</t-tabs>
<t-input v-model="searchQuery" clearable class="sandbox-search" :placeholder="$t('menu.search')"
:aria-label="$t('menu.search')">
<template #prefix-icon><t-icon name="search" size="16px" /></template>
</t-input>
</div>
<t-loading :loading="loading" size="small" class="sandbox-list-loading">
<t-alert
v-if="!loading && dockerTabDisabled && filteredRecords.length > 0"
theme="warning"
class="sandbox-docker-banner"
:message="$t('settings.sandbox.dockerDisabledAlert')"
>
<template #description>
<p>{{ $t('settings.sandbox.dockerDisabledHint') }}</p>
</template>
</t-alert>
<div v-if="!loading && dockerTabDisabled && filteredRecords.length === 0" class="sandbox-docker-disabled">
<t-empty :description="$t('settings.sandbox.dockerDisabledAlert')" />
<p class="sandbox-empty-hint">{{ $t('settings.sandbox.dockerDisabledHint') }}</p>
</div>
<div v-else-if="!loading" class="sandbox-grid">
<div v-for="record in filteredRecords" :key="record.id" class="sandbox-card"
:class="[`sandbox-card--${record.sandbox_type}`, { 'sandbox-card--clickable': !isLegacyRecord(record) }]"
:role="isLegacyRecord(record) ? undefined : 'button'"
:tabindex="isLegacyRecord(record) ? undefined : 0"
@click="openCard(record)" @keydown.enter="openCard(record)">
<SandboxBackendBadge :type="record.sandbox_type" />
<div class="sandbox-card__body">
<div class="sandbox-card__header">
<h3 class="sandbox-card__title" :title="record.name">{{ record.name }}</h3>
<t-tag v-if="isLegacyRecord(record)" theme="warning" variant="light" size="small">
{{ $t('settings.sandbox.legacyConfig') }}
</t-tag>
<div class="sandbox-card__actions" @click.stop>
<t-dropdown
:options="cardMenu(record)"
placement="bottom-right"
attach="body"
trigger="click"
@click="(data: any) => onMenuAction(data.value, record)"
>
<t-button variant="text" shape="square" size="small" class="sandbox-card__more">
<t-icon name="ellipsis" />
</t-button>
</t-dropdown>
<div class="sandbox-list-scroll">
<t-loading :loading="loading" size="small" class="sandbox-list-loading">
<t-alert v-if="!loading && dockerTabDisabled && filteredRecords.length > 0" theme="warning"
class="sandbox-docker-banner" :message="$t('settings.sandbox.dockerDisabledAlert')">
<template #description><p>{{ $t('settings.sandbox.dockerDisabledHint') }}</p></template>
</t-alert>
<div v-if="!loading && dockerTabDisabled && filteredRecords.length === 0" class="sandbox-docker-disabled">
<t-empty :description="$t('settings.sandbox.dockerDisabledAlert')" />
<p class="sandbox-empty-hint">{{ $t('settings.sandbox.dockerDisabledHint') }}</p>
</div>
<div v-else-if="!loading && filteredRecords.length" class="sandbox-grid">
<div v-for="record in filteredRecords" :key="record.id" class="sandbox-card"
:class="[`sandbox-card--${record.sandbox_type}`, { 'sandbox-card--clickable': !isLegacyRecord(record) }]"
:role="isLegacyRecord(record) ? undefined : 'button'"
:tabindex="isLegacyRecord(record) ? undefined : 0"
@click="openCard(record)" @keydown.enter.self="openCard(record)" @keydown.space.self.prevent="openCard(record)">
<SandboxBackendBadge :type="record.sandbox_type" />
<div class="sandbox-card__body">
<div class="sandbox-card__header">
<h3 class="sandbox-card__title" :title="record.name">{{ record.name }}</h3>
<t-tag v-if="isLegacyRecord(record)" theme="warning" variant="light" size="small">
{{ $t('settings.sandbox.legacyConfig') }}
</t-tag>
<div class="sandbox-card__actions" @click.stop>
<t-dropdown
:options="cardMenu(record)"
placement="bottom-right"
attach="body"
trigger="click"
@click="(data: any) => onMenuAction(data.value, record)"
>
<t-button variant="text" shape="square" size="small" class="sandbox-card__more"
:aria-label="$t('modelCatalog.more')">
<t-icon name="ellipsis" />
</t-button>
</t-dropdown>
</div>
</div>
<div class="sandbox-card__subtitle">
<span class="sandbox-card__type">{{ backendLabel(record.sandbox_type) }}</span>
<template v-if="record.description">
<span class="sandbox-card__sep">·</span>
<span class="sandbox-card__desc" :title="record.description">{{ record.description }}</span>
</template>
</div>
<div v-if="targetSummary(record)" class="sandbox-card__url" :title="targetSummary(record)">
{{ targetSummary(record) }}
</div>
<ul v-if="cardWarnings[record.id]?.length" class="sandbox-card__warnings">
<li v-for="item in cardWarnings[record.id]" :key="item.key">
<t-icon name="error-circle" size="12px" />
<span>{{ item.text }}</span>
</li>
</ul>
</div>
<div class="sandbox-card__subtitle">
<span class="sandbox-card__type">{{ backendLabel(record.sandbox_type) }}</span>
<template v-if="record.description">
<span class="sandbox-card__sep">·</span>
<span class="sandbox-card__desc" :title="record.description">{{ record.description }}</span>
</template>
</div>
<div v-if="targetSummary(record)" class="sandbox-card__url" :title="targetSummary(record)">
{{ targetSummary(record) }}
</div>
<ul v-if="cardWarnings[record.id]?.length" class="sandbox-card__warnings">
<li v-for="item in cardWarnings[record.id]" :key="item.key">
<t-icon name="error-circle" size="12px" />
<span>{{ item.text }}</span>
</li>
</ul>
</div>
</div>
<button v-if="canCreateOnTab" type="button" class="sandbox-card sandbox-card--add" @click="openCreate">
<span class="sandbox-card--add__icon" aria-hidden="true"><t-icon name="add" /></span>
<span class="sandbox-card--add__label">{{ $t('settings.sandbox.addConfig') }}</span>
</button>
</div>
<p v-if="!loading && !dockerTabDisabled && records.length === 0" class="sandbox-empty-hint">
{{ $t('settings.sandbox.noConfigs') }}
</p>
</t-loading>
<div v-else-if="!loading" class="sandbox-empty">
<t-empty :description="$t(records.length === 0 ? 'settings.sandbox.noConfigs' : 'common.noResult')" />
</div>
</t-loading>
</div>
<SandboxConfigEditorDrawer v-model:visible="showEditor" :record="editingRecord"
:preset-type="createPresetType"
@ -219,6 +231,7 @@ import { useConfirmDelete } from '@/components/settings/useConfirmDelete'
import { getSession } from '@/api/chat/index'
import { useDeploymentCapabilitiesStore } from '@/stores/deploymentCapabilities'
import { docsUrl } from '@/utils/docsUrl'
import { matchesResourceQuery } from '@/utils/resourceListSearch'
import {
deleteSandboxConfig,
getSandboxConfigInventory,
@ -260,6 +273,7 @@ const policySaving = ref(false)
const workspaceScriptsDisabled = ref(false)
const records = ref<SandboxConfigRecord[]>([])
const activeType = ref<string>('all')
const searchQuery = ref('')
const showEditor = ref(false)
const editingRecord = ref<SandboxConfigRecord | null>(null)
@ -281,7 +295,10 @@ const filteredRecords = computed(() => {
const base = activeType.value === 'all'
? records.value
: records.value.filter((r) => r.sandbox_type === activeType.value)
return base
return base.filter((record) => matchesResourceQuery({
name: record.name,
description: `${record.description || ''} ${backendLabel(record.sandbox_type)} ${targetSummary(record)}`,
}, searchQuery.value))
})
const countByType = (type: string) =>
@ -577,214 +594,89 @@ onMounted(async () => {
</script>
<style lang="less" scoped>
@import (reference) '@/components/css/settings-section.less';
@import (reference) '@/components/css/provider-card.less';
@import (reference) '@/components/css/settings-section.less';
.sandbox-settings {
width: 100%;
}
.section-header {
.settings-section-header();
}
.defaults-trigger {
--td-bg-color-container-hover: transparent;
flex-shrink: 0;
padding-left: 0;
padding-right: 0;
font-weight: 600;
}
.header-actions {
display: flex;
align-items: center;
gap: 18px;
flex-shrink: 0;
}
.header-action-link {
display: inline-flex;
align-items: center;
gap: 5px;
color: var(--td-brand-color);
font-size: var(--app-text-base);
font-weight: 600;
text-decoration: none;
&:hover {
color: var(--td-brand-color-hover);
}
}
.sandbox-settings { .settings-list-page(); container-type: inline-size; }
.section-header { .settings-section-header(); flex-shrink: 0; margin-bottom: 20px; }
.section-header__main { min-width: 0; }
.section-header__top { margin-bottom: 8px; padding-right: 28px; }
.section-header__titlewrap {
display: flex;
align-items: center;
gap: 6px;
h2 {
margin-bottom: 0;
}
display: flex; align-items: center; gap: 6px;
h2 { margin-bottom: 0; }
}
.hint-trigger {
display: inline-flex;
align-items: center;
justify-content: center;
padding: 2px;
border: none;
border-radius: var(--app-radius-xs);
background: transparent;
color: var(--td-text-color-placeholder);
cursor: help;
line-height: 1;
&:hover,
&:focus-visible {
color: var(--td-brand-color);
}
.header-actions { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }
.header-action { .settings-list-action(); }
.hint-popover__link {
display: inline-flex; align-items: center; align-self: flex-start; gap: 5px; margin-top: 4px;
color: var(--td-brand-color); font-size: var(--app-text-sm); text-decoration: none;
&:hover { color: var(--td-brand-color-hover); text-decoration: underline; }
}
.hint-popover {
display: flex;
flex-direction: column;
gap: 4px;
max-width: 340px;
}
.hint-popover__title {
margin: 0;
color: var(--td-text-color-primary);
font-size: var(--app-text-md);
font-weight: 600;
}
.hint-popover__text {
margin: 0;
color: var(--td-text-color-secondary);
font-size: var(--app-text-sm);
line-height: 1.55;
}
.sandbox-list-loading {
min-height: 120px;
}
.hint-trigger { .settings-title-help(); }
.hint-popover { display: flex; flex-direction: column; gap: 4px; max-width: 340px; }
.hint-popover__title { margin: 0; color: var(--td-text-color-primary); font-size: var(--app-text-md); font-weight: 600; }
.hint-popover__text { margin: 0; color: var(--td-text-color-secondary); font-size: var(--app-text-sm); line-height: 1.55; }
.setting-row {
.setting-row();
gap: 24px;
display: flex; align-items: center; justify-content: space-between; gap: 24px;
flex-shrink: 0; padding: 14px 16px; margin-bottom: 16px;
border: 1px solid var(--td-component-stroke); border-radius: var(--app-radius-lg);
background: var(--td-bg-color-container);
}
.setting-info {
.setting-info();
.setting-info(); max-width: none;
label { font-size: var(--app-text-md); }
.desc { font-size: var(--app-text-sm); }
}
.setting-control {
.setting-control();
}
.setting-control { display: flex; align-items: center; flex-shrink: 0; }
.sandbox-tabs-row {
display: flex;
align-items: flex-start;
gap: 16px;
margin-bottom: 16px;
display: flex; align-items: center; gap: 20px; flex-shrink: 0;
border-bottom: 1px solid var(--td-component-stroke);
}
.sandbox-type-tabs {
flex: 1;
min-width: 0;
margin-bottom: 0;
:deep(.t-tabs__nav-item) {
font-size: var(--app-text-md);
}
:deep(.t-tabs__nav-item-wrapper) {
padding: 0 12px;
margin: 0;
}
:deep(.t-tabs__operations) {
display: none;
}
:deep(.t-tabs__nav-scroll) {
overflow-x: auto;
scrollbar-width: none;
&::-webkit-scrollbar {
display: none;
flex: 1; min-width: 0; background: transparent;
:deep(.t-tabs__nav-item) { height: 44px; margin-right: 24px; font-size: var(--app-text-base); }
:deep(.t-tabs__nav-item-wrapper) { margin: 0; padding: 0 2px; }
:deep(.t-tabs__nav-item:not(.t-is-disabled):hover .t-tabs__nav-item-wrapper) { background: transparent; }
:deep(.t-tabs__nav-container.t-is-top::after),
:deep(.t-tabs__bar), :deep(.t-tabs__content), :deep(.t-tabs__operations) { display: none; }
:deep(.t-tabs__nav-scroll) { overflow-x: auto; scrollbar-width: none; }
:deep(.t-tabs__nav-item.t-is-active) {
color: var(--td-text-color-primary); text-shadow: none;
.t-icon { color: var(--td-brand-color); }
.sandbox-tab-count { color: var(--td-brand-color); background: var(--td-brand-color-light); }
&::after {
content: ''; position: absolute; bottom: 0; left: 0; right: 0; height: 2px;
background: var(--td-brand-color); border-radius: var(--app-radius-pill);
}
}
:deep(.t-tabs__content) {
display: none;
}
}
.sandbox-tab-label {
display: inline-flex; align-items: center; gap: 6px;
:deep(.sandbox-badge) { background: transparent; }
}
.sandbox-tab-count {
min-width: 20px; height: 20px; padding: 0 6px; box-sizing: border-box;
border-radius: var(--app-radius-pill); background: var(--td-bg-color-secondarycontainer);
color: var(--td-text-color-secondary); font-size: var(--app-text-xs); line-height: 20px;
text-align: center; font-variant-numeric: tabular-nums;
}
.sandbox-search {
flex: 0 0 240px;
width: 240px;
:deep(.t-input) { border-radius: var(--app-radius-sm); }
}
.sandbox-list-scroll { flex: 1; min-height: 0; overflow: auto; padding: 16px 0 28px; }
.sandbox-list-loading { display: block; min-height: 160px; }
.sandbox-grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr));
gap: 12px;
.sandbox-card--add {
width: 100%;
height: 100%;
}
}
.sandbox-card {
.provider-card();
&--clickable {
.provider-card-interactive();
}
&--add {
flex-direction: column;
align-items: center;
justify-content: center;
gap: 8px;
min-height: 68px;
border-style: dashed;
background: transparent;
color: var(--td-text-color-placeholder);
cursor: pointer;
font: inherit;
text-align: center;
&:hover,
&:focus-visible {
color: var(--td-brand-color);
border-color: var(--td-brand-color);
box-shadow: none;
}
&__icon {
display: flex;
align-items: center;
justify-content: center;
width: 32px;
height: 32px;
border-radius: var(--app-radius-md);
background: color-mix(in srgb, var(--td-brand-color) 10%, transparent);
color: var(--td-brand-color);
font-size: var(--app-text-2xl);
}
&__label {
font-size: var(--app-text-md);
font-weight: 500;
line-height: 1.4;
}
}
&--clickable { .provider-card-interactive(); }
}
.sandbox-empty { padding: 40px 16px; }
.sandbox-card__body {
.provider-card-body();
}
@ -859,23 +751,14 @@ onMounted(async () => {
opacity: 1;
}
.sandbox-docker-banner {
margin-bottom: 12px;
}
.sandbox-docker-disabled {
padding: 48px 16px 24px;
text-align: center;
}
.sandbox-empty-hint {
margin: 16px 0 0;
font-size: var(--app-text-md);
color: var(--td-text-color-placeholder);
}
.sandbox-docker-disabled .sandbox-empty-hint {
margin-top: 8px;
.sandbox-docker-banner { margin-bottom: 12px; }
.sandbox-docker-disabled { padding: 48px 16px 24px; text-align: center; }
.sandbox-empty-hint { margin: 8px 0 0; font-size: var(--app-text-md); color: var(--td-text-color-placeholder); }
@container (max-width: 760px) {
.section-header__top { align-items: flex-start; flex-wrap: wrap; gap: 12px; }
.sandbox-tabs-row { flex-wrap: wrap; gap: 0; }
.sandbox-type-tabs { flex-basis: 100%; }
.sandbox-search { flex: 1 1 100%; width: 100%; margin: 8px 0; }
}
.inventory-banner {

View File

@ -61,6 +61,7 @@
</template>
<div class="content-wrapper" :class="{
'content-wrapper--wide': currentSection === 'members',
'content-wrapper--resource-list': ['models', 'mymemory', 'platform-api-keys', 'model-catalog', 'members', 'sandbox'].includes(currentSection),
'content-wrapper--full': SYSTEM_ADMIN_SECTIONS.has(currentSection) || isIntegrationSection(currentSection),
}">
<!-- 角色不允许访问当前 section(deep-link 进来 / 跨空间切换后角色降级)—— 优先于具体 section 渲染。
@ -713,6 +714,24 @@ onUnmounted(() => {
&--full {
padding: 30px 34px 40px;
}
&--resource-list {
flex: 1;
min-height: 0;
overflow: hidden;
display: flex;
flex-direction: column;
padding: 20px 28px 0;
> .section {
flex: 1;
min-height: 0;
}
@media (max-width: 720px) {
padding: 16px 16px 0;
}
}
}
.section {

View File

@ -1,19 +1,13 @@
<template>
<div class="tenant-members">
<!-- Section header. The (i) permission speed-look popover lives
next to the title so it reads as meta-info about *this
section*. The audit-log entry sits on the right of the header
row — secondary navigation that opens the audit drawer; gated
to Admin+ so non-managers don't see a button they can't use. -->
<div class="section-header">
<div class="section-header-row">
<div class="section-header-titlewrap">
<h2>{{ $t('tenantMember.title') }}</h2>
<t-popup placement="bottom-start" trigger="hover" overlay-class-name="wk-popover permissions-popup-overlay"
<t-popup placement="bottom-left" trigger="hover" show-arrow overlay-class-name="wk-popover permissions-popup-overlay"
:overlay-inner-style="permissionsPopupInnerStyle">
<button type="button" class="permissions-trigger-btn" :aria-label="$t('tenantMember.permissions.title')"
:title="$t('tenantMember.permissions.iconHint')">
<t-icon name="info-circle" size="16px" />
<button type="button" class="permissions-trigger-btn" :aria-label="$t('tenantMember.permissions.title')">
<t-icon name="help-circle" size="16px" />
</button>
<template #content>
<div class="permissions-compact permissions-compact--popover">
@ -40,14 +34,121 @@
</div>
</template>
</t-popup>
<!-- Audit log entry sits inline with the title: title (i)
[审计日志]. Keeping all section-level affordances on the
left edge avoids the "lonely right-aligned button"
pattern in narrow settings panels. -->
</div>
<div class="members-header-actions">
<t-button v-if="canViewAudit" variant="text" size="small" class="header-audit-btn" @click="openAuditDrawer">
<template #icon><t-icon name="history" /></template>
{{ $t('tenantMember.audit.tabLabel') }}
</t-button>
<t-popup v-if="canManage" v-model="invitePopupVisible" trigger="click" placement="bottom-end"
destroy-on-close overlay-class-name="wk-popover wk-popover--form member-invite-popup-overlay">
<t-button theme="default" variant="text" size="small" class="members-list-add-btn"
:title="$t('tenantMember.add.button')" :aria-label="$t('tenantMember.add.button')">
<template #icon><t-icon name="user-add" /></template>
{{ $t('tenantMember.add.button') }}
</t-button>
<template #content>
<div class="member-invite-popup-inner" @click.stop>
<div class="member-invite-popup-title">
{{
addDialogStep === 'form'
? $t('tenantMember.add.dialogTitle')
: $t('tenantInvitation.confirmInviteTitle')
}}
</div>
<t-form v-if="addDialogStep === 'form'" ref="addFormRef" :data="addForm" :rules="addFormRules"
:label-width="80" class="member-invite-form">
<t-form-item :label="$t('tenantMember.add.emailLabel')" name="email">
<t-input v-model="addForm.email" :placeholder="$t('tenantMember.add.emailPlaceholder')"
clearable />
</t-form-item>
<t-form-item :label="$t('tenantMember.add.roleLabel')" name="role">
<t-select v-model="addForm.role" :options="roleOptions" :popup-props="roleSelectPopupProps" />
</t-form-item>
</t-form>
<div v-else class="invite-confirm-body">
{{ $t('tenantInvitation.confirmInviteBody', {
email: addConfirmEmail,
role: addConfirmRoleLabel,
}) }}
</div>
<div class="invite-popup-footer">
<t-button v-if="addDialogStep === 'form'" variant="outline" :disabled="adding"
@click="invitePopupVisible = false">
{{ $t('common.cancel') }}
</t-button>
<t-button v-else variant="outline" :disabled="adding" @click="goBackToForm">
{{ $t('common.back') }}
</t-button>
<t-button theme="primary" :loading="adding" @click="submitAdd">
{{ dialogConfirmLabel }}
</t-button>
</div>
</div>
</template>
</t-popup>
<!-- Share-link generator. Sits next to the invite-by-email
popup so the two flows live side-by-side: "I know who"
(email input) vs "I don't" (one link, group chat). -->
<t-popup v-if="canManage" v-model="shareLinkPopupVisible" trigger="click" placement="bottom-end"
destroy-on-close overlay-class-name="wk-popover wk-popover--form member-invite-popup-overlay">
<t-button theme="default" variant="text" size="small" class="members-list-add-btn"
:title="$t('tenantInvitation.shareLink.button')"
:aria-label="$t('tenantInvitation.shareLink.button')">
<template #icon><t-icon name="link" /></template>
{{ $t('tenantInvitation.shareLink.button') }}
</t-button>
<template #content>
<div class="member-invite-popup-inner" @click.stop>
<div class="member-invite-popup-title">
{{
shareLinkResult
? $t('tenantInvitation.shareLink.resultTitle')
: $t('tenantInvitation.shareLink.dialogTitle')
}}
</div>
<div v-if="!shareLinkResult" class="member-invite-form">
<p class="invite-confirm-body">
{{ $t('tenantInvitation.shareLink.description', { days: INVITATION_TTL_DAYS }) }}
</p>
<t-form :data="shareLinkForm" :label-width="80">
<t-form-item :label="$t('tenantMember.add.roleLabel')" name="role">
<t-select v-model="shareLinkForm.role" :options="roleOptions"
:popup-props="roleSelectPopupProps" />
</t-form-item>
</t-form>
</div>
<div v-else class="share-link-result">
<p class="invite-confirm-body">
{{ $t('tenantInvitation.shareLink.resultBody') }}
</p>
<div class="share-link-row">
<input class="share-link-row__input"
:value="absoluteInviteURL(shareLinkResult.invite_url || '')"
readonly @click="($event.target as HTMLInputElement).select()" />
<t-button size="small" theme="primary" variant="outline"
@click="copyText(absoluteInviteURL(shareLinkResult.invite_url || ''))">
<template #icon><t-icon name="copy" /></template>
{{ $t('tenantInvitation.copyLink') }}
</t-button>
</div>
</div>
<div class="invite-popup-footer">
<t-button v-if="!shareLinkResult" variant="outline" :disabled="creatingShareLink"
@click="shareLinkPopupVisible = false">
{{ $t('common.cancel') }}
</t-button>
<t-button v-else variant="outline" @click="shareLinkPopupVisible = false">
{{ $t('common.close') }}
</t-button>
<t-button v-if="!shareLinkResult" theme="primary" :loading="creatingShareLink"
@click="submitShareLink">
{{ $t('tenantInvitation.shareLink.generate') }}
</t-button>
</div>
</div>
</template>
</t-popup>
</div>
</div>
<p class="section-description">
@ -64,26 +165,32 @@
</p>
</div>
<div class="members-tab-layout">
<!-- Toolbar 已被并入「空间成员」列表头:搜索框紧贴列表头右
侧,邀请按钮再往右一个图标位,所有「针对这张列表」的控
件聚到同一行,独立 toolbar 不复存在。 -->
<!-- Pending invitations. Shown only to managers because the
viewer/contributor roles don't have an action surface
here. Even when empty we still render the header so
operators get a stable "is there anything pending?"
affordance after they hit "Send invitation". -->
<div v-if="canManage" class="pending-invitations-section">
<div class="pending-invitations-header">
<div class="pending-invitations-titlewrap">
<span class="pending-invitations-title">
{{ $t('tenantInvitation.pendingSectionTitle') }}
<div class="members-tabbar">
<t-tabs v-model="activeListTab" class="members-tabs">
<t-tab-panel value="members">
<template #label>
<span class="members-tab-label"><t-icon name="usergroup" size="16px" />
{{ $t('tenantMember.listTitle') }}<span class="members-list-count-badge">{{ membersTotal }}</span>
</span>
<!-- Same count-badge style as the «空间成员» list header
so the two list titles read at parity. -->
<span class="members-list-count-badge">{{ invitationsTotal }}</span>
</div>
</template>
</t-tab-panel>
<t-tab-panel v-if="canManage" value="invitations">
<template #label>
<span class="members-tab-label"><t-icon name="mail" size="16px" />
{{ $t('tenantInvitation.pendingSectionTitle') }}<span class="members-list-count-badge">{{ invitationsTotal }}</span>
</span>
</template>
</t-tab-panel>
</t-tabs>
<t-input v-show="activeListTab === 'members'" v-model="searchQuery" class="members-list-search"
:placeholder="$t('tenantMember.searchPlaceholder')" :aria-label="$t('tenantMember.searchPlaceholder')" clearable>
<template #prefix-icon><t-icon name="search" size="16px" /></template>
</t-input>
</div>
<div class="members-tab-layout">
<div v-if="canManage" v-show="activeListTab === 'invitations'" class="pending-invitations-section">
<div class="pending-invitations-header">
<span class="pending-invitations-desc">
{{ $t('tenantInvitation.pendingSectionDesc', { days: INVITATION_TTL_DAYS }) }}
</span>
@ -176,136 +283,13 @@
</div>
<div v-if="invitationsTotal > 0" class="data-table-shell__pager">
<t-pagination v-model="invitationsPage" v-model:page-size="invitationsPageSize" :total="invitationsTotal"
size="small" show-jumper show-page-number show-page-size
size="small" :show-jumper="false" show-page-number :show-page-size="invitationsTotal > 10"
:page-size-options="INVITATIONS_PAGE_SIZE_OPTIONS" @change="onInvitationsPageChange" />
</div>
</div>
</div>
<!-- Member list. 列表头(标题 / 计数 / 搜索框 / 邀请按钮)始终
渲染,loading / error / empty / 表格作为下方的内容状态切换。
这样搜索时输入框不会被卸载,避免焦点丢失与页面抖动。 -->
<div class="members-list-wrap">
<div class="members-list-header">
<div class="members-list-titlewrap">
<span class="members-list-title">{{ $t('tenantMember.listTitle') }}</span>
<span class="members-list-count-badge">{{ membersTotal }}</span>
</div>
<div class="members-list-actions">
<div class="members-list-search">
<t-input v-model="searchQuery" size="small" :placeholder="$t('tenantMember.searchPlaceholder')" clearable>
<template #prefix-icon><t-icon name="search" /></template>
</t-input>
</div>
<t-popup v-if="canManage" v-model="invitePopupVisible" trigger="click" placement="bottom-end"
destroy-on-close overlay-class-name="wk-popover wk-popover--form member-invite-popup-overlay">
<t-button theme="primary" variant="outline" shape="square" size="small" class="members-list-add-btn"
:title="$t('tenantMember.add.button')" :aria-label="$t('tenantMember.add.button')">
<template #icon><t-icon name="user-add" /></template>
</t-button>
<template #content>
<div class="member-invite-popup-inner" @click.stop>
<div class="member-invite-popup-title">
{{
addDialogStep === 'form'
? $t('tenantMember.add.dialogTitle')
: $t('tenantInvitation.confirmInviteTitle')
}}
</div>
<t-form v-if="addDialogStep === 'form'" ref="addFormRef" :data="addForm" :rules="addFormRules"
:label-width="80" class="member-invite-form">
<t-form-item :label="$t('tenantMember.add.emailLabel')" name="email">
<t-input v-model="addForm.email" :placeholder="$t('tenantMember.add.emailPlaceholder')"
clearable />
</t-form-item>
<t-form-item :label="$t('tenantMember.add.roleLabel')" name="role">
<t-select v-model="addForm.role" :options="roleOptions" :popup-props="roleSelectPopupProps" />
</t-form-item>
</t-form>
<div v-else class="invite-confirm-body">
{{ $t('tenantInvitation.confirmInviteBody', {
email: addConfirmEmail,
role: addConfirmRoleLabel,
}) }}
</div>
<div class="invite-popup-footer">
<t-button v-if="addDialogStep === 'form'" variant="outline" :disabled="adding"
@click="invitePopupVisible = false">
{{ $t('common.cancel') }}
</t-button>
<t-button v-else variant="outline" :disabled="adding" @click="goBackToForm">
{{ $t('common.back') }}
</t-button>
<t-button theme="primary" :loading="adding" @click="submitAdd">
{{ dialogConfirmLabel }}
</t-button>
</div>
</div>
</template>
</t-popup>
<!-- Share-link generator. Sits next to the invite-by-email
popup so the two flows live side-by-side: "I know who"
(email input) vs "I don't" (one link, group chat). -->
<t-popup v-if="canManage" v-model="shareLinkPopupVisible" trigger="click" placement="bottom-end"
destroy-on-close overlay-class-name="wk-popover wk-popover--form member-invite-popup-overlay">
<t-button theme="default" variant="outline" shape="square" size="small" class="members-list-add-btn"
:title="$t('tenantInvitation.shareLink.button')"
:aria-label="$t('tenantInvitation.shareLink.button')">
<template #icon><t-icon name="link" /></template>
</t-button>
<template #content>
<div class="member-invite-popup-inner" @click.stop>
<div class="member-invite-popup-title">
{{
shareLinkResult
? $t('tenantInvitation.shareLink.resultTitle')
: $t('tenantInvitation.shareLink.dialogTitle')
}}
</div>
<div v-if="!shareLinkResult" class="member-invite-form">
<p class="invite-confirm-body">
{{ $t('tenantInvitation.shareLink.description', { days: INVITATION_TTL_DAYS }) }}
</p>
<t-form :data="shareLinkForm" :label-width="80">
<t-form-item :label="$t('tenantMember.add.roleLabel')" name="role">
<t-select v-model="shareLinkForm.role" :options="roleOptions"
:popup-props="roleSelectPopupProps" />
</t-form-item>
</t-form>
</div>
<div v-else class="share-link-result">
<p class="invite-confirm-body">
{{ $t('tenantInvitation.shareLink.resultBody') }}
</p>
<div class="share-link-row">
<input class="share-link-row__input"
:value="absoluteInviteURL(shareLinkResult.invite_url || '')"
readonly @click="($event.target as HTMLInputElement).select()" />
<t-button size="small" theme="primary" variant="outline"
@click="copyText(absoluteInviteURL(shareLinkResult.invite_url || ''))">
<template #icon><t-icon name="copy" /></template>
{{ $t('tenantInvitation.copyLink') }}
</t-button>
</div>
</div>
<div class="invite-popup-footer">
<t-button v-if="!shareLinkResult" variant="outline" :disabled="creatingShareLink"
@click="shareLinkPopupVisible = false">
{{ $t('common.cancel') }}
</t-button>
<t-button v-else variant="outline" @click="shareLinkPopupVisible = false">
{{ $t('common.close') }}
</t-button>
<t-button v-if="!shareLinkResult" theme="primary" :loading="creatingShareLink"
@click="submitShareLink">
{{ $t('tenantInvitation.shareLink.generate') }}
</t-button>
</div>
</div>
</template>
</t-popup>
</div>
</div>
<div v-show="activeListTab === 'members'" class="members-list-wrap">
<div v-if="loading && members.length === 0" class="loading-inline">
<t-loading size="small" />
<span>{{ $t('tenantMember.loading') }}</span>
@ -325,7 +309,7 @@
</div>
<div v-else class="data-table-shell data-table-shell--with-footer">
<div class="data-table-shell__scroll">
<t-table row-key="user_id" :data="members" :columns="columns" size="medium" hover stripe :loading="loading">
<t-table row-key="user_id" :data="members" :columns="columns" size="medium" hover :loading="loading">
<template #member="{ row }">
<div class="member-cell">
<span class="member-name">{{ memberPrimary(row) }}</span>
@ -335,8 +319,10 @@
<template #role="{ row }">
<div class="role-cell">
<t-select v-if="canManage && row.user_id !== currentUserId" :model-value="row.role"
class="member-role-select" size="small" :popup-props="roleSelectPopupProps"
class="member-role-select" :borderless="true" :popup-props="roleSelectPopupProps"
:aria-label="`${memberPrimary(row)} · ${$t('tenantMember.columns.role')}`"
@change="(val: string) => onRoleChange(row, val)">
<template #prefixIcon><t-icon :name="roleIcon(row.role)" size="14px" /></template>
<t-option v-for="opt in roleOptions" :key="opt.value" :value="opt.value" :label="opt.label">
<span class="role-option">
<t-icon :name="roleIcon(opt.value)" class="role-option-icon" />
@ -344,9 +330,10 @@
</span>
</t-option>
</t-select>
<t-tag v-else :theme="roleTagTheme(row.role)" size="small">
<span v-else class="member-role-label">
<t-icon :name="roleIcon(row.role)" size="14px" />
{{ $t('tenantMember.role.' + row.role) }}
</t-tag>
</span>
</div>
</template>
<template #joined_at="{ row }">{{ formatDate(row.joined_at) }}</template>
@ -369,7 +356,7 @@
</div>
<div v-if="membersTotal > 0" class="data-table-shell__pager">
<t-pagination v-model="membersPage" v-model:page-size="membersPageSize" :total="membersTotal" size="small"
show-jumper show-page-number show-page-size :page-size-options="MEMBERS_PAGE_SIZE_OPTIONS"
:show-jumper="false" show-page-number :show-page-size="membersTotal > 10" :page-size-options="MEMBERS_PAGE_SIZE_OPTIONS"
@change="onMembersPageChange" />
</div>
</div>
@ -575,6 +562,7 @@ const shareLinkResult = ref<TenantInvitation | null>(null)
const addDialogStep = ref<'form' | 'confirm'>('form')
const addFormRef = ref<any>(null)
const searchQuery = ref('')
const activeListTab = ref('members')
/** 已应用到服务端筛选的检索词(相对输入框防抖) */
const memberSearchQ = ref('')
let memberSearchDebounceTimer: number | undefined
@ -655,6 +643,10 @@ const canManage = computed(
// Admin+ (and cross-tenant superusers) can view the audit log. Mirrors
// the server's g.Admin() guard on /tenants/:id/audit-log so we don't
// render a tab that would just 403.
watch(canManage, (allowed) => {
if (!allowed) activeListTab.value = 'members'
})
const canViewAudit = computed(
() =>
currentRole.value === 'owner' ||
@ -733,8 +725,8 @@ function roleMatrixIcon(role: TenantRole): string {
}
const columns = computed(() => [
{ colKey: 'member', title: t('tenantMember.columns.member'), ellipsis: true, minWidth: 132 },
{ colKey: 'role', title: t('tenantMember.columns.role'), width: 128 },
{ colKey: 'member', title: t('tenantMember.columns.member'), ellipsis: true, minWidth: 230 },
{ colKey: 'role', title: t('tenantMember.columns.role'), width: 168 },
{ colKey: 'joined_at', title: t('tenantMember.columns.joinedAt'), width: 154 },
{ colKey: 'actions', title: t('tenantMember.columns.operations'), width: 88, align: 'left' },
])
@ -1471,7 +1463,8 @@ watch(
@import (reference) '@/components/css/settings-table.less';
.tenant-members {
width: 100%;
.settings-list-page();
container-type: inline-size;
}
.member-cell {
@ -1502,9 +1495,13 @@ watch(
.section-header {
.settings-section-header();
flex-shrink: 0;
margin-bottom: 12px;
padding-right: 32px;
}
.section-header-row {
margin-bottom: 8px;
display: flex;
align-items: center;
justify-content: space-between;
@ -1515,24 +1512,31 @@ watch(
.section-header-titlewrap {
display: inline-flex;
align-items: center;
gap: 2px;
gap: 6px;
min-width: 0;
h2 {
margin: 0;
line-height: 1.25;
}
}
/* 顶部右侧的「审计日志」入口。t-button variant="text" 自带颜色
交互;这里只调 flex 行为,避免在 wrap 时被挤压。 */
.header-audit-btn {
flex-shrink: 0;
.members-header-actions {
display: flex;
align-items: center;
flex-wrap: wrap;
gap: 8px;
}
.header-audit-btn.t-button,
.members-list-add-btn.t-button {
.settings-list-action();
}
.members-tab-layout {
display: flex;
flex-direction: column;
flex: 1;
min-height: 0;
overflow: auto;
padding: 16px 0 32px;
}
/* 带子分页的卡片:仅在表格主体上横向滚动,页脚不参与滚动,避免分页条被卷入或对齐错位。
@ -1571,135 +1575,128 @@ watch(
background-color: transparent;
}
.permissions-trigger-btn {
display: inline-flex;
align-items: center;
justify-content: center;
flex-shrink: 0;
width: 22px;
height: 22px;
margin: 0;
padding: 0;
border: none;
border-radius: var(--app-radius-sm);
background: transparent;
color: var(--td-text-color-secondary);
cursor: pointer;
line-height: 0;
transition: background-color var(--app-motion-base) ease, color var(--app-motion-base) ease;
.permissions-trigger-btn { .settings-title-help(); }
:deep(.t-icon) {
display: block;
}
&:hover {
background-color: var(--td-bg-color-secondarycontainer);
color: var(--td-brand-color);
}
&:focus-visible {
outline: 2px solid var(--td-brand-color-focus);
outline-offset: 1px;
}
}
/* 列表上方的标题行:「空间成员 [N] · 筛选出 K」 左侧;右侧
是「搜索 + 邀请按钮」一组。视觉级别与「待接受邀请」一致。 */
.members-list-wrap {
display: flex;
flex-direction: column;
gap: 10px;
}
.members-list-header {
.members-tabbar {
display: flex;
align-items: center;
justify-content: space-between;
gap: 12px;
padding: 0 2px;
flex-wrap: wrap;
gap: 16px;
flex-shrink: 0;
border-bottom: 1px solid var(--td-component-stroke);
}
.members-list-titlewrap {
display: inline-flex;
align-items: center;
gap: 8px;
.members-tabs {
flex: 1;
min-width: 0;
background: transparent;
:deep(.t-tabs__nav-item) { height: 44px; margin-right: 24px; font-size: var(--app-text-base); }
:deep(.t-tabs__nav-item-wrapper) { margin: 0; padding: 0 2px; }
:deep(.t-tabs__nav-item:not(.t-is-disabled):hover .t-tabs__nav-item-wrapper) { background: transparent; }
:deep(.t-tabs__nav-container.t-is-top::after),
:deep(.t-tabs__bar), :deep(.t-tabs__content), :deep(.t-tabs__operations) { display: none; }
:deep(.t-tabs__nav-scroll) { overflow-x: auto; scrollbar-width: none; }
:deep(.t-tabs__nav-item.t-is-active) {
color: var(--td-text-color-primary);
text-shadow: none;
.t-icon { color: var(--td-brand-color); }
.members-list-count-badge { color: var(--td-brand-color); background: var(--td-brand-color-light); }
&::after {
content: '';
position: absolute;
bottom: 0;
left: 0;
right: 0;
height: 2px;
background: var(--td-brand-color);
border-radius: var(--app-radius-pill);
}
}
}
.members-list-title {
font-size: var(--app-text-base);
font-weight: 600;
color: var(--td-text-color-primary);
}
.members-tab-label { display: inline-flex; align-items: center; gap: 6px; }
/* 数字外面套一个浅底圆角徽章,避免裸露的「成员 1」读起来像
排版残留。色阶与 td-tag default+light 看齐。 */
.members-list-count-badge {
display: inline-flex;
align-items: center;
justify-content: center;
min-width: 22px;
min-width: 20px;
height: 20px;
padding: 0 7px;
border-radius: var(--app-radius-lg);
background-color: var(--td-bg-color-secondarycontainer);
color: var(--td-text-color-primary);
font-size: var(--app-text-sm);
font-weight: 600;
line-height: 1;
}
.members-list-filter-hint {
font-size: var(--app-text-sm);
padding: 0 6px;
box-sizing: border-box;
border-radius: var(--app-radius-pill);
background: var(--td-bg-color-secondarycontainer);
color: var(--td-text-color-secondary);
}
.members-list-actions {
display: inline-flex;
align-items: center;
gap: 8px;
flex: 0 1 auto;
min-width: 0;
font-size: var(--app-text-xs);
line-height: 20px;
text-align: center;
font-variant-numeric: tabular-nums;
}
.members-list-search {
/* 用显式 width 锁定外层尺寸,避免 inline-flex 父容器下子项跟随
内容宽度变化(TDesign t-input 在 hover/focus 时会显示 clearable
的 × 图标、边框态切换),导致整行横向抖动。 */
flex: 0 0 14rem;
width: 14rem;
min-width: 0;
flex: 0 0 240px;
width: 240px;
:deep(.t-input) { border-radius: var(--app-radius-sm); }
}
@container (max-width: 700px) {
.members-tabbar { flex-wrap: wrap; gap: 0; }
.members-tabs { flex-basis: 100%; }
.members-list-search { flex: 1 1 100%; width: 100%; margin: 8px 0; }
}
.member-role-label {
display: inline-flex;
align-items: center;
gap: 6px;
box-sizing: border-box;
width: 128px;
height: 28px;
padding: 0 8px;
border: 1px solid transparent;
border-radius: var(--app-radius-sm);
background: var(--td-bg-color-secondarycontainer);
color: var(--td-text-color-primary);
font-size: var(--app-text-md);
line-height: 26px;
.t-icon { flex-shrink: 0; color: var(--td-text-color-secondary); }
}
.member-role-select {
width: 128px;
flex: 0 0 128px;
:deep(.t-input) {
width: 100%;
}
}
height: 28px;
min-height: 28px;
padding: 0 8px;
border: 1px solid transparent;
border-radius: var(--app-radius-sm);
background: var(--td-bg-color-secondarycontainer);
font-size: var(--app-text-md);
/* 列表头的邀请按钮:outline + primary,自带外框,比裸 icon
有分量;shape="square" 让它仍然是个紧凑的图标按钮。 */
.members-list-add-btn {
flex-shrink: 0;
}
@media (max-width: 560px) {
.members-list-actions {
width: 100%;
justify-content: flex-start;
}
.members-list-search {
flex: 1 1 auto;
width: auto;
max-width: none;
&:hover { border-color: var(--td-component-stroke); }
&.t-is-focused { border-color: var(--td-brand-color); }
}
:deep(.t-input__prefix) { margin-right: 6px; color: var(--td-text-color-secondary); }
}
.data-table-shell {
.settings-data-table();
/* 角色列:下拉收缩到内容宽度,不再撑满整格。原先 100% 在窄角色
名(如"Owner")下显得空荡且与其他列对不齐。 */
:deep(thead th) {
background: var(--td-bg-color-secondarycontainer);
color: var(--td-text-color-secondary);
font-weight: 500;
}
:deep(.t-table tbody tr:last-child td) { border-bottom: 0; }
:deep(.t-table__content > table) { min-width: 640px; }
// 角色标签与下拉控件保持同宽,文字与图标沿同一列对齐。
&:deep(.role-cell) {
display: flex;
align-items: center;
@ -1707,9 +1704,6 @@ watch(
box-sizing: border-box;
}
&:deep(.member-role-select.t-select) {
width: 100%;
}
}
/* Audit drawer's data-table-shell variant: only used inside the audit
@ -2002,28 +1996,9 @@ watch(
}
.pending-invitations-section {
margin-bottom: 24px;
display: flex;
flex-direction: column;
gap: 10px;
.pending-invitations-header {
display: flex;
flex-direction: column;
gap: 4px;
}
.pending-invitations-titlewrap {
display: flex;
align-items: center;
gap: 8px;
}
.pending-invitations-title {
font-size: var(--app-text-base);
font-weight: 600;
color: var(--td-text-color-primary);
}
gap: 12px;
.pending-invitations-desc {
font-size: var(--app-text-sm);
@ -2031,18 +2006,12 @@ watch(
}
.pending-invitations-empty {
padding: 10px 12px;
border: 1px dashed var(--td-component-stroke);
border-radius: var(--app-radius-md);
color: var(--td-text-color-secondary);
padding: 40px 16px;
border: 1px solid var(--td-component-stroke);
border-radius: var(--app-radius-lg);
text-align: center;
color: var(--td-text-color-placeholder);
font-size: var(--app-text-md);
background: var(--td-bg-color-container);
}
/* Visually distinguish from members table so the eye doesn't fuse
"pending" rows with "actual member" rows. */
.pending-invitations-table {
background: var(--td-bg-color-secondarycontainer);
}
}

View File

@ -5,9 +5,9 @@
<div class="section-header__main">
<div class="section-header__titlewrap">
<h2>{{ t('modelCatalog.title') }}</h2>
<t-popup placement="bottom-start" trigger="hover" :overlay-inner-style="{ maxWidth: '420px' }">
<t-popup placement="bottom-left" trigger="hover" show-arrow :overlay-inner-style="{ maxWidth: 'min(420px, calc(100vw - 64px))' }">
<button type="button" class="hint-trigger" :aria-label="t('modelCatalog.howItWorks')">
<t-icon name="info-circle" size="16px" />
<t-icon name="help-circle" size="16px" />
</button>
<template #content>
<div class="hint-popover">
@ -22,7 +22,6 @@
</template>
</t-popup>
</div>
<p class="section-description">{{ t('modelCatalog.description') }}</p>
</div>
<div class="section-header__actions">
<t-button theme="primary" variant="text" class="header-action" :disabled="!state" @click="openAdd">
@ -39,6 +38,7 @@
<input ref="fileInput" type="file" accept=".json,application/json" hidden @change="importOverlay" />
</div>
</div>
<p class="section-description">{{ t('modelCatalog.description') }}</p>
</header>
<t-alert v-if="state?.deployment_error" theme="warning" class="catalog-alert"
@ -422,7 +422,7 @@ const capabilities = (model: CatalogModel) => [
const rowClassName = ({ row }: { row: CatalogRow }) => (row.model.deprecated ? 'catalog-row--hidden' : '')
const columns = computed<TableProps['columns']>(() => [
{ colKey: 'model', title: t('modelCatalog.columns.model') },
{ colKey: 'model', title: t('modelCatalog.columns.model'), minWidth: 240 },
{ colKey: 'type', title: t('modelCatalog.columns.type'), width: 100 },
{ colKey: 'tokens', title: t('modelCatalog.columns.tokens'), width: 124, align: 'right' },
{ colKey: 'capabilities', title: t('modelCatalog.columns.capabilities'), width: 148 },
@ -782,13 +782,22 @@ onMounted(load)
<style lang="less" scoped>
@import (reference) '@/components/css/settings-section.less';
@import (reference) '@/components/css/settings-table.less';
.model-catalog {
width: 100%;
.settings-list-page();
}
.section-header {
.settings-section-header();
flex-shrink: 0;
margin-bottom: 12px;
padding-right: 32px;
}
.section-header__top {
flex-wrap: wrap;
margin-bottom: 8px;
}
.section-header__main {
@ -805,48 +814,19 @@ onMounted(load)
}
}
.section-header__titlewrap + .section-description {
margin-top: 8px;
}
.section-header__actions {
display: flex;
align-items: center;
gap: 16px;
flex-shrink: 0;
gap: 8px;
flex-wrap: wrap;
}
.header-action {
--td-bg-color-container-hover: transparent;
padding-left: 0;
padding-right: 0;
font-weight: 600;
}
.header-action--muted {
color: var(--td-text-color-secondary);
&:hover:not(:disabled) {
color: var(--td-brand-color);
}
.header-action.t-button {
.settings-list-action();
}
.hint-trigger {
display: inline-flex;
align-items: center;
justify-content: center;
padding: 2px;
border: none;
border-radius: var(--app-radius-xs);
background: transparent;
color: var(--td-text-color-placeholder);
cursor: help;
line-height: 1;
&:hover,
&:focus-visible {
color: var(--td-brand-color);
}
.settings-title-help();
}
.hint-popover {
@ -889,15 +869,20 @@ onMounted(load)
}
.catalog-toolbar {
flex-shrink: 0;
display: flex;
flex-wrap: wrap;
align-items: center;
gap: 12px;
padding-bottom: 12px;
margin-bottom: 16px;
border-bottom: 1px solid var(--td-component-stroke);
:deep(.t-input), :deep(.t-select) { border-radius: var(--app-radius-sm); }
}
.catalog-toolbar__search {
width: 200px;
width: 240px;
}
.catalog-toolbar__select {
@ -954,30 +939,28 @@ onMounted(load)
}
.data-table-shell {
overflow-x: auto;
border: 1px solid var(--td-component-stroke);
border-radius: var(--app-radius-lg);
background-color: var(--td-bg-color-container);
.settings-data-table();
min-height: 0;
overflow: auto;
margin-bottom: 32px;
&:deep(thead th) {
background-color: var(--td-bg-color-secondarycontainer);
font-size: var(--app-text-md);
font-weight: 600;
:deep(thead th) {
background: var(--td-bg-color-secondarycontainer);
color: var(--td-text-color-secondary);
font-weight: 500;
}
&:deep(.t-table td),
&:deep(.t-table th) {
padding-top: 12px;
padding-bottom: 12px;
vertical-align: middle;
}
&:deep(.t-table__pagination) {
padding: 12px 16px;
:deep(.t-table td), :deep(.t-table th) { vertical-align: middle; }
:deep(.t-table tbody tr:last-child td) { border-bottom: 0; }
:deep(.t-table__pagination) {
padding: 10px 16px;
border-top: 1px solid var(--td-component-stroke);
}
}
.catalog-table-shell {
:deep(.t-table__content > table) { min-width: 840px; }
&:deep(.t-table tbody tr) {
cursor: pointer;
}

View File

@ -1,18 +1,25 @@
<template>
<div class="platform-api-keys">
<header class="section-header">
<h2>{{ t('platformApiKeys.title') }}</h2>
<p class="section-description">{{ t('platformApiKeys.description') }}</p>
</header>
<t-alert theme="warning" :message="t('platformApiKeys.securityNotice')" class="security-alert">
<template #operation>
<t-button size="small" variant="outline" @click="openCreate">
<div class="section-header__top">
<div class="section-header__titlewrap">
<h2>{{ t('platformApiKeys.title') }}</h2>
<t-popup placement="bottom-left" trigger="hover" show-arrow>
<button type="button" class="hint-trigger" :aria-label="t('platformApiKeys.title')">
<t-icon name="help-circle" size="16px" />
</button>
<template #content>
<div class="security-hint" role="note">{{ t('platformApiKeys.securityNotice') }}</div>
</template>
</t-popup>
</div>
<t-button size="small" variant="outline" class="header-action" @click="openCreate">
<template #icon><t-icon name="add" /></template>
{{ t('platformApiKeys.create') }}
</t-button>
</template>
</t-alert>
</div>
<p class="section-description">{{ t('platformApiKeys.description') }}</p>
</header>
<section class="keys-section">
<div v-if="loading" class="keys-state">
@ -357,31 +364,53 @@ onMounted(reload)
<style lang="less" scoped>
@import (reference) '@/components/css/settings-section.less';
@import (reference) '@/components/css/settings-table.less';
.platform-api-keys {
width: 100%;
.settings-list-page();
}
.section-header {
.settings-section-header();
flex-shrink: 0;
margin-bottom: 12px;
padding-right: 32px;
}
.section-header h2 {
margin: 0 0 8px;
font-size: var(--app-text-3xl);
font-weight: 600;
color: var(--td-text-color-primary);
.section-header__top {
flex-wrap: wrap;
margin-bottom: 8px;
}
.security-alert {
margin-bottom: 20px;
.section-header__titlewrap {
display: flex;
align-items: center;
gap: 6px;
h2 { margin: 0; }
}
.hint-trigger {
.settings-title-help();
}
.security-hint {
max-width: min(320px, calc(100vw - 64px));
padding: 4px;
color: var(--td-text-color-secondary);
font-size: var(--app-text-sm);
line-height: 20px;
}
.header-action.t-button {
.settings-list-action();
}
.keys-section {
border: 1px solid var(--td-component-border);
border-radius: var(--app-radius-lg);
background: var(--td-bg-color-container);
overflow: hidden;
.settings-data-table();
min-height: 0;
overflow: auto;
margin: 4px 0 32px;
}
.keys-state {
@ -401,18 +430,18 @@ onMounted(reload)
.api-key-table-wrap {
width: 100%;
overflow-x: auto;
}
.api-key-table {
width: 100%;
min-width: 760px;
border-collapse: collapse;
table-layout: fixed;
}
.api-key-table th,
.api-key-table td {
padding: 13px 14px;
padding: 12px 24px;
border-bottom: 1px solid var(--td-component-stroke);
text-align: left;
vertical-align: middle;
@ -420,10 +449,10 @@ onMounted(reload)
.api-key-table th {
background: var(--td-bg-color-secondarycontainer);
color: var(--td-text-color-placeholder);
font-size: var(--app-text-sm);
color: var(--td-text-color-secondary);
font-size: var(--app-text-md);
font-weight: 500;
line-height: 1.4;
line-height: 22px;
}
.api-key-table td {
@ -495,6 +524,10 @@ onMounted(reload)
line-height: 1.4;
}
.api-key-table tbody tr:hover {
background: var(--td-bg-color-container-hover);
}
.api-key-table tbody tr:last-child td {
border-bottom: none;
}

View File

@ -1,5 +1,5 @@
-- Browser authorization is durable; live browser processes remain ephemeral.
CREATE TABLE browser_devices (
CREATE TABLE IF NOT EXISTS browser_devices (
scope_key VARCHAR(32) PRIMARY KEY,
id VARCHAR(32) NOT NULL UNIQUE,
tenant BIGINT NOT NULL,
@ -18,15 +18,15 @@ CREATE TABLE browser_devices (
lease_key VARCHAR(32) NOT NULL DEFAULT '',
lease_until TIMESTAMPTZ NOT NULL
);
CREATE TABLE browser_pairings (
CREATE TABLE IF NOT EXISTS browser_pairings (
scope_key VARCHAR(32) PRIMARY KEY,
token_hash VARCHAR(64) NOT NULL UNIQUE,
tenant BIGINT NOT NULL,
"user" VARCHAR(36) NOT NULL,
expires_at TIMESTAMPTZ NOT NULL
);
CREATE INDEX browser_pairings_expiry ON browser_pairings(expires_at);
CREATE TABLE browser_task_interruptions (
CREATE INDEX IF NOT EXISTS browser_pairings_expiry ON browser_pairings(expires_at);
CREATE TABLE IF NOT EXISTS browser_task_interruptions (
scope_key VARCHAR(32) NOT NULL,
session VARCHAR(36) NOT NULL,
PRIMARY KEY (scope_key, session)

View File

@ -3,7 +3,7 @@ ALTER TABLE memory_subjects ADD COLUMN extraction_state JSONB;
ALTER TABLE memory_items ADD COLUMN replaces_id VARCHAR(36) NOT NULL DEFAULT '';
-- Progress is an indexed row per conversation; subject rows only hold a lease.
CREATE TABLE memory_extraction_sessions (
CREATE TABLE IF NOT EXISTS memory_extraction_sessions (
tenant_id BIGINT NOT NULL,
subject_id VARCHAR(512) NOT NULL,
session_id VARCHAR(36) NOT NULL,
@ -17,8 +17,8 @@ CREATE TABLE memory_extraction_sessions (
failed_at TIMESTAMP WITH TIME ZONE, updated_at TIMESTAMP WITH TIME ZONE NOT NULL,
PRIMARY KEY (tenant_id, subject_id, session_id)
);
CREATE INDEX idx_memory_extraction_pending ON memory_extraction_sessions (tenant_id, subject_id, pending, updated_at, session_id);
CREATE INDEX idx_memory_replaces ON memory_items (tenant_id, subject_id, replaces_id, status);
CREATE INDEX IF NOT EXISTS idx_memory_extraction_pending ON memory_extraction_sessions (tenant_id, subject_id, pending, updated_at, session_id);
CREATE INDEX IF NOT EXISTS idx_memory_replaces ON memory_items (tenant_id, subject_id, replaces_id, status);
-- Recover the old active record when a legacy pending inference prematurely
-- superseded it. Keep an explicit target so confirmation can still replace it.

View File

@ -1,4 +1,4 @@
CREATE TABLE model_catalog_configs (
CREATE TABLE IF NOT EXISTS model_catalog_configs (
id INTEGER PRIMARY KEY,
version BIGINT NOT NULL DEFAULT 0,
overlay JSONB NOT NULL,
@ -8,4 +8,4 @@ CREATE TABLE model_catalog_configs (
CHECK (id = 1)
);
INSERT INTO model_catalog_configs (id, version, overlay, history)
VALUES (1, 0, '{"providers":{}}', '[]');
VALUES (1, 0, '{"providers":{}}', '[]') ON CONFLICT DO NOTHING;