(story: string, sessionId: string)
| 262 | ); |
| 263 | |
| 264 | async function genImgBlob(story: string, sessionId: string): Promise<string> { |
| 265 | const session = await ai.loadSession(sessionId, { |
| 266 | store: new JsonSessionStore(), |
| 267 | }); |
| 268 | const chat = session.chat({ sessionId, model }); |
| 269 | const { text: storyImgDescr } = await chat.send(` |
| 270 | Describe an image that the captures the essence of this story: ${story}. |
| 271 | Do not use any words indicating violence or profanity. Return a string only. |
| 272 | Do not return JSON.`); |
| 273 | const imgPrompt = createImgPrompt(storyImgDescr); |
| 274 | return await imgBlobFlow(imgPrompt); |
| 275 | } |
| 276 | |
| 277 | const imgBlobFlow = ai.defineFlow( |
| 278 | { |
no test coverage detected