File tree 2 files changed +3
-13
lines changed
plugin-image-generation/src
2 files changed +3
-13
lines changed Original file line number Diff line number Diff line change @@ -165,16 +165,6 @@ export async function buildConversationThread(
165
165
return thread ;
166
166
}
167
167
168
- export function getMediaType ( attachment : Media ) {
169
- if ( attachment . contentType ?. startsWith ( "video" ) ) {
170
- return "video" ;
171
- } else if ( attachment . contentType ?. startsWith ( "image" ) ) {
172
- return "image" ;
173
- } else {
174
- throw new Error ( `Unsupported media type` ) ;
175
- }
176
- }
177
-
178
168
export async function sendTweet (
179
169
client : ClientBase ,
180
170
content : Content ,
@@ -207,14 +197,14 @@ export async function sendTweet(
207
197
const mediaBuffer = Buffer . from (
208
198
await response . arrayBuffer ( )
209
199
) ;
210
- const mediaType = getMediaType ( attachment ) ;
200
+ const mediaType = attachment . contentType ;
211
201
return { data : mediaBuffer , mediaType } ;
212
202
} else if ( fs . existsSync ( attachment . url ) ) {
213
203
// Handle local file paths
214
204
const mediaBuffer = await fs . promises . readFile (
215
205
path . resolve ( attachment . url )
216
206
) ;
217
- const mediaType = getMediaType ( attachment ) ;
207
+ const mediaType = attachment . contentType ;
218
208
return { data : mediaBuffer , mediaType } ;
219
209
} else {
220
210
throw new Error (
Original file line number Diff line number Diff line change @@ -207,7 +207,7 @@ const imageGeneration: Action = {
207
207
source : "imageGeneration" ,
208
208
description : "..." , //caption.title,
209
209
text : "..." , //caption.description,
210
- contentType : "image" ,
210
+ contentType : "image/png " ,
211
211
} ,
212
212
] ,
213
213
} ,
You can’t perform that action at this time.
0 commit comments