ENCOA-274 and patch to the Dockerfile, in some merge the firebase tools were left out

This commit is contained in:
Carlos-Mesquita
2024-12-11 15:23:00 +00:00
parent 0222c339fe
commit 196f9e9c3e
9 changed files with 36 additions and 23 deletions

View File

@@ -25,6 +25,9 @@ async def get_writing_args_academic(task: int, attachment: UploadFile) -> List[D
if task == 2:
raise NotImplemented("Task 2 academic isn't implemented yet, current implementation still uses General Task 2 prompts.")
attachment_bytes = await attachment.read()
messages = [
{
"role": "user",
@@ -32,17 +35,19 @@ async def get_writing_args_academic(task: int, attachment: UploadFile) -> List[D
},
{
"role": "user",
"content": writing_args[str(task)]["instructions"]
"content": [
{
"type": "text",
"text": writing_args[str(task)]["instructions"],
},
{
"type": "image_url",
"image_url": {
"url": f"data:image/{attachment.filename.split('.')[-1]};base64,{b64encode(attachment_bytes).decode('utf-8')}"
}
}
]
}
]
if task == 1:
attachment_bytes = await attachment.read()
messages.append({
"type": "image_url",
"image_url": {
"url": f"data:image/{attachment.filename.split('.')[-1]};base64,{b64encode(attachment_bytes).decode('utf-8')}"
}
})
return messages