chore: cleanup transform code a tad
This commit is contained in:
@@ -26,22 +26,18 @@ export namespace ProviderTransform {
|
|||||||
msgs = msgs.map((msg) => {
|
msgs = msgs.map((msg) => {
|
||||||
if (msg.providerOptions) {
|
if (msg.providerOptions) {
|
||||||
for (const options of Object.values(msg.providerOptions)) {
|
for (const options of Object.values(msg.providerOptions)) {
|
||||||
if (options && typeof options === "object") {
|
|
||||||
delete options["itemId"]
|
delete options["itemId"]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if (!Array.isArray(msg.content)) {
|
if (!Array.isArray(msg.content)) {
|
||||||
return msg
|
return msg
|
||||||
}
|
}
|
||||||
const content = msg.content.map((part) => {
|
const content = msg.content.map((part) => {
|
||||||
if (part.providerOptions) {
|
if (part.providerOptions) {
|
||||||
for (const options of Object.values(part.providerOptions)) {
|
for (const options of Object.values(part.providerOptions)) {
|
||||||
if (options && typeof options === "object") {
|
|
||||||
delete options["itemId"]
|
delete options["itemId"]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return part
|
return part
|
||||||
})
|
})
|
||||||
return { ...msg, content } as typeof msg
|
return { ...msg, content } as typeof msg
|
||||||
|
|||||||
Reference in New Issue
Block a user