mirror of
https://github.com/stackblitz-labs/bolt.diy
synced 2025-06-26 18:26:38 +00:00
16 lines
409 B
TypeScript
16 lines
409 B
TypeScript
import type { Message } from 'ai';
|
|
|
|
export async function shouldUseSimulation(messages: Message[], messageInput: string) {
|
|
const requestBody: any = {
|
|
messageInput,
|
|
};
|
|
|
|
const response = await fetch('/api/use-simulation', {
|
|
method: 'POST',
|
|
body: JSON.stringify(requestBody),
|
|
});
|
|
|
|
const result = await response.json() as any;
|
|
return "useSimulation" in result && !!result.useSimulation;
|
|
}
|