discourse/plugins/chat/assets/stylesheets/common/chat-message-text.scss
Joffrey JAFFEUX d8d756cd2f
DEV: chat streaming (#25736)
This commit introduces the possibility to stream messages. To allow plugins to use streaming this commit also ships a `ChatSDK` library to allow to interact with few parts of discourse chat.

```ruby
ChatSDK::Message.create_with_stream(raw: "test") do |helper|
  5.times do |i|
    is_streaming = helper.stream(raw: "more #{i}")
    next if !is_streaming
    sleep 2
  end
end
```

This commit also introduces all the frontend parts:
- messages can now be marked as streaming
- when streaming their content will be updated when a new content is appended
- a special UI will be showing (a blinking indicator)
- a cancel button allows the user to stop the streaming, when cancelled `helper.stream(...)` will return `false`, and the plugin can decide exit early
2024-02-20 09:49:19 +01:00

26 lines
469 B
SCSS

.chat-message-container.-streaming {
.chat-message-text {
@keyframes cursor-blink {
0% {
opacity: 0;
}
}
p::after {
margin-left: 3px;
margin-bottom: -4px;
content: "";
width: 6px;
height: 17px;
background: var(--primary);
display: inline-block;
animation: cursor-blink 0.5s steps(2) infinite;
}
}
.stop-streaming-btn {
margin-top: 0.5rem;
margin-bottom: 0.25rem;
}
}