|
@@ -4556,16 +4556,29 @@ class PublicRpcService implements PublicRpcServiceInterface
|
|
|
*/
|
|
*/
|
|
|
public function delAiChatRecord(array $data): array
|
|
public function delAiChatRecord(array $data): array
|
|
|
{
|
|
{
|
|
|
- $chat_id = $data['chat_id'];
|
|
|
|
|
|
|
+ $session_id = $data['session_id'];
|
|
|
$user_id = $data['user_id'];
|
|
$user_id = $data['user_id'];
|
|
|
- $chat = AiChat::where('chat_id',$chat_id)->where('user_id',$user_id)->first();
|
|
|
|
|
|
|
+ $chat = AiChat::where('session_id',$session_id)->where('user_id',$user_id)->orderBy('send_time','desc')->first();
|
|
|
if(empty($chat)){
|
|
if(empty($chat)){
|
|
|
return Result::error('此用户的聊天记录不存在!');
|
|
return Result::error('此用户的聊天记录不存在!');
|
|
|
}
|
|
}
|
|
|
- $del_chat = AiChat::where('chat_id',$chat_id)->where('user_id',$user_id)->delete();
|
|
|
|
|
|
|
+ $del_chat = AiChat::where('chat_id',$chat['chat_id'])->where('user_id',$user_id)->delete();
|
|
|
if(empty($del_chat)){
|
|
if(empty($del_chat)){
|
|
|
return Result::error('删除失败!');
|
|
return Result::error('删除失败!');
|
|
|
}
|
|
}
|
|
|
- return Result::success(['删除成功']);
|
|
|
|
|
|
|
+ return Result::success('删除成功'.$chat['chat_id']);
|
|
|
|
|
+ }
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 自助建站-ai会话-给模板添加导航
|
|
|
|
|
+ */
|
|
|
|
|
+ public function addTemplateCates(array $data): array
|
|
|
|
|
+ {
|
|
|
|
|
+ $session_id = $data['session_id'];
|
|
|
|
|
+ $user_id = $data['user_id'];
|
|
|
|
|
+ $chat = AiChat::where('session_id',$session_id)->where('user_id',$user_id)->orderBy('send_time','asc')->get()->all();
|
|
|
|
|
+ if(empty($chat)){
|
|
|
|
|
+ return Result::error('此用户的聊天记录不存在!');
|
|
|
|
|
+ }
|
|
|
|
|
+ return Result::success($chat);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|