mirror of
https://github.com/discourse/discourse-ai.git
synced 2025-06-26 01:22:20 +00:00
FIX: Correct prompt format for img2text used in our AI Bot PDF Rag pipeline (#1323)
This commit is contained in:
parent
f090065405
commit
1b71330cea
@ -127,14 +127,15 @@ class DiscourseAi::Utils::ImageToText
|
|||||||
messages = [
|
messages = [
|
||||||
{
|
{
|
||||||
type: :user,
|
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}",
|
"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
|
else
|
||||||
messages = [
|
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
|
end
|
||||||
prompt = DiscourseAi::Completions::Prompt.new(system_message, messages: messages)
|
prompt = DiscourseAi::Completions::Prompt.new(system_message, messages: messages)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user