mirror of
https://github.com/Mintplex-Labs/anything-llm.git
synced 2024-11-15 19:00:33 +01:00
dc4ad6b5a9
* wip bg workers for live document sync * Add ability to re-embed specific documents across many workspaces via background queue bgworkser is gated behind expieremental system setting flag that needs to be explictly enabled UI for watching/unwatching docments that are embedded. TODO: UI to easily manage all bg tasks and see run results TODO: UI to enable this feature and background endpoints to manage it * create frontend views and paths Move elements to correct experimental scope * update migration to delete runs on removal of watched document * Add watch support to YouTube transcripts (#1716) * Add watch support to YouTube transcripts refactor how sync is done for supported types * Watch specific files in Confluence space (#1718) Add failure-prune check for runs * create tmp workflow modifications for beta image * create tmp workflow modifications for beta image * create tmp workflow modifications for beta image * dual build update copy of alert modals * update job interval * Add support for live-sync of Github files * update copy for document sync feature * hide Experimental features from UI * update docs links * [FEAT] Implement new settings menu for experimental features (#1735) * implement new settings menu for experimental features * remove unused context save bar --------- Co-authored-by: timothycarambat <rambat1010@gmail.com> * dont run job on boot * unset workflow changes * Add persistent encryption service Relay key to collector so persistent encryption can be used Encrypt any private data in chunkSources used for replay during resync jobs * update jsDOC * Linting and organization * update modal copy for feature --------- Co-authored-by: Sean Hatfield <seanhatfield5@gmail.com>
30 lines
874 B
JavaScript
30 lines
874 B
JavaScript
const path = require('node:path');
|
|
const fs = require('node:fs');
|
|
const { parentPort } = require('node:worker_threads');
|
|
const documentsPath =
|
|
process.env.NODE_ENV === "development"
|
|
? path.resolve(__dirname, `../../storage/documents`)
|
|
: path.resolve(process.env.STORAGE_DIR, `documents`);
|
|
|
|
function log(stringContent = '') {
|
|
if (parentPort) parentPort.postMessage(stringContent);
|
|
else console.log(`parentPort is undefined. Debug: ${stringContent}`)
|
|
}
|
|
|
|
function conclude() {
|
|
if (parentPort) parentPort.postMessage('done');
|
|
else process.exit(0);
|
|
}
|
|
|
|
function updateSourceDocument(docPath = null, jsonContent = {}) {
|
|
const destinationFilePath = path.resolve(documentsPath, docPath);
|
|
fs.writeFileSync(destinationFilePath, JSON.stringify(jsonContent, null, 4), {
|
|
encoding: "utf-8",
|
|
});
|
|
}
|
|
|
|
module.exports = {
|
|
log,
|
|
conclude,
|
|
updateSourceDocument,
|
|
} |