Made it easy to add control images to the samples in the UI

This commit is contained in:
Jaret Burkett
2025-07-17 12:00:48 -06:00
parent e25d2feddf
commit 8610c6ed7f
16 changed files with 400 additions and 57 deletions

View File

@@ -1,5 +1,5 @@
import { PrismaClient } from '@prisma/client';
import { defaultDatasetsFolder } from '@/paths';
import { defaultDatasetsFolder, defaultDataRoot } from '@/paths';
import { defaultTrainFolder } from '@/paths';
import NodeCache from 'node-cache';
@@ -66,3 +66,22 @@ export const getHFToken = async () => {
myCache.set(key, token);
return token;
};
export const getDataRoot = async () => {
const key = 'DATA_ROOT';
let dataRoot = myCache.get(key) as string;
if (dataRoot) {
return dataRoot;
}
let row = await prisma.settings.findFirst({
where: {
key: key,
},
});
dataRoot = defaultDataRoot;
if (row?.value && row.value !== '') {
dataRoot = row.value;
}
myCache.set(key, dataRoot);
return dataRoot;
};