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
feat(chat): pulse the artifact folder when generated files arrive
wizardchen4d66d57fe7e7
diff --git a/frontend/src/components/css/chat-message-shared.less b/frontend/src/components/css/chat-message-shared.lessindex f4d1b3143..f6efcd8ca 100644--- a/frontend/src/components/css/chat-message-shared.less+++ b/frontend/src/components/css/chat-message-shared.less@@ -95,6 +95,10 @@flex-shrink: 0;}+.answer-toolbar__artifact.is-arrived {+ animation: artifact-toolbar-arrive 0.7s cubic-bezier(0.22, 1.2, 0.36, 1);+}+.answer-toolbar__artifact.is-collecting .t-button {color: var(--td-text-color-placeholder);cursor: wait;@@ -114,6 +118,20 @@}}+@keyframes artifact-toolbar-arrive {+ 0% {+ transform: scale(0.82);+ }++ 55% {+ transform: scale(1.12);+ }++ 100% {+ transform: scale(1);+ }+}+.answer-toolbar__artifact-count {position: absolute;top: -2px;@@ -127,8 +145,8 @@height: 14px;padding: 0 3px;border-radius: 7px;- background: var(--td-bg-color-secondarycontainer);- color: var(--td-text-color-secondary);+ background: var(--td-brand-color);+ color: var(--td-text-color-anti);font-size: 10px;font-weight: 600;line-height: 1;@@ -136,6 +154,33 @@pointer-events: none;}+.answer-toolbar__artifact.is-arrived .answer-toolbar__artifact-count {+ animation: artifact-count-arrive 0.7s cubic-bezier(0.22, 1.4, 0.36, 1);+}++@keyframes artifact-count-arrive {+ 0% {+ transform: scale(0.4);+ opacity: 0;+ }++ 60% {+ transform: scale(1.28);+ opacity: 1;+ }++ 100% {+ transform: scale(1);+ }+}++@media (prefers-reduced-motion: reduce) {+ .answer-toolbar__artifact.is-arrived,+ .answer-toolbar__artifact.is-arrived .answer-toolbar__artifact-count {+ animation: none;+ }+}+.answer-toolbar__follow-up-loading {display: inline-flex;align-items: center;diff --git a/frontend/src/composables/useArtifactArriveMotion.ts b/frontend/src/composables/useArtifactArriveMotion.tsnew file mode 100644index 000000000..16083925b--- /dev/null+++ b/frontend/src/composables/useArtifactArriveMotion.ts@@ -0,0 +1,31 @@+import { nextTick, onMounted, ref, watch, type Ref } from 'vue'++/**+ * One-shot attention motion when generated files first land on a live+ * answer. Historical messages already have artifacts at mount and stay still.+ */+export function useArtifactArriveMotion(artifactCount: Ref<number>) {+ const artifactArrived = ref(false)+ let armed = false++ onMounted(() => {+ requestAnimationFrame(() => {+ armed = true+ })+ })++ watch(artifactCount, (count, previous) => {+ if (!armed || count <= 0 || (previous ?? 0) > 0) return+ artifactArrived.value = false+ nextTick(() => {+ artifactArrived.value = true+ })+ })++ function onArtifactArriveEnd(event?: AnimationEvent) {+ if (event?.animationName && event.animationName !== 'artifact-toolbar-arrive') return+ artifactArrived.value = false+ }++ return { artifactArrived, onArtifactArriveEnd }+}diff --git a/frontend/src/views/chat/components/AgentStreamDisplay.vue b/frontend/src/views/chat/components/AgentStreamDisplay.vueindex 96e87839f..ddd364cd7 100644--- a/frontend/src/views/chat/components/AgentStreamDisplay.vue+++ b/frontend/src/views/chat/components/AgentStreamDisplay.vue@@ -341,7 +341,8 @@mode is the primary path for skills, so this is wherethe button is most likely to appear. --><span v-if="hasArtifacts || artifactsCollecting" class="answer-toolbar__artifact"- :class="{ 'is-collecting': artifactButtonCollecting }">+ :class="{ 'is-collecting': artifactButtonCollecting, 'is-arrived': artifactArrived }"+ @animationend="onArtifactArriveEnd"><t-button size="small" variant="outline" shape="round":disabled="artifactButtonCollecting":title="hasArtifacts ? $t('agent.artifactDrawer.buttonTitle') : $t('agent.artifactDrawer.collecting')"@@ -538,6 +539,7 @@ import ChatCitationFloat from '@/components/ChatCitationFloat.vue';import picturePreview from '@/components/picture-preview.vue';import ChatArtifactsDrawer from './ChatArtifactsDrawer.vue';import { isCollectingSkillArtifacts } from '@/utils/skillArtifacts';+import { useArtifactArriveMotion } from '@/composables/useArtifactArriveMotion';import ChatMemoryStep from './ChatMemoryStep.vue';import { useChatMemoryRow, type UsedMemory } from '@/composables/useChatMemoryRow';import { countGrepDocuments, groupGrepChunkResults } from '@/utils/grepResultsGroup';@@ -948,6 +950,7 @@ const artifactList = computed(() => {});const hasArtifacts = computed(() => artifactList.value.length > 0);const artifactCount = computed(() => artifactList.value.length);+const { artifactArrived, onArtifactArriveEnd } = useArtifactArriveMotion(artifactCount);const artifactsCollecting = computed(() => isCollectingSkillArtifacts(props.session as any));const artifactButtonCollecting = computed(() => artifactsCollecting.value && !hasArtifacts.value);const sessionIdForArtifacts = computed(() => props.sessionId ?? '');diff --git a/frontend/src/views/chat/components/answerToolbarCompletion.test.mjs b/frontend/src/views/chat/components/answerToolbarCompletion.test.mjsindex 3214c34fd..f54cdd493 100644--- a/frontend/src/views/chat/components/answerToolbarCompletion.test.mjs+++ b/frontend/src/views/chat/components/answerToolbarCompletion.test.mjs@@ -30,7 +30,12 @@ test('artifact count is a top-right overlay instead of t-badge', () => {assert.match(agentStream, /class="answer-toolbar__artifact-count"/)assert.match(sharedStyles, /answer-toolbar__artifact-count/)assert.match(sharedStyles, /position: absolute/)- assert.match(sharedStyles, /td-bg-color-secondarycontainer/)+ assert.match(sharedStyles, /td-brand-color/)+ assert.match(sharedStyles, /artifact-toolbar-arrive/)+ assert.match(botMessage, /is-arrived': artifactArrived/)+ assert.match(agentStream, /is-arrived': artifactArrived/)+ assert.match(botMessage, /useArtifactArriveMotion/)+ assert.match(agentStream, /useArtifactArriveMotion/)assert.doesNotMatch(botMessage, /<t-badge/)assert.doesNotMatch(agentStream, /<t-badge/)})diff --git a/frontend/src/views/chat/components/botmsg.vue b/frontend/src/views/chat/components/botmsg.vueindex be4064cf5..a708708df 100644--- a/frontend/src/views/chat/components/botmsg.vue+++ b/frontend/src/views/chat/components/botmsg.vue@@ -57,7 +57,8 @@Emptiness is the default: the button stays hidden forconversational messages that never touched a skill. --><span v-if="hasArtifacts || artifactsCollecting" class="answer-toolbar__artifact"- :class="{ 'is-collecting': artifactButtonCollecting }">+ :class="{ 'is-collecting': artifactButtonCollecting, 'is-arrived': artifactArrived }"+ @animationend="onArtifactArriveEnd"><t-button size="small" variant="outline" shape="round":disabled="artifactButtonCollecting":title="hasArtifacts ? $t('agent.artifactDrawer.buttonTitle') : $t('agent.artifactDrawer.collecting')"@@ -112,6 +113,7 @@ import ChatCitationFloat from '@/components/ChatCitationFloat.vue';import picturePreview from '@/components/picture-preview.vue';import ChatArtifactsDrawer from './ChatArtifactsDrawer.vue';import { isCollectingSkillArtifacts } from '@/utils/skillArtifacts';+import { useArtifactArriveMotion } from '@/composables/useArtifactArriveMotion';import { sanitizeMarkdownHTML, safeMarkdownToHTML, createSafeImage, isValidImageURL, hydrateProtectedFileImages } from '@/utils/security';import {artifactIndexFromEventTarget,@@ -227,6 +229,7 @@ const artifactList = computed(() => {});const hasArtifacts = computed(() => artifactList.value.length > 0);const artifactCount = computed(() => artifactList.value.length);+const { artifactArrived, onArtifactArriveEnd } = useArtifactArriveMotion(artifactCount);const artifactsCollecting = computed(() => isCollectingSkillArtifacts(props.session));const artifactButtonCollecting = computed(() => artifactsCollecting.value && !hasArtifacts.value);const messageIdForArtifacts = computed(() => {