fix: Remove image dublicate (#271)

This commit is contained in:
Petr Mironychev
2025-11-20 23:25:00 +01:00
committed by GitHub
parent 24565dc81f
commit a3527e1442
8 changed files with 70 additions and 51 deletions

View File

@ -601,6 +601,21 @@ void ChatRootView::showAddImageDialog()
}
}
QStringList ChatRootView::convertUrlsToLocalPaths(const QVariantList &urls) const
{
QStringList localPaths;
for (const QVariant &urlVariant : urls) {
QUrl url(urlVariant.toString());
if (url.isLocalFile()) {
QString localPath = url.toLocalFile();
if (!localPath.isEmpty()) {
localPaths.append(localPath);
}
}
}
return localPaths;
}
void ChatRootView::calculateMessageTokensCount(const QString &message)
{
m_messageTokensCount = Context::TokenUtils::estimateTokens(message);