style: polish sidebar, list pages, toolbox and citation UI (#4154)

* Compact and align collapsed sidebar icons

* Unify chat composer control sizing and styling

* Polish sidebar, list pages, toolbox and citation popover styling

* Update tests for compact sidebar and borderless citation pills
main
lyingbug 2026-10-11 15:01:12 +08:00 committed by GitHub
parent 231a5c0b15
commit d2dbf72099
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
25 changed files with 497 additions and 449 deletions

View File

@ -212,9 +212,13 @@ select:-webkit-autofill {
/* 应用级强调色:智能体 / 图谱等「非品牌但反复出现」的语义色,透明叠加请用 color-mix */
:root {
--app-accent-purple: #7c4dff;
--app-accent-blue: #2f6bff;
--app-accent-teal: #0f8f83;
}
:root[theme-mode="dark"] {
--app-accent-purple: #9d7cff;
--app-accent-blue: #6f9bff;
--app-accent-teal: #3cc4b4;
}
/* 引用原文定位:纸面荧光笔色,文字与整块区域使用不同强度。 */

View File

@ -1,28 +1,35 @@
<template>
<Teleport to="body">
<div v-if="float.visible" class="chat-citation-float" :class="{ 'chat-citation-float--kb': float.type === 'kb' }"
<div v-if="float.visible" class="chat-citation-float" :class="`chat-citation-float--${float.type}`"
:style="{ top: `${float.top}px`, left: `${float.left}px` }"
@mouseenter="onEnter?.()" @mouseleave="onLeave?.()">
<template v-if="float.type === 'web'">
<div class="chat-citation-float__title">{{ float.title || float.url }}</div>
<div class="chat-citation-float__header">
<span class="chat-citation-float__icon chat-citation-float__icon--web" aria-hidden="true" />
<div class="chat-citation-float__title">{{ float.title || float.url }}</div>
</div>
<a v-if="float.url" class="chat-citation-float__link" :href="float.url" target="_blank"
rel="noopener noreferrer">{{ float.url }}</a>
</template>
<template v-else>
<div class="chat-citation-float__title">{{ float.title }}</div>
<div class="chat-citation-float__header">
<span class="chat-citation-float__icon chat-citation-float__icon--book" aria-hidden="true" />
<div class="chat-citation-float__title">{{ float.title }}</div>
</div>
<div v-if="float.loading" class="chat-citation-float__muted">{{ loadingText }}</div>
<div v-else-if="float.error" class="chat-citation-float__error">{{ float.error }}</div>
<div v-else class="chat-citation-float__body">{{ float.content }}</div>
<div v-else class="chat-citation-float__body">{{ plainContent }}</div>
</template>
</div>
</Teleport>
</template>
<script setup lang="ts">
import { computed } from 'vue'
import { useI18n } from 'vue-i18n'
import type { CitationFloatState } from '@/composables/useChatCitationPopover'
defineProps<{
const props = defineProps<{
float: CitationFloatState
onEnter?: () => void
onLeave?: () => void
@ -30,6 +37,17 @@ defineProps<{
const { t } = useI18n()
const loadingText = t('common.loading')
// 预览只放纯文本摘录,去掉 Markdown 标记和多余空行
const plainContent = computed(() => props.float.content
.replace(/^\s*([-*_])\1{2,}\s*$/gm, '')
.replace(/^#{1,6}\s+/gm, '')
.replace(/^\s*>\s?/gm, '')
.replace(/!\[[^\]]*\]\([^)]*\)/g, '')
.replace(/\[([^\]]+)\]\([^)]*\)/g, '$1')
.replace(/(\*\*|__|`)/g, '')
.replace(/\n{2,}/g, '\n')
.trim())
</script>
<style lang="less">

View File

@ -19,20 +19,12 @@ test('composer browser button is disabled and opens settings when the extension
assert.match(inputField, /\$t\('localBrowser\.reconnectHint'\)|\$t\(browserSourceUnavailableHint\)/)
})
test('mention button matches icon controls and the stream artifact count badge', () => {
test('mention button matches icon controls and leaves the count to the selected chips', () => {
const css = inputField.slice(inputField.indexOf('.kb-btn {'), inputField.indexOf('.kb-btn-text'))
assert.match(css, /width: 28px/)
assert.match(css, /&:hover:not\(\.disabled\):not\(\.active\)/)
assert.doesNotMatch(css, /box-shadow: inset/)
const count = inputField.slice(inputField.indexOf('.kb-count {'), inputField.indexOf('.kb-btn-text'))
assert.match(count, /top: -2px/)
assert.match(count, /right: -2px/)
assert.match(count, /min-width: 14px/)
assert.match(count, /height: 14px/)
assert.match(count, /font-size: (?:10px|var\(--app-text-2xs\))/)
assert.match(count, /border-radius: 7px/)
assert.match(count, /font-variant-numeric: tabular-nums/)
assert.doesNotMatch(count, /border: 2px solid/)
assert.doesNotMatch(inputField, /class="kb-count"/)
})
test('a selected browser source keeps brand color on hover', () => {

View File

@ -1186,7 +1186,7 @@ const updateModelDropdownPosition = () => {
height: rect.height
});
const dropdownWidth = 280;
const dropdownWidth = 320;
const offsetY = 8;
const { width: vw, height: vh } = cssViewportSize(zoom);
@ -1847,6 +1847,8 @@ const toggleModelSelector = () => {
updateModelDropdownPosition();
setTimeout(() => {
updateModelDropdownPosition();
document.querySelector('.model-selector-content .model-option.selected')
?.scrollIntoView({ block: 'nearest' });
}, 50);
});
});
@ -2897,7 +2899,6 @@ defineExpose({
d="M13.5 10V11.5C13.5 12.163 13.7634 12.7989 14.2322 13.2678C14.7011 13.7366 15.337 14 16 14C16.663 14 17.2989 13.7366 17.7678 13.2678C18.2366 12.7989 18.5 12.163 18.5 11.5V10C18.5 7.74566 17.6045 5.58365 16.0104 3.98959C14.4163 2.39553 12.2543 1.5 10 1.5C7.74566 1.5 5.58365 2.39553 3.98959 3.98959C2.39553 5.58365 1.5 7.74566 1.5 10C1.5 12.2543 2.39553 14.4163 3.98959 16.0104C5.58365 17.6045 7.74566 18.5 10 18.5H12"
stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" />
</svg>
<span v-if="allSelectedItems.length > 0" class="kb-count">{{ allSelectedItems.length }}</span>
</div>
</t-tooltip>
@ -2966,9 +2967,6 @@ defineExpose({
<div v-for="model in availableModels" :key="model.id" class="model-option"
:class="{ selected: model.id === selectedModelId }" @click="handleModelChange(model.id || '')">
<div class="model-option-left">
<div class="model-option-icon">
<t-icon name="chat" size="14px" />
</div>
<div class="model-option-name-wrap">
<span class="model-option-name">{{ modelDisplayName(model) }}</span>
<span v-if="model.display_name" class="model-option-raw-name">{{ model.name }}</span>
@ -2979,6 +2977,9 @@ defineExpose({
:class="{ 'is-default': isDefaultContextWindow(model.parameters?.context_window) }"
:title="contextWindowTitle(model.parameters?.context_window)"
>{{ formatContextWindow(model.parameters?.context_window) }}</span>
<span class="model-option-check">
<t-icon v-if="model.id === selectedModelId" name="check" size="14px" />
</span>
</div>
<div v-if="availableModels.length === 0" class="model-option empty">
{{ $t('input.noModel') }}
@ -3139,14 +3140,17 @@ const getImgSrc = (url: string) => {
display: flex;
flex-wrap: wrap;
align-items: center;
gap: 5px;
padding: 6px 12px 6px;
border-bottom: 1px solid var(--td-component-stroke);
gap: 6px;
padding: 12px 16px 0;
background: var(--td-bg-color-container);
border-radius: 11px 11px 0 0;
/* 与 .rich-input-container 内缘上边圆角一致(12px - 1px 边框) */
}
.rich-input-container:has(.selected-tags-inline) :deep(.t-textarea__inner) {
padding-top: 8px;
}
.mention-chip {
.chat-resource-chip-surface();
@ -3333,7 +3337,7 @@ const getImgSrc = (url: string) => {
/* 控制栏 */
.control-bar {
position: relative;
margin: 0 16px 12px;
margin: 0 12px 12px;
display: flex;
align-items: center;
justify-content: space-between;
@ -3369,7 +3373,7 @@ const getImgSrc = (url: string) => {
.control-left {
display: flex;
align-items: center;
gap: 8px;
gap: 4px;
flex: 1;
flex-wrap: wrap;
min-width: 0;
@ -3406,11 +3410,14 @@ const getImgSrc = (url: string) => {
.agent-mode-btn {
height: 28px;
padding: 0 10px;
padding: 0 8px 0 10px;
margin-right: 4px;
box-sizing: border-box;
min-width: auto;
font-weight: 500;
position: relative;
border: .5px solid var(--td-component-border);
border-radius: var(--app-radius-pill);
background: var(--td-bg-color-secondarycontainer);
}
.agent-icon {
@ -3435,7 +3442,7 @@ const getImgSrc = (url: string) => {
color: var(--td-text-color-secondary);
font-weight: 500;
white-space: nowrap;
margin: 0 4px;
margin: 0 2px;
}
.control-icon {
@ -3478,28 +3485,6 @@ const getImgSrc = (url: string) => {
}
}
.kb-count {
position: absolute;
top: -2px;
right: -2px;
z-index: 1;
display: inline-flex;
align-items: center;
justify-content: center;
box-sizing: border-box;
min-width: 14px;
height: 14px;
padding: 0 3px;
border-radius: 7px;
background: var(--td-brand-color);
color: var(--td-text-color-anti);
font-size: var(--app-text-2xs);
font-weight: 600;
line-height: 1;
font-variant-numeric: tabular-nums;
pointer-events: none;
}
.kb-btn-text {
font-size: var(--app-text-md);
color: var(--td-text-color-secondary);
@ -3537,8 +3522,8 @@ const getImgSrc = (url: string) => {
position: absolute;
top: -2px;
right: -2px;
background: #07C05F;
color: #fff;
background: var(--td-brand-color);
color: var(--td-text-color-anti);
font-size: var(--app-text-2xs);
width: 14px;
height: 14px;
@ -3576,8 +3561,8 @@ const getImgSrc = (url: string) => {
position: absolute;
top: -2px;
right: -2px;
background: #07C05F;
color: #fff;
background: var(--td-brand-color);
color: var(--td-text-color-anti);
font-size: var(--app-text-2xs);
width: 14px;
height: 14px;
@ -3772,6 +3757,7 @@ const getImgSrc = (url: string) => {
width: 28px;
height: 28px;
padding: 0;
border-radius: 50%;
box-sizing: border-box;
font-size: var(--app-text-xl);
line-height: 1;
@ -3791,7 +3777,13 @@ const getImgSrc = (url: string) => {
}
&.disabled {
background-color: var(--td-success-color-light);
opacity: 1;
background-color: var(--td-bg-color-component);
color: var(--td-text-color-placeholder);
&:hover {
background-color: var(--td-bg-color-component);
}
}
img {
@ -3804,7 +3796,6 @@ const getImgSrc = (url: string) => {
.model-selector-trigger.reasoning-effort-trigger {
flex-shrink: 0;
min-width: 0;
box-sizing: content-box;
background: transparent;
font: inherit;
}
@ -3871,11 +3862,11 @@ const getImgSrc = (url: string) => {
display: flex;
align-items: center;
gap: 6px;
padding: 2px 8px;
min-width: 100px;
height: 22px;
padding: 0 8px;
height: 28px;
box-sizing: border-box;
border: 0;
border-radius: var(--app-radius-sm);
border: .5px solid var(--td-component-border);
transition: background var(--app-motion-instant), border-color var(--app-motion-instant);
cursor: pointer;
@ -3972,7 +3963,7 @@ const getImgSrc = (url: string) => {
display: flex;
align-items: center;
justify-content: space-between;
padding: 8px 10px;
padding: 8px 8px 8px 16px;
border-bottom: .5px solid var(--td-component-stroke);
background: var(--td-bg-color-container);
font-size: var(--app-text-sm);
@ -4025,17 +4016,22 @@ const getImgSrc = (url: string) => {
cursor: pointer;
transition: background var(--app-motion-instant);
border-radius: var(--app-radius-sm);
margin-bottom: 4px;
margin-bottom: 2px;
&:last-child {
margin-bottom: 0;
}
&:hover,
&.selected {
&:hover {
background: var(--td-bg-color-secondarycontainer);
}
&.selected .model-option-name,
&.selected .model-option-check {
color: var(--td-brand-color);
font-weight: 500;
}
&.empty {
color: var(--td-text-color-placeholder);
cursor: default;
@ -4056,14 +4052,13 @@ const getImgSrc = (url: string) => {
flex: 1;
}
.model-option-icon {
width: 16px;
height: 16px;
.model-option-check {
width: 14px;
height: 14px;
display: flex;
align-items: center;
justify-content: center;
flex-shrink: 0;
color: var(--td-text-color-secondary);
}
.model-option-name-wrap {
@ -4093,10 +4088,7 @@ const getImgSrc = (url: string) => {
flex-shrink: 0;
font-size: var(--app-text-xs);
font-variant-numeric: tabular-nums;
color: var(--td-text-color-secondary);
background: var(--td-bg-color-secondarycontainer);
padding: 0 6px;
border-radius: var(--app-radius-xs);
color: var(--td-text-color-placeholder);
line-height: 18px;
&.is-default {

View File

@ -85,8 +85,16 @@ onMounted(() => { if (!props.hideScopes) orgStore.fetchOrganizations() })
gap: var(--app-space-3);
min-width: 0;
}
.category-tabs { .artifact-filter-tabs(); }
// 与右侧 32px 的下拉框、搜索框同高:3px 内边距 × 2 + 26px 按钮
.category-tabs {
.artifact-filter-tabs();
button { display: inline-flex; align-items: center; height: 26px; padding: 0 12px; }
}
.scope-count { margin-left: 5px; font-size: var(--app-text-xs); font-variant-numeric: tabular-nums; }
.space-filter,
.search-input {
:deep(.t-input) { border-radius: var(--app-radius-sm); }
}
.space-filter { width: 180px; }
.space-filter-icon-active { color: var(--td-brand-color); }
.search-input { width: 260px; max-width: 100%; margin-left: auto; }

View File

@ -4,10 +4,7 @@
<template #content>
<div class="resource-sort-panel" role="menu" :aria-label="t('resourceSort.title')">
<section v-for="group in groups" :key="group.key" class="resource-sort-group">
<div class="resource-sort-group__heading">
<div class="resource-sort-group__label">{{ group.label }}</div>
<div class="resource-sort-group__description">{{ group.description }}</div>
</div>
<div class="resource-sort-group__label" :title="group.description">{{ group.label }}</div>
<div class="resource-sort-group__options">
<button v-for="option in group.options" :key="option.value" type="button"
class="resource-sort-option" :class="{ active: modelValue === option.value }"
@ -85,23 +82,21 @@ function selectOption(value: ResourceSortValue) {
justify-content: center;
gap: 5px;
max-width: 180px;
height: 28px;
padding: 0 8px;
height: 32px;
padding: 0 10px;
border: 1px solid var(--td-component-stroke);
border-radius: var(--app-radius-sm);
background: var(--td-bg-color-secondarycontainer);
background: var(--td-bg-color-container);
color: var(--td-text-color-secondary);
font-family: var(--app-font-family);
font-size: var(--app-text-sm);
font-size: var(--app-text-md);
cursor: pointer;
box-shadow: inset 0 1px 0 color-mix(in srgb, var(--td-bg-color-container) 72%, transparent);
transition: color 0.12s ease, background-color 0.12s ease, border-color 0.12s ease;
&:hover,
&.active {
color: var(--td-brand-color);
border-color: color-mix(in srgb, var(--td-brand-color) 38%, var(--td-component-stroke));
background: var(--td-brand-color-light);
color: var(--td-text-color-primary);
background: var(--td-bg-color-container-hover);
}
&__label {
@ -122,41 +117,31 @@ function selectOption(value: ResourceSortValue) {
}
.resource-sort-panel {
width: 330px;
width: 260px;
max-width: calc(100vw - 32px);
padding: 6px;
padding: 4px;
box-sizing: border-box;
color: var(--td-text-color-primary);
}
.resource-sort-group {
padding: 7px 6px 8px;
& + & {
margin-top: 4px;
padding-top: 4px;
border-top: 1px solid var(--td-component-stroke);
}
&__heading {
padding: 0 4px 6px;
}
&__label {
font-size: var(--app-text-md);
line-height: 20px;
font-weight: 600;
}
&__description {
margin-top: 1px;
color: var(--td-text-color-secondary);
padding: 6px 8px 2px;
color: var(--td-text-color-placeholder);
font-size: var(--app-text-xs);
line-height: 17px;
line-height: 18px;
}
&__options {
display: grid;
grid-template-columns: repeat(2, minmax(0, 1fr));
gap: 4px;
gap: 2px;
}
}
@ -166,7 +151,7 @@ function selectOption(value: ResourceSortValue) {
justify-content: space-between;
min-width: 0;
height: 32px;
padding: 0 10px;
padding: 0 8px;
border: 0;
border-radius: var(--app-radius-sm);
background: transparent;
@ -176,11 +161,10 @@ function selectOption(value: ResourceSortValue) {
cursor: pointer;
&:hover {
background: var(--td-bg-color-secondarycontainer);
background: var(--td-bg-color-container-hover);
}
&.active {
background: var(--td-brand-color-light);
color: var(--td-brand-color);
font-weight: 500;
}

View File

@ -566,8 +566,12 @@ onUnmounted(() => {
&--collapsed {
.user-button {
justify-content: center;
padding: 6px 3px;
width: 32px;
height: 32px;
margin: 0 auto;
padding: 0;
gap: 0;
border-radius: var(--app-radius-sm);
}
.user-dropdown {

View File

@ -47,39 +47,23 @@
text-overflow: ellipsis;
}
:deep(.citation-kb) {
background: color-mix(in srgb, var(--td-text-color-primary) 4%, transparent);
color: color-mix(in srgb, var(--td-text-color-primary) 86%, var(--td-text-color-primary));
border: 0;
box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--td-text-color-primary) 10%, transparent);
cursor: pointer;
white-space: nowrap;
position: relative;
transition: background var(--app-motion-fast) ease, box-shadow var(--app-motion-fast) ease, color var(--app-motion-fast) ease;
}
:deep(.citation-kb:hover) {
background: color-mix(in srgb, var(--td-text-color-primary) 7%, transparent);
box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--td-text-color-primary) 18%, transparent);
color: var(--td-text-color-primary);
}
// 引用标签只用浅底色区分,不加描边,避免像按钮一样抢正文
:deep(.citation-kb),
:deep(.citation-web) {
background: color-mix(in srgb, var(--td-brand-color) 6%, transparent);
color: color-mix(in srgb, var(--td-brand-color) 72%, var(--td-text-color-secondary));
background: color-mix(in srgb, var(--td-text-color-primary) 6%, transparent);
color: var(--td-text-color-secondary);
border: 0;
box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--td-brand-color) 17%, transparent);
cursor: pointer;
white-space: nowrap;
position: relative;
text-decoration: none;
transition: background var(--app-motion-fast) ease, box-shadow var(--app-motion-fast) ease, color var(--app-motion-fast) ease;
transition: background var(--app-motion-fast) ease, color var(--app-motion-fast) ease;
}
:deep(.citation-kb:hover),
:deep(.citation-web:hover) {
background: color-mix(in srgb, var(--td-brand-color) 10%, transparent);
box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--td-brand-color) 28%, transparent);
color: color-mix(in srgb, var(--td-brand-color) 82%, var(--td-text-color-primary));
background: color-mix(in srgb, var(--td-text-color-primary) 10%, transparent);
color: var(--td-text-color-primary);
}
:deep(.citation-web:focus-visible),
@ -115,73 +99,112 @@
.chat-citation-float {
position: absolute;
z-index: 10000;
max-width: 320px;
padding: 10px 12px;
border-radius: var(--app-radius-md);
box-sizing: border-box;
width: 300px;
max-width: calc(100vw - 32px);
padding: 10px 12px 12px;
border: 0.5px solid var(--td-component-stroke);
border-radius: var(--app-radius-lg);
background: var(--td-bg-color-container);
box-shadow: 0 6px 18px rgba(0, 0, 0, 0.18);
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.04), 0 6px 20px rgba(0, 0, 0, 0.08);
font-family: var(--app-font-family);
font-size: var(--app-text-sm);
line-height: 1.5;
line-height: 1.6;
color: var(--td-text-color-primary);
overflow-wrap: anywhere;
animation: chat-citation-float-in var(--app-motion-fast) ease-out both;
&__header {
display: flex;
align-items: flex-start;
gap: 6px;
padding-bottom: 8px;
margin-bottom: 8px;
border-bottom: 1px solid var(--td-component-stroke);
}
&__icon {
flex-shrink: 0;
width: 14px;
height: 14px;
margin-top: 3px;
background-color: var(--td-text-color-placeholder);
mask-size: contain;
mask-repeat: no-repeat;
mask-position: center;
-webkit-mask-size: contain;
-webkit-mask-repeat: no-repeat;
-webkit-mask-position: center;
&--book {
mask-image: url('@/assets/img/ziliao.svg');
-webkit-mask-image: url('@/assets/img/ziliao.svg');
}
&--web {
mask-image: url('@/assets/img/websearch-globe.svg');
-webkit-mask-image: url('@/assets/img/websearch-globe.svg');
}
}
&__title {
font-weight: 600;
color: var(--td-brand-color);
margin-bottom: 4px;
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 2;
line-clamp: 2;
overflow: hidden;
font-size: var(--app-text-md);
font-weight: 500;
line-height: 20px;
color: var(--td-text-color-primary);
}
&__link {
color: var(--td-brand-color);
word-break: break-all;
}
&__body {
max-height: 200px;
overflow-y: auto;
white-space: pre-wrap;
}
&__muted,
&__error {
display: block;
overflow: hidden;
color: var(--td-text-color-secondary);
text-overflow: ellipsis;
white-space: nowrap;
text-decoration: none;
&:hover {
color: var(--td-brand-color);
}
}
// 摘录只展示前几行,完整内容点击引用后在侧栏查看
&__body {
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 7;
line-clamp: 7;
overflow: hidden;
white-space: pre-line;
color: var(--td-text-color-secondary);
}
&__muted {
color: var(--td-text-color-placeholder);
}
&__error {
color: var(--td-error-color);
}
&--kb {
box-sizing: border-box;
width: 264px;
max-width: calc(100vw - 32px);
padding: 12px 14px;
border: 0.5px solid var(--td-component-stroke);
border-radius: var(--app-radius-lg);
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.04), 0 6px 20px rgba(0, 0, 0, 0.08);
font-family: var(--app-font-family);
font-size: var(--app-text-md);
line-height: 1.6;
overflow-wrap: anywhere;
transition: background-color var(--app-motion-fast) ease;
&--web &__header {
margin-bottom: 6px;
}
}
&:hover {
background: var(--td-bg-color-container-hover);
}
.chat-citation-float__title {
margin-bottom: 6px;
font-weight: 500;
color: var(--td-text-color-primary);
}
.chat-citation-float__body {
color: var(--td-text-color-secondary);
}
@keyframes chat-citation-float-in {
from {
opacity: 0;
transform: translateY(-4px);
}
}
@media (prefers-reduced-motion: reduce) {
.chat-citation-float--kb {
transition: none;
.chat-citation-float {
animation: none;
}
}

View File

@ -1,14 +0,0 @@
import assert from 'node:assert/strict'
import { readFileSync } from 'node:fs'
import { fileURLToPath } from 'node:url'
import { dirname, join } from 'node:path'
import test from 'node:test'
const here = dirname(fileURLToPath(import.meta.url))
const css = readFileSync(join(here, 'chat-citations.less'), 'utf8')
test('citation pills use compact baseline-aligned source styling', () => {
assert.match(css, /border-radius:\s*(?:999px|var\(--app-radius-pill\))/)
assert.match(css, /font-size:\s*0\.72em/)
assert.match(css, /box-shadow:\s*inset 0 0 0 1px/)
})

View File

@ -72,6 +72,8 @@
font-size: var(--app-text-sm);
line-height: 18px;
overflow: hidden;
&.is-empty { color: var(--td-text-color-placeholder); }
}
.card-bottom {
display: flex;
@ -135,6 +137,8 @@
padding: 0 5px;
box-sizing: border-box;
border-radius: 5px;
background: var(--td-bg-color-secondarycontainer);
color: var(--td-text-color-secondary);
font-size: var(--app-text-xs);
font-weight: 500;
font-variant-numeric: tabular-nums;
@ -172,9 +176,10 @@
box-sizing: border-box;
display: flex;
flex-direction: column;
margin: 0 16px 0 0;
margin: 0;
padding: 20px 28px 0;
@media (max-width: 720px) { margin: 0; padding: var(--app-space-4) var(--app-space-4) 0; }
html.wails-desktop & { padding-top: 42px; }
@media (max-width: 720px) { padding: var(--app-space-4) var(--app-space-4) 0; }
}
.resource-list-main() {
flex: 1;
@ -198,6 +203,7 @@
min-height: 32px;
padding: 0 12px;
gap: 6px;
font-size: var(--app-text-md);
box-shadow: none;
color: var(--td-text-color-primary);
background: var(--td-bg-color-container);

View File

@ -20,10 +20,10 @@
</div>
</t-tooltip>
<div class="sidebar-toggle" @click="uiStore.toggleSidebar" :title="t('menu.collapseSidebar')">
<svg viewBox="0 0 20 20" width="18" height="18" fill="none" xmlns="http://www.w3.org/2000/svg">
<rect x="1.5" y="1.5" width="17" height="17" rx="3" stroke="currentColor" stroke-width="1.2" />
<line x1="7.5" y1="1.5" x2="7.5" y2="18.5" stroke="currentColor" stroke-width="1.2" />
<line x1="4" y1="7.5" x2="4" y2="12.5" stroke="currentColor" stroke-width="1.2"
<svg viewBox="0 0 20 20" width="16" height="16" fill="none" xmlns="http://www.w3.org/2000/svg">
<rect x="1.5" y="1.5" width="17" height="17" rx="3" stroke="currentColor" stroke-width="1.5" />
<line x1="7.5" y1="1.5" x2="7.5" y2="18.5" stroke="currentColor" stroke-width="1.5" />
<line x1="4" y1="7.5" x2="4" y2="12.5" stroke="currentColor" stroke-width="1.5"
stroke-linecap="round" />
</svg>
</div>
@ -34,14 +34,14 @@
<div class="menu_item sidebar-toggle-item" @click="uiStore.toggleSidebar">
<div class="menu_item-box">
<div class="menu_icon">
<svg class="icon" viewBox="0 0 20 20" width="20" height="20" fill="none"
<svg class="icon icon--toggle" viewBox="0 0 20 20" width="16" height="16" fill="none"
xmlns="http://www.w3.org/2000/svg">
<rect x="1.5" y="1.5" width="17" height="17" rx="3" stroke="currentColor"
stroke-width="1.2" />
<line x1="7.5" y1="1.5" x2="7.5" y2="18.5" stroke="currentColor" stroke-width="1.2" />
<line x1="5" y1="10" x2="3" y2="8" stroke="currentColor" stroke-width="1.2"
stroke-width="1.5" />
<line x1="7.5" y1="1.5" x2="7.5" y2="18.5" stroke="currentColor" stroke-width="1.5" />
<line x1="5" y1="10" x2="3" y2="8" stroke="currentColor" stroke-width="1.5"
stroke-linecap="round" />
<line x1="5" y1="10" x2="3" y2="12" stroke="currentColor" stroke-width="1.2"
<line x1="5" y1="10" x2="3" y2="12" stroke="currentColor" stroke-width="1.5"
stroke-linecap="round" />
</svg>
</div>
@ -85,7 +85,7 @@
@mouseleave="mouseleaveMenu(item.path)" :data-guide="`nav-${item.path}`"
:class="['menu_item', item.childrenPath && item.childrenPath == currentpath ? 'menu_item_c_active' : isMenuItemActive(item.path) ? 'menu_item_active' : '']">
<div class="menu_item-box">
<div class="menu_icon">
<div class="menu_icon" :class="`menu_icon--${item.icon}`">
<img class="icon"
:src="getImgSrc(item.icon == 'zhishiku' ? knowledgeIcon : item.icon == 'agent' ? agentIcon : item.icon == 'artifact' ? artifactIcon : item.icon == 'toolbox' ? toolboxIcon : item.icon == 'organization' ? organizationIcon : item.icon == 'logout' ? logoutIcon : item.icon == 'setting' ? settingIcon : prefixIcon)"
alt="">
@ -1253,16 +1253,16 @@ const resizeSidebar = (delta: number, keyboard: boolean) => {
<style lang="less" scoped>
.aside_box {
// 侧栏水平栅格:图标列与文案列统一对齐(Logo / 菜单 / 会话分组 / 会话行)
--sidebar-inset-x: 14px;
--sidebar-inset-x: 10px;
--sidebar-icon-size: 18px;
--sidebar-channel-icon: 14px;
--sidebar-icon-gap: 8px;
--sidebar-text-inset: calc(var(--sidebar-inset-x) + var(--sidebar-icon-size) + var(--sidebar-icon-gap)); // 40px
--sidebar-text-inset: calc(var(--sidebar-inset-x) + var(--sidebar-icon-size) + var(--sidebar-icon-gap)); // 36px
min-width: 0;
width: var(--sidebar-width, 260px);
flex-shrink: 0;
padding: 8px 6px 6px;
padding: 8px 4px 6px;
background: var(--td-bg-color-sidebar);
box-sizing: border-box;
/* Avoid 100vh because <html> carries a `zoom` multiplier for font-size
@ -1287,15 +1287,23 @@ const resizeSidebar = (delta: number, keyboard: boolean) => {
transition: none;
}
&--collapsed {
min-width: 60px;
width: 60px;
padding: 8px 3px 6px;
&.aside_box--collapsed {
min-width: 48px;
width: 48px;
padding: 8px 0;
overflow: visible;
.menu_box {
align-items: center;
}
.menu_item {
justify-content: center;
padding: 7px 0;
width: 32px;
height: 32px;
padding: 0;
margin: 0 auto 6px;
border-radius: var(--app-radius-sm);
.menu_item-box {
justify-content: center;
@ -1304,9 +1312,14 @@ const resizeSidebar = (delta: number, keyboard: boolean) => {
.menu_icon {
margin-right: 0;
justify-content: center;
}
}
.menu_item_active {
border-radius: var(--app-radius-sm);
}
.menu_bottom {
align-items: center;
}
@ -1321,17 +1334,19 @@ const resizeSidebar = (delta: number, keyboard: boolean) => {
display: flex;
align-items: center;
justify-content: space-between;
height: 50px;
// 抵消 .aside_box 顶部内边距,使行中线与主区 .chat-header 标题中线(距顶 19.5px)齐平
height: 39px;
margin: -8px 0 4px;
flex-shrink: 0;
padding: 0 10px 0 var(--sidebar-inset-x);
padding: 0 2px 0 var(--sidebar-inset-x);
}
.sidebar-toggle {
display: flex;
align-items: center;
justify-content: center;
width: 18px;
height: 18px;
width: 28px;
height: 28px;
flex-shrink: 0;
cursor: pointer;
color: var(--td-text-color-secondary);
@ -1353,7 +1368,7 @@ const resizeSidebar = (delta: number, keyboard: boolean) => {
overflow: hidden;
.logo {
width: 128px;
width: 108px;
height: auto;
}
@ -1462,7 +1477,7 @@ const resizeSidebar = (delta: number, keyboard: boolean) => {
align-items: center;
justify-content: space-between;
height: 34px;
padding: 6px 10px 6px var(--sidebar-inset-x);
padding: 6px 8px 6px var(--sidebar-inset-x);
box-sizing: border-box;
margin-bottom: 1px;
border-radius: var(--app-radius-xs);
@ -1486,8 +1501,11 @@ const resizeSidebar = (delta: number, keyboard: boolean) => {
.menu_icon {
display: flex;
align-items: center;
justify-content: center;
flex: 0 0 var(--sidebar-icon-size);
width: var(--sidebar-icon-size);
height: var(--sidebar-icon-size);
margin-right: var(--sidebar-icon-gap);
color: var(--td-text-color-secondary);
@ -1496,6 +1514,14 @@ const resizeSidebar = (delta: number, keyboard: boolean) => {
height: 18px;
overflow: hidden;
}
// 图形几乎占满画布的图标缩小显示,否则会比其他图标大一圈
&.menu_icon--zhishiku .icon,
&.menu_icon--organization .icon,
.icon.icon--toggle {
width: 16px;
height: 16px;
}
}
.menu_title {
@ -1504,7 +1530,7 @@ const resizeSidebar = (delta: number, keyboard: boolean) => {
font-family: var(--app-font-family);
font-size: var(--app-text-base);
font-style: normal;
font-weight: 600;
font-weight: 500;
line-height: 20px;
overflow: hidden;
white-space: nowrap;
@ -1554,7 +1580,7 @@ const resizeSidebar = (delta: number, keyboard: boolean) => {
display: flex;
align-items: center;
gap: var(--sidebar-icon-gap);
padding: 0 10px 0 var(--sidebar-inset-x);
padding: 0 8px 0 var(--sidebar-inset-x);
min-width: 0;
box-sizing: border-box;
}
@ -1611,11 +1637,11 @@ const resizeSidebar = (delta: number, keyboard: boolean) => {
.session-list-scope-header {
position: absolute;
top: 4px;
right: 10px;
right: 8px;
z-index: 2;
display: flex;
justify-content: flex-end;
max-width: calc(100% - var(--sidebar-inset-x) - 10px);
max-width: calc(100% - var(--sidebar-inset-x) - 8px);
:deep(.session-source-filter--inline) {
flex: 0 1 auto;
@ -1639,9 +1665,13 @@ const resizeSidebar = (delta: number, keyboard: boolean) => {
min-width: 0;
overflow: hidden;
&.session-chat-row {
margin-bottom: 1px;
}
&.session-chat-row .session-list-row {
min-height: 30px;
padding-right: 6px;
height: 34px;
padding-right: 4px;
border-radius: var(--app-radius-sm);
transition: background var(--app-motion-fast) ease, color var(--app-motion-fast) ease;
}
@ -1687,7 +1717,7 @@ const resizeSidebar = (delta: number, keyboard: boolean) => {
line-height: 20px;
height: 100%;
width: 100%;
padding: 6px 0;
padding: 0;
position: relative;
min-width: 0;
background: transparent;
@ -1787,7 +1817,7 @@ const resizeSidebar = (delta: number, keyboard: boolean) => {
.logo_actions {
display: flex;
align-items: center;
gap: 4px;
gap: 2px;
flex-shrink: 0;
}
@ -1795,8 +1825,8 @@ const resizeSidebar = (delta: number, keyboard: boolean) => {
display: flex;
align-items: center;
justify-content: center;
width: 26px;
height: 26px;
width: 28px;
height: 28px;
flex-shrink: 0;
cursor: pointer;
border-radius: var(--app-radius-sm);

View File

@ -7381,7 +7381,7 @@ export default {
statusFailed: '실패',
statusCancelled: '취소됨',
statusDraft: '초안',
noDescription: '설명 없음',
noDescription: '아직 설명이 없습니다',
emptyKnowledgeDragDrop: '지식이 비어 있음, 드래그 앤 드롭으로 업로드',
pdfDocFormat: 'pdf, doc 형식 파일, 최대 {size}MB',
textMarkdownFormat: 'text, markdown 형식 파일, 최대 {size}MB',

View File

@ -7383,7 +7383,7 @@ export default {
statusFailed: '失败',
statusCancelled: '已取消',
statusDraft: '草稿',
noDescription: '无描述',
noDescription: '暂无描述',
emptyKnowledgeDragDrop: '知识为空,拖放上传',
pdfDocFormat: 'pdf、doc 格式文件,不超过{size}M',
textMarkdownFormat: 'text、markdown格式文件,不超过{size}M',

View File

@ -7383,7 +7383,7 @@ export default {
statusFailed: '失敗',
statusCancelled: '已取消',
statusDraft: '草稿',
noDescription: '無描述',
noDescription: '暫無描述',
emptyKnowledgeDragDrop: '知識為空,拖放上傳',
pdfDocFormat: 'pdf、doc 格式檔案,不超過{size}M',
textMarkdownFormat: 'text、markdown格式檔案,不超過{size}M',

View File

@ -2,6 +2,7 @@ import assert from 'node:assert/strict'
import test from 'node:test'
import { createPinia, setActivePinia } from 'pinia'
import { useUIStore } from './ui.ts'
import { SIDEBAR_COLLAPSED_WIDTH } from '../utils/sidebarWidth.ts'
test('sidebar drag bounds, collapse, button restore, and saved width stay consistent', () => {
const originalStorage = Object.getOwnPropertyDescriptor(globalThis, 'localStorage')
@ -24,7 +25,7 @@ test('sidebar drag bounds, collapse, button restore, and saved width stay consis
ui.resizeSidebar(270)
ui.resizeSidebar(179)
assert.equal(ui.sidebarCollapsed, true)
assert.equal(ui.sidebarDisplayWidth, 60)
assert.equal(ui.sidebarDisplayWidth, SIDEBAR_COLLAPSED_WIDTH)
ui.toggleSidebar()
assert.equal(ui.sidebarDisplayWidth, 270, 'collapse keeps the last expanded width')
ui.collapseSidebar()

View File

@ -1,7 +1,7 @@
export const SIDEBAR_DEFAULT_WIDTH = 260
export const SIDEBAR_MIN_WIDTH = 220
export const SIDEBAR_MAX_WIDTH = 280
export const SIDEBAR_COLLAPSED_WIDTH = 60
export const SIDEBAR_COLLAPSED_WIDTH = 48
export const SIDEBAR_COLLAPSE_THRESHOLD = 180
export function clampSidebarWidth(width: number): number {

View File

@ -228,7 +228,7 @@
</t-popup>
</div>
<div class="card-content">
<div class="card-description" :title="agent.description || $t('agent.noDescription')">
<div class="card-description" :class="{ 'is-empty': !agent.description }" :title="agent.description || $t('agent.noDescription')">
{{ agent.description || $t('agent.noDescription') }}</div>
</div>
<div class="card-bottom">
@ -400,7 +400,7 @@
<!-- 卡片内容 -->
<div class="card-content">
<div class="card-description" :title="agent.description || $t('agent.noDescription')">
<div class="card-description" :class="{ 'is-empty': !agent.description }" :title="agent.description || $t('agent.noDescription')">
{{ agent.description || $t('agent.noDescription') }}
</div>
</div>
@ -539,7 +539,7 @@
</t-popup>
</div>
<div class="card-content">
<div class="card-description" :title="shared.agent?.description || $t('agent.noDescription')">
<div class="card-description" :class="{ 'is-empty': !shared.agent?.description }" :title="shared.agent?.description || $t('agent.noDescription')">
{{ shared.agent?.description || $t('agent.noDescription') }}</div>
</div>
<div class="card-bottom">
@ -1737,62 +1737,16 @@ watch(keyword, () => { collapsedAgentSections.value = new Set() })
gap: 8px;
}
// 底色统一浅灰,仅图标着色;同一能力在三个列表页使用同一颜色
.feature-badge {
.resource-feature-badge();
&.mode-normal {
background: color-mix(in srgb, var(--td-brand-color) 8%, transparent);
color: var(--td-brand-color-active);
&:hover {
background: color-mix(in srgb, var(--td-brand-color) 12%, transparent);
}
}
&.mode-agent {
background: color-mix(in srgb, var(--app-accent-purple) 8%, transparent);
color: var(--td-brand-color);
&:hover {
background: color-mix(in srgb, var(--app-accent-purple) 12%, transparent);
}
}
&.web-search {
background: color-mix(in srgb, var(--td-warning-color) 8%, transparent);
color: var(--td-warning-color);
&:hover {
background: color-mix(in srgb, var(--td-warning-color) 12%, transparent);
}
}
&.knowledge {
background: var(--td-bg-color-secondarycontainer);
color: var(--td-text-color-secondary);
&:hover {
background: var(--td-bg-color-container-hover);
}
}
&.mcp {
background: color-mix(in srgb, var(--td-error-color) 8%, transparent);
color: var(--td-error-color);
&:hover {
background: color-mix(in srgb, var(--td-error-color) 12%, transparent);
}
}
&.multi-turn {
background: color-mix(in srgb, var(--td-brand-color) 8%, transparent);
color: var(--td-brand-color);
&:hover {
background: color-mix(in srgb, var(--td-brand-color) 12%, transparent);
}
}
&.mode-normal,
&.multi-turn { color: var(--app-accent-blue); }
&.mode-agent { color: var(--app-accent-purple); }
&.web-search { color: var(--td-warning-color); }
&.knowledge { color: var(--td-brand-color); }
&.mcp { color: var(--app-accent-teal); }
}
// 删除确认对话框样式

View File

@ -467,17 +467,9 @@ onBeforeUnmount(() => {
<style scoped lang="less">
@import '@/components/css/artifact-filter-tabs.less';
@import (reference) '@/components/css/resource-card.less';
.artifact-library {
flex: 1;
min-width: 0;
height: 100%;
box-sizing: border-box;
display: flex;
flex-direction: column;
margin: 0 16px 0 0;
padding: 20px 28px 0;
}
.artifact-library { .resource-list-content(); }
.header {
display: flex;
@ -523,13 +515,16 @@ onBeforeUnmount(() => {
border-bottom: 1px solid var(--td-component-stroke);
}
// 与右侧 32px 的搜索框同高:3px 内边距 × 2 + 26px 按钮
.category-tabs {
.artifact-filter-tabs();
button { display: inline-flex; align-items: center; height: 26px; padding: 0 12px; }
}
.search-input {
width: 260px;
max-width: 100%;
:deep(.t-input) { border-radius: var(--app-radius-sm); }
}
.library-main {

View File

@ -165,8 +165,8 @@
</button>
<!-- 卡片头部 -->
<div class="card-header">
<KbTypeAvatar :type="kb.type" />
<span class="card-title" :title="kb.name">
<KbWikiBadge v-if="isWikiKb(kb)" />
<span class="card-title-text">{{ kb.name }}</span>
</span>
<!-- The card menu always exists when the card is visible: pin
@ -206,7 +206,7 @@
<!-- 卡片内容 -->
<div class="card-content">
<div class="card-description" :title="kb.description || $t('knowledgeBase.noDescription')">
<div class="card-description" :class="{ 'is-empty': !kb.description }" :title="kb.description || $t('knowledgeBase.noDescription')">
{{ kb.description || $t('knowledgeBase.noDescription') }}
</div>
</div>
@ -226,6 +226,9 @@
<t-icon v-if="kb.isProcessing" name="loading" size="12px" class="processing-icon" />
</div>
</t-tooltip>
<div v-if="isWikiKb(kb)" class="feature-badge wiki">
<KbWikiBadge />
</div>
<t-tooltip v-if="kb.extract_config?.enabled" :content="$t('knowledgeList.features.knowledgeGraph')"
placement="top">
<div class="feature-badge kg">
@ -269,8 +272,8 @@
</button>
<!-- 卡片头部 -->
<div class="card-header">
<KbTypeAvatar :type="kb.type" />
<span class="card-title" :title="kb.name">
<KbWikiBadge v-if="isWikiKb(kb)" />
<span class="card-title-text">{{ kb.name }}</span>
</span>
<t-tooltip :content="$t('knowledgeList.menu.viewDetails')" placement="top">
@ -283,7 +286,7 @@
<!-- 卡片内容 -->
<div class="card-content">
<div class="card-description" :title="kb.description || $t('knowledgeBase.noDescription')">
<div class="card-description" :class="{ 'is-empty': !kb.description }" :title="kb.description || $t('knowledgeBase.noDescription')">
{{ kb.description || $t('knowledgeBase.noDescription') }}
</div>
</div>
@ -303,6 +306,9 @@
}}</span>
</div>
</t-tooltip>
<div v-if="isWikiKb(kb)" class="feature-badge wiki">
<KbWikiBadge />
</div>
<t-tooltip v-if="kb.extract_config?.enabled" :content="$t('knowledgeList.features.knowledgeGraph')"
placement="top">
<div class="feature-badge kg">
@ -398,8 +404,8 @@
</button>
<!-- 卡片头部 -->
<div class="card-header">
<KbTypeAvatar :type="kb.type" />
<span class="card-title" :title="kb.name">
<KbWikiBadge v-if="isWikiKb(kb)" />
<span class="card-title-text">{{ kb.name }}</span>
</span>
<!-- See the matching block in the "all" tab template for why
@ -437,7 +443,7 @@
<!-- 卡片内容 -->
<div class="card-content">
<div class="card-description" :title="kb.description || $t('knowledgeBase.noDescription')">
<div class="card-description" :class="{ 'is-empty': !kb.description }" :title="kb.description || $t('knowledgeBase.noDescription')">
{{ kb.description || $t('knowledgeBase.noDescription') }}
</div>
</div>
@ -457,6 +463,9 @@
<t-icon v-if="kb.isProcessing" name="loading" size="12px" class="processing-icon" />
</div>
</t-tooltip>
<div v-if="isWikiKb(kb)" class="feature-badge wiki">
<KbWikiBadge />
</div>
<t-tooltip v-if="kb.extract_config?.enabled" :content="$t('knowledgeList.features.knowledgeGraph')"
placement="top">
<div class="feature-badge kg">
@ -549,8 +558,8 @@
}" role="link" tabindex="0" @keydown.enter.self.prevent="handleSharedKbClick(shared)" @keydown.space.self.prevent="handleSharedKbClick(shared)" @click="handleSharedKbClick(shared)">
<!-- 卡片头部 -->
<div class="card-header">
<KbTypeAvatar :type="shared.knowledge_base.type" />
<span class="card-title" :title="shared.knowledge_base.name">
<KbWikiBadge v-if="isWikiKb(shared.knowledge_base)" />
<span class="card-title-text">{{ shared.knowledge_base.name }}</span>
</span>
<t-tooltip v-if="!shared.is_mine" :content="$t('knowledgeList.menu.viewDetails')" placement="top">
@ -563,7 +572,7 @@
<!-- 卡片内容 -->
<div class="card-content">
<div class="card-description" :title="shared.knowledge_base.description || $t('knowledgeBase.noDescription')">
<div class="card-description" :class="{ 'is-empty': !shared.knowledge_base.description }" :title="shared.knowledge_base.description || $t('knowledgeBase.noDescription')">
{{ shared.knowledge_base.description || $t('knowledgeBase.noDescription') }}
</div>
</div>
@ -584,6 +593,9 @@
'-') : (shared.knowledge_base.knowledge_count ?? '-') }}</span>
</div>
</t-tooltip>
<div v-if="isWikiKb(shared.knowledge_base)" class="feature-badge wiki">
<KbWikiBadge />
</div>
</div>
</div>
</div>
@ -724,6 +736,7 @@ import { listOrganizationSharedKnowledgeBases, type SharedKnowledgeBase, type Or
import { mergeAllScopeKnowledgeBases, type OwnedKnowledgeBase, type SharedKnowledgeBaseLike } from './kbListMerge'
import KnowledgeBaseEditorModal from './KnowledgeBaseEditorModal.vue'
import KbWikiBadge from './components/KbWikiBadge.vue'
import KbTypeAvatar from './components/KbTypeAvatar.vue'
import ResourceListToolbar from '@/components/ResourceListToolbar.vue'
import { matchesResourceQuery } from '@/utils/resourceListSearch'
import ResourceOriginBadge from '@/components/ResourceOriginBadge.vue'
@ -1809,40 +1822,15 @@ watch(keyword, () => { collapsedKbSections.value = new Set() })
}
}
&.kg {
background: color-mix(in srgb, var(--app-accent-purple) 8%, transparent);
color: var(--td-brand-color);
&.kg { color: var(--app-accent-purple); }
&.multimodal { color: var(--td-warning-color); }
&.question { color: var(--app-accent-blue); }
&.shared { color: var(--td-brand-color); }
&.wiki :deep(.kb-wiki-badge) { color: var(--app-accent-teal); }
&:hover {
background: color-mix(in srgb, var(--app-accent-purple) 12%, transparent);
}
}
&.multimodal {
background: color-mix(in srgb, var(--td-warning-color) 8%, transparent);
color: var(--td-warning-color);
&:hover {
background: color-mix(in srgb, var(--td-warning-color) 12%, transparent);
}
}
&.question {
background: color-mix(in srgb, var(--td-success-color) 8%, transparent);
color: var(--td-success-color);
&:hover {
background: color-mix(in srgb, var(--td-success-color) 12%, transparent);
}
}
&.shared {
background: color-mix(in srgb, var(--td-brand-color) 8%, transparent);
color: var(--td-brand-color);
&:hover {
background: color-mix(in srgb, var(--td-brand-color) 12%, transparent);
}
:deep(.kb-wiki-badge svg) {
width: 14px;
height: 14px;
}
&.role-admin {

View File

@ -0,0 +1,34 @@
<template>
<span class="kb-type-avatar" :class="isFaq ? 'is-faq' : 'is-document'" aria-hidden="true">
<t-icon :name="isFaq ? 'chat-bubble-help' : 'folder'" size="16px" />
</span>
</template>
<script setup lang="ts">
import { computed } from 'vue'
const props = defineProps<{ type?: string }>()
const isFaq = computed(() => props.type === 'faq')
</script>
<style scoped lang="less">
.kb-type-avatar {
display: flex;
align-items: center;
justify-content: center;
flex-shrink: 0;
width: 28px;
height: 28px;
border-radius: var(--app-radius-md);
&.is-document {
background: linear-gradient(135deg, color-mix(in srgb, var(--td-brand-color) 15%, transparent) 0%, color-mix(in srgb, var(--td-brand-color) 8%, transparent) 100%);
color: var(--td-brand-color-active);
}
&.is-faq {
background: linear-gradient(135deg, color-mix(in srgb, var(--weknora-faq-color, #0052d9) 15%, transparent) 0%, color-mix(in srgb, var(--weknora-faq-color, #0052d9) 8%, transparent) 100%);
color: var(--weknora-faq-color, #0052d9);
}
}
</style>

View File

@ -6520,6 +6520,8 @@ span.graph-focus-name {
}
.graph-unlinked-toggle {
margin: 0;
padding: 0;
border: 0;
background: transparent;
font: inherit;

View File

@ -123,7 +123,7 @@
<!-- 卡片内容 -->
<div class="card-content">
<div class="card-description" :title="org.description || $t('organization.noDescription')">
<div class="card-description" :class="{ 'is-empty': !org.description }" :title="org.description || $t('organization.noDescription')">
{{ org.description || $t('organization.noDescription') }}
</div>
</div>
@ -1249,47 +1249,14 @@ watch(keyword, () => { collapsedOrgSections.value = new Set() })
line-height: 1;
}
&.stat-member {
background: color-mix(in srgb, var(--td-text-color-secondary) 8%, transparent);
color: var(--td-text-color-secondary);
&.stat-kb .t-icon { color: var(--td-brand-color); }
.t-icon {
color: var(--td-text-color-secondary);
}
&:hover {
background: color-mix(in srgb, var(--td-text-color-secondary) 12%, transparent);
}
}
&.stat-kb {
background: var(--td-bg-color-secondarycontainer);
color: var(--td-text-color-secondary);
.t-icon {
color: var(--td-text-color-secondary);
}
&:hover {
background: var(--td-bg-color-container-hover);
}
}
&.stat-agent {
background: color-mix(in srgb, var(--app-accent-purple) 8%, transparent);
color: var(--td-brand-color);
.stat-agent-icon {
width: 14px;
height: 14px;
flex-shrink: 0;
/* 将绿色 icon 着色为紫色,与标签统一 */
filter: brightness(0) saturate(100%) invert(48%) sepia(79%) saturate(2476%) hue-rotate(236deg);
}
&:hover {
background: color-mix(in srgb, var(--app-accent-purple) 12%, transparent);
}
.stat-agent-icon {
width: 14px;
height: 14px;
flex-shrink: 0;
/* 将绿色 icon 着色为紫色,与智能体能力色一致 */
filter: brightness(0) saturate(100%) invert(48%) sepia(79%) saturate(2476%) hue-rotate(236deg);
}
}

View File

@ -12,10 +12,12 @@
</div>
<template v-else>
<t-input v-if="services.length > 0" v-model="query" class="list-search" :placeholder="$t('menu.search')"
:aria-label="$t('menu.search')" clearable>
<template #prefix-icon><t-icon name="search" size="16px" /></template>
</t-input>
<Teleport to="#toolbox-toolbar" defer>
<t-input v-if="services.length > 0" v-model="query" class="list-search" :placeholder="$t('menu.search')"
:aria-label="$t('menu.search')" clearable>
<template #prefix-icon><t-icon name="search" size="16px" /></template>
</t-input>
</Teleport>
<div v-if="services.length === 0 && !authStore.hasRole('admin')" class="empty-state">
<t-empty :description="$t('mcpSettings.empty')" />
</div>
@ -272,10 +274,6 @@ defineExpose({ openAdd: handleAdd })
.settings-section-header();
}
.list-search {
margin-bottom: 20px;
}
.loading-container {
padding: 40px 0;
text-align: center;
@ -307,8 +305,14 @@ defineExpose({ openAdd: handleAdd })
padding: 0;
overflow: hidden;
border: 1px solid var(--td-component-stroke);
border-radius: var(--app-radius-lg);
border-radius: var(--app-radius-md);
background: var(--td-bg-color-container);
transition: border-color 0.18s ease, box-shadow 0.18s ease;
&:hover:not(.service-card--add) {
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);
}
&--add {
align-items: center;
@ -365,7 +369,7 @@ defineExpose({ openAdd: handleAdd })
}
.service-card__badge {
.provider-card-badge(26px, 7px);
.provider-card-badge(28px, 8px);
font-size: var(--app-text-md);
:deep(.t-icon) {

View File

@ -24,10 +24,12 @@
</div>
<template v-else>
<t-input v-if="catalog.length > 0" v-model="query" class="list-search" :placeholder="$t('menu.search')"
:aria-label="$t('menu.search')" clearable>
<template #prefix-icon><t-icon name="search" size="16px" /></template>
</t-input>
<Teleport to="#toolbox-toolbar" defer>
<t-input v-if="catalog.length > 0" v-model="query" class="list-search" :placeholder="$t('menu.search')"
:aria-label="$t('menu.search')" clearable>
<template #prefix-icon><t-icon name="search" size="16px" /></template>
</t-input>
</Teleport>
<div v-if="catalog.length === 0" class="empty-state">
<t-empty :description="skillText('emptyDesc')" />
<p v-if="skillConfigs.length === 0" class="empty-hint">
@ -758,8 +760,8 @@ function installChipStatus(item: SkillCatalogItem, inst: SkillCatalogInstall): s
}
function installChipStatusIcon(item: SkillCatalogItem, inst: SkillCatalogInstall): string {
if (inst.status === 'failed') return 'close-circle'
if (inst.status === 'ready' && inst.enabled && installOutdated(item, inst)) return 'error-circle'
if (inst.status === 'failed') return 'close-circle-filled'
if (inst.status === 'ready' && inst.enabled && installOutdated(item, inst)) return 'error-circle-filled'
if (inst.status === 'ready' && inst.enabled) return 'check-circle-filled'
return ''
}
@ -1326,10 +1328,6 @@ onUnmounted(() => {
@import (reference) '@/components/css/settings-section.less';
.list-search {
margin-bottom: 20px;
}
.skill-settings {
width: 100%;
}
@ -1384,7 +1382,7 @@ onUnmounted(() => {
:global(.skill-install-panel-overlay .t-popup__content) {
padding: 0 !important;
border-radius: var(--app-radius-sm) !important;
border-radius: var(--app-radius-md) !important;
border: 1px solid var(--td-component-stroke) !important;
background: var(--td-bg-color-container) !important;
box-shadow: var(--td-shadow-2) !important;
@ -1432,12 +1430,17 @@ onUnmounted(() => {
padding: 0;
overflow: hidden;
border: 1px solid var(--td-component-stroke);
border-radius: var(--app-radius-lg);
border-radius: var(--app-radius-md);
background: var(--td-bg-color-container);
transition: border-color 0.18s ease, box-shadow 0.18s ease;
min-width: 0;
height: 100%;
&:hover:not(.skill-card--add, .skill-card--focused) {
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);
}
&--focused {
border-color: var(--td-brand-color);
box-shadow: 0 0 0 2px var(--td-brand-color-focus);
@ -1505,7 +1508,7 @@ onUnmounted(() => {
}
.skill-card__badge {
.provider-card-badge(26px, 7px);
.provider-card-badge(28px, 8px);
font-size: var(--app-text-md);
:deep(.t-icon) {
@ -1684,8 +1687,18 @@ onUnmounted(() => {
color: var(--td-success-color);
}
// 异常状态只用前置圆点着色,避免整排卡片铺满红黄底色
&.skill-card__entry--stale::before,
&.skill-card__entry--failed::before {
content: '';
flex-shrink: 0;
width: 6px;
height: 6px;
border-radius: 50%;
}
&.skill-card__entry--stale {
background: color-mix(in srgb, var(--td-warning-color) 10%, transparent);
&::before { background: var(--td-warning-color); }
.skill-card__entry-status {
color: var(--td-warning-color);
@ -1693,7 +1706,7 @@ onUnmounted(() => {
}
&.skill-card__entry--failed {
background: color-mix(in srgb, var(--td-error-color) 10%, transparent);
&::before { background: var(--td-error-color); }
.skill-card__entry-status {
color: var(--td-error-color);
@ -1750,14 +1763,15 @@ onUnmounted(() => {
max-width: calc(100vw - 32px);
max-height: min(360px, 70vh);
overflow-y: auto;
padding: 4px 0;
padding: 4px;
box-sizing: border-box;
}
.skill-install-panel__group {
margin: 0;
padding: 6px 12px 4px;
font-size: var(--app-text-sm);
line-height: 20px;
padding: 6px 8px 2px;
font-size: var(--app-text-xs);
line-height: 18px;
color: var(--td-text-color-placeholder);
}
@ -1767,10 +1781,10 @@ onUnmounted(() => {
gap: 8px;
width: 100%;
height: 32px;
margin: 0;
padding: 0 12px;
margin: 0 0 2px;
padding: 0 8px;
border: 0;
border-radius: 0;
border-radius: var(--app-radius-sm);
background: none;
color: var(--td-text-color-primary);
cursor: pointer;
@ -1815,16 +1829,23 @@ onUnmounted(() => {
.skill-install-panel__add {
flex-shrink: 0;
color: var(--td-text-color-placeholder);
color: var(--td-brand-color);
opacity: 0;
transition: opacity var(--app-motion-fast) ease;
}
.skill-install-panel__item--available:hover .skill-install-panel__add {
color: var(--td-brand-color);
.skill-install-panel__item--available:hover .skill-install-panel__add,
.skill-install-panel__item--available:focus-visible .skill-install-panel__add {
opacity: 1;
}
.skill-install-panel__item--available:hover {
color: var(--td-text-color-primary);
}
.skill-install-panel__split {
height: 1px;
margin: 4px 0;
margin: 4px -4px;
background: var(--td-component-stroke);
}

View File

@ -22,19 +22,23 @@
</header>
<template v-if="visibleItems.length">
<div class="toolbox-tabs" role="tablist" :aria-label="t('toolbox.title')">
<button v-for="item in visibleItems" :key="item.key" type="button" role="tab" class="toolbox-tab"
:aria-selected="selectedItem?.key === item.key" @click="select(item.key)">
<BrowserIcon v-if="item.key === 'browserconnection'" width="18" height="18" />
<t-icon v-else :name="item.icon" size="18px" />
<span>{{ t(item.title) }}</span>
<span v-if="item.key === 'browserconnection' && browserStatus" class="toolbox-tab-status"
:class="`is-${browserStatus}`">
<i aria-hidden="true" />{{ t(`localBrowser.${browserStatus}`) }}
</span>
<span v-else-if="item.key !== 'browserconnection' && counts[item.key] !== undefined"
class="toolbox-tab-count">{{ counts[item.key] }}</span>
</button>
<div class="toolbox-tabbar">
<div class="toolbox-tabs" role="tablist" :aria-label="t('toolbox.title')">
<button v-for="item in visibleItems" :key="item.key" type="button" role="tab" class="toolbox-tab"
:aria-selected="selectedItem?.key === item.key" @click="select(item.key)">
<BrowserIcon v-if="item.key === 'browserconnection'" width="16" height="16" />
<t-icon v-else :name="item.icon" size="16px" />
<span>{{ t(item.title) }}</span>
<span v-if="item.key === 'browserconnection' && browserStatus" class="toolbox-tab-status"
:class="`is-${browserStatus}`">
<i aria-hidden="true" />{{ t(`localBrowser.${browserStatus}`) }}
</span>
<span v-else-if="item.key !== 'browserconnection' && counts[item.key] !== undefined"
class="toolbox-tab-count">{{ counts[item.key] }}</span>
</button>
</div>
<!-- 面板通过 Teleport 把搜索框放到标签栏右侧 -->
<div id="toolbox-toolbar" class="toolbox-toolbar" />
</div>
<section v-if="selectedItem" class="toolbox-main" role="tabpanel">
@ -123,15 +127,10 @@ watch(() => visibleItems.value.map((item) => item.key), (keys, previous = []) =>
</script>
<style scoped lang="less">
@import (reference) '@/components/css/resource-card.less';
.toolbox-page {
flex: 1;
min-width: 0;
height: 100%;
box-sizing: border-box;
display: flex;
flex-direction: column;
margin: 0 16px 0 0;
padding: 20px 28px 0;
.resource-list-content();
color: var(--td-text-color-primary);
}
@ -170,6 +169,7 @@ watch(() => visibleItems.value.map((item) => item.key), (keys, previous = []) =>
border-radius: var(--app-radius-sm);
background: var(--td-bg-color-container);
color: var(--td-text-color-primary);
font-size: var(--app-text-md);
transition: background var(--app-motion-base);
&:hover:not(:disabled) {
@ -208,28 +208,50 @@ watch(() => visibleItems.value.map((item) => item.key), (keys, previous = []) =>
}
}
.toolbox-tabs {
.toolbox-tabbar {
flex-shrink: 0;
display: flex;
gap: 32px;
overflow-x: auto;
align-items: center;
gap: 16px;
border-bottom: 1px solid var(--td-component-stroke);
}
.toolbox-tabs {
flex: 1;
min-width: 0;
display: flex;
gap: 24px;
overflow-x: auto;
scrollbar-width: none;
}
.toolbox-toolbar {
flex-shrink: 0;
display: flex;
align-items: center;
:deep(.t-input__wrap) {
width: 240px;
}
:deep(.t-input) {
border-radius: var(--app-radius-sm);
}
}
.toolbox-tab {
position: relative;
flex-shrink: 0;
display: inline-flex;
align-items: center;
gap: 8px;
height: 48px;
gap: 6px;
height: 44px;
padding: 0 2px;
border: 0;
background: transparent;
color: var(--td-text-color-secondary);
font: inherit;
font-size: var(--app-text-lg);
font-size: var(--app-text-base);
font-weight: 500;
cursor: pointer;
transition: color var(--app-motion-fast) ease;
@ -318,7 +340,7 @@ watch(() => visibleItems.value.map((item) => item.key), (keys, previous = []) =>
min-height: 0;
overflow-y: auto;
overflow-x: hidden;
padding: var(--app-space-5) 0 var(--app-space-8);
padding: var(--app-space-4) 0 var(--app-space-8);
}
.toolbox-panel {
@ -330,13 +352,26 @@ watch(() => visibleItems.value.map((item) => item.key), (keys, previous = []) =>
}
@media (max-width: 768px) {
.toolbox-page {
margin: 0;
padding: 16px 16px 0;
.toolbox-tabbar {
flex-wrap: wrap;
}
.toolbox-tabs {
flex-basis: 100%;
gap: 20px;
}
.toolbox-toolbar {
width: 100%;
padding: 8px 0;
&:empty {
display: none;
}
:deep(.t-input__wrap) {
width: 100%;
}
}
}
</style>