mirror of
https://github.com/vercel/commerce.git
synced 2025-05-19 07:56:59 +00:00
18 lines
455 B
TypeScript
18 lines
455 B
TypeScript
import { post } from './fetch';
|
|
|
|
const generateRequestPayload = (prompt: string) => ({
|
|
model: 'dall-e-3',
|
|
prompt
|
|
});
|
|
|
|
// TODO(Benson): Type the interface returned from open ai
|
|
|
|
async function createImageAsync(prompt: string): Promise<any> {
|
|
const data = await post('/api/open-ai/image', generateRequestPayload(prompt));
|
|
console.log({ data });
|
|
// return getFunctionCallArguments<any>(data);
|
|
return data;
|
|
}
|
|
|
|
export default { createImageAsync };
|