fix: 修复AI机器人不存在的情况

This commit is contained in:
kuaifan 2025-04-07 09:05:17 +08:00
parent 06db036e4a
commit 59b29014d9

View File

@ -629,11 +629,12 @@ class UsersController extends AbstractController
User::auth(); User::auth();
// //
$type = trim(Request::input('type')); $type = trim(Request::input('type'));
if (!UserBot::systemBotName($type)) { $botName = "ai-{$type}";
if (!UserBot::systemBotName($botName)) {
return Base::retError('AI机器人不存在'); return Base::retError('AI机器人不存在');
} }
// //
$botUser = User::botGetOrCreate("ai-{$type}"); $botUser = User::botGetOrCreate($botName);
if (empty($botUser)) { if (empty($botUser)) {
return Base::retError('AI机器人不存在'); return Base::retError('AI机器人不存在');
} }