mirror of
https://github.com/nomic-ai/gpt4all.git
synced 2025-09-11 13:29:08 +00:00
Add txt and markdown files to attach feature. (#3135)
Signed-off-by: Adam Treat <treat.adam@gmail.com> Signed-off-by: AT <manyoso@users.noreply.github.com> Co-authored-by: Jared Van Bortel <jared@nomic.ai>
This commit is contained in:
41
gpt4all-chat/qml/MyFileIcon.qml
Normal file
41
gpt4all-chat/qml/MyFileIcon.qml
Normal file
@@ -0,0 +1,41 @@
|
||||
import QtCore
|
||||
import QtQuick
|
||||
import QtQuick.Controls
|
||||
import QtQuick.Controls.Basic
|
||||
import Qt5Compat.GraphicalEffects
|
||||
|
||||
Item {
|
||||
id: fileIcon
|
||||
property real iconSize: 24
|
||||
property string fileName: ""
|
||||
implicitWidth: iconSize
|
||||
implicitHeight: iconSize
|
||||
|
||||
Image {
|
||||
id: fileImage
|
||||
anchors.fill: parent
|
||||
visible: false
|
||||
sourceSize.width: iconSize
|
||||
sourceSize.height: iconSize
|
||||
mipmap: true
|
||||
source: {
|
||||
if (fileIcon.fileName.toLowerCase().endsWith(".txt"))
|
||||
return "qrc:/gpt4all/icons/file-txt.svg"
|
||||
else if (fileIcon.fileName.toLowerCase().endsWith(".pdf"))
|
||||
return "qrc:/gpt4all/icons/file-pdf.svg"
|
||||
else if (fileIcon.fileName.toLowerCase().endsWith(".md"))
|
||||
return "qrc:/gpt4all/icons/file-md.svg"
|
||||
else if (fileIcon.fileName.toLowerCase().endsWith(".xlsx"))
|
||||
return "qrc:/gpt4all/icons/file-xls.svg"
|
||||
else if (fileIcon.fileName.toLowerCase().endsWith(".docx"))
|
||||
return "qrc:/gpt4all/icons/file-docx.svg"
|
||||
else
|
||||
return "qrc:/gpt4all/icons/file.svg"
|
||||
}
|
||||
}
|
||||
ColorOverlay {
|
||||
anchors.fill: fileImage
|
||||
source: fileImage
|
||||
color: theme.textColor
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user