perf: 机器人支持新会话

This commit is contained in:
kuaifan
2025-07-25 11:17:12 +08:00
parent b406e22695
commit 0b86fa7bee
9 changed files with 85 additions and 62 deletions

View File

@@ -3291,15 +3291,7 @@ class DialogController extends AbstractController
$dialog = WebSocketDialog::checkDialog($dialog_id);
}
//
if ($dialog->type != 'user') {
return Base::retError('当前对话不支持');
}
//
$hasAiUser = WebSocketDialogUser::join('users as u', 'web_socket_dialog_users.userid', '=', 'u.userid')
->where('dialog_id', $dialog->id)
->where('u.email', 'like', 'ai-%@bot.system')
->exists();
if (!$hasAiUser) {
if (!$dialog->isSessionDialog()) {
return Base::retError('当前对话不支持');
}
//
@@ -3312,7 +3304,6 @@ class DialogController extends AbstractController
//
$session = WebSocketDialogSession::create([
'dialog_id' => $dialog->id,
'status' => 1,
'title' => '',
]);
$session->save();