mirror of
https://github.com/idootop/mi-gpt.git
synced 2025-04-08 01:13:56 +00:00
fix: update default room name and description
This commit is contained in:
parent
772ad22200
commit
aae3202c98
|
@ -22,7 +22,7 @@
|
|||
"build": "tsup",
|
||||
"db:gen": "npx prisma migrate dev --name hello",
|
||||
"db:reset": "rm .bot.json && npx prisma migrate reset",
|
||||
"prepublish": "npm run build"
|
||||
"prepublish": "yarn db:gen && npm run build"
|
||||
},
|
||||
"dependencies": {
|
||||
"@prisma/client": "^5.8.1",
|
||||
|
|
|
@ -103,10 +103,16 @@ class _BotConfig {
|
|||
} as any;
|
||||
}
|
||||
let { bot, master, room } = currentConfig;
|
||||
bot = (await UserCRUD.addOrUpdate(currentConfig.bot)) ?? oldConfig.bot;
|
||||
master =
|
||||
(await UserCRUD.addOrUpdate(currentConfig.master)) ?? oldConfig.master;
|
||||
room = (await RoomCRUD.addOrUpdate(currentConfig.room)) ?? oldConfig.room;
|
||||
const newDefaultRoomName = `${master.name}和${bot.name}的私聊`;
|
||||
if (room.name.endsWith("的私聊")) {
|
||||
room.name = config.room?.name ?? newDefaultRoomName;
|
||||
}
|
||||
if (room.description.endsWith("的私聊")) {
|
||||
room.description = config.room?.description ?? newDefaultRoomName;
|
||||
}
|
||||
bot = (await UserCRUD.addOrUpdate(bot)) ?? oldConfig.bot;
|
||||
master = (await UserCRUD.addOrUpdate(master)) ?? oldConfig.master;
|
||||
room = (await RoomCRUD.addOrUpdate(room)) ?? oldConfig.room;
|
||||
return { bot, master, room };
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user