Open atulgrover opened 2 months ago
To ensure that CSV files uploaded in the knowledge base are not downloadable by default and provide an option to turn off the sources for CSV files, you can modify the getOptions
function to conditionally disable the "Download" option for CSV files. Additionally, you can add a new option to turn off the sources for CSV files.
Here's how you can modify the code:
const getOptions = (): Option[] => [
{
label: "Delete",
onClick: () => void onDeleteKnowledge(knowledge),
iconName: "delete",
iconColor: "dangerous",
disabled: brain?.role !== "Owner",
},
{
label: "Download",
onClick: () => void downloadFile(),
iconName: "download",
iconColor: "primary",
disabled: brain?.role !== "Owner" || !isUploadedKnowledge(knowledge) || knowledge.extension === ".csv",
},
{
label: "Turn Off Source",
onClick: () => void turnOffSource(),
iconName: "toggle_off",
iconColor: "warning",
disabled: brain?.role !== "Owner" || knowledge.extension !== ".csv",
},
];
const turnOffSource = () => {
// Implement the logic to turn off the source for CSV files
console.log(`Turning off source for knowledge ID: ${knowledge.id}`);
setOptionsOpened(false);
};
In this modification:
.csv
.turnOffSource
function should contain the logic to turn off the source for CSV files [1].This change should be made in the KnowledgeItem.tsx
file located at frontend/app/studio/[brainId]/BrainManagementTabs/components/KnowledgeTab/KnowledgeTable/KnowledgeItem/KnowledgeItem.tsx
.
To continue talking to Dosu, mention @dosu.
The Feature
the csv file had tabular information and should not be downloadable by default... there must be an option to tuen off the sources for csv files....
Motivation, pitch
where in the code can I do it myself?
Twitter / LinkedIn details
No response