fix(ui): minor visual enhancements (#8909)

- Fixes thinking box overflowing in other pages
- Shows loading icon to the active chats

Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
This commit is contained in:
Ettore Di Giacinto
2026-03-09 18:02:26 +01:00
committed by GitHub
parent 05a3d00924
commit 75428d8d1f
2 changed files with 13 additions and 6 deletions

View File

@@ -103,6 +103,7 @@ export function useChat(initialModel = '') {
})
const [isStreaming, setIsStreaming] = useState(false)
const [streamingChatId, setStreamingChatId] = useState(null)
const [streamingContent, setStreamingContent] = useState('')
const [streamingReasoning, setStreamingReasoning] = useState('')
const [streamingToolCalls, setStreamingToolCalls] = useState([])
@@ -263,6 +264,7 @@ export function useChat(initialModel = '') {
const controller = new AbortController()
abortControllerRef.current = controller
setIsStreaming(true)
setStreamingChatId(activeChatId)
setStreamingContent('')
setStreamingReasoning('')
setStreamingToolCalls([])
@@ -526,6 +528,7 @@ export function useChat(initialModel = '') {
// Finalize
setIsStreaming(false)
setStreamingChatId(null)
abortControllerRef.current = null
setStreamingContent('')
setStreamingReasoning('')
@@ -577,14 +580,17 @@ export function useChat(initialModel = '') {
))
}, [])
const isActiveStreaming = isStreaming && streamingChatId === activeChatId
return {
chats,
activeChat,
activeChatId,
isStreaming,
streamingContent,
streamingReasoning,
streamingToolCalls,
isStreaming: isActiveStreaming,
streamingChatId: isStreaming ? streamingChatId : null,
streamingContent: isActiveStreaming ? streamingContent : '',
streamingReasoning: isActiveStreaming ? streamingReasoning : '',
streamingToolCalls: isActiveStreaming ? streamingToolCalls : [],
tokensPerSecond,
maxTokensPerSecond,
addChat,

View File

@@ -164,8 +164,8 @@ export default function Chat() {
const { addToast } = useOutletContext()
const navigate = useNavigate()
const {
chats, activeChat, activeChatId, isStreaming, streamingContent, streamingReasoning,
streamingToolCalls, tokensPerSecond, maxTokensPerSecond,
chats, activeChat, activeChatId, isStreaming, streamingChatId, streamingContent,
streamingReasoning, streamingToolCalls, tokensPerSecond, maxTokensPerSecond,
addChat, switchChat, deleteChat, deleteAllChats, renameChat, updateChatSettings,
sendMessage, stopGeneration, clearHistory, getContextUsagePercent,
} = useChat(urlModel || '')
@@ -430,6 +430,7 @@ export default function Chat() {
className="chat-list-item-name"
onDoubleClick={() => startRename(chat.id, chat.name)}
>
{streamingChatId === chat.id && <i className="fas fa-circle-notch fa-spin" style={{ marginRight: '6px', fontSize: '0.7rem', opacity: 0.7 }} />}
{chat.name}
</span>
<span className="chat-list-item-time">{relativeTime(chat.updatedAt)}</span>