feat(chat): Show thinking mode and response time in AI messages
This commit is contained in:
parent
31350d6428
commit
9a7ac1586c
@ -285,6 +285,27 @@
|
||||
border-bottom-right-radius: 4px;
|
||||
}
|
||||
|
||||
/* Thinking info badge - pokazuje tryb i czas odpowiedzi */
|
||||
.thinking-info-badge {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 4px;
|
||||
margin-top: var(--spacing-sm);
|
||||
padding-top: var(--spacing-sm);
|
||||
border-top: 1px solid #e5e7eb;
|
||||
font-size: 11px;
|
||||
color: #9ca3af;
|
||||
}
|
||||
|
||||
.thinking-badge-level {
|
||||
color: #7c3aed;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.thinking-badge-time {
|
||||
color: #6b7280;
|
||||
}
|
||||
|
||||
/* Klikalne linki jako kolorowe badge'y */
|
||||
.message-content a {
|
||||
display: inline-block;
|
||||
@ -1725,7 +1746,7 @@ async function sendMessage() {
|
||||
document.getElementById('typingIndicator').style.display = 'none';
|
||||
|
||||
if (data.success) {
|
||||
addMessage('assistant', data.message);
|
||||
addMessage('assistant', data.message, true, data.tech_info);
|
||||
// Reload conversations to update list
|
||||
loadConversations();
|
||||
} else {
|
||||
@ -1751,7 +1772,7 @@ function sendSuggestion(text) {
|
||||
}
|
||||
|
||||
// Add message to chat
|
||||
function addMessage(role, content, animate = true) {
|
||||
function addMessage(role, content, animate = true, techInfo = null) {
|
||||
const messagesDiv = document.getElementById('chatMessages');
|
||||
const typingIndicator = document.getElementById('typingIndicator');
|
||||
|
||||
@ -1767,6 +1788,27 @@ function addMessage(role, content, animate = true) {
|
||||
contentDiv.className = 'message-content';
|
||||
contentDiv.innerHTML = formatMessage(content);
|
||||
|
||||
// Add thinking info badge for AI responses
|
||||
if (role === 'assistant' && techInfo) {
|
||||
const thinkingBadge = document.createElement('div');
|
||||
thinkingBadge.className = 'thinking-info-badge';
|
||||
|
||||
const thinkingLevel = techInfo.thinking_level || 'high';
|
||||
const latencyMs = techInfo.latency_ms || 0;
|
||||
const latencySec = (latencyMs / 1000).toFixed(1);
|
||||
|
||||
const levelLabels = {
|
||||
'minimal': '⚡ Błyskawiczny',
|
||||
'low': '🚀 Szybki',
|
||||
'medium': '⚖️ Średni',
|
||||
'high': '🧠 Głęboki'
|
||||
};
|
||||
const levelLabel = levelLabels[thinkingLevel] || thinkingLevel;
|
||||
|
||||
thinkingBadge.innerHTML = `<span class="thinking-badge-level">${levelLabel}</span> · <span class="thinking-badge-time">${latencySec}s</span>`;
|
||||
contentDiv.appendChild(thinkingBadge);
|
||||
}
|
||||
|
||||
messageDiv.appendChild(avatar);
|
||||
messageDiv.appendChild(contentDiv);
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user