fix: Improve reply prompt (#7588)

Co-authored-by: Sojan Jose <sojan@chatwoot.com>
This commit is contained in:
Muhsin Keloth
2023-08-09 10:25:37 +05:30
committed by GitHub
parent b5dec067a1
commit c1c3a62412
5 changed files with 24 additions and 45 deletions

View File

@@ -18,10 +18,6 @@ module Enterprise::Integrations::OpenaiProcessorService
private
def prompt_from_file(file_name)
Rails.root.join('enterprise/lib/enterprise/integrations/openai_prompts', "#{file_name}.txt").read
end
def labels_with_messages
conversation = find_conversation
@@ -47,7 +43,7 @@ module Enterprise::Integrations::OpenaiProcessorService
model: self.class::GPT_MODEL,
messages: [
{ role: 'system',
content: prompt_from_file('summary') },
content: prompt_from_file('summary', enterprise: true) },
{ role: 'user', content: conversation_messages }
]
}.to_json
@@ -62,7 +58,7 @@ module Enterprise::Integrations::OpenaiProcessorService
messages: [
{
role: 'system',
content: prompt_from_file('label_suggestion')
content: prompt_from_file('label_suggestion', enterprise: true)
},
{ role: 'user', content: content }
]