diff --git a/python/huggingFace/resources/messages/PyHuggingFaceBundle.properties b/python/huggingFace/resources/messages/PyHuggingFaceBundle.properties
index b3ec8f09c40d..b5514d1fb3e7 100644
--- a/python/huggingFace/resources/messages/PyHuggingFaceBundle.properties
+++ b/python/huggingFace/resources/messages/PyHuggingFaceBundle.properties
@@ -7,7 +7,7 @@ python.hugging.face.base.url=https://huggingface.co
python.hugging.face.updated.suffix= Updated {0}
python.hugging.face.open.on.link.text=Open on Hugging Face
-python.hugging.face.placeholder.gated.model=Sorry, this {0} is gated.
Please visit the [HuggingFace website]({1})
for more details about the {2} card.
+python.hugging.face.placeholder.gated.model=Sorry, this {0} is gated.
Please visit the [HuggingFace website]({1})
for more details about the {2} card.
python.hugging.face.placeholder.no.readme=This model has no description available. For more details, please follow the [link]({0})
python.hugging.face.placeholder.trimmed=*Please find the rest of the {0} card [here]({1})*
python.hugging.face.placeholder.no.internet=Failed to fetch data for {0}. Please check your internet connection.
diff --git a/python/huggingFace/src/com/intellij/python/community/impl/huggingFace/api/HuggingFaceModelSortKey.kt b/python/huggingFace/src/com/intellij/python/community/impl/huggingFace/api/HuggingFaceModelSortKey.kt
index b1deafce3a93..215796122333 100644
--- a/python/huggingFace/src/com/intellij/python/community/impl/huggingFace/api/HuggingFaceModelSortKey.kt
+++ b/python/huggingFace/src/com/intellij/python/community/impl/huggingFace/api/HuggingFaceModelSortKey.kt
@@ -5,9 +5,8 @@ import org.jetbrains.annotations.ApiStatus
@ApiStatus.Internal
enum class HuggingFaceModelSortKey(val value: String, val displayName: String) {
- AUTHOR("author", "Author"),
- CREATED_AT("createdAt", "Created At"),
- LAST_MODIFIED("lastModified", "Last Modified"),
DOWNLOADS("downloads", "Downloads"),
- LIKES("likes", "Likes");
+ LIKES("likes", "Likes"),
+ CREATED_AT("createdAt", "Created At"),
+ LAST_MODIFIED("lastModified", "Last Modified");
}
diff --git a/python/huggingFace/src/com/intellij/python/community/impl/huggingFace/cache/HuggingFaceEntitiesCache.kt b/python/huggingFace/src/com/intellij/python/community/impl/huggingFace/cache/HuggingFaceEntitiesCache.kt
index ebcad4ac0bcc..723922493659 100644
--- a/python/huggingFace/src/com/intellij/python/community/impl/huggingFace/cache/HuggingFaceEntitiesCache.kt
+++ b/python/huggingFace/src/com/intellij/python/community/impl/huggingFace/cache/HuggingFaceEntitiesCache.kt
@@ -37,6 +37,12 @@ abstract class HuggingFaceCache(private val maxSize: Int) : PersistentStateCompo
}
}
+ @Synchronized
+ fun saveEntity(entityData: HuggingFaceEntityBasicApiData) {
+ cacheMap[entityData.itemId] = entityData
+ nameSet.add(entityData.itemId)
+ }
+
@Synchronized
fun isInCache(entityId: String): Boolean {
if (hotCache.containsKey(entityId)) return true
@@ -67,7 +73,6 @@ abstract class HuggingFaceCache(private val maxSize: Int) : PersistentStateCompo
}
}
-
@State(
name = "HuggingFaceModelsCache",
storages = [Storage("huggingFaceModelsCache.xml")]
diff --git a/python/huggingFace/src/com/intellij/python/community/impl/huggingFace/documentation/HuggingFaceHtmlBuilder.kt b/python/huggingFace/src/com/intellij/python/community/impl/huggingFace/documentation/HuggingFaceHtmlBuilder.kt
index 29e8f7895d79..bbcd54286756 100644
--- a/python/huggingFace/src/com/intellij/python/community/impl/huggingFace/documentation/HuggingFaceHtmlBuilder.kt
+++ b/python/huggingFace/src/com/intellij/python/community/impl/huggingFace/documentation/HuggingFaceHtmlBuilder.kt
@@ -11,6 +11,7 @@ import com.intellij.python.community.impl.huggingFace.HuggingFaceEntityKind
import com.intellij.python.community.impl.huggingFace.api.HuggingFaceEntityBasicApiData
import com.intellij.python.community.impl.huggingFace.api.HuggingFaceURLProvider
import com.intellij.python.community.impl.huggingFace.service.PyHuggingFaceBundle
+import com.jetbrains.python.PythonLanguage
import org.jetbrains.annotations.ApiStatus
import org.jetbrains.annotations.Nls
@@ -29,7 +30,7 @@ class HuggingFaceHtmlBuilder(
} else {
generateCardHeader(modelDataApiContent)
}
- @NlsSafe val convertedHtml = readAction { DocMarkdownToHtmlConverter.convert(project, modelCardContent) }
+ @NlsSafe val convertedHtml = readAction { DocMarkdownToHtmlConverter.convert(project, modelCardContent, PythonLanguage.INSTANCE) }
val wrappedBodyContent = HtmlChunk.div()
.setClass(DocumentationMarkup.CLASS_CONTENT)
@@ -58,8 +59,6 @@ class HuggingFaceHtmlBuilder(
listOf(HtmlChunk.text(PyHuggingFaceBundle.message("python.hugging.face.dataset")), HtmlChunk.nbsp(2))
}
-
-
val modelInfoRow = DocumentationMarkup.GRAYED_ELEMENT
.children(
*conditionalChunks.toTypedArray(),
@@ -80,21 +79,22 @@ class HuggingFaceHtmlBuilder(
.child(HtmlChunk.text(PyHuggingFaceBundle.getMessage("python.hugging.face.open.on.link.text")))
.wrapWith("p")
- val headerContainer = HtmlChunk.div()
- .setClass(DocumentationMarkup.CLASS_DEFINITION)
- .children(
- modelNameWithIconRow,
- modelInfoRow,
- linkRow,
- )
+ val headerContainer = HtmlChunk.div()
+ .setClass(DocumentationMarkup.CLASS_DEFINITION)
+ .children(
+ modelNameWithIconRow,
+ modelInfoRow,
+ linkRow,
+ )
+
return headerContainer
}
companion object {
private const val NBHP = "‑"
private val DOWNLOADS_ICON = HtmlChunk.tag("icon")
- .attr("src", "AllIcons.Actions.Download")
+ .attr("src", "AllIcons.Plugins.Downloads")
private val LIKES_ICON = HtmlChunk.tag("icon")
- .attr(".src", "AllIcons.Toolwindows.ToolWindowFavorites")
+ .attr(".src", "AllIcons.Plugins.Rating")
}
}
\ No newline at end of file