FIX: Correct prompt format for img2text used in our AI Bot PDF Rag pipeline (#1323)

This commit is contained in:
Rafael dos Santos Silva 2025-05-07 16:48:56 -03:00 committed by GitHub
parent f090065405
commit 1b71330cea
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -127,14 +127,15 @@ class DiscourseAi::Utils::ImageToText
messages = [
{
type: :user,
content:
content: [
"The following text was extracted from an image using OCR. Please enhance, correct, and structure this content while maintaining the original text:\n\n#{raw_text}",
upload_ids: [page.id],
{ upload_id: page.id },
],
},
]
else
messages = [
{ type: :user, content: "Please OCR the content in the image.", upload_ids: [page.id] },
{ type: :user, content: ["Please OCR the content in the image.", { upload_id: page.id }] },
]
end
prompt = DiscourseAi::Completions::Prompt.new(system_message, messages: messages)