fix(ai): 去除服务端收到大模型对话请求时对用户提问的二次重复广播
This commit is contained in:
@@ -72,22 +72,6 @@ class ChatBotController extends Controller
|
|||||||
$roomId = $request->input('room_id');
|
$roomId = $request->input('room_id');
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// 先广播用户的提问消息
|
|
||||||
$userMsg = [
|
|
||||||
'id' => $this->chatState->nextMessageId($roomId),
|
|
||||||
'room_id' => $roomId,
|
|
||||||
'from_user' => $user->username,
|
|
||||||
'to_user' => 'AI小班长',
|
|
||||||
'content' => $message,
|
|
||||||
'is_secret' => false,
|
|
||||||
'font_color' => '#000000',
|
|
||||||
'action' => '',
|
|
||||||
'sent_at' => now()->toDateTimeString(),
|
|
||||||
];
|
|
||||||
$this->chatState->pushMessage($roomId, $userMsg);
|
|
||||||
broadcast(new MessageSent($roomId, $userMsg));
|
|
||||||
SaveMessageJob::dispatch($userMsg);
|
|
||||||
|
|
||||||
$result = $this->aiChat->chat($user->id, $message, $roomId);
|
$result = $this->aiChat->chat($user->id, $message, $roomId);
|
||||||
|
|
||||||
$reply = $result['reply'];
|
$reply = $result['reply'];
|
||||||
|
|||||||
Reference in New Issue
Block a user