mirror of
https://github.com/Mintplex-Labs/anything-llm.git
synced 2024-11-05 06:20:10 +01:00
708068a09e
* v2 Login screen (#254) * adding gradients for modal and sidebar * adding font setup * redesigned login screen for MultiUserAuth * completed multi user mode login screen * linting * login screen for single user auth redesign complete * created reusable gradient for login screen --------- Co-authored-by: timothycarambat <rambat1010@gmail.com> * v2 sidebar (#262) * adding gradients for modal and sidebar * adding font setup * redesigned login screen for MultiUserAuth * completed multi user mode login screen * linting * login screen for single user auth redesign complete * WIP sidebar redesign * created reusable gradient for login screen * remove dark mode items * update new workspace button * completed sidebar for desktop view * add interactivity states --------- Co-authored-by: timothycarambat <rambat1010@gmail.com> * remove duplicated pkg * v2 settings (#264) * adding gradients for modal and sidebar * adding font setup * redesigned login screen for MultiUserAuth * completed multi user mode login screen * linting * login screen for single user auth redesign complete * WIP sidebar redesign * created reusable gradient for login screen * remove dark mode items * update new workspace button * completed sidebar for desktop view * WIP added colors/gradients to admin settings * WIP fix discord logo import * WIP settings redesign - added routes for general settings and restyled components * WIP settings for LLM Preference, VectorDB, ExportImport * settings menu UI complete WIP functionality * settings fully functional/removed dark mode logo * linting * removing unneeded dependency * Fix admin sidebar visibility Fix API Keys location and work with single/mum Fix Appearance location - WIP on funcitonality * update api key page * fix permissions for appearance * Single user mode fixes * fix multi user mode enabled * fix import export * Rename AdminSidebar to SettingsSidebar * Fix mobile sidebar links --------- Co-authored-by: timothycarambat <rambat1010@gmail.com> * V2 user logout (#265) * Add user logout button * hide other 3 dot button * wrap admin routes * V2 workspace modal (#267) Update new workspace modal remove duplicate tailwind colors * v2 Settings modal styles (#266) * EditUserModal styles complete * workspaces modals styles complete * create invite link modal styles complete * create new api key modal styles complete --------- Co-authored-by: timothycarambat <rambat1010@gmail.com> * v2 Chats Redesign (#270) * fix default message for new workspace * prompt input box ui redesign complete * ui tweak to prompt input * WIP chat msg redesign * chat container and historical chat messages redesign * manage workspace modal appears when clicking upload a document on empty workspace * fixed loading skeleton styles * citations redesign complete * restyle pending chat and prompt reply components * default chat messages styles updated * linting * update how chats are returned --------- Co-authored-by: timothycarambat <rambat1010@gmail.com> * Onboarding modal flow for first time setup (#274) * WIP onboarding modal flow * onboarding flow complete and private route redirection for onboarding setep * redirect to home on onboarding complete * add onboarding redirect using paths.onboarding() * Apply changes to auth flow, onboarding determination, and flows * remove formref --------- Co-authored-by: timothycarambat <rambat1010@gmail.com> * v2 document picker (#275) * remove unneeded comments * WIP document picker UI * WIP basic UI complete for document picker tab and settings tab * linting * settings menu complete, document row WIP * WIP document picker loading from localFiles * WIP file picker logic * refactoring document picker to work with backend * WIP refactoring document picker * WIP refactor document picker to work with backend * file uploading with dropzone working * WIP deleting file when not embedded * WIP embeddings * WIP embedding with temp button and hardcoded paths * WIP placeholder for WorkspaceDirectory component * WIP WorkspaceDirectory * WIP * sort workspaceDocs and availibleDocs complete * added directories util * add and remove document from ws working * v2 document picker complete * reference modal ui bug fixes * truncate function bug fix * ManageWorkspace modal bug fixes * blocking mobile users modal for workspace settings * mobile ui fixes * linting * ui padding fixes * citation bug fixes * code review changes * debounce handlers * change tempFile object to array * selection count fix * Convert workspace modal to div Memo workspace settings update conditional rendering of workspace settings * Show no documents --------- Co-authored-by: timothycarambat <rambat1010@gmail.com> * mobile sidebar styles * padding on Mobile view mobile sidebar items * UI touchup * suggestion implementations * CSS fixes and animation perfomance change to GPU accelerated and 60fps * change will-change * remove transitions from onboarding modals, simplify on-change handlers * Swap onboarding to memoized components and debounce onchange handlers * remove console log * remove Avenir font --------- Co-authored-by: Sean Hatfield <seanhatfield5@gmail.com>
71 lines
1.9 KiB
JavaScript
71 lines
1.9 KiB
JavaScript
const path = require("path");
|
|
const fs = require("fs");
|
|
const { getType } = require("mime");
|
|
const { v4 } = require("uuid");
|
|
const { SystemSettings } = require("../../models/systemSettings");
|
|
const LOGO_FILENAME = "anything-llm.png";
|
|
|
|
function validFilename(newFilename = "") {
|
|
return ![LOGO_FILENAME].includes(newFilename);
|
|
}
|
|
|
|
function getDefaultFilename() {
|
|
return LOGO_FILENAME;
|
|
}
|
|
|
|
async function determineLogoFilepath(defaultFilename = LOGO_FILENAME) {
|
|
const currentLogoFilename = await SystemSettings.currentLogoFilename();
|
|
const basePath = path.join(__dirname, "../../storage/assets");
|
|
const defaultFilepath = path.join(basePath, defaultFilename);
|
|
|
|
if (currentLogoFilename && validFilename(currentLogoFilename)) {
|
|
customLogoPath = path.join(basePath, currentLogoFilename);
|
|
return fs.existsSync(customLogoPath) ? customLogoPath : defaultFilepath;
|
|
}
|
|
|
|
return defaultFilepath;
|
|
}
|
|
|
|
function fetchLogo(logoPath) {
|
|
const mime = getType(logoPath);
|
|
const buffer = fs.readFileSync(logoPath);
|
|
return {
|
|
buffer,
|
|
size: buffer.length,
|
|
mime,
|
|
};
|
|
}
|
|
|
|
async function renameLogoFile(originalFilename = null) {
|
|
const extname = path.extname(originalFilename) || ".png";
|
|
const newFilename = `${v4()}${extname}`;
|
|
const originalFilepath = path.join(
|
|
__dirname,
|
|
`../../storage/assets/${originalFilename}`
|
|
);
|
|
const outputFilepath = path.join(
|
|
__dirname,
|
|
`../../storage/assets/${newFilename}`
|
|
);
|
|
|
|
fs.renameSync(originalFilepath, outputFilepath);
|
|
return newFilename;
|
|
}
|
|
|
|
async function removeCustomLogo(logoFilename = LOGO_FILENAME) {
|
|
if (!logoFilename || !validFilename(logoFilename)) return false;
|
|
const logoPath = path.join(__dirname, `../../storage/assets/${logoFilename}`);
|
|
if (fs.existsSync(logoPath)) fs.unlinkSync(logoPath);
|
|
return true;
|
|
}
|
|
|
|
module.exports = {
|
|
fetchLogo,
|
|
renameLogoFile,
|
|
removeCustomLogo,
|
|
validFilename,
|
|
getDefaultFilename,
|
|
determineLogoFilepath,
|
|
LOGO_FILENAME,
|
|
};
|