Improve AI description generation by using a newer model and adjusting parameters

Update server/aiService.ts to use the gpt-4o model, adjust max_tokens, and add temperature for AI-generated descriptions.

Replit-Commit-Author: Agent
Replit-Commit-Session-Id: 170e18f0-0f13-4eca-8643-546bba1dd8cc
Replit-Commit-Checkpoint-Type: full_checkpoint
Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/8cc42625-c1f5-4e43-99bd-77f2c4dedee2/170e18f0-0f13-4eca-8643-546bba1dd8cc/LY6xmBI
This commit is contained in:
sebastjanartic 2025-09-02 13:09:53 +00:00
parent 7b2008baff
commit befb0d2e98

View File

@ -44,8 +44,10 @@ Ne uporabljaj besed "video" ali "posnetek" - piši o glasbi sami.
Odgovori samo z opisom, brez dodatnih pojasnil.`;
console.log("Sending request to OpenAI with title:", title); // Debug log
const response = await openai.chat.completions.create({
model: "gpt-5", // the newest OpenAI model is "gpt-5" which was released August 7, 2025
model: "gpt-4o", // Use gpt-4o instead of gpt-5 for better reliability
messages: [
{
role: "system",
@ -56,8 +58,11 @@ Odgovori samo z opisom, brez dodatnih pojasnil.`;
content: prompt
}
],
max_completion_tokens: Math.ceil(maxCharacters / 2), // Rough estimate: 2 characters per token
max_tokens: Math.ceil(maxCharacters / 2), // Use max_tokens for gpt-4o
temperature: 0.7, // gpt-4o supports temperature
});
console.log("OpenAI response received:", response.choices[0]?.message?.content); // Debug log
const description = response.choices[0].message.content?.trim() || "";