repo
stringlengths
5
106
file_url
stringlengths
78
301
file_path
stringlengths
4
211
content
stringlengths
0
32.8k
language
stringclasses
1 value
license
stringclasses
7 values
commit_sha
stringlengths
40
40
retrieved_at
stringdate
2026-01-04 14:56:49
2026-01-05 02:23:25
truncated
bool
2 classes
Mintplex-Labs/anything-llm
https://github.com/Mintplex-Labs/anything-llm/blob/e287fab56089cf8fcea9ba579a3ecdeca0daa313/server/utils/files/multer.js
server/utils/files/multer.js
const multer = require("multer"); const path = require("path"); const fs = require("fs"); const { v4 } = require("uuid"); const { normalizePath } = require("."); /** * Handle File uploads for auto-uploading. * Mostly used for internal GUI/API uploads. */ const fileUploadStorage = multer.diskStorage({ destination:...
javascript
MIT
e287fab56089cf8fcea9ba579a3ecdeca0daa313
2026-01-04T14:57:11.963777Z
false
Mintplex-Labs/anything-llm
https://github.com/Mintplex-Labs/anything-llm/blob/e287fab56089cf8fcea9ba579a3ecdeca0daa313/server/utils/TextToSpeech/index.js
server/utils/TextToSpeech/index.js
function getTTSProvider() { const provider = process.env.TTS_PROVIDER || "openai"; switch (provider) { case "openai": const { OpenAiTTS } = require("./openAi"); return new OpenAiTTS(); case "elevenlabs": const { ElevenLabsTTS } = require("./elevenLabs"); return new ElevenLabsTTS(); ...
javascript
MIT
e287fab56089cf8fcea9ba579a3ecdeca0daa313
2026-01-04T14:57:11.963777Z
false
Mintplex-Labs/anything-llm
https://github.com/Mintplex-Labs/anything-llm/blob/e287fab56089cf8fcea9ba579a3ecdeca0daa313/server/utils/TextToSpeech/openAiGeneric/index.js
server/utils/TextToSpeech/openAiGeneric/index.js
class GenericOpenAiTTS { constructor() { if (!process.env.TTS_OPEN_AI_COMPATIBLE_KEY) this.#log( "No OpenAI compatible API key was set. You might need to set this to use your OpenAI compatible TTS service." ); if (!process.env.TTS_OPEN_AI_COMPATIBLE_MODEL) this.#log( "No Open...
javascript
MIT
e287fab56089cf8fcea9ba579a3ecdeca0daa313
2026-01-04T14:57:11.963777Z
false
Mintplex-Labs/anything-llm
https://github.com/Mintplex-Labs/anything-llm/blob/e287fab56089cf8fcea9ba579a3ecdeca0daa313/server/utils/TextToSpeech/openAi/index.js
server/utils/TextToSpeech/openAi/index.js
class OpenAiTTS { constructor() { if (!process.env.TTS_OPEN_AI_KEY) throw new Error("No OpenAI API key was set."); const { OpenAI: OpenAIApi } = require("openai"); this.openai = new OpenAIApi({ apiKey: process.env.TTS_OPEN_AI_KEY, }); this.voice = process.env.TTS_OPEN_AI_VOICE_MODEL ??...
javascript
MIT
e287fab56089cf8fcea9ba579a3ecdeca0daa313
2026-01-04T14:57:11.963777Z
false
Mintplex-Labs/anything-llm
https://github.com/Mintplex-Labs/anything-llm/blob/e287fab56089cf8fcea9ba579a3ecdeca0daa313/server/utils/TextToSpeech/elevenLabs/index.js
server/utils/TextToSpeech/elevenLabs/index.js
const { ElevenLabsClient, stream } = require("elevenlabs"); class ElevenLabsTTS { constructor() { if (!process.env.TTS_ELEVEN_LABS_KEY) throw new Error("No ElevenLabs API key was set."); this.elevenLabs = new ElevenLabsClient({ apiKey: process.env.TTS_ELEVEN_LABS_KEY, }); // Rachel as de...
javascript
MIT
e287fab56089cf8fcea9ba579a3ecdeca0daa313
2026-01-04T14:57:11.963777Z
false
Mintplex-Labs/anything-llm
https://github.com/Mintplex-Labs/anything-llm/blob/e287fab56089cf8fcea9ba579a3ecdeca0daa313/server/utils/PasswordRecovery/index.js
server/utils/PasswordRecovery/index.js
const bcrypt = require("bcryptjs"); const { v4, validate } = require("uuid"); const { User } = require("../../models/user"); const { RecoveryCode, PasswordResetToken, } = require("../../models/passwordRecovery"); async function generateRecoveryCodes(userId) { const newRecoveryCodes = []; const plainTextCodes =...
javascript
MIT
e287fab56089cf8fcea9ba579a3ecdeca0daa313
2026-01-04T14:57:11.963777Z
false
Mintplex-Labs/anything-llm
https://github.com/Mintplex-Labs/anything-llm/blob/e287fab56089cf8fcea9ba579a3ecdeca0daa313/server/utils/MCP/index.js
server/utils/MCP/index.js
const MCPHypervisor = require("./hypervisor"); class MCPCompatibilityLayer extends MCPHypervisor { static _instance; constructor() { super(); if (MCPCompatibilityLayer._instance) return MCPCompatibilityLayer._instance; MCPCompatibilityLayer._instance = this; } /** * Get all of the active MCP s...
javascript
MIT
e287fab56089cf8fcea9ba579a3ecdeca0daa313
2026-01-04T14:57:11.963777Z
false
Mintplex-Labs/anything-llm
https://github.com/Mintplex-Labs/anything-llm/blob/e287fab56089cf8fcea9ba579a3ecdeca0daa313/server/utils/MCP/hypervisor/index.js
server/utils/MCP/hypervisor/index.js
const { safeJsonParse } = require("../../http"); const path = require("path"); const fs = require("fs"); const { Client } = require("@modelcontextprotocol/sdk/client/index.js"); const { StdioClientTransport, } = require("@modelcontextprotocol/sdk/client/stdio.js"); const { SSEClientTransport, } = require("@modelcon...
javascript
MIT
e287fab56089cf8fcea9ba579a3ecdeca0daa313
2026-01-04T14:57:11.963777Z
false
Mintplex-Labs/anything-llm
https://github.com/Mintplex-Labs/anything-llm/blob/e287fab56089cf8fcea9ba579a3ecdeca0daa313/server/utils/prisma/index.js
server/utils/prisma/index.js
const { PrismaClient } = require("@prisma/client"); // npx prisma introspect // npx prisma generate // npx prisma migrate dev --name init -> ensures that db is in sync with schema // npx prisma migrate reset -> resets the db const logLevels = ["error", "info", "warn"]; // add "query" to debug query logs const prisma ...
javascript
MIT
e287fab56089cf8fcea9ba579a3ecdeca0daa313
2026-01-04T14:57:11.963777Z
false
Mintplex-Labs/anything-llm
https://github.com/Mintplex-Labs/anything-llm/blob/e287fab56089cf8fcea9ba579a3ecdeca0daa313/server/utils/boot/eagerLoadContextWindows.js
server/utils/boot/eagerLoadContextWindows.js
/** * Eagerly load the context windows for the current provider. * This is done to ensure that the context windows are pre-cached when the server boots. * * This prevents us from having misreporting of the context window before a chat is ever sent. * eg: when viewing the attachments in the workspace - the context ...
javascript
MIT
e287fab56089cf8fcea9ba579a3ecdeca0daa313
2026-01-04T14:57:11.963777Z
false
Mintplex-Labs/anything-llm
https://github.com/Mintplex-Labs/anything-llm/blob/e287fab56089cf8fcea9ba579a3ecdeca0daa313/server/utils/boot/index.js
server/utils/boot/index.js
const { Telemetry } = require("../../models/telemetry"); const { BackgroundService } = require("../BackgroundWorkers"); const { EncryptionManager } = require("../EncryptionManager"); const { CommunicationKey } = require("../comKey"); const setupTelemetry = require("../telemetry"); const eagerLoadContextWindows = requir...
javascript
MIT
e287fab56089cf8fcea9ba579a3ecdeca0daa313
2026-01-04T14:57:11.963777Z
false
Mintplex-Labs/anything-llm
https://github.com/Mintplex-Labs/anything-llm/blob/e287fab56089cf8fcea9ba579a3ecdeca0daa313/server/utils/boot/MetaGenerator.js
server/utils/boot/MetaGenerator.js
/** * @typedef MetaTagDefinition * @property {('link'|'meta')} tag - the type of meta tag element * @property {{string:string}|null} props - the inner key/values of a meta tag * @property {string|null} content - Text content to be injected between tags. If null self-closing. */ /** * This class serves the defaul...
javascript
MIT
e287fab56089cf8fcea9ba579a3ecdeca0daa313
2026-01-04T14:57:11.963777Z
false
Mintplex-Labs/anything-llm
https://github.com/Mintplex-Labs/anything-llm/blob/e287fab56089cf8fcea9ba579a3ecdeca0daa313/server/utils/database/index.js
server/utils/database/index.js
const { getGitVersion } = require("../../endpoints/utils"); const { Telemetry } = require("../../models/telemetry"); function checkColumnTemplate(tablename = null, column = null) { if (!tablename || !column) throw new Error(`Migration Error`, { tablename, column }); return `SELECT COUNT(*) AS _exists FROM prag...
javascript
MIT
e287fab56089cf8fcea9ba579a3ecdeca0daa313
2026-01-04T14:57:11.963777Z
false
Mintplex-Labs/anything-llm
https://github.com/Mintplex-Labs/anything-llm/blob/e287fab56089cf8fcea9ba579a3ecdeca0daa313/server/utils/collectorApi/index.js
server/utils/collectorApi/index.js
const { EncryptionManager } = require("../EncryptionManager"); const { Agent } = require("undici"); /** * @typedef {Object} CollectorOptions * @property {string} whisperProvider - The provider to use for whisper, defaults to "local" * @property {string} WhisperModelPref - The model to use for whisper if set. * @pr...
javascript
MIT
e287fab56089cf8fcea9ba579a3ecdeca0daa313
2026-01-04T14:57:11.963777Z
false
Mintplex-Labs/anything-llm
https://github.com/Mintplex-Labs/anything-llm/blob/e287fab56089cf8fcea9ba579a3ecdeca0daa313/server/utils/EmbeddingEngines/native/index.js
server/utils/EmbeddingEngines/native/index.js
const path = require("path"); const fs = require("fs"); const { toChunks } = require("../../helpers"); const { v4 } = require("uuid"); const { SUPPORTED_NATIVE_EMBEDDING_MODELS } = require("./constants"); class NativeEmbedder { static defaultModel = "Xenova/all-MiniLM-L6-v2"; /** * Supported embedding models f...
javascript
MIT
e287fab56089cf8fcea9ba579a3ecdeca0daa313
2026-01-04T14:57:11.963777Z
false
Mintplex-Labs/anything-llm
https://github.com/Mintplex-Labs/anything-llm/blob/e287fab56089cf8fcea9ba579a3ecdeca0daa313/server/utils/EmbeddingEngines/native/constants.js
server/utils/EmbeddingEngines/native/constants.js
const SUPPORTED_NATIVE_EMBEDDING_MODELS = { "Xenova/all-MiniLM-L6-v2": { maxConcurrentChunks: 25, // Right now, this is NOT the token length, and is instead the number of characters // that can be processed in a single pass. So we override to 1,000 characters. // roughtly the max number of tokens assu...
javascript
MIT
e287fab56089cf8fcea9ba579a3ecdeca0daa313
2026-01-04T14:57:11.963777Z
false
Mintplex-Labs/anything-llm
https://github.com/Mintplex-Labs/anything-llm/blob/e287fab56089cf8fcea9ba579a3ecdeca0daa313/server/utils/EmbeddingEngines/cohere/index.js
server/utils/EmbeddingEngines/cohere/index.js
const { toChunks } = require("../../helpers"); class CohereEmbedder { constructor() { if (!process.env.COHERE_API_KEY) throw new Error("No Cohere API key was set."); const { CohereClient } = require("cohere-ai"); const cohere = new CohereClient({ token: process.env.COHERE_API_KEY, }); ...
javascript
MIT
e287fab56089cf8fcea9ba579a3ecdeca0daa313
2026-01-04T14:57:11.963777Z
false
Mintplex-Labs/anything-llm
https://github.com/Mintplex-Labs/anything-llm/blob/e287fab56089cf8fcea9ba579a3ecdeca0daa313/server/utils/EmbeddingEngines/lmstudio/index.js
server/utils/EmbeddingEngines/lmstudio/index.js
const { parseLMStudioBasePath } = require("../../AiProviders/lmStudio"); const { maximumChunkLength } = require("../../helpers"); class LMStudioEmbedder { constructor() { if (!process.env.EMBEDDING_BASE_PATH) throw new Error("No embedding base path was set."); if (!process.env.EMBEDDING_MODEL_PREF) ...
javascript
MIT
e287fab56089cf8fcea9ba579a3ecdeca0daa313
2026-01-04T14:57:11.963777Z
false
Mintplex-Labs/anything-llm
https://github.com/Mintplex-Labs/anything-llm/blob/e287fab56089cf8fcea9ba579a3ecdeca0daa313/server/utils/EmbeddingEngines/localAi/index.js
server/utils/EmbeddingEngines/localAi/index.js
const { toChunks, maximumChunkLength } = require("../../helpers"); class LocalAiEmbedder { constructor() { if (!process.env.EMBEDDING_BASE_PATH) throw new Error("No embedding base path was set."); if (!process.env.EMBEDDING_MODEL_PREF) throw new Error("No embedding model was set."); const { ...
javascript
MIT
e287fab56089cf8fcea9ba579a3ecdeca0daa313
2026-01-04T14:57:11.963777Z
false
Mintplex-Labs/anything-llm
https://github.com/Mintplex-Labs/anything-llm/blob/e287fab56089cf8fcea9ba579a3ecdeca0daa313/server/utils/EmbeddingEngines/genericOpenAi/index.js
server/utils/EmbeddingEngines/genericOpenAi/index.js
const { toChunks, maximumChunkLength } = require("../../helpers"); class GenericOpenAiEmbedder { constructor() { if (!process.env.EMBEDDING_BASE_PATH) throw new Error( "GenericOpenAI must have a valid base path to use for the api." ); this.className = "GenericOpenAiEmbedder"; const { ...
javascript
MIT
e287fab56089cf8fcea9ba579a3ecdeca0daa313
2026-01-04T14:57:11.963777Z
false
Mintplex-Labs/anything-llm
https://github.com/Mintplex-Labs/anything-llm/blob/e287fab56089cf8fcea9ba579a3ecdeca0daa313/server/utils/EmbeddingEngines/openRouter/index.js
server/utils/EmbeddingEngines/openRouter/index.js
const { toChunks } = require("../../helpers"); class OpenRouterEmbedder { constructor() { if (!process.env.OPENROUTER_API_KEY) throw new Error("No OpenRouter API key was set."); this.className = "OpenRouterEmbedder"; const { OpenAI: OpenAIApi } = require("openai"); this.openai = new OpenAIApi({...
javascript
MIT
e287fab56089cf8fcea9ba579a3ecdeca0daa313
2026-01-04T14:57:11.963777Z
false
Mintplex-Labs/anything-llm
https://github.com/Mintplex-Labs/anything-llm/blob/e287fab56089cf8fcea9ba579a3ecdeca0daa313/server/utils/EmbeddingEngines/liteLLM/index.js
server/utils/EmbeddingEngines/liteLLM/index.js
const { toChunks, maximumChunkLength } = require("../../helpers"); class LiteLLMEmbedder { constructor() { const { OpenAI: OpenAIApi } = require("openai"); if (!process.env.LITE_LLM_BASE_PATH) throw new Error( "LiteLLM must have a valid base path to use for the api." ); this.basePath ...
javascript
MIT
e287fab56089cf8fcea9ba579a3ecdeca0daa313
2026-01-04T14:57:11.963777Z
false
Mintplex-Labs/anything-llm
https://github.com/Mintplex-Labs/anything-llm/blob/e287fab56089cf8fcea9ba579a3ecdeca0daa313/server/utils/EmbeddingEngines/azureOpenAi/index.js
server/utils/EmbeddingEngines/azureOpenAi/index.js
const { toChunks } = require("../../helpers"); class AzureOpenAiEmbedder { constructor() { const { AzureOpenAI } = require("openai"); if (!process.env.AZURE_OPENAI_ENDPOINT) throw new Error("No Azure API endpoint was set."); if (!process.env.AZURE_OPENAI_KEY) throw new Error("No Azure API key...
javascript
MIT
e287fab56089cf8fcea9ba579a3ecdeca0daa313
2026-01-04T14:57:11.963777Z
false
Mintplex-Labs/anything-llm
https://github.com/Mintplex-Labs/anything-llm/blob/e287fab56089cf8fcea9ba579a3ecdeca0daa313/server/utils/EmbeddingEngines/ollama/index.js
server/utils/EmbeddingEngines/ollama/index.js
const { maximumChunkLength } = require("../../helpers"); const { Ollama } = require("ollama"); class OllamaEmbedder { constructor() { if (!process.env.EMBEDDING_BASE_PATH) throw new Error("No embedding base path was set."); if (!process.env.EMBEDDING_MODEL_PREF) throw new Error("No embedding mode...
javascript
MIT
e287fab56089cf8fcea9ba579a3ecdeca0daa313
2026-01-04T14:57:11.963777Z
false
Mintplex-Labs/anything-llm
https://github.com/Mintplex-Labs/anything-llm/blob/e287fab56089cf8fcea9ba579a3ecdeca0daa313/server/utils/EmbeddingEngines/openAi/index.js
server/utils/EmbeddingEngines/openAi/index.js
const { toChunks } = require("../../helpers"); class OpenAiEmbedder { constructor() { if (!process.env.OPEN_AI_KEY) throw new Error("No OpenAI API key was set."); this.className = "OpenAiEmbedder"; const { OpenAI: OpenAIApi } = require("openai"); this.openai = new OpenAIApi({ apiKey: process.en...
javascript
MIT
e287fab56089cf8fcea9ba579a3ecdeca0daa313
2026-01-04T14:57:11.963777Z
false
Mintplex-Labs/anything-llm
https://github.com/Mintplex-Labs/anything-llm/blob/e287fab56089cf8fcea9ba579a3ecdeca0daa313/server/utils/EmbeddingEngines/mistral/index.js
server/utils/EmbeddingEngines/mistral/index.js
class MistralEmbedder { constructor() { if (!process.env.MISTRAL_API_KEY) throw new Error("No Mistral API key was set."); const { OpenAI: OpenAIApi } = require("openai"); this.openai = new OpenAIApi({ baseURL: "https://api.mistral.ai/v1", apiKey: process.env.MISTRAL_API_KEY ?? null, ...
javascript
MIT
e287fab56089cf8fcea9ba579a3ecdeca0daa313
2026-01-04T14:57:11.963777Z
false
Mintplex-Labs/anything-llm
https://github.com/Mintplex-Labs/anything-llm/blob/e287fab56089cf8fcea9ba579a3ecdeca0daa313/server/utils/EmbeddingEngines/voyageAi/index.js
server/utils/EmbeddingEngines/voyageAi/index.js
class VoyageAiEmbedder { constructor() { if (!process.env.VOYAGEAI_API_KEY) throw new Error("No Voyage AI API key was set."); const { VoyageEmbeddings, } = require("@langchain/community/embeddings/voyage"); this.model = process.env.EMBEDDING_MODEL_PREF || "voyage-3-lite"; this.voyage...
javascript
MIT
e287fab56089cf8fcea9ba579a3ecdeca0daa313
2026-01-04T14:57:11.963777Z
false
Mintplex-Labs/anything-llm
https://github.com/Mintplex-Labs/anything-llm/blob/e287fab56089cf8fcea9ba579a3ecdeca0daa313/server/utils/EmbeddingEngines/gemini/index.js
server/utils/EmbeddingEngines/gemini/index.js
const { toChunks } = require("../../helpers"); const MODEL_MAP = { "embedding-001": 2048, "text-embedding-004": 2048, "gemini-embedding-exp-03-07": 8192, }; class GeminiEmbedder { constructor() { if (!process.env.GEMINI_EMBEDDING_API_KEY) throw new Error("No Gemini API key was set."); this.clas...
javascript
MIT
e287fab56089cf8fcea9ba579a3ecdeca0daa313
2026-01-04T14:57:11.963777Z
false
Mintplex-Labs/anything-llm
https://github.com/Mintplex-Labs/anything-llm/blob/e287fab56089cf8fcea9ba579a3ecdeca0daa313/server/utils/EmbeddingRerankers/native/index.js
server/utils/EmbeddingRerankers/native/index.js
const path = require("path"); const fs = require("fs"); class NativeEmbeddingReranker { static #model = null; static #tokenizer = null; static #transformers = null; static #initializationPromise = null; // This is a folder that Mintplex Labs hosts for those who cannot capture the HF model download // endp...
javascript
MIT
e287fab56089cf8fcea9ba579a3ecdeca0daa313
2026-01-04T14:57:11.963777Z
false
Mintplex-Labs/anything-llm
https://github.com/Mintplex-Labs/anything-llm/blob/e287fab56089cf8fcea9ba579a3ecdeca0daa313/server/utils/telemetry/index.js
server/utils/telemetry/index.js
const { getGitVersion } = require("../../endpoints/utils"); const { Telemetry } = require("../../models/telemetry"); // Telemetry is anonymized and your data is never read. This can be disabled by setting // DISABLE_TELEMETRY=true in the `.env` of however you setup. Telemetry helps us determine use // of how AnythingL...
javascript
MIT
e287fab56089cf8fcea9ba579a3ecdeca0daa313
2026-01-04T14:57:11.963777Z
false
Mintplex-Labs/anything-llm
https://github.com/Mintplex-Labs/anything-llm/blob/e287fab56089cf8fcea9ba579a3ecdeca0daa313/server/utils/http/index.js
server/utils/http/index.js
process.env.NODE_ENV === "development" ? require("dotenv").config({ path: `.env.${process.env.NODE_ENV}` }) : require("dotenv").config(); const JWT = require("jsonwebtoken"); const { User } = require("../../models/user"); const { jsonrepair } = require("jsonrepair"); const extract = require("extract-json-from-strin...
javascript
MIT
e287fab56089cf8fcea9ba579a3ecdeca0daa313
2026-01-04T14:57:11.963777Z
false
Mintplex-Labs/anything-llm
https://github.com/Mintplex-Labs/anything-llm/blob/e287fab56089cf8fcea9ba579a3ecdeca0daa313/server/utils/TextSplitter/index.js
server/utils/TextSplitter/index.js
/** * @typedef {object} DocumentMetadata * @property {string} id - eg; "123e4567-e89b-12d3-a456-426614174000" * @property {string} url - eg; "file://example.com/index.html" * @property {string} title - eg; "example.com/index.html" * @property {string} docAuthor - eg; "no author found" * @property {string} descrip...
javascript
MIT
e287fab56089cf8fcea9ba579a3ecdeca0daa313
2026-01-04T14:57:11.963777Z
false
Mintplex-Labs/anything-llm
https://github.com/Mintplex-Labs/anything-llm/blob/e287fab56089cf8fcea9ba579a3ecdeca0daa313/server/__tests__/models/systemPromptVariables.test.js
server/__tests__/models/systemPromptVariables.test.js
const { SystemPromptVariables } = require("../../models/systemPromptVariables"); const prisma = require("../../utils/prisma"); const mockUser = { id: 1, username: "john.doe", bio: "I am a test user", }; const mockWorkspace = { id: 1, name: "Test Workspace", slug: 'test-workspace', }; const mockSystemProm...
javascript
MIT
e287fab56089cf8fcea9ba579a3ecdeca0daa313
2026-01-04T14:57:11.963777Z
false
Mintplex-Labs/anything-llm
https://github.com/Mintplex-Labs/anything-llm/blob/e287fab56089cf8fcea9ba579a3ecdeca0daa313/server/__tests__/utils/helpers/convertTo.test.js
server/__tests__/utils/helpers/convertTo.test.js
/* eslint-env jest */ const { prepareChatsForExport } = require("../../../utils/helpers/chat/convertTo"); // Mock the database models jest.mock("../../../models/workspaceChats"); jest.mock("../../../models/embedChats"); const { WorkspaceChats } = require("../../../models/workspaceChats"); const { EmbedChats } = requi...
javascript
MIT
e287fab56089cf8fcea9ba579a3ecdeca0daa313
2026-01-04T14:57:11.963777Z
false
Mintplex-Labs/anything-llm
https://github.com/Mintplex-Labs/anything-llm/blob/e287fab56089cf8fcea9ba579a3ecdeca0daa313/server/__tests__/utils/agents/defaults.test.js
server/__tests__/utils/agents/defaults.test.js
// Set required env vars before requiring modules process.env.STORAGE_DIR = __dirname; process.env.NODE_ENV = "test"; const { SystemPromptVariables } = require("../../../models/systemPromptVariables"); const Provider = require("../../../utils/agents/aibitat/providers/ai-provider"); jest.mock("../../../models/systemPr...
javascript
MIT
e287fab56089cf8fcea9ba579a3ecdeca0daa313
2026-01-04T14:57:11.963777Z
false
Mintplex-Labs/anything-llm
https://github.com/Mintplex-Labs/anything-llm/blob/e287fab56089cf8fcea9ba579a3ecdeca0daa313/server/__tests__/utils/agents/aibitat/providers/helpers/untooled.test.js
server/__tests__/utils/agents/aibitat/providers/helpers/untooled.test.js
const UnTooled = require("../../../../../../utils/agents/aibitat/providers/helpers/untooled"); describe("UnTooled: validFuncCall", () => { const untooled = new UnTooled(); const validFunc = { "name": "brave-search-brave_web_search", "description": "Example function", "parameters": { "$schema": "h...
javascript
MIT
e287fab56089cf8fcea9ba579a3ecdeca0daa313
2026-01-04T14:57:11.963777Z
false
Mintplex-Labs/anything-llm
https://github.com/Mintplex-Labs/anything-llm/blob/e287fab56089cf8fcea9ba579a3ecdeca0daa313/server/__tests__/utils/agentFlows/executor.test.js
server/__tests__/utils/agentFlows/executor.test.js
const { FlowExecutor } = require("../../../utils/agentFlows/executor"); describe("FlowExecutor: getValueFromPath", () => { const executor = new FlowExecutor(); it("can handle invalid objects", () => { expect(executor.getValueFromPath(null, "a.b.c")).toBe(""); expect(executor.getValueFromPath(undefined, "a...
javascript
MIT
e287fab56089cf8fcea9ba579a3ecdeca0daa313
2026-01-04T14:57:11.963777Z
false
Mintplex-Labs/anything-llm
https://github.com/Mintplex-Labs/anything-llm/blob/e287fab56089cf8fcea9ba579a3ecdeca0daa313/server/__tests__/utils/vectorDbProviders/pgvector/index.test.js
server/__tests__/utils/vectorDbProviders/pgvector/index.test.js
const { PGVector } = require("../../../../utils/vectorDbProviders/pgvector"); describe("PGVector.sanitizeForJsonb", () => { it("returns null/undefined as-is", () => { expect(PGVector.sanitizeForJsonb(null)).toBeNull(); expect(PGVector.sanitizeForJsonb(undefined)).toBeUndefined(); }); it("keeps safe whit...
javascript
MIT
e287fab56089cf8fcea9ba579a3ecdeca0daa313
2026-01-04T14:57:11.963777Z
false
Mintplex-Labs/anything-llm
https://github.com/Mintplex-Labs/anything-llm/blob/e287fab56089cf8fcea9ba579a3ecdeca0daa313/server/__tests__/utils/SQLConnectors/connectionParser.test.js
server/__tests__/utils/SQLConnectors/connectionParser.test.js
/* eslint-env jest */ const { ConnectionStringParser } = require("../../../utils/agents/aibitat/plugins/sql-agent/SQLConnectors/utils"); describe("ConnectionStringParser", () => { describe("Basic Parsing", () => { test("should parse a basic connection string without options", () => { const parser = new Con...
javascript
MIT
e287fab56089cf8fcea9ba579a3ecdeca0daa313
2026-01-04T14:57:11.963777Z
false
Mintplex-Labs/anything-llm
https://github.com/Mintplex-Labs/anything-llm/blob/e287fab56089cf8fcea9ba579a3ecdeca0daa313/server/__tests__/utils/chats/openaiHelpers.test.js
server/__tests__/utils/chats/openaiHelpers.test.js
/* eslint-env jest, node */ const { extractTextContent, extractAttachments } = require('../../../endpoints/api/openai/helpers'); describe('OpenAI Helper Functions', () => { describe('extractTextContent', () => { test('should return string content as-is when not an array', () => { const content = 'Hello wor...
javascript
MIT
e287fab56089cf8fcea9ba579a3ecdeca0daa313
2026-01-04T14:57:11.963777Z
false
Mintplex-Labs/anything-llm
https://github.com/Mintplex-Labs/anything-llm/blob/e287fab56089cf8fcea9ba579a3ecdeca0daa313/server/__tests__/utils/chats/openaiCompatible.test.js
server/__tests__/utils/chats/openaiCompatible.test.js
/* eslint-env jest, node */ const { OpenAICompatibleChat } = require('../../../utils/chats/openaiCompatible'); const { WorkspaceChats } = require('../../../models/workspaceChats'); const { getVectorDbClass, getLLMProvider } = require('../../../utils/helpers'); const { extractTextContent, extractAttachments } = require(...
javascript
MIT
e287fab56089cf8fcea9ba579a3ecdeca0daa313
2026-01-04T14:57:11.963777Z
false
Mintplex-Labs/anything-llm
https://github.com/Mintplex-Labs/anything-llm/blob/e287fab56089cf8fcea9ba579a3ecdeca0daa313/server/__tests__/utils/safeJSONStringify/safeJSONStringify.test.js
server/__tests__/utils/safeJSONStringify/safeJSONStringify.test.js
/* eslint-env jest */ const { safeJSONStringify } = require("../../../utils/helpers/chat/responses"); describe("safeJSONStringify", () => { test("handles regular objects without BigInt", () => { const obj = { a: 1, b: "test", c: true, d: null }; expect(safeJSONStringify(obj)).toBe(JSON.stringify(obj)); });...
javascript
MIT
e287fab56089cf8fcea9ba579a3ecdeca0daa313
2026-01-04T14:57:11.963777Z
false
Mintplex-Labs/anything-llm
https://github.com/Mintplex-Labs/anything-llm/blob/e287fab56089cf8fcea9ba579a3ecdeca0daa313/server/__tests__/utils/TextSplitter/index.test.js
server/__tests__/utils/TextSplitter/index.test.js
const { TextSplitter } = require("../../../utils/TextSplitter"); const _ = require("lodash"); describe("TextSplitter", () => { test("should split long text into n sized chunks", async () => { const text = "This is a test text to be split into chunks".repeat(2); const textSplitter = new TextSplitter({ c...
javascript
MIT
e287fab56089cf8fcea9ba579a3ecdeca0daa313
2026-01-04T14:57:11.963777Z
false
Mintplex-Labs/anything-llm
https://github.com/Mintplex-Labs/anything-llm/blob/e287fab56089cf8fcea9ba579a3ecdeca0daa313/server/prisma/seed.js
server/prisma/seed.js
const { PrismaClient } = require("@prisma/client"); const prisma = new PrismaClient(); async function main() { const settings = [ { label: "multi_user_mode", value: "false" }, { label: "logo_filename", value: "anything-llm.png" }, ]; for (let setting of settings) { const existing = await prisma.syst...
javascript
MIT
e287fab56089cf8fcea9ba579a3ecdeca0daa313
2026-01-04T14:57:11.963777Z
false
marktext/marktext
https://github.com/marktext/marktext/blob/aa71e33e07845419533d767ad0d260a7c267cec7/.eslintrc.js
.eslintrc.js
module.exports = { root: true, parserOptions: { parser: '@babel/eslint-parser', ecmaVersion: 11, ecmaFeatures: { impliedStrict: true }, sourceType: 'module' }, env: { browser: true, es6: true, node: true }, extends: [ 'standard', 'eslint:recommended', 'plugi...
javascript
MIT
aa71e33e07845419533d767ad0d260a7c267cec7
2026-01-04T14:57:09.944492Z
false
marktext/marktext
https://github.com/marktext/marktext/blob/aa71e33e07845419533d767ad0d260a7c267cec7/babel.config.js
babel.config.js
const proposalClassProperties = require('@babel/plugin-proposal-class-properties') const syntaxClassProperties = require('@babel/plugin-syntax-class-properties') const transformRuntime = require('@babel/plugin-transform-runtime') const syntaxDynamicImport = require('@babel/plugin-syntax-dynamic-import') const functionB...
javascript
MIT
aa71e33e07845419533d767ad0d260a7c267cec7
2026-01-04T14:57:09.944492Z
false
marktext/marktext
https://github.com/marktext/marktext/blob/aa71e33e07845419533d767ad0d260a7c267cec7/vetur.config.js
vetur.config.js
module.exports = { projects: [ { root: './src/renderer', package: '../../package.json', tsconfig: './jsconfig.json' } ] }
javascript
MIT
aa71e33e07845419533d767ad0d260a7c267cec7
2026-01-04T14:57:09.944492Z
false
marktext/marktext
https://github.com/marktext/marktext/blob/aa71e33e07845419533d767ad0d260a7c267cec7/tools/validateLicenses.js
tools/validateLicenses.js
'use strict' const path = require('path') const thirdPartyChecker = require('../.electron-vue/thirdPartyChecker.js') const rootDir = path.resolve(__dirname, '..') thirdPartyChecker.validateLicenses(rootDir)
javascript
MIT
aa71e33e07845419533d767ad0d260a7c267cec7
2026-01-04T14:57:09.944492Z
false
marktext/marktext
https://github.com/marktext/marktext/blob/aa71e33e07845419533d767ad0d260a7c267cec7/tools/deobfuscateStackTrace.js
tools/deobfuscateStackTrace.js
const fs = require('fs') const readline = require('readline') const arg = require('arg') const sourceMap = require('source-map') const stackTraceParser = require('stacktrace-parser') const spec = { '--map': String, '-m': '--map' } const args = arg(spec, { argv: process.argv.slice(1), permissive: true }) const mapP...
javascript
MIT
aa71e33e07845419533d767ad0d260a7c267cec7
2026-01-04T14:57:09.944492Z
false
marktext/marktext
https://github.com/marktext/marktext/blob/aa71e33e07845419533d767ad0d260a7c267cec7/tools/generateThirdPartyLicense.js
tools/generateThirdPartyLicense.js
'use strict' const path = require('path') const fs = require('fs') const thirdPartyChecker = require('../.electron-vue/thirdPartyChecker.js') const rootDir = path.resolve(__dirname, '..') const additionalPackages = { hunspell: { packageName: 'Hunspell', licenses: 'LGPL 2.1', licenseText: fs.readFileSync...
javascript
MIT
aa71e33e07845419533d767ad0d260a7c267cec7
2026-01-04T14:57:09.944492Z
false
marktext/marktext
https://github.com/marktext/marktext/blob/aa71e33e07845419533d767ad0d260a7c267cec7/src/renderer/main.js
src/renderer/main.js
import Vue from 'vue' import VueElectron from 'vue-electron' import sourceMapSupport from 'source-map-support' import bootstrapRenderer from './bootstrap' import VueRouter from 'vue-router' import lang from 'element-ui/lib/locale/lang/en' import locale from 'element-ui/lib/locale' import axios from './axios' import sto...
javascript
MIT
aa71e33e07845419533d767ad0d260a7c267cec7
2026-01-04T14:57:09.944492Z
false
marktext/marktext
https://github.com/marktext/marktext/blob/aa71e33e07845419533d767ad0d260a7c267cec7/src/renderer/config.js
src/renderer/config.js
import path from 'path' export const PATH_SEPARATOR = path.sep export const THEME_STYLE_ID = 'ag-theme' export const COMMON_STYLE_ID = 'ag-common-style' export const DEFAULT_EDITOR_FONT_FAMILY = '"Open Sans", "Clear Sans", "Helvetica Neue", Helvetica, Arial, sans-serif, Segoe UI Emoji, Apple Color Emoji, "Noto Color ...
javascript
MIT
aa71e33e07845419533d767ad0d260a7c267cec7
2026-01-04T14:57:09.944492Z
false
marktext/marktext
https://github.com/marktext/marktext/blob/aa71e33e07845419533d767ad0d260a7c267cec7/src/renderer/bootstrap.js
src/renderer/bootstrap.js
import path from 'path' import { ipcRenderer } from 'electron' import log from 'electron-log' import RendererPaths from './node/paths' let exceptionLogger = s => console.error(s) const configureLogger = () => { const { debug, paths, windowId } = global.marktext.env log.transports.console.level = process.env.NODE_...
javascript
MIT
aa71e33e07845419533d767ad0d260a7c267cec7
2026-01-04T14:57:09.944492Z
false
marktext/marktext
https://github.com/marktext/marktext/blob/aa71e33e07845419533d767ad0d260a7c267cec7/src/renderer/services/index.js
src/renderer/services/index.js
import notification from './notification' export default [ notification ]
javascript
MIT
aa71e33e07845419533d767ad0d260a7c267cec7
2026-01-04T14:57:09.944492Z
false
marktext/marktext
https://github.com/marktext/marktext/blob/aa71e33e07845419533d767ad0d260a7c267cec7/src/renderer/services/printService.js
src/renderer/services/printService.js
import { getImageInfo } from 'muya/lib/utils' class MarkdownPrint { /** * Prepare document export and append a hidden print container to the window. * * @param {string} html HTML string * @param {boolean} [renderStatic] Render for static files like PDF documents */ renderMarkdown (html, renderStatic...
javascript
MIT
aa71e33e07845419533d767ad0d260a7c267cec7
2026-01-04T14:57:09.944492Z
false
marktext/marktext
https://github.com/marktext/marktext/blob/aa71e33e07845419533d767ad0d260a7c267cec7/src/renderer/services/notification/index.js
src/renderer/services/notification/index.js
import template from './index.html' import { getUniqueId } from '../../util' import { sanitize, EXPORT_DOMPURIFY_CONFIG } from '../../util/dompurify' import './index.css' const INON_HASH = { primary: 'icon-message', error: 'icon-error', warning: 'icon-warn', info: 'icon-info' } const TYPE_HASH = { primary: '...
javascript
MIT
aa71e33e07845419533d767ad0d260a7c267cec7
2026-01-04T14:57:09.944492Z
false
marktext/marktext
https://github.com/marktext/marktext/blob/aa71e33e07845419533d767ad0d260a7c267cec7/src/renderer/util/pdf.js
src/renderer/util/pdf.js
import fs from 'fs' import path from 'path' import Slugger from 'muya/lib/parser/marked/slugger' import { isFile } from 'common/filesystem' import { escapeHTML, unescapeHTML } from 'muya/lib/utils' import academicTheme from '@/assets/themes/export/academic.theme.css' import liberTheme from '@/assets/themes/export/liber...
javascript
MIT
aa71e33e07845419533d767ad0d260a7c267cec7
2026-01-04T14:57:09.944492Z
false
marktext/marktext
https://github.com/marktext/marktext/blob/aa71e33e07845419533d767ad0d260a7c267cec7/src/renderer/util/markdownToHtml.js
src/renderer/util/markdownToHtml.js
import ExportHtml from 'muya/lib/utils/exportHtml' const markdownToHtml = async markdown => { const html = await new ExportHtml(markdown).renderHtml() return `<article class="markdown-body">${html}</article>` } export default markdownToHtml
javascript
MIT
aa71e33e07845419533d767ad0d260a7c267cec7
2026-01-04T14:57:09.944492Z
false
marktext/marktext
https://github.com/marktext/marktext/blob/aa71e33e07845419533d767ad0d260a7c267cec7/src/renderer/util/themeColor.js
src/renderer/util/themeColor.js
import darkTheme from '../assets/themes/dark.theme.css' import graphiteTheme from '../assets/themes/graphite.theme.css' import materialDarkTheme from '../assets/themes/material-dark.theme.css' import oneDarkTheme from '../assets/themes/one-dark.theme.css' import ulyssesTheme from '../assets/themes/ulysses.theme.css' i...
javascript
MIT
aa71e33e07845419533d767ad0d260a7c267cec7
2026-01-04T14:57:09.944492Z
false
marktext/marktext
https://github.com/marktext/marktext/blob/aa71e33e07845419533d767ad0d260a7c267cec7/src/renderer/util/index.js
src/renderer/util/index.js
export const delay = time => { let timerId let rejectFn const p = new Promise((resolve, reject) => { rejectFn = reject timerId = setTimeout(() => { p.cancel = () => {} rejectFn = null resolve() }, time) }) p.cancel = () => { clearTimeout(timerId) timerId = null rejec...
javascript
MIT
aa71e33e07845419533d767ad0d260a7c267cec7
2026-01-04T14:57:09.944492Z
false
marktext/marktext
https://github.com/marktext/marktext/blob/aa71e33e07845419533d767ad0d260a7c267cec7/src/renderer/util/listToTree.js
src/renderer/util/listToTree.js
class Node { constructor (item) { const { parent, lvl, content, slug } = item this.parent = parent this.lvl = lvl this.label = content this.slug = slug this.children = [] } // Add child node. addChild (node) { this.children.push(node) } } const findParent = (item, lastNode, rootN...
javascript
MIT
aa71e33e07845419533d767ad0d260a7c267cec7
2026-01-04T14:57:09.944492Z
false
marktext/marktext
https://github.com/marktext/marktext/blob/aa71e33e07845419533d767ad0d260a7c267cec7/src/renderer/util/theme.js
src/renderer/util/theme.js
import { THEME_STYLE_ID, COMMON_STYLE_ID, DEFAULT_CODE_FONT_FAMILY, oneDarkThemes, railscastsThemes } from '../config' import { dark, graphite, materialDark, oneDark, ulysses } from './themeColor' import { isLinux } from './index' import elementStyle from 'element-ui/lib/theme-chalk/index.css' const ORIGINAL_THEME = '...
javascript
MIT
aa71e33e07845419533d767ad0d260a7c267cec7
2026-01-04T14:57:09.944492Z
false
marktext/marktext
https://github.com/marktext/marktext/blob/aa71e33e07845419533d767ad0d260a7c267cec7/src/renderer/util/fileSystem.js
src/renderer/util/fileSystem.js
import path from 'path' import crypto from 'crypto' import fs from 'fs-extra' import { statSync, constants } from 'fs' import cp from 'child_process' import { tmpdir } from 'os' import dayjs from 'dayjs' import { Octokit } from '@octokit/rest' import { isImageFile } from 'common/filesystem/paths' import { isWindows } f...
javascript
MIT
aa71e33e07845419533d767ad0d260a7c267cec7
2026-01-04T14:57:09.944492Z
false
marktext/marktext
https://github.com/marktext/marktext/blob/aa71e33e07845419533d767ad0d260a7c267cec7/src/renderer/util/clipboard.js
src/renderer/util/clipboard.js
import { isLinux, isOsx, isWindows } from './index' import plist from 'plist' import { clipboard as remoteClipboard } from '@electron/remote' const hasClipboardFiles = () => { return remoteClipboard.has('NSFilenamesPboardType') } const getClipboardFiles = () => { if (!hasClipboardFiles()) { return [] } return p...
javascript
MIT
aa71e33e07845419533d767ad0d260a7c267cec7
2026-01-04T14:57:09.944492Z
false
marktext/marktext
https://github.com/marktext/marktext/blob/aa71e33e07845419533d767ad0d260a7c267cec7/src/renderer/util/dompurify.js
src/renderer/util/dompurify.js
import runSanitize from 'muya/lib/utils/dompurify' export const PREVIEW_DOMPURIFY_CONFIG = Object.freeze({ FORBID_ATTR: ['style', 'contenteditable'], ALLOW_DATA_ATTR: false, USE_PROFILES: { html: true, svg: true, svgFilters: true, mathMl: false }, RETURN_TRUSTED_TYPE: false }) export const E...
javascript
MIT
aa71e33e07845419533d767ad0d260a7c267cec7
2026-01-04T14:57:09.944492Z
false
marktext/marktext
https://github.com/marktext/marktext/blob/aa71e33e07845419533d767ad0d260a7c267cec7/src/renderer/util/day.js
src/renderer/util/day.js
import dayjs from 'dayjs/esm' import relativeTime from 'dayjs/esm/plugin/relativeTime' // `en` is a built in locale. no need to import it. // import 'dayjs/esm/locale/en' // load on demand // dayjs.locale('en') // use en locale globally dayjs.extend(relativeTime) export default dayjs
javascript
MIT
aa71e33e07845419533d767ad0d260a7c267cec7
2026-01-04T14:57:09.944492Z
false
marktext/marktext
https://github.com/marktext/marktext/blob/aa71e33e07845419533d767ad0d260a7c267cec7/src/renderer/node/ripgrepSearcher.js
src/renderer/node/ripgrepSearcher.js
// Modified version of https://github.com/atom/atom/blob/master/src/ripgrep-directory-searcher.js // // Copyright (c) 2011-2019 GitHub Inc. // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Softwa...
javascript
MIT
aa71e33e07845419533d767ad0d260a7c267cec7
2026-01-04T14:57:09.944492Z
false
marktext/marktext
https://github.com/marktext/marktext/blob/aa71e33e07845419533d767ad0d260a7c267cec7/src/renderer/node/fileSearcher.js
src/renderer/node/fileSearcher.js
import { spawn } from 'child_process' import RipgrepDirectorySearcher from './ripgrepSearcher' // Use ripgrep searcher to search for files on disk only. class FileSearcher extends RipgrepDirectorySearcher { searchInDirectory (directoryPath, pattern, options, numPathsFound) { const args = ['--files'] if (opt...
javascript
MIT
aa71e33e07845419533d767ad0d260a7c267cec7
2026-01-04T14:57:09.944492Z
false
marktext/marktext
https://github.com/marktext/marktext/blob/aa71e33e07845419533d767ad0d260a7c267cec7/src/renderer/node/paths.js
src/renderer/node/paths.js
import { rgPath } from 'vscode-ripgrep' import EnvPaths from 'common/envPaths' // // "vscode-ripgrep" is unpacked out of asar because of the binary. const rgDiskPath = rgPath.replace(/\bapp\.asar\b/, 'app.asar.unpacked') class RendererPaths extends EnvPaths { /** * Configure and sets all application paths. * ...
javascript
MIT
aa71e33e07845419533d767ad0d260a7c267cec7
2026-01-04T14:57:09.944492Z
false
marktext/marktext
https://github.com/marktext/marktext/blob/aa71e33e07845419533d767ad0d260a7c267cec7/src/renderer/store/help.js
src/renderer/store/help.js
import { getUniqueId, cloneObj } from '../util' /** * Default internel markdown document with editor options. * * @type {IDocumentState} Internel markdown document */ export const defaultFileState = { // Indicates whether there are unsaved changes. isSaved: true, // Full path to the file or empty. If the val...
javascript
MIT
aa71e33e07845419533d767ad0d260a7c267cec7
2026-01-04T14:57:09.944492Z
false
marktext/marktext
https://github.com/marktext/marktext/blob/aa71e33e07845419533d767ad0d260a7c267cec7/src/renderer/store/treeCtrl.js
src/renderer/store/treeCtrl.js
import path from 'path' import { getUniqueId } from '../util' import { PATH_SEPARATOR } from '../config' /** * Return all sub-directories relative to the root directory. * * @param {string} rootPath Root directory path * @param {string} pathname Full directory path * @returns {Array<string>} Sub-directories relat...
javascript
MIT
aa71e33e07845419533d767ad0d260a7c267cec7
2026-01-04T14:57:09.944492Z
false
marktext/marktext
https://github.com/marktext/marktext/blob/aa71e33e07845419533d767ad0d260a7c267cec7/src/renderer/store/commandCenter.js
src/renderer/store/commandCenter.js
import { ipcRenderer } from 'electron' import log from 'electron-log' import bus from '../bus' import staticCommands, { RootCommand } from '../commands' const state = { rootCommand: new RootCommand(staticCommands) } const getters = {} const mutations = { REGISTER_COMMAND (state, command) { state.rootCommand....
javascript
MIT
aa71e33e07845419533d767ad0d260a7c267cec7
2026-01-04T14:57:09.944492Z
false
marktext/marktext
https://github.com/marktext/marktext/blob/aa71e33e07845419533d767ad0d260a7c267cec7/src/renderer/store/editor.js
src/renderer/store/editor.js
import { clipboard, ipcRenderer, shell, webFrame } from 'electron' import path from 'path' import equal from 'fast-deep-equal' import { isSamePathSync } from 'common/filesystem/paths' import bus from '../bus' import { hasKeys, getUniqueId } from '../util' import listToTree from '../util/listToTree' import { createDocum...
javascript
MIT
aa71e33e07845419533d767ad0d260a7c267cec7
2026-01-04T14:57:09.944492Z
true
marktext/marktext
https://github.com/marktext/marktext/blob/aa71e33e07845419533d767ad0d260a7c267cec7/src/renderer/store/listenForMain.js
src/renderer/store/listenForMain.js
import { ipcRenderer } from 'electron' import bus from '../bus' const state = {} const getters = {} const mutations = {} const actions = { LISTEN_FOR_EDIT ({ commit }) { ipcRenderer.on('mt::editor-edit-action', (e, type) => { if (type === 'findInFolder') { commit('SET_LAYOUT', { rightC...
javascript
MIT
aa71e33e07845419533d767ad0d260a7c267cec7
2026-01-04T14:57:09.944492Z
false
marktext/marktext
https://github.com/marktext/marktext/blob/aa71e33e07845419533d767ad0d260a7c267cec7/src/renderer/store/index.js
src/renderer/store/index.js
import Vue from 'vue' import Vuex from 'vuex' import { ipcRenderer } from 'electron' import listenForMain from './listenForMain' import project from './project' import editor from './editor' import layout from './layout' import preferences from './preferences' import autoUpdates from './autoUpdates' import notificatio...
javascript
MIT
aa71e33e07845419533d767ad0d260a7c267cec7
2026-01-04T14:57:09.944492Z
false
marktext/marktext
https://github.com/marktext/marktext/blob/aa71e33e07845419533d767ad0d260a7c267cec7/src/renderer/store/preferences.js
src/renderer/store/preferences.js
import { ipcRenderer } from 'electron' import bus from '../bus' // user preference const state = { autoSave: false, autoSaveDelay: 5000, titleBarStyle: 'custom', openFilesInNewWindow: false, openFolderInNewWindow: false, zoom: 1.0, hideScrollbar: false, wordWrapInToc: false, fileSortBy: 'created', ...
javascript
MIT
aa71e33e07845419533d767ad0d260a7c267cec7
2026-01-04T14:57:09.944492Z
false
marktext/marktext
https://github.com/marktext/marktext/blob/aa71e33e07845419533d767ad0d260a7c267cec7/src/renderer/store/autoUpdates.js
src/renderer/store/autoUpdates.js
import { ipcRenderer } from 'electron' import notice from '../services/notification' const state = {} const getters = {} const mutations = {} // mt::UPDATE_DOWNLOADED const actions = { LISTEN_FOR_UPDATE ({ commit }) { ipcRenderer.on('mt::UPDATE_ERROR', (e, message) => { notice.notify({ title: 'U...
javascript
MIT
aa71e33e07845419533d767ad0d260a7c267cec7
2026-01-04T14:57:09.944492Z
false
marktext/marktext
https://github.com/marktext/marktext/blob/aa71e33e07845419533d767ad0d260a7c267cec7/src/renderer/store/layout.js
src/renderer/store/layout.js
import { ipcRenderer } from 'electron' import bus from '../bus' const width = localStorage.getItem('side-bar-width') const sideBarWidth = typeof +width === 'number' ? Math.max(+width, 220) : 280 // messages from main process, and do not change the state const state = { rightColumn: 'files', showSideBar: false, ...
javascript
MIT
aa71e33e07845419533d767ad0d260a7c267cec7
2026-01-04T14:57:09.944492Z
false
marktext/marktext
https://github.com/marktext/marktext/blob/aa71e33e07845419533d767ad0d260a7c267cec7/src/renderer/store/notification.js
src/renderer/store/notification.js
import { ipcRenderer, shell } from 'electron' import notice from '../services/notification' const state = {} const getters = {} const mutations = {} const actions = { LISTEN_FOR_NOTIFICATION ({ commit }) { const DEFAULT_OPTS = { title: 'Infomation', type: 'primary', time: 10000, messag...
javascript
MIT
aa71e33e07845419533d767ad0d260a7c267cec7
2026-01-04T14:57:09.944492Z
false
marktext/marktext
https://github.com/marktext/marktext/blob/aa71e33e07845419533d767ad0d260a7c267cec7/src/renderer/store/project.js
src/renderer/store/project.js
import path from 'path' import { ipcRenderer, shell } from 'electron' import { addFile, unlinkFile, addDirectory, unlinkDirectory } from './treeCtrl' import bus from '../bus' import { create, paste, rename } from '../util/fileSystem' import { PATH_SEPARATOR } from '../config' import notice from '../services/notificatio...
javascript
MIT
aa71e33e07845419533d767ad0d260a7c267cec7
2026-01-04T14:57:09.944492Z
false
marktext/marktext
https://github.com/marktext/marktext/blob/aa71e33e07845419533d767ad0d260a7c267cec7/src/renderer/store/tweet.js
src/renderer/store/tweet.js
import { ipcRenderer } from 'electron' import bus from '../bus' const state = {} const getters = {} const mutations = {} const actions = { LISTEN_FOR_TWEET () { ipcRenderer.on('mt::tweet', (e, type) => { if (type === 'twitter') { bus.$emit('tweetDialog') } }) } } export default { st...
javascript
MIT
aa71e33e07845419533d767ad0d260a7c267cec7
2026-01-04T14:57:09.944492Z
false
marktext/marktext
https://github.com/marktext/marktext/blob/aa71e33e07845419533d767ad0d260a7c267cec7/src/renderer/contextMenu/tabs/index.js
src/renderer/contextMenu/tabs/index.js
import { getCurrentWindow, Menu as RemoteMenu, MenuItem as RemoteMenuItem } from '@electron/remote' import { CLOSE_THIS, CLOSE_OTHERS, CLOSE_SAVED, CLOSE_ALL, SEPARATOR, RENAME, COPY_PATH, SHOW_IN_FOLDER } from './menuItems' export const showContextMenu = (event, tab) => { const menu = new RemoteMenu...
javascript
MIT
aa71e33e07845419533d767ad0d260a7c267cec7
2026-01-04T14:57:09.944492Z
false
marktext/marktext
https://github.com/marktext/marktext/blob/aa71e33e07845419533d767ad0d260a7c267cec7/src/renderer/contextMenu/tabs/menuItems.js
src/renderer/contextMenu/tabs/menuItems.js
import * as contextMenu from './actions' // NOTE: This are mutable fields that may change at runtime. export const SEPARATOR = { type: 'separator' } export const CLOSE_THIS = { label: 'Close', id: 'closeThisTab', click (menuItem, browserWindow) { contextMenu.closeThis(menuItem._tabId) } } export const...
javascript
MIT
aa71e33e07845419533d767ad0d260a7c267cec7
2026-01-04T14:57:09.944492Z
false
marktext/marktext
https://github.com/marktext/marktext/blob/aa71e33e07845419533d767ad0d260a7c267cec7/src/renderer/contextMenu/tabs/actions.js
src/renderer/contextMenu/tabs/actions.js
import bus from '../../bus' export const closeThis = (tabId) => { bus.$emit('TABS::close-this', tabId) } export const closeOthers = (tabId) => { bus.$emit('TABS::close-others', tabId) } export const closeSaved = () => { bus.$emit('TABS::close-saved') } export const closeAll = () => { bus.$emit('TABS::close-...
javascript
MIT
aa71e33e07845419533d767ad0d260a7c267cec7
2026-01-04T14:57:09.944492Z
false
marktext/marktext
https://github.com/marktext/marktext/blob/aa71e33e07845419533d767ad0d260a7c267cec7/src/renderer/contextMenu/sideBar/index.js
src/renderer/contextMenu/sideBar/index.js
import { getCurrentWindow, Menu as RemoteMenu, MenuItem as RemoteMenuItem } from '@electron/remote' import { SEPARATOR, NEW_FILE, NEW_DIRECTORY, COPY, CUT, PASTE, RENAME, DELETE, SHOW_IN_FOLDER } from './menuItems' export const showContextMenu = (event, hasPathCache) => { const menu = new RemoteMen...
javascript
MIT
aa71e33e07845419533d767ad0d260a7c267cec7
2026-01-04T14:57:09.944492Z
false
marktext/marktext
https://github.com/marktext/marktext/blob/aa71e33e07845419533d767ad0d260a7c267cec7/src/renderer/contextMenu/sideBar/menuItems.js
src/renderer/contextMenu/sideBar/menuItems.js
import * as contextMenu from './actions' // NOTE: This are mutable fields that may change at runtime. export const SEPARATOR = { type: 'separator' } export const NEW_FILE = { label: 'New File', id: 'newFileMenuItem', click (menuItem, browserWindow) { contextMenu.newFile() } } export const NEW_DIRECTOR...
javascript
MIT
aa71e33e07845419533d767ad0d260a7c267cec7
2026-01-04T14:57:09.944492Z
false
marktext/marktext
https://github.com/marktext/marktext/blob/aa71e33e07845419533d767ad0d260a7c267cec7/src/renderer/contextMenu/sideBar/actions.js
src/renderer/contextMenu/sideBar/actions.js
import bus from '../../bus' export const newFile = (menuItem, browserWindow) => { bus.$emit('SIDEBAR::new', 'file') } export const newDirectory = (menuItem, browserWindow) => { bus.$emit('SIDEBAR::new', 'directory') } export const copy = (menuItem, browserWindow) => { bus.$emit('SIDEBAR::copy-cut', 'copy') } ...
javascript
MIT
aa71e33e07845419533d767ad0d260a7c267cec7
2026-01-04T14:57:09.944492Z
false
marktext/marktext
https://github.com/marktext/marktext/blob/aa71e33e07845419533d767ad0d260a7c267cec7/src/renderer/commands/spellcheckerLanguage.js
src/renderer/commands/spellcheckerLanguage.js
import bus from '../bus' import notice from '@/services/notification' import { delay } from '@/util' import { SpellChecker } from '@/spellchecker' import { getLanguageName } from '@/spellchecker/languageMap' // Command to switch the spellchecker language class SpellcheckerLanguageCommand { constructor (spellchecker)...
javascript
MIT
aa71e33e07845419533d767ad0d260a7c267cec7
2026-01-04T14:57:09.944492Z
false
marktext/marktext
https://github.com/marktext/marktext/blob/aa71e33e07845419533d767ad0d260a7c267cec7/src/renderer/commands/index.js
src/renderer/commands/index.js
// List of all static commands that are loaded into command center. import { ipcRenderer, shell } from 'electron' import { getCurrentWindow } from '@electron/remote' import bus from '../bus' import { delay, isOsx } from '@/util' import { isUpdatable } from './utils' import getCommandDescriptionById from './descriptions...
javascript
MIT
aa71e33e07845419533d767ad0d260a7c267cec7
2026-01-04T14:57:09.944492Z
false
marktext/marktext
https://github.com/marktext/marktext/blob/aa71e33e07845419533d767ad0d260a7c267cec7/src/renderer/commands/trailingNewline.js
src/renderer/commands/trailingNewline.js
import { ipcRenderer } from 'electron' import { delay } from '@/util' import bus from '../bus' const descriptions = [ 'Trim all trailing newlines', 'Ensure single newline', 'Disabled' ] class TrailingNewlineCommand { constructor (editorState) { this.id = 'file.trailing-newline' this.description = 'Fil...
javascript
MIT
aa71e33e07845419533d767ad0d260a7c267cec7
2026-01-04T14:57:09.944492Z
false
marktext/marktext
https://github.com/marktext/marktext/blob/aa71e33e07845419533d767ad0d260a7c267cec7/src/renderer/commands/quickOpen.js
src/renderer/commands/quickOpen.js
import path from 'path' import { ipcRenderer } from 'electron' import { isChildOfDirectory, hasMarkdownExtension, MARKDOWN_INCLUSIONS } from '../../common/filesystem/paths' import bus from '../bus' import { delay } from '@/util' import FileSearcher from '@/node/fileSearcher' const SPECIAL_CHARS = /[\[\]\\^$.\|\?\*\+\(...
javascript
MIT
aa71e33e07845419533d767ad0d260a7c267cec7
2026-01-04T14:57:09.944492Z
false
marktext/marktext
https://github.com/marktext/marktext/blob/aa71e33e07845419533d767ad0d260a7c267cec7/src/renderer/commands/fileEncoding.js
src/renderer/commands/fileEncoding.js
import { ipcRenderer } from 'electron' import { ENCODING_NAME_MAP, getEncodingName } from 'common/encoding' import { delay } from '@/util' import bus from '../bus' class FileEncodingCommand { constructor (editorState) { this.id = 'file.change-encoding' this.description = 'File: Change Encoding' this.plac...
javascript
MIT
aa71e33e07845419533d767ad0d260a7c267cec7
2026-01-04T14:57:09.944492Z
false
marktext/marktext
https://github.com/marktext/marktext/blob/aa71e33e07845419533d767ad0d260a7c267cec7/src/renderer/commands/descriptions.js
src/renderer/commands/descriptions.js
const commandDescriptions = Object.freeze({ // ============================================ // # Key binding descriptions // # 'mt.hide': 'MarkText: Hide MarkText', 'mt.hide-others': 'MarkText: Hide Others', 'file.new-window': 'File: New Window', 'file.new-tab': 'File: New Tab', 'file.open-file': 'File...
javascript
MIT
aa71e33e07845419533d767ad0d260a7c267cec7
2026-01-04T14:57:09.944492Z
false
marktext/marktext
https://github.com/marktext/marktext/blob/aa71e33e07845419533d767ad0d260a7c267cec7/src/renderer/commands/lineEnding.js
src/renderer/commands/lineEnding.js
import { ipcRenderer } from 'electron' import { delay } from '@/util' import bus from '../bus' const crlfDescription = 'Carriage return and line feed (CRLF)' const lfDescription = 'Line feed (LF)' class LineEndingCommand { constructor (editorState) { this.id = 'file.line-ending' this.description = 'File: Ch...
javascript
MIT
aa71e33e07845419533d767ad0d260a7c267cec7
2026-01-04T14:57:09.944492Z
false
marktext/marktext
https://github.com/marktext/marktext/blob/aa71e33e07845419533d767ad0d260a7c267cec7/src/renderer/commands/utils.js
src/renderer/commands/utils.js
import path from 'path' import { isFile } from 'common/filesystem' /// Check whether the package is updatable at runtime. export const isUpdatable = () => { // TODO: If not updatable, allow to check whether there is a new version available. const resFile = isFile(path.join(process.resourcesPath, 'app-update.yml')...
javascript
MIT
aa71e33e07845419533d767ad0d260a7c267cec7
2026-01-04T14:57:09.944492Z
false
marktext/marktext
https://github.com/marktext/marktext/blob/aa71e33e07845419533d767ad0d260a7c267cec7/src/renderer/prefComponents/image/config.js
src/renderer/prefComponents/image/config.js
export const imageActions = [{ label: 'Upload image to cloud using selected uploader (must be configured below)', value: 'upload' }, { label: 'Copy image to designated relative assets or global local folder', value: 'folder' }, { label: 'Keep original location', value: 'path' }]
javascript
MIT
aa71e33e07845419533d767ad0d260a7c267cec7
2026-01-04T14:57:09.944492Z
false
marktext/marktext
https://github.com/marktext/marktext/blob/aa71e33e07845419533d767ad0d260a7c267cec7/src/renderer/prefComponents/image/components/uploader/services.js
src/renderer/prefComponents/image/components/uploader/services.js
// TODO: Remove information from other vue source files into this file. export const isValidService = name => { return name !== 'none' && services.hasOwnProperty(name) } const services = { // Dummy service used to opt-in real services. none: { name: 'None', isGdprCompliant: true, privacyUrl: '', ...
javascript
MIT
aa71e33e07845419533d767ad0d260a7c267cec7
2026-01-04T14:57:09.944492Z
false
marktext/marktext
https://github.com/marktext/marktext/blob/aa71e33e07845419533d767ad0d260a7c267cec7/src/renderer/prefComponents/editor/config.js
src/renderer/prefComponents/editor/config.js
import { ENCODING_NAME_MAP } from 'common/encoding' export const tabSizeOptions = [{ label: '1', value: 1 }, { label: '2', value: 2 }, { label: '3', value: 3 }, { label: '4', value: 4 }] export const endOfLineOptions = [{ label: 'Default', value: 'default' }, { label: 'Carriage return and line f...
javascript
MIT
aa71e33e07845419533d767ad0d260a7c267cec7
2026-01-04T14:57:09.944492Z
false
marktext/marktext
https://github.com/marktext/marktext/blob/aa71e33e07845419533d767ad0d260a7c267cec7/src/renderer/prefComponents/general/config.js
src/renderer/prefComponents/general/config.js
export const titleBarStyleOptions = [{ label: 'Custom', value: 'custom' }, { label: 'Native', value: 'native' }] export const zoomOptions = [{ label: '50.0%', value: 0.5 }, { label: '62.5%', value: 0.625 }, { label: '75.0%', value: 0.75 }, { label: '87.5%', value: 0.875 }, { label: '100.0%', ...
javascript
MIT
aa71e33e07845419533d767ad0d260a7c267cec7
2026-01-04T14:57:09.944492Z
false
marktext/marktext
https://github.com/marktext/marktext/blob/aa71e33e07845419533d767ad0d260a7c267cec7/src/renderer/prefComponents/theme/config.js
src/renderer/prefComponents/theme/config.js
export const themes = [ { name: 'light' }, { name: 'dark' }, { name: 'graphite' }, { name: 'material-dark' }, { name: 'ulysses' }, { name: 'one-dark' } ] export const autoSwitchThemeOptions = [{ label: 'Adjust theme at startup', // Always value: 0 }, /* { label: 'O...
javascript
MIT
aa71e33e07845419533d767ad0d260a7c267cec7
2026-01-04T14:57:09.944492Z
false