mirror of
https://gitea.toothfairyai.com/ToothFairyAI/tf_code.git
synced 2026-04-08 17:59:09 +00:00
fix: ensure that tool attachments arent sent as user messages (#8944)
This commit is contained in:
@@ -597,7 +597,7 @@ export namespace SessionPrompt {
|
||||
sessionID,
|
||||
system: [...(await SystemPrompt.environment()), ...(await SystemPrompt.custom())],
|
||||
messages: [
|
||||
...MessageV2.toModelMessage(sessionMessages),
|
||||
...MessageV2.toModelMessage(sessionMessages, { tools }),
|
||||
...(isLastStep
|
||||
? [
|
||||
{
|
||||
@@ -718,8 +718,22 @@ export namespace SessionPrompt {
|
||||
},
|
||||
toModelOutput(result) {
|
||||
return {
|
||||
type: "text",
|
||||
value: result.output,
|
||||
type: "content",
|
||||
value: [
|
||||
{
|
||||
type: "text",
|
||||
text: result.output,
|
||||
},
|
||||
...(result.attachments?.map((attachment: MessageV2.FilePart) => {
|
||||
const base64 = attachment.url.startsWith("data:") ? attachment.url.split(",", 2)[1] : attachment.url
|
||||
|
||||
return {
|
||||
type: "media",
|
||||
data: base64,
|
||||
mediaType: attachment.mime,
|
||||
}
|
||||
}) ?? []),
|
||||
],
|
||||
}
|
||||
},
|
||||
})
|
||||
@@ -808,8 +822,22 @@ export namespace SessionPrompt {
|
||||
}
|
||||
item.toModelOutput = (result) => {
|
||||
return {
|
||||
type: "text",
|
||||
value: result.output,
|
||||
type: "content",
|
||||
value: [
|
||||
{
|
||||
type: "text",
|
||||
text: result.output,
|
||||
},
|
||||
...(result.attachments?.map((attachment: MessageV2.FilePart) => {
|
||||
const base64 = attachment.url.startsWith("data:") ? attachment.url.split(",", 2)[1] : attachment.url
|
||||
|
||||
return {
|
||||
type: "media",
|
||||
data: base64,
|
||||
mediaType: attachment.mime,
|
||||
}
|
||||
}) ?? []),
|
||||
],
|
||||
}
|
||||
}
|
||||
tools[key] = item
|
||||
|
||||
Reference in New Issue
Block a user