File tree Expand file tree Collapse file tree 2 files changed +16
-27
lines changed Expand file tree Collapse file tree 2 files changed +16
-27
lines changed Original file line number Diff line number Diff line change @@ -64,26 +64,26 @@ interface AnthropicTextContentItem {
64
64
}
65
65
66
66
interface AnthropicUrlPdfContentItem {
67
- type : 'document' ;
67
+ type : string ;
68
68
source : {
69
- type : 'url' ;
69
+ type : string ;
70
70
url : string ;
71
71
} ;
72
72
}
73
73
74
74
interface AnthropicBase64PdfContentItem {
75
- type : 'document' ;
75
+ type : string ;
76
76
source : {
77
- type : 'base64' ;
77
+ type : string ;
78
78
data : string ;
79
79
media_type : string ;
80
80
} ;
81
81
}
82
82
83
83
interface AnthropicPlainTextContentItem {
84
- type : 'document' ;
84
+ type : string ;
85
85
source : {
86
- type : 'text' ;
86
+ type : string ;
87
87
data : string ;
88
88
media_type : string ;
89
89
} ;
@@ -213,25 +213,14 @@ const transformAndAppendFileContentItem = (
213
213
} else if ( item . file ?. file_data ) {
214
214
const contentType =
215
215
mimeType === fileExtensionMimeTypeMap . txt ? 'text' : 'base64' ;
216
- if ( contentType === 'text' ) {
217
- transformedMessage . content . push ( {
218
- type : 'document' ,
219
- source : {
220
- type : contentType ,
221
- data : item . file . file_data ,
222
- media_type : mimeType ,
223
- } ,
224
- } ) ;
225
- } else {
226
- transformedMessage . content . push ( {
227
- type : 'document' ,
228
- source : {
229
- type : contentType ,
230
- data : item . file . file_data ,
231
- media_type : mimeType ,
232
- } ,
233
- } ) ;
234
- }
216
+ transformedMessage . content . push ( {
217
+ type : 'document' ,
218
+ source : {
219
+ type : contentType ,
220
+ data : item . file . file_data ,
221
+ media_type : mimeType ,
222
+ } ,
223
+ } ) ;
235
224
}
236
225
} ;
237
226
Original file line number Diff line number Diff line change @@ -188,7 +188,7 @@ const getMessageContent = (message: Message) => {
188
188
out . push ( {
189
189
document : {
190
190
format : fileFormat ,
191
- name : crypto . randomUUID ( ) ,
191
+ name : item . file . file_name || crypto . randomUUID ( ) ,
192
192
source : {
193
193
s3Location : {
194
194
uri : item . file . file_url ,
@@ -200,7 +200,7 @@ const getMessageContent = (message: Message) => {
200
200
out . push ( {
201
201
document : {
202
202
format : fileFormat ,
203
- name : crypto . randomUUID ( ) ,
203
+ name : item . file . file_name || crypto . randomUUID ( ) ,
204
204
source : {
205
205
bytes : item . file . file_data ,
206
206
} ,
You can’t perform that action at this time.
0 commit comments