diff --git a/.gitignore b/.gitignore
index f6a7e551f78..deb88990dd3 100644
--- a/.gitignore
+++ b/.gitignore
@@ -9,3 +9,5 @@ v-env
aws_cf_deploy_anything_llm.json
yarn.lock
*.bak
+
+/.idea/*
diff --git a/collector/processSingleFile/index.js b/collector/processSingleFile/index.js
index a00b139ed4b..fc72feb0d11 100644
--- a/collector/processSingleFile/index.js
+++ b/collector/processSingleFile/index.js
@@ -47,8 +47,9 @@ async function processSingleFile(targetFilename, options = {}) {
}
let processFileAs = fileExtension;
+ const fileTypeDefault = options["experimental_file_type_default"];
if (!SUPPORTED_FILETYPE_CONVERTERS.hasOwnProperty(fileExtension)) {
- if (isTextType(fullFilePath)) {
+ if (isTextType(fullFilePath) || fileTypeDefault) {
console.log(
`\x1b[33m[Collector]\x1b[0m The provided filetype of ${fileExtension} does not have a preset and will be processed as .txt.`
);
diff --git a/frontend/src/models/experimental/fileTypeDefault.js b/frontend/src/models/experimental/fileTypeDefault.js
new file mode 100644
index 00000000000..d717230cf18
--- /dev/null
+++ b/frontend/src/models/experimental/fileTypeDefault.js
@@ -0,0 +1,24 @@
+import { API_BASE } from "@/utils/constants";
+import { baseHeaders } from "@/utils/request";
+
+const FileTypeDefault = {
+ featureFlag: "experimental_file_type_default",
+ toggleFeature: async function (updatedStatus = false) {
+ return await fetch(`${API_BASE}/experimental/toggle-file-type-default`, {
+ method: "POST",
+ headers: baseHeaders(),
+ body: JSON.stringify({ updatedStatus }),
+ })
+ .then((res) => {
+ if (!res.ok) throw new Error("Could not update status.");
+ return true;
+ })
+ .then((res) => res)
+ .catch((e) => {
+ console.error(e);
+ return false;
+ });
+ },
+};
+
+export default FileTypeDefault;
diff --git a/frontend/src/models/system.js b/frontend/src/models/system.js
index 663cb21b76f..383898f5f8e 100644
--- a/frontend/src/models/system.js
+++ b/frontend/src/models/system.js
@@ -2,6 +2,7 @@ import { API_BASE, AUTH_TIMESTAMP, fullApiUrl } from "@/utils/constants";
import { baseHeaders, safeJsonParse } from "@/utils/request";
import DataConnector from "./dataConnector";
import LiveDocumentSync from "./experimental/liveSync";
+import FileTypeDefault from "./experimental/fileTypeDefault";
import AgentPlugins from "./experimental/agentPlugins";
const System = {
@@ -738,6 +739,7 @@ const System = {
experimentalFeatures: {
liveSync: LiveDocumentSync,
+ fileTypeDefault: FileTypeDefault,
agentPlugins: AgentPlugins,
},
};
diff --git a/frontend/src/pages/Admin/ExperimentalFeatures/Features/FileTypeDefault/toggle.jsx b/frontend/src/pages/Admin/ExperimentalFeatures/Features/FileTypeDefault/toggle.jsx
new file mode 100644
index 00000000000..359f111fadc
--- /dev/null
+++ b/frontend/src/pages/Admin/ExperimentalFeatures/Features/FileTypeDefault/toggle.jsx
@@ -0,0 +1,57 @@
+import System from "@/models/system";
+import showToast from "@/utils/toast";
+import { useState } from "react";
+
+export default function FileTypeDefaultToggle({ enabled = false, onToggle }) {
+ const [status, setStatus] = useState(enabled);
+
+ async function toggleFeatureFlag() {
+ const updated =
+ await System.experimentalFeatures.fileTypeDefault.toggleFeature(!status);
+ if (!updated) {
+ showToast("Failed to update status of feature.", "error", {
+ clear: true,
+ });
+ return false;
+ }
+
+ setStatus(!status);
+ showToast(
+ `File type default has been ${!status ? "enabled" : "disabled"}.`,
+ "success",
+ { clear: true }
+ );
+ onToggle();
+ }
+
+ return (
+
+
+
+
+ File Type Default
+
+
+
+
+
+ If the type of an imported file cannot be determined, this setting
+ changes the default behavior to process the file as text instead of
+ displaying an error message.
+
+
+ This feature only applies when importing file-based content.
+