microsoft / azurechat

🤖 💼 Azure Chat Solution Accelerator powered by Azure Open AI Service

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

When using Dall-E, pre-checked prompt variables are not used.

yhakiai opened this issue · comments

When using Dall-E, pre-checked prompt variables are not used.

Receives args and performs value validation, but the value is not actually used, but the prompt (userMessage) entered by the user is directly used.

async function executeCreateImage(
args: { prompt: string },
threadId: string,
userMessage: string,
signal: AbortSignal
) {
console.log("createImage called with prompt:", args.prompt);
if (!args.prompt) {
return "No prompt provided";
}
// Check the prompt is < 4000 characters (DALL-E 3)
if (args.prompt.length >= 4000) {
return "Prompt is too long, it must be less than 4000 characters";
}
const openAI = OpenAIDALLEInstance();
let response;
try {
response = await openAI.images.generate(
{
model: "dall-e-3",
prompt: userMessage,
response_format: "b64_json",
},
{
signal,
}
);