Initial commit: Memind H5 portal with MindSpace, Plaza, and agent jobs.
Track application source and tests; exclude local env, user workspaces, and runtime data via .gitignore. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
export function mindspaceFlags(env = process.env) {
|
||||
const enabled = env.MINDSPACE_ENABLED !== 'false';
|
||||
return {
|
||||
mindspace_enabled: enabled,
|
||||
mindspace_upload_enabled: enabled && env.MINDSPACE_UPLOAD_ENABLED !== 'false',
|
||||
mindspace_publish_enabled: enabled && env.MINDSPACE_PUBLISH_ENABLED === 'true',
|
||||
mindspace_private_enabled: enabled && env.MINDSPACE_PRIVATE_ENABLED !== 'false',
|
||||
mindspace_agent_jobs_enabled: enabled && env.MINDSPACE_AGENT_JOBS_ENABLED === 'true',
|
||||
};
|
||||
}
|
||||
|
||||
export function assertMindSpaceRoute(flags, route) {
|
||||
if (!flags.mindspace_enabled) {
|
||||
throw Object.assign(new Error('MindSpace 功能未启用'), { code: 'feature_disabled' });
|
||||
}
|
||||
if (route === 'upload' && !flags.mindspace_upload_enabled) {
|
||||
throw Object.assign(new Error('上传功能未启用'), { code: 'feature_disabled' });
|
||||
}
|
||||
if (route === 'agent' && !flags.mindspace_agent_jobs_enabled) {
|
||||
throw Object.assign(new Error('Agent 任务功能未启用'), { code: 'feature_disabled' });
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user