refactor(knowledge): tighten chunk popup layout

main
wizardchen 2026-07-28 15:09:41 +08:00 committed by lyingbug
parent 378523c497
commit c3bb3ff822
5 changed files with 77 additions and 80 deletions

View File

@ -1698,9 +1698,6 @@ const handleDetailsScroll = () => {
<div class="chunk-heading">
<span class="chunk-index">{{ $t('knowledgeBase.segment') }} {{ index + 1 }}</span>
<span class="chunk-meta">{{ chunk.meta }}</span>
<t-tag v-if="chunk.hasParent" size="small" theme="default" variant="light">
{{ $t('knowledgeBase.childChunk') }}
</t-tag>
</div>
<div class="chunk-header-right">
<t-tooltip v-if="chunk.original.index_status === 'failed' && canEditContent"
@ -1743,12 +1740,7 @@ const handleDetailsScroll = () => {
<t-button class="icon-action-btn chunk-question-entry"
:class="{ 'is-active': questionPopupChunk === chunk.original.id }" size="small" variant="text"
shape="square" :title="$t('knowledgeBase.generatedQuestions')">
<template #icon>
<span class="chunk-question-entry-icon">
<t-icon name="help-circle" size="15px" />
<span v-if="chunk.questions.length" class="chunk-question-entry-count">{{ chunk.questions.length }}</span>
</span>
</template>
<template #icon><t-icon name="help-circle" size="15px" /></template>
</t-button>
<template #content>
<div class="chunk-questions-popup" @click.stop>
@ -1775,6 +1767,21 @@ const handleDetailsScroll = () => {
</div>
</div>
<div class="chunk-questions-popup-body">
<div v-if="canEditContent && questionComposerChunk === chunk.original.id" class="question-composer">
<t-input v-model="questionDrafts[chunk.original.id]" autofocus
:placeholder="$t('knowledgeBase.addGeneratedQuestion')" @enter="addQuestion(chunk.original)" />
<t-tooltip :content="$t('common.cancel')" placement="top">
<t-button class="icon-action-btn" size="small" variant="text" shape="square"
:disabled="savingQuestionChunk === chunk.original.id"
@click="closeQuestionComposer(chunk.original)">
<template #icon><t-icon name="close" size="14px" /></template>
</t-button>
</t-tooltip>
<t-button size="small" theme="primary" :loading="savingQuestionChunk === chunk.original.id"
:disabled="!(questionDrafts[chunk.original.id] || '').trim()" @click="addQuestion(chunk.original)">
{{ $t('common.add') }}
</t-button>
</div>
<div v-if="chunk.questions.length" class="questions-list">
<div v-for="question in chunk.questions" :key="question.id" class="question-item">
<span class="question-leading-icon"><t-icon name="help-circle" size="14px" /></span>
@ -1811,22 +1818,6 @@ const handleDetailsScroll = () => {
<div v-else-if="questionComposerChunk !== chunk.original.id" class="questions-empty">
<t-icon name="chat-bubble-help" size="20px" />
<span>{{ $t('knowledgeBase.noGeneratedQuestions') }}</span>
<t-button v-if="canEditContent" size="small" variant="text"
@click="openQuestionComposer(chunk.original)">
<template #icon><t-icon name="add" size="14px" /></template>
{{ $t('common.add') }}
</t-button>
</div>
<div v-if="canEditContent && questionComposerChunk === chunk.original.id" class="question-composer">
<div class="question-composer-icon"><t-icon name="add" size="15px" /></div>
<t-input v-model="questionDrafts[chunk.original.id]" autofocus
:placeholder="$t('knowledgeBase.addGeneratedQuestion')" @enter="addQuestion(chunk.original)" />
<t-button size="small" variant="text" :disabled="savingQuestionChunk === chunk.original.id"
@click="closeQuestionComposer(chunk.original)">{{ $t('common.cancel') }}</t-button>
<t-button size="small" theme="primary" :loading="savingQuestionChunk === chunk.original.id"
:disabled="!(questionDrafts[chunk.original.id] || '').trim()" @click="addQuestion(chunk.original)">
{{ $t('common.add') }}
</t-button>
</div>
</div>
</div>
@ -1899,6 +1890,14 @@ const handleDetailsScroll = () => {
</t-button>
</t-popconfirm>
</div>
<div class="chunk-history-diff-legend">
<span class="chunk-history-diff-legend-item chunk-history-diff-legend-item--add">
<i />{{ $t('knowledgeBase.diffAddedInCurrent') }}
</span>
<span class="chunk-history-diff-legend-item chunk-history-diff-legend-item--del">
<i />{{ $t('knowledgeBase.diffRemovedFromCurrent') }}
</span>
</div>
<div v-if="!compactChunkDiff(chunk.original).length" class="chunk-history-no-diff">
{{ $t('knowledgeBase.noContentChanges') }}
</div>
@ -2615,7 +2614,7 @@ const handleDetailsScroll = () => {
}
.chunk-history-popup-head {
padding: 12px 14px 10px;
padding: 8px 12px 7px;
border-bottom: 1px solid var(--td-component-stroke);
}
@ -2629,7 +2628,7 @@ const handleDetailsScroll = () => {
}
.chunk-history-current {
margin-top: 4px;
margin-top: 2px;
color: var(--td-text-color-placeholder);
font-size: 11px;
}
@ -2724,6 +2723,35 @@ const handleDetailsScroll = () => {
font-size: 11px;
}
.chunk-history-diff-legend {
display: flex;
align-items: center;
gap: 12px;
margin: 0 0 6px;
color: var(--td-text-color-placeholder);
font-size: 10px;
}
.chunk-history-diff-legend-item {
display: inline-flex;
align-items: center;
gap: 4px;
i {
width: 7px;
height: 7px;
border-radius: 2px;
}
&--add i {
background: var(--td-success-color);
}
&--del i {
background: var(--td-error-color);
}
}
.chunk-history-no-diff {
padding: 12px;
border-radius: 4px;
@ -2772,34 +2800,6 @@ const handleDetailsScroll = () => {
}
}
.chunk-question-entry {
overflow: visible;
}
.chunk-question-entry-icon {
position: relative;
display: inline-flex;
align-items: center;
justify-content: center;
}
.chunk-question-entry-count {
position: absolute;
top: -8px;
right: -9px;
min-width: 14px;
height: 14px;
padding: 0 3px;
border: 1px solid var(--td-bg-color-container);
border-radius: 999px;
color: var(--td-text-color-anti);
background: var(--td-brand-color);
font-size: 9px;
font-weight: 600;
line-height: 12px;
text-align: center;
}
.chunk-context-popup,
.chunk-questions-popup {
width: min(520px, calc(100vw - 32px));
@ -2819,8 +2819,8 @@ const handleDetailsScroll = () => {
.chunk-popup-head {
justify-content: space-between;
min-height: 46px;
padding: 8px 12px 8px 14px;
min-height: 38px;
padding: 4px 8px 4px 12px;
border-bottom: 1px solid var(--td-component-stroke);
}
@ -2859,7 +2859,7 @@ const handleDetailsScroll = () => {
.chunk-questions-popup-body {
max-height: min(480px, calc(100vh - 170px));
padding: 0 10px 10px;
padding: 0 10px 8px;
overflow-y: auto;
}
@ -2872,20 +2872,20 @@ const handleDetailsScroll = () => {
}
.questions-list {
padding-top: 4px;
padding-top: 0;
}
.question-item {
align-items: flex-start;
align-items: center;
gap: 8px;
min-height: 38px;
padding: 8px 6px;
min-height: 34px;
padding: 5px 6px;
border-bottom: 1px solid var(--td-component-stroke);
border-radius: 4px;
background: transparent;
font-size: 13px;
color: var(--td-text-color-primary);
line-height: 1.5;
line-height: 20px;
&:hover {
background: var(--td-bg-color-container-hover);
@ -2897,6 +2897,7 @@ const handleDetailsScroll = () => {
.question-text {
flex: 1;
line-height: 20px;
word-break: break-word;
}
@ -2915,8 +2916,7 @@ const handleDetailsScroll = () => {
align-items: center;
justify-content: center;
width: 18px;
height: 24px;
margin-top: -1px;
height: 20px;
color: var(--td-text-color-secondary);
flex-shrink: 0;
}
@ -2934,7 +2934,7 @@ const handleDetailsScroll = () => {
}
.question-inline-editor {
align-items: flex-start;
align-items: center;
gap: 6px;
flex: 1;
}
@ -2946,32 +2946,21 @@ const handleDetailsScroll = () => {
.questions-empty {
justify-content: center;
gap: 8px;
padding: 18px 8px 8px;
padding: 20px 8px 12px;
color: var(--td-text-color-placeholder);
font-size: 12px;
}
.question-composer {
gap: 6px;
padding-top: 10px;
padding: 8px 4px;
border-bottom: 1px solid var(--td-component-stroke);
}
.question-composer :deep(.t-input) {
flex: 1;
}
.question-composer-icon {
display: flex;
align-items: center;
justify-content: center;
width: 26px;
height: 26px;
border-radius: 4px;
color: var(--td-text-color-secondary);
background: var(--td-bg-color-container-hover);
flex-shrink: 0;
}
// 音频播放器样式
.audio-player-section {
margin-bottom: 16px;

View File

@ -554,6 +554,8 @@ export default {
currentVersion: 'Current version',
noChunkHistory: 'No edit history',
compareRevisionWithCurrent: 'Content changes from v{revision} to current v{current}',
diffAddedInCurrent: 'Added in current',
diffRemovedFromCurrent: 'Removed from current',
noContentChanges: 'No content changes; this revision only changed status',
revertRevision: 'Revert revision',
revertRevisionConfirm: 'Revert to v{revision}? A new revision will be created.',

View File

@ -564,6 +564,8 @@ export default {
currentVersion: "현재 버전",
noChunkHistory: "편집 기록 없음",
compareRevisionWithCurrent: "v{revision}과 현재 v{current}의 내용 차이",
diffAddedInCurrent: "현재 버전에 추가됨",
diffRemovedFromCurrent: "현재 버전에서 삭제됨",
noContentChanges: "내용 변경이 없으며 상태만 변경된 버전입니다",
revertRevision: "버전 되돌리기",
revertRevisionConfirm: "v{revision}(으)로 되돌리시겠습니까? 새 버전이 생성됩니다.",

View File

@ -489,6 +489,8 @@ export default {
currentVersion: 'Текущая версия',
noChunkHistory: 'История изменений пуста',
compareRevisionWithCurrent: 'Изменения содержимого от v{revision} до текущей v{current}',
diffAddedInCurrent: 'Добавлено в текущей версии',
diffRemovedFromCurrent: 'Удалено в текущей версии',
noContentChanges: 'Содержимое не изменилось; версия содержит только смену статуса',
revertRevision: 'Откатить версию',
revertRevisionConfirm: 'Откатить к v{revision}? Будет создана новая версия.',

View File

@ -553,6 +553,8 @@ export default {
currentVersion: "当前版本",
noChunkHistory: "暂无编辑历史",
compareRevisionWithCurrent: "v{revision} 与当前 v{current} 的内容差异",
diffAddedInCurrent: "当前版本新增",
diffRemovedFromCurrent: "当前版本删除",
noContentChanges: "内容没有变化,该版本仅包含状态变更",
revertRevision: "回滚版本",
revertRevisionConfirm: "确定回滚到 v{revision} 吗?回滚后会生成一个新版本。",