mirror of
https://github.com/nomic-ai/gpt4all.git
synced 2025-09-22 03:48: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:
@@ -132,7 +132,13 @@ void Chat::newPromptResponsePair(const QString &prompt, const QList<QUrl> &attac
|
||||
Q_ASSERT(url.isLocalFile());
|
||||
const QString localFilePath = url.toLocalFile();
|
||||
const QFileInfo info(localFilePath);
|
||||
Q_ASSERT(info.suffix() == "xlsx"); // We only support excel right now
|
||||
|
||||
Q_ASSERT(
|
||||
info.suffix().toLower() == "xlsx" ||
|
||||
info.suffix().toLower() == "txt" ||
|
||||
info.suffix().toLower() == "md" ||
|
||||
info.suffix().toLower() == "rst"
|
||||
);
|
||||
|
||||
PromptAttachment attached;
|
||||
attached.url = url;
|
||||
|
@@ -40,6 +40,11 @@ public:
|
||||
|
||||
QString processedContent() const
|
||||
{
|
||||
const QString localFilePath = url.toLocalFile();
|
||||
const QFileInfo info(localFilePath);
|
||||
if (info.suffix().toLower() != "xlsx")
|
||||
return u"## Attached: %1\n\n%2"_s.arg(file(), content);
|
||||
|
||||
QBuffer buffer;
|
||||
buffer.setData(content);
|
||||
buffer.open(QIODevice::ReadOnly);
|
||||
|
Reference in New Issue
Block a user