feat: 强制停止AI回复 - 真正中止Ollama接口请求

- ollama-api.js: chatStream 新增 AbortController 参数,同时中止 fetch 和 reader
- input-area.js: 发送按钮流式时变为停止按钮(红色方块),点击立即 abort
- abort 时保留已生成内容,标记 [已停止]
- 停止按钮带脉冲动画,视觉反馈明确
- 真正的接口级别终止:fetch abort + reader.cancel 双重保险
This commit is contained in:
thzxx
2026-04-03 12:31:04 +08:00
parent 6088ea4629
commit f80dd7f390
3 changed files with 101 additions and 9 deletions
+16
View File
@@ -827,6 +827,22 @@ body::before {
height: 18px;
}
/* 停止按钮样式 */
.send-btn.stop-btn {
background: linear-gradient(135deg, #ff4757, #ff6b81);
box-shadow: 0 2px 10px rgba(255, 71, 87, 0.4);
animation: stopPulse 1.5s ease-in-out infinite;
}
.send-btn.stop-btn:hover {
box-shadow: 0 4px 20px rgba(255, 71, 87, 0.6);
}
@keyframes stopPulse {
0%, 100% { box-shadow: 0 2px 10px rgba(255, 71, 87, 0.4); }
50% { box-shadow: 0 2px 16px rgba(255, 71, 87, 0.7); }
}
.spinner {
width: 18px;
height: 18px;