fix: consistent instrumentation with conversation.display_id (#13194)
This commit is contained in:
@@ -30,7 +30,7 @@ class Captain::Conversation::ResponseBuilderJob < ApplicationJob
|
|||||||
delegate :account, :inbox, to: :@conversation
|
delegate :account, :inbox, to: :@conversation
|
||||||
|
|
||||||
def generate_and_process_response
|
def generate_and_process_response
|
||||||
@response = Captain::Llm::AssistantChatService.new(assistant: @assistant, conversation_id: @conversation.id).generate_response(
|
@response = Captain::Llm::AssistantChatService.new(assistant: @assistant, conversation_id: @conversation.display_id).generate_response(
|
||||||
message_history: collect_previous_messages
|
message_history: collect_previous_messages
|
||||||
)
|
)
|
||||||
process_response
|
process_response
|
||||||
|
|||||||
@@ -37,6 +37,7 @@ class Captain::Llm::ContactNotesService < Llm::BaseAiService
|
|||||||
model: @model,
|
model: @model,
|
||||||
temperature: @temperature,
|
temperature: @temperature,
|
||||||
account_id: @conversation.account_id,
|
account_id: @conversation.account_id,
|
||||||
|
conversation_id: @conversation.display_id,
|
||||||
feature_name: 'contact_notes',
|
feature_name: 'contact_notes',
|
||||||
messages: [
|
messages: [
|
||||||
{ role: 'system', content: system_prompt },
|
{ role: 'system', content: system_prompt },
|
||||||
|
|||||||
@@ -100,7 +100,7 @@ class Captain::Llm::ConversationFaqService < Llm::BaseAiService
|
|||||||
model: @model,
|
model: @model,
|
||||||
temperature: @temperature,
|
temperature: @temperature,
|
||||||
account_id: @conversation.account_id,
|
account_id: @conversation.account_id,
|
||||||
conversation_id: @conversation.id,
|
conversation_id: @conversation.display_id,
|
||||||
feature_name: 'conversation_faq',
|
feature_name: 'conversation_faq',
|
||||||
messages: [
|
messages: [
|
||||||
{ role: 'system', content: system_prompt },
|
{ role: 'system', content: system_prompt },
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ RSpec.describe Captain::Conversation::ResponseBuilderJob, type: :job do
|
|||||||
end
|
end
|
||||||
|
|
||||||
it 'uses Captain::Llm::AssistantChatService' do
|
it 'uses Captain::Llm::AssistantChatService' do
|
||||||
expect(Captain::Llm::AssistantChatService).to receive(:new).with(assistant: assistant, conversation_id: conversation.id)
|
expect(Captain::Llm::AssistantChatService).to receive(:new).with(assistant: assistant, conversation_id: conversation.display_id)
|
||||||
expect(Captain::Assistant::AgentRunnerService).not_to receive(:new)
|
expect(Captain::Assistant::AgentRunnerService).not_to receive(:new)
|
||||||
|
|
||||||
described_class.perform_now(conversation, assistant)
|
described_class.perform_now(conversation, assistant)
|
||||||
|
|||||||
Reference in New Issue
Block a user