# 在 .tool-calls-block 前插入 .tool-running-indicator 样式 OLD_CSS = ".tool-calls-block {" NEW_CSS = ( "/* 工具执行中实时动画指示器 */\n" ".tool-running-indicator {\n" " display: flex; align-items: center; gap: 8px;\n" " padding: 8px 12px; font-size: 13px; color: var(--text-2);\n" " border-left: 3px solid var(--primary); background: rgba(79,142,247,0.04);\n" " border-radius: 0 8px 8px 0; animation: toolFadeIn 0.3s ease;\n" "}\n" ".tool-running-indicator .tool-step-action { color: var(--text-2); font-size: 12px; }\n" ".tool-running-dots { display: inline-flex; gap: 2px; margin-left: 4px; }\n" ".tool-running-dots span {\n" " display: inline-block; width: 4px; height: 4px; border-radius: 50%;\n" " background: var(--primary); animation: toolDotBounce 1.2s infinite ease-in-out;\n" "}\n" ".tool-running-dots span:nth-child(2) { animation-delay: 0.2s; }\n" ".tool-running-dots span:nth-child(3) { animation-delay: 0.4s; }\n" "@keyframes toolDotBounce { 0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; } 40% { transform: scale(1); opacity: 1; } }\n" ".tool-calls-block {" ) with open('/opt/bookworm-web/public/index.html', 'r', encoding='utf-8') as f: content = f.read() assert content.count(OLD_CSS) == 1, f'OLD_CSS count: {content.count(OLD_CSS)}' content = content.replace(OLD_CSS, NEW_CSS, 1) with open('/opt/bookworm-web/public/index.html', 'w', encoding='utf-8') as f: f.write(content) print('CSS patch applied OK')