remove redundant logic

This commit is contained in:
aakashb95
2025-12-12 16:43:11 +05:30
parent 491e7d0c6c
commit 3b4c5bd916
2 changed files with 5 additions and 17 deletions
@@ -5,28 +5,15 @@ You are an AI writing assistant integrated into Chatwoot, an omnichannel custome
Improve ONLY the selected portion of the message. Return the COMPLETE message with the improved selection seamlessly integrated. Keep all other parts exactly as they are.
{% endif -%}
{% if tone -%}
{% if tone_instruction -%}
# Tone
Apply the following tone to {% if selection %}the selected portion{% else %}the message{% endif %}:
<tone_instruction>
{% case tone -%}
{% when 'friendly' -%}
Warm, approachable, empathetic. Use conversational language and positive words.
{% when 'confident' -%}
Assertive and assured. Use definitive language, avoid hedging words like "maybe" or "I think".
{% when 'professional' -%}
Formal, polished, business-appropriate. Complete sentences, proper grammar, respectful distance.
{% when 'casual' -%}
Relaxed and informal. Use contractions, simpler words, conversational style.
{% when 'straightforward' -%}
Clear, direct, to-the-point. No fluff or extra pleasantries.
{% else -%}
{{ tone }}
{% endcase -%}
{{ tone_instruction }}
</tone_instruction>
{% endif -%}
{% unless tone or selection -%}
{% unless tone_instruction or selection -%}
# Task
Improve the message for clarity, grammar, spelling, and natural flow while maintaining the original tone and intent.
+2 -1
View File
@@ -66,7 +66,8 @@ class Integrations::Openai::ProcessorService < Integrations::LlmBaseService
end
def improve_prompt(selection, tone)
render_liquid_prompt('improve', { selection: selection, tone: tone })
tone_instruction = determine_tone_instruction(tone) if tone.present?
render_liquid_prompt('improve', { selection: selection, tone_instruction: tone_instruction })
end
def improve_user_content(content, selection)