fix(chat): 修复思考块图标旋转与长文本换行

This commit is contained in:
XianYuDaXian committed 2026-03-24 22:22:22 +08:00
1 parent 0255eedd17
commit bb6739a59e
2 files changed
+41 -13

No files matched your search

+31 -5
View File
@@ -681,12 +681,17 @@ body {
}
.think-block[data-thinking="true"] .think-summary::before {
animation: thinkSpinSlow 5.5s linear infinite;
animation: thinkSpinSlow 2.2s linear infinite;
animation-delay: var(--think-spin-delay, 0s);
}
.think-block[data-thinking="true"] .think-agent summary::before {
animation: thinkSpinSlow 5.5s linear infinite;
.think-block[data-thinking="true"] .think-agent-avatar {
animation: thinkSpinSlow 2.2s linear infinite;
animation-delay: var(--think-spin-delay, 0s);
}
.think-block[data-thinking="true"] .think-rollout-title::before {
animation: thinkSpinSlow 2.2s linear infinite;
animation-delay: var(--think-spin-delay, 0s);
}
@@ -716,6 +721,8 @@ body {
font-size: 12px;
color: var(--accents-5);
line-height: 1.6;
overflow-wrap: anywhere;
word-break: break-word;
max-height: 0;
opacity: 0;
overflow: hidden;
@@ -844,8 +851,7 @@ body {
max-width: 100%;
}
.think-agent summary::before {
content: "";
.think-agent-avatar {
width: 20px;
height: 20px;
display: inline-flex;
@@ -858,6 +864,12 @@ body {
box-shadow: 0 2px 8px rgba(17, 17, 17, 0.15);
}
.think-agent-label {
display: inline-flex;
align-items: center;
min-width: 0;
}
.think-agent summary::after {
content: "";
width: 6px;
@@ -974,6 +986,9 @@ body {
display: flex;
flex-direction: column;
gap: 10px;
min-width: 0;
overflow-wrap: anywhere;
word-break: break-word;
}
.think-item-row {
@@ -1024,6 +1039,17 @@ body {
font-size: 12px;
color: var(--accents-5);
line-height: 1.6;
min-width: 0;
overflow-wrap: anywhere;
word-break: break-word;
}
.think-item-body code,
.think-rollout-body code,
.think-content code {
white-space: pre-wrap;
overflow-wrap: anywhere;
word-break: break-word;
}
html[data-theme='dark'] .think-agent {
+10 -8
View File
@@ -1141,6 +1141,10 @@
if (!sections.length) {
return renderBasicMarkdown(text);
}
const renderThinkAgentSummary = (title) => {
const safeTitle = escapeHtml(title);
return `<summary><span class="think-agent-avatar" aria-hidden="true"></span><span class="think-agent-label">${safeTitle}</span></summary>`;
};
const renderGroups = (blocks, openAllGroups) => {
const groups = [];
const map = new Map();
@@ -1175,9 +1179,8 @@
if (synthetic.length) {
return synthetic.map((agent, agentIdx) => {
const inner = renderFlatBlocks(agent.blocks);
const title = escapeHtml(agent.title);
const openAttr = openAll ? ' open' : (idx === 0 && agentIdx === 0 ? ' open' : '');
return `<details class="think-agent"${openAttr}><summary>${title}</summary><div class="think-agent-items">${inner}</div></details>`;
return `<details class="think-agent"${openAttr}>${renderThinkAgentSummary(agent.title)}<div class="think-agent-items">${inner}</div></details>`;
}).join('');
}
}
@@ -1187,9 +1190,8 @@
if (!section.title) {
return `<div class="think-agent-items">${inner}</div>`;
}
const title = escapeHtml(section.title);
const openAttr = openAll ? ' open' : (idx === 0 ? ' open' : '');
return `<details class="think-agent"${openAttr}><summary>${title}</summary><div class="think-agent-items">${inner}</div></details>`;
return `<details class="think-agent"${openAttr}>${renderThinkAgentSummary(section.title)}<div class="think-agent-items">${inner}</div></details>`;
});
return `<div class="think-agents">${agentBlocks.join('')}</div>`;
}
@@ -1617,14 +1619,14 @@
if (!entry.thinkingActive) {
block.removeAttribute('data-thinking');
node.style.removeProperty('--think-spin-delay');
block.querySelectorAll('.think-agent summary').forEach((summary) => {
summary.style.removeProperty('--think-spin-delay');
block.querySelectorAll('.think-agent-avatar').forEach((avatar) => {
avatar.style.removeProperty('--think-spin-delay');
});
} else {
block.setAttribute('data-thinking', 'true');
node.style.setProperty('--think-spin-delay', spinOffset);
block.querySelectorAll('.think-agent summary').forEach((summary) => {
summary.style.setProperty('--think-spin-delay', spinOffset);
block.querySelectorAll('.think-agent-avatar').forEach((avatar) => {
avatar.style.setProperty('--think-spin-delay', spinOffset);
});
}
});