feat(chat): Obsługa linków wewnętrznych i lepszy badge thinking
- Dodano style CSS dla forum-link (fiolet), news-link (zieleń), b2b-link (żółty) - formatMessage() obsługuje teraz linki wewnętrzne (/forum/, /news/, /b2b/) - Badge thinking pokazuje opis jakościowy (np. "dogłębna analiza z weryfikacją") Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
08aee8864a
commit
827168fb24
@ -306,6 +306,11 @@
|
||||
color: #6b7280;
|
||||
}
|
||||
|
||||
.thinking-badge-desc {
|
||||
color: #9ca3af;
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
/* Klikalne linki jako kolorowe badge'y */
|
||||
.message-content a {
|
||||
display: inline-block;
|
||||
@ -342,6 +347,39 @@
|
||||
box-shadow: 0 2px 4px rgba(4, 120, 87, 0.2);
|
||||
}
|
||||
|
||||
/* 💬 Linki do FORUM - fioletowy */
|
||||
.message-content a.forum-link {
|
||||
background: #f5f3ff;
|
||||
color: #7c3aed;
|
||||
}
|
||||
.message-content a.forum-link:hover {
|
||||
background: #ede9fe;
|
||||
color: #6d28d9;
|
||||
transform: translateY(-1px);
|
||||
}
|
||||
|
||||
/* 📰 Linki do AKTUALNOŚCI - zielony */
|
||||
.message-content a.news-link {
|
||||
background: #ecfdf5;
|
||||
color: #059669;
|
||||
}
|
||||
.message-content a.news-link:hover {
|
||||
background: #d1fae5;
|
||||
color: #047857;
|
||||
transform: translateY(-1px);
|
||||
}
|
||||
|
||||
/* 💼 Linki do B2B - żółty */
|
||||
.message-content a.b2b-link {
|
||||
background: #fefce8;
|
||||
color: #ca8a04;
|
||||
}
|
||||
.message-content a.b2b-link:hover {
|
||||
background: #fef9c3;
|
||||
color: #a16207;
|
||||
transform: translateY(-1px);
|
||||
}
|
||||
|
||||
/* 🔗 Linki ZEWNĘTRZNE (www, social media, maps) - niebieski */
|
||||
.message-content a.external-link {
|
||||
background: #eff6ff;
|
||||
@ -1797,15 +1835,23 @@ function addMessage(role, content, animate = true, techInfo = null) {
|
||||
const latencyMs = techInfo.latency_ms || 0;
|
||||
const latencySec = (latencyMs / 1000).toFixed(1);
|
||||
|
||||
// Labels with quality descriptions to show value of deeper thinking
|
||||
const levelLabels = {
|
||||
'minimal': '⚡ Błyskawiczny',
|
||||
'low': '🚀 Szybki',
|
||||
'medium': '⚖️ Średni',
|
||||
'high': '🧠 Głęboki'
|
||||
'medium': '⚖️ Zbalansowany',
|
||||
'high': '🧠 Głęboka analiza'
|
||||
};
|
||||
const levelDescriptions = {
|
||||
'minimal': 'szybka odpowiedź',
|
||||
'low': 'zwięzła analiza',
|
||||
'medium': 'przemyślana odpowiedź',
|
||||
'high': 'dogłębna analiza z weryfikacją'
|
||||
};
|
||||
const levelLabel = levelLabels[thinkingLevel] || thinkingLevel;
|
||||
const levelDesc = levelDescriptions[thinkingLevel] || '';
|
||||
|
||||
thinkingBadge.innerHTML = `<span class="thinking-badge-level">${levelLabel}</span> · <span class="thinking-badge-time">${latencySec}s</span>`;
|
||||
thinkingBadge.innerHTML = `<span class="thinking-badge-level">${levelLabel}</span> · <span class="thinking-badge-desc">${levelDesc}</span> · <span class="thinking-badge-time">${latencySec}s</span>`;
|
||||
contentDiv.appendChild(thinkingBadge);
|
||||
}
|
||||
|
||||
@ -1830,13 +1876,38 @@ function formatMessage(text) {
|
||||
text = escapeHtml(text);
|
||||
|
||||
// Convert markdown links [text](url) to <a> tags with appropriate class
|
||||
// Links: company (orange), person (green), external (blue)
|
||||
// Links: company (orange), person (green), forum (purple), news (green), b2b (yellow), external (blue)
|
||||
|
||||
// First: Handle internal links starting with /
|
||||
text = text.replace(/\[([^\]]+)\]\((\/[^)]+)\)/g, function(match, linkText, url) {
|
||||
let linkClass = 'external-link';
|
||||
if (url.startsWith('/company/')) {
|
||||
linkClass = 'company-link';
|
||||
} else if (url.startsWith('/forum/')) {
|
||||
linkClass = 'forum-link';
|
||||
} else if (url.startsWith('/news/') || url.startsWith('/aktualnosci/')) {
|
||||
linkClass = 'news-link';
|
||||
} else if (url.startsWith('/b2b/') || url.startsWith('/ogloszenia/')) {
|
||||
linkClass = 'b2b-link';
|
||||
} else if (url.startsWith('/osoba/')) {
|
||||
linkClass = 'person-link';
|
||||
}
|
||||
return '<a href="' + url + '" class="' + linkClass + '">' + linkText + '</a>';
|
||||
});
|
||||
|
||||
// Then: Handle full URLs (https://)
|
||||
text = text.replace(/\[([^\]]+)\]\((https?:\/\/[^)]+)\)/g, function(match, linkText, url) {
|
||||
let linkClass = 'external-link';
|
||||
if (url.includes('nordabiznes.pl/company/')) {
|
||||
linkClass = 'company-link';
|
||||
} else if (url.includes('nordabiznes.pl/osoba/')) {
|
||||
linkClass = 'person-link';
|
||||
} else if (url.includes('nordabiznes.pl/forum/')) {
|
||||
linkClass = 'forum-link';
|
||||
} else if (url.includes('nordabiznes.pl/news/') || url.includes('nordabiznes.pl/aktualnosci/')) {
|
||||
linkClass = 'news-link';
|
||||
} else if (url.includes('nordabiznes.pl/b2b/') || url.includes('nordabiznes.pl/ogloszenia/')) {
|
||||
linkClass = 'b2b-link';
|
||||
}
|
||||
return '<a href="' + url + '" target="_blank" rel="noopener" class="' + linkClass + '">' + linkText + '</a>';
|
||||
});
|
||||
|
||||
Loading…
Reference in New Issue
Block a user