onQueue(config('knowledgebase.queue.chat_log', 'default')); } public function handle(): void { $session = ChatSession::where('session_token', $this->sessionToken)->first(); if (!$session) { return; } ChatLog::create([ 'chat_session_id' => $session->id, 'user_id' => $this->userId, 'category_id' => $this->categoryId, 'question' => $this->question, 'answer' => $this->answer, 'sources_used' => $this->sources, 'context_chunks' => $this->contextChunks, 'model_used' => $this->modelUsed, 'tokens_used' => $this->tokensUsed, 'response_time' => $this->responseTime, 'has_answer' => $this->hasAnswer, 'is_flagged' => false, ]); $session->update(['last_activity_at' => now()]); } }