Open-source LLM knowledge platform: turn raw documents into a queryable RAG, an autonomous reasoning agent, and a self-maintaining Wiki.
Go agentagenticaichatbotdsh-pluginembeddingsevaluationgenerative-aigolangknowledge-basellmmulti-tenantollamaopenaiquestion-answeringragrerankingsemantic-searchvector-searchwiki
ui(chat): refine the question outline to a tighter Codex-like rail
wizardchen29b8fa3d9a1c
diff --git a/frontend/src/components/chat/ChatQuestionMinimap.test.ts b/frontend/src/components/chat/ChatQuestionMinimap.test.tsindex 8598941f6..bbda23aa1 100644--- a/frontend/src/components/chat/ChatQuestionMinimap.test.ts+++ b/frontend/src/components/chat/ChatQuestionMinimap.test.ts@@ -9,11 +9,12 @@ test('does not render the rail until the thread overflows', () => {assert.match(component, /v-if="visible"/)})-test('opens a following Q&A card to the right of the left-side rail', () => {+test('opens a following preview card to the right of the left-side rail', () => {assert.match(component, /question-minimap__panel/)assert.match(component, /question-minimap__bridge/)assert.match(component, /question-minimap__question/)assert.match(component, /question-minimap__answer/)+ assert.doesNotMatch(component, /question-minimap__kicker/)assert.match(component, /CLOSE_DELAY_MS = 150/)assert.match(component, /left: `\$\{RAIL_INSET_PX\}px`/)assert.match(component, /top: `\$\{peakYPx\}px`/)@@ -22,19 +23,19 @@ test('opens a following Q&A card to the right of the left-side rail', () => {})test('grows nearby ticks into a mountain under the pointer', () => {- assert.match(component, /tickMountainScale/)+ assert.match(component, /tickDisplayScale/)assert.match(component, /nearestTickId/)assert.match(component, /scaleX\(/)assert.match(component, /handleRailPointerMove/)})-test('centers the rail and panel in the thread instead of stretching top to bottom', () => {+test('centers the rail in the thread instead of stretching top to bottom', () => {assert.match(component, /top: 50%/)assert.match(component, /transform: translateY\(-50%\)/)+ assert.match(component, /RAIL_INSET_PX = 0/)assert.match(component, /height: `\$\{trackHeight\}px`/)assert.doesNotMatch(component, /inset-block: 0/)assert.doesNotMatch(component, /align-self: flex-start/)- assert.doesNotMatch(component, /height: min\(360px, 50%\)/)assert.match(composable, /questionMinimapTrackHeight\(measured\.length, el\.clientHeight\)/)})@@ -47,7 +48,9 @@ test('uses chat question minimap i18n keys', () => {assert.match(component, /chat\.questionMinimapTitle/)assert.match(component, /chat\.questionMinimapAriaLabel/)assert.match(component, /chat\.questionMinimapAttachmentPlaceholder/)- assert.match(component, /chat\.questionMinimapAnswerPending/)+ assert.doesNotMatch(component, /questionMinimapQuestionLabel/)+ assert.doesNotMatch(component, /questionMinimapAnswerLabel/)+ assert.doesNotMatch(component, /questionMinimapAnswerPending/)})test('wraps the overlay in navigation without overriding the rail button role', () => {@@ -63,7 +66,7 @@ test('keeps scroll-driven active question changes from clobbering keyboard navigtest('does not draw a second scrollbar thumb next to the native scrollbar', () => {assert.doesNotMatch(component, /question-minimap__viewport/)- assert.match(component, /RAIL_INSET_PX = 16/)+ assert.match(component, /RAIL_INSET_PX = 0/)assert.match(component, /scrollbar-width: none/)})@@ -78,9 +81,14 @@ test('highlights the matching tick for the peaked question', () => {assert.match(component, /tick\.id === peakId/)})+test('keeps the preview card at 13px instead of inheriting the chat 20px type', () => {+ assert.match(component, /font-size: 13px/)+ assert.doesNotMatch(component, /font: inherit/)+ assert.match(component, /--td-text-color-primary/)+})+test('uses only approved TDesign tokens in minimap styles', () => {assert.doesNotMatch(component, /--td-brand-color-light/)assert.doesNotMatch(component, /--td-border-level-2-color/)assert.doesNotMatch(component, /--td-shadow-2/)- assert.doesNotMatch(component, /--td-text-color-primary/)})diff --git a/frontend/src/components/chat/ChatQuestionMinimap.vue b/frontend/src/components/chat/ChatQuestionMinimap.vueindex 1d927563f..20d0ec432 100644--- a/frontend/src/components/chat/ChatQuestionMinimap.vue+++ b/frontend/src/components/chat/ChatQuestionMinimap.vue@@ -26,7 +26,7 @@:class="{ 'question-minimap__tick--active': tick.id === peakId }":style="{top: `${tick.yPx}px`,- transform: `translateY(-50%) scaleX(${tickMountainScale(tick.yPx, mountainPointerY)})`,+ transform: `translateY(-50%) scaleX(${tickDisplayScale(tick.yPx, mountainPointerY, tick.id === peakId)})`,}"/></button>@@ -48,7 +48,7 @@<p class="question-minimap__question" :title="questionText(peakTurn)">{{ questionText(peakTurn) }}</p>- <p class="question-minimap__answer">+ <p v-if="answerText(peakTurn)" class="question-minimap__answer">{{ answerText(peakTurn) }}</p></section>@@ -63,13 +63,13 @@ import {answerPreviewText,nearestTickId,questionDisplayText,- tickMountainScale,+ tickDisplayScale,type ChatMessageLike,type UserQuestion,} from '@/utils/chatQuestionMinimap'const CLOSE_DELAY_MS = 150-const RAIL_INSET_PX = 16+const RAIL_INSET_PX = 0const props = defineProps<{scrollContainer: HTMLElement | null@@ -109,7 +109,7 @@ const peakId = computed(() => {if (keyboardIndex.value >= 0) {return questions.value[keyboardIndex.value]?.id ?? null}- return hoveredId.value+ return hoveredId.value ?? activeId.value})const peakTurn = computed(() => (questions.value.find((question) => question.id === peakId.value) ?? null@@ -130,7 +130,7 @@ const questionText = (question: UserQuestion) => ()const answerText = (question: UserQuestion) => (- answerPreviewText(question.answerContent, t('chat.questionMinimapAnswerPending'))+ answerPreviewText(question.answerContent))const clearCloseTimer = () => {@@ -296,6 +296,8 @@ onBeforeUnmount(() => {align-items: stretch;transform: translateY(-50%);pointer-events: none;+ font-size: 13px;+ line-height: 1.45;}.question-minimap__rail,@@ -306,9 +308,10 @@ onBeforeUnmount(() => {.question-minimap__rail {position: relative;- width: 28px;+ width: 24px;height: 100%;padding: 0;+ overflow: visible;border: 0;background: transparent;cursor: pointer;@@ -321,12 +324,12 @@ onBeforeUnmount(() => {.question-minimap__tick {position: absolute;- left: 2px;+ left: 0;width: 8px;height: 2px;border-radius: 1px;background: var(--td-text-color-secondary);- opacity: 0.55;+ opacity: 0.4;transform: translateY(-50%);transform-origin: left center;transition: transform 120ms ease-out, background 120ms ease-out, opacity 120ms ease-out;@@ -334,7 +337,7 @@ onBeforeUnmount(() => {.question-minimap__tick--active {background: var(--td-brand-color);- opacity: 1;+ opacity: 0.85;}.question-minimap__bridge {@@ -343,16 +346,16 @@ onBeforeUnmount(() => {.question-minimap__panel {position: absolute;- left: 36px;- width: 240px;- max-height: min(360px, 50vh);- padding: 8px 10px;+ left: 20px;+ width: 220px;+ max-height: min(280px, 40vh);+ padding: 6px 8px;overflow: hidden;scrollbar-width: none;border: 1px solid var(--td-component-stroke);- border-radius: 8px;+ border-radius: 6px;background: var(--td-bg-color-container);- box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);+ box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);transform: translateY(-50%);cursor: pointer;}@@ -364,13 +367,15 @@ onBeforeUnmount(() => {.question-minimap__question,.question-minimap__answer {margin: 0;- color: var(--td-text-color-secondary);- font: inherit;+ font-size: 13px;+ font-weight: 400;+ line-height: 1.45;}.question-minimap__question {overflow: hidden;- font-weight: 600;+ color: var(--td-text-color-primary);+ font-weight: 500;text-overflow: ellipsis;white-space: nowrap;}@@ -379,9 +384,10 @@ onBeforeUnmount(() => {display: -webkit-box;margin-top: 4px;overflow: hidden;+ color: var(--td-text-color-secondary);-webkit-box-orient: vertical;-webkit-line-clamp: 3;- opacity: 0.75;+ opacity: 0.8;}@media (prefers-reduced-motion: reduce) {diff --git a/frontend/src/i18n/locales/en-US.ts b/frontend/src/i18n/locales/en-US.tsindex 903aeae27..2359970d0 100755--- a/frontend/src/i18n/locales/en-US.ts+++ b/frontend/src/i18n/locales/en-US.ts@@ -3247,10 +3247,9 @@ export default {referencesDrawerDocsSection: 'Documents',referencesDrawerToolsSection: 'Tools',referencesDrawerEmpty: 'No sources available',- questionMinimapTitle: 'Questions',+ questionMinimapTitle: 'Q&A',questionMinimapAriaLabel: 'Question outline',questionMinimapAttachmentPlaceholder: '(Attachment)',- questionMinimapAnswerPending: 'Generating',referenceChunkCount: '{count} chunk(s)',fallbackHint: 'No relevant content found in knowledge base. Above is a direct response from the model.',requestInfoTitle: 'Request info',diff --git a/frontend/src/i18n/locales/ko-KR.ts b/frontend/src/i18n/locales/ko-KR.tsindex f65773c0a..e7048babf 100755--- a/frontend/src/i18n/locales/ko-KR.ts+++ b/frontend/src/i18n/locales/ko-KR.ts@@ -3255,7 +3255,6 @@ export default {questionMinimapTitle: '질문',questionMinimapAriaLabel: '질문 목차',questionMinimapAttachmentPlaceholder: '(첨부)',- questionMinimapAnswerPending: '생성 중',referenceChunkCount: '{count}개 청크',fallbackHint: '지식 베이스에서 관련 내용을 찾지 못했습니다. 위는 모델의 직접 응답입니다.',requestInfoTitle: 'Request info',diff --git a/frontend/src/i18n/locales/ru-RU.ts b/frontend/src/i18n/locales/ru-RU.tsindex 804c5e5b5..646fc2622 100755--- a/frontend/src/i18n/locales/ru-RU.ts+++ b/frontend/src/i18n/locales/ru-RU.ts@@ -3255,7 +3255,6 @@ export default {questionMinimapTitle: 'Вопросы',questionMinimapAriaLabel: 'Содержание вопросов',questionMinimapAttachmentPlaceholder: '(Вложение)',- questionMinimapAnswerPending: 'Генерация',referenceChunkCount: '{count} фрагмент(ов)',fallbackHint: 'В базе знаний не найдено релевантного содержимого. Выше представлен прямой ответ модели.',requestInfoTitle: 'Request info',diff --git a/frontend/src/i18n/locales/zh-CN.ts b/frontend/src/i18n/locales/zh-CN.tsindex b6ae506f0..6e5fe145a 100755--- a/frontend/src/i18n/locales/zh-CN.ts+++ b/frontend/src/i18n/locales/zh-CN.ts@@ -3254,10 +3254,9 @@ export default {referencesDrawerDocsSection: '知识库文档',referencesDrawerToolsSection: '工具',referencesDrawerEmpty: '暂无参考来源',- questionMinimapTitle: '提问',+ questionMinimapTitle: '问答',questionMinimapAriaLabel: '提问目录',questionMinimapAttachmentPlaceholder: '(附件)',- questionMinimapAnswerPending: '生成中',referenceChunkCount: '{count}个片段',fallbackHint: '未从知识库中检索到相关内容,以上为模型直接回答',requestInfoTitle: '请求信息',diff --git a/frontend/src/utils/chatQuestionMinimap.test.ts b/frontend/src/utils/chatQuestionMinimap.test.tsindex 57a3326de..2f89cccb4 100644--- a/frontend/src/utils/chatQuestionMinimap.test.ts+++ b/frontend/src/utils/chatQuestionMinimap.test.ts@@ -5,7 +5,9 @@ import {ACTIVE_QUESTION_TOP_OFFSET_PX,QUESTION_MINIMAP_TRACK_MAX_PX,QUESTION_TICK_GAP_PX,+ QUESTION_TICK_INSET_PX,QUESTION_TICK_MOUNTAIN_GAIN,+ CURRENT_TICK_SCALE,activeQuestionId,answerPreviewText,collectUserQuestions,@@ -16,6 +18,7 @@ import {questionDisplayText,questionMinimapTrackHeight,shouldShowQuestionMinimap,+ tickDisplayScale,tickMountainScale,viewportBand,} from './chatQuestionMinimap.ts'@@ -27,8 +30,8 @@ test('isChatOverflowing is false when content fits or matches the viewport', ()})test('questionMinimapTrackHeight packs ticks with a small gap instead of filling the rail', () => {- assert.equal(questionMinimapTrackHeight(1, 800), QUESTION_TICK_GAP_PX)- assert.equal(questionMinimapTrackHeight(3, 800), 2 * QUESTION_TICK_GAP_PX)+ assert.equal(questionMinimapTrackHeight(1, 800), QUESTION_TICK_INSET_PX * 2)+ assert.equal(questionMinimapTrackHeight(3, 800), 2 * QUESTION_TICK_GAP_PX + 2 * QUESTION_TICK_INSET_PX)assert.equal(questionMinimapTrackHeight(0, 800), 0)assert.equal(questionMinimapTrackHeight(3, 0), 0)})@@ -38,8 +41,9 @@ test('questionMinimapTrackHeight still caps a long cluster to the centered rail'assert.equal(questionMinimapTrackHeight(100, 400), 200)})-test('shouldShowQuestionMinimap requires overflow and at least one question', () => {- assert.equal(shouldShowQuestionMinimap(true, 1), true)+test('shouldShowQuestionMinimap requires overflow and at least two questions', () => {+ assert.equal(shouldShowQuestionMinimap(true, 1), false)+ assert.equal(shouldShowQuestionMinimap(true, 2), true)assert.equal(shouldShowQuestionMinimap(true, 0), false)assert.equal(shouldShowQuestionMinimap(false, 4), false)})@@ -61,20 +65,26 @@ test('collectUserQuestions keeps loaded user turns with ids, in list order', ())})-test('answerPreviewText strips markdown and uses the pending placeholder when empty', () => {+test('answerPreviewText strips markdown and stays empty when there is no answer yet', () => {assert.equal(- answerPreviewText('## Hello\n**world** and [link](https://x)', '生成中'),+ answerPreviewText('## Hello\n**world** and [link](https://x)'),'Hello world and link',)- assert.equal(answerPreviewText(' ', '生成中'), '生成中')- assert.equal(answerPreviewText(undefined, '生成中'), '生成中')+ assert.equal(answerPreviewText(' '), '')+ assert.equal(answerPreviewText(undefined), '')})test('tickMountainScale is 1 without a pointer and peaks at the hovered tick', () => {assert.equal(tickMountainScale(100, null), 1)assert.equal(tickMountainScale(100, 100), 1 + QUESTION_TICK_MOUNTAIN_GAIN)- assert.ok(tickMountainScale(100, 100) > tickMountainScale(135, 100))- assert.ok(tickMountainScale(135, 100) > tickMountainScale(200, 100))+ assert.ok(tickMountainScale(100, 100) > tickMountainScale(108, 100))+ assert.ok(tickMountainScale(108, 100) > tickMountainScale(200, 100))+})++test('tickDisplayScale lengthens the current tick at rest and follows the pointer when hovering', () => {+ assert.equal(tickDisplayScale(100, null, false), 1)+ assert.equal(tickDisplayScale(100, null, true), CURRENT_TICK_SCALE)+ assert.equal(tickDisplayScale(100, 100, false), 1 + QUESTION_TICK_MOUNTAIN_GAIN)})test('nearestTickId picks the closest tick to the pointer', () => {diff --git a/frontend/src/utils/chatQuestionMinimap.ts b/frontend/src/utils/chatQuestionMinimap.tsindex fbc93ce48..fd6e667d8 100644--- a/frontend/src/utils/chatQuestionMinimap.ts+++ b/frontend/src/utils/chatQuestionMinimap.ts@@ -1,6 +1,7 @@-export const QUESTION_TICK_RADIUS_PX = 3-export const QUESTION_TICK_GAP_PX = 35-export const QUESTION_TICK_MOUNTAIN_GAIN = 2.2+export const QUESTION_TICK_INSET_PX = 8+export const QUESTION_TICK_GAP_PX = 8+export const QUESTION_TICK_MOUNTAIN_GAIN = 1.5+export const CURRENT_TICK_SCALE = 1.7export const ACTIVE_QUESTION_TOP_OFFSET_PX = 72export const VIEWPORT_BAND_MIN_HEIGHT_PX = 16export const QUESTION_MINIMAP_TRACK_MAX_PX = 360@@ -16,8 +17,8 @@ export function questionMinimapTrackHeight(clientHeight * QUESTION_MINIMAP_TRACK_RATIO,)const naturalHeight = questionCount === 1- ? QUESTION_TICK_GAP_PX- : (questionCount - 1) * QUESTION_TICK_GAP_PX+ ? QUESTION_TICK_INSET_PX * 2+ : (questionCount - 1) * QUESTION_TICK_GAP_PX + QUESTION_TICK_INSET_PX * 2return Math.min(naturalHeight, maxHeight)}@@ -52,7 +53,7 @@ export function isChatOverflowing(scrollHeight: number, clientHeight: number): b}export function shouldShowQuestionMinimap(overflowing: boolean, questionCount: number): boolean {- return overflowing && questionCount >= 1+ return overflowing && questionCount >= 2}export function collectUserQuestions(messages: ChatMessageLike[]): UserQuestion[] {@@ -92,10 +93,7 @@ export function questionDisplayText(return normalized.length > 0 ? normalized : attachmentPlaceholder}-export function answerPreviewText(- content: string | undefined,- pendingPlaceholder: string,-): string {+export function answerPreviewText(content: string | undefined): string {const normalized = (content ?? '').replace(/```[\s\S]*?```/g, ' ').replace(/`([^`]+)`/g, '$1')@@ -103,7 +101,7 @@ export function answerPreviewText(.replace(/[#>*_~-]+/g, ' ').replace(/\s+/g, ' ').trim()- return normalized.length > 0 ? normalized : pendingPlaceholder+ return normalized}export function tickMountainScale(tickY: number, pointerY: number | null): number {@@ -113,6 +111,15 @@ export function tickMountainScale(tickY: number, pointerY: number | null): numbereturn 1 + QUESTION_TICK_MOUNTAIN_GAIN * Math.exp(-0.5 * (dy / sigma) ** 2)}+export function tickDisplayScale(+ tickY: number,+ pointerY: number | null,+ isCurrent: boolean,+): number {+ if (pointerY !== null) return tickMountainScale(tickY, pointerY)+ return isCurrent ? CURRENT_TICK_SCALE : 1+}+export function nearestTickId(ticks: Array<{ id: string; yPx: number }>,pointerY: number,@@ -157,7 +164,7 @@ export function mapQuestionTicks(}const preferredSpan = (n - 1) * QUESTION_TICK_GAP_PX- const minY = Math.min(QUESTION_TICK_RADIUS_PX, trackHeight / 2)+ const minY = Math.min(QUESTION_TICK_INSET_PX, trackHeight / 2)const maxY = Math.max(minY, trackHeight - minY)const available = maxY - minYconst span = preferredSpan <= trackHeight ? preferredSpan : available