mirror of
https://github.com/carlrobertoh/ProxyAI.git
synced 2026-05-21 19:13:38 +00:00
fix: compatibility issue
This commit is contained in:
parent
a120ce544f
commit
0e93c38e29
2 changed files with 14 additions and 11 deletions
|
|
@ -13,7 +13,7 @@ import ee.carlrobert.codegpt.settings.service.ServiceType
|
|||
import ee.carlrobert.codegpt.settings.service.codegpt.CodeGPTService
|
||||
import ee.carlrobert.codegpt.toolwindow.chat.ui.textarea.AttachImageNotifier
|
||||
import ee.carlrobert.codegpt.ui.OverlayUtil
|
||||
import io.ktor.util.*
|
||||
import java.nio.file.Path
|
||||
import java.nio.file.Paths
|
||||
import kotlin.io.path.absolutePathString
|
||||
|
||||
|
|
@ -34,7 +34,7 @@ class CodeGPTProjectActivity : ProjectActivity {
|
|||
) {
|
||||
val desktopPath = Paths.get(System.getProperty("user.home"), "Desktop")
|
||||
project.service<FileWatcher>().watch(desktopPath) {
|
||||
if (watchExtensions.contains(it.extension.lowercase())) {
|
||||
if (watchExtensions.contains(getFileExtension(it))) {
|
||||
showImageAttachmentNotification(
|
||||
project,
|
||||
desktopPath.resolve(it).absolutePathString()
|
||||
|
|
@ -44,6 +44,16 @@ class CodeGPTProjectActivity : ProjectActivity {
|
|||
}
|
||||
}
|
||||
|
||||
private fun getFileExtension(path: Path): String {
|
||||
val fileName = path.fileName.toString()
|
||||
val lastIndexOfDot = fileName.lastIndexOf('.')
|
||||
return if (lastIndexOfDot != -1) {
|
||||
fileName.substring(lastIndexOfDot + 1).lowercase()
|
||||
} else {
|
||||
""
|
||||
}
|
||||
}
|
||||
|
||||
private fun showImageAttachmentNotification(project: Project, filePath: String) {
|
||||
OverlayUtil.getDefaultNotification(
|
||||
CodeGPTBundle.get("imageAttachmentNotification.content"),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue