feat: add thinking indicator while model is generating

- src/types.ts: Add isThinking flag to ChatMessage to track transient
  'model is working' state.

- src/chat-view.ts: Set isThinking: true on the assistant placeholder
  message when user sends input. Clear it when the first stream chunk
  arrives or on error. Update render() to show a spinner + 'Thinking…'
  text while isThinking is active.

- styles.css: Add ollama-thinking-indicator class with a CSS spinner
  animation and muted italic text styling.
This commit is contained in:
2026-05-19 21:21:47 +02:00
parent 810676ff21
commit 70bf963f28
4 changed files with 56 additions and 7 deletions
+26
View File
@@ -149,3 +149,29 @@
.ollama-send-button:active {
filter: brightness(0.95);
}
/* Thinking indicator */
.ollama-thinking-indicator {
display: inline-flex;
align-items: center;
gap: var(--size-4-1);
font-style: italic;
color: var(--text-muted);
}
.ollama-thinking-indicator::before {
content: '';
display: inline-block;
width: 0.9em;
height: 0.9em;
border: 2px solid var(--text-muted);
border-top-color: transparent;
border-radius: 50%;
animation: ollama-spin 1s linear infinite;
}
@keyframes ollama-spin {
to {
transform: rotate(360deg);
}
}