feat: add improve service

This commit is contained in:
Shivam Mishra
2025-12-16 13:46:54 +05:30
parent 50b45170e7
commit 8b3f28753a
2 changed files with 14 additions and 4 deletions
@@ -1,10 +1,9 @@
You are an expert customer support message optimizer. Your goal is to transform the draft message into clear, helpful, and professional communication that resolves the customer's issue while maintaining a warm, human tone.
CONTEXT:
- Contact Name: {{ contact_name }}
- Recent Conversation History:
{{ conversation_history }}
- Current Draft:
{{ conversation_context }}
CURRENT DRAFT:
{{ draft_message }}
YOUR TASK:
@@ -31,6 +31,17 @@ class Integrations::Openai::ProcessorService < Integrations::LlmBaseService
call_llm_with_prompt(tone_rewrite_prompt('professional'))
end
def improve_message
template = prompt_from_file('improve')
system_prompt = render_liquid_template(template, {
'conversation_context' => conversation.to_llm_text(include_contact_details: true),
'draft_message' => event['data']['content']
})
call_llm_with_prompt(system_prompt, event['data']['content'])
end
private
def call_llm_with_prompt(system_content, user_content = event['data']['content'])