File tree 2 files changed +9
-5
lines changed 2 files changed +9
-5
lines changed Original file line number Diff line number Diff line change @@ -5,8 +5,14 @@ export default defineEventHandler(async (event) => {
5
5
6
6
const { prompt, imageParts } = await readBody ( event ) ;
7
7
8
+ const imageData = imageParts . map ( ( image ) => {
9
+ return {
10
+ inlineData : image ,
11
+ } ;
12
+ } ) ;
13
+
8
14
try {
9
- const result = await model . generateContent ( [ prompt , [ ...imageParts ] ] ) ;
15
+ const result = await model . generateContent ( [ prompt , ...imageData ] ) ;
10
16
const response = await result . response ;
11
17
const text = response . text ( ) ;
12
18
Original file line number Diff line number Diff line change @@ -41,10 +41,8 @@ export const useChatStore = defineStore({
41
41
42
42
getImageParts : ( state ) =>
43
43
state . chatHistory . map ( ( chat ) => ( {
44
- inlineData : {
45
- data : chat . imageData ?. link ,
46
- mimeType : chat . imageData ?. type ,
47
- } ,
44
+ data : chat . imageData ?. link ,
45
+ mimeType : chat . imageData ?. type ,
48
46
} ) ) ,
49
47
} ,
50
48
} ) ;
You can’t perform that action at this time.
0 commit comments