chore: trace initDB log

This commit is contained in:
WJG 2024-06-16 20:04:43 +08:00
parent 1992317f10
commit 8138d77e62
No known key found for this signature in database
GPG Key ID: 258474EF8590014A
2 changed files with 3 additions and 3 deletions

View File

@ -50,7 +50,7 @@ export class MiGPT {
}
async start() {
await initDB();
await initDB(this.speaker.debug);
const main = () => {
console.log(kBannerASCII);
return this.ai.run();

View File

@ -41,12 +41,12 @@ export function getDBInfo() {
return { dbPath, withSchema };
}
export async function initDB() {
export async function initDB(debug = false) {
const { dbPath, withSchema } = getDBInfo();
if (!exists(dbPath)) {
await deleteFile(".bot.json");
await Shell.run(`npx prisma migrate dev --name init ${withSchema}`, {
silent: true,
silent: debug ? false : true,
});
}
const success = exists(dbPath);