feat: add ai generate recipe
This commit is contained in:
14
utils/api/index.ts
Normal file
14
utils/api/index.ts
Normal file
@@ -0,0 +1,14 @@
|
||||
// filter prompt
|
||||
export async function generateRecipeImage(foods: string[]) {
|
||||
return $fetch('/api/recipes/image/generate', {
|
||||
method: 'POST',
|
||||
body: {
|
||||
foods,
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
export async function getRecipeImage(foods: string[]) {
|
||||
const data = await generateRecipeImage(foods)
|
||||
return `data:image/png;base64,${data.images[0]}`
|
||||
}
|
||||
Reference in New Issue
Block a user