Adjust AI model settings and improve video metadata update functionality

Modify AI service to remove temperature setting and update storage logic to allow all metadata updates for admin edits in BunnyStorage.

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:04:39 +00:00
parent 82fd6bed09
commit e948249a96
4 changed files with 11 additions and 16 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 35 KiB

View File

@ -57,7 +57,6 @@ Odgovori samo z opisom, brez dodatnih pojasnil.`;
}
],
max_completion_tokens: Math.ceil(maxCharacters / 2), // Rough estimate: 2 characters per token
temperature: 0.7,
});
const description = response.choices[0].message.content?.trim() || "";

View File

@ -837,34 +837,30 @@ class BunnyStorage implements IStorage {
}
async updateVideo(id: string, updates: UpdateVideo): Promise<Video | undefined> {
// Allow updating face detection data and views even with Bunny.net integration
const allowedUpdates = ['faceCenterPosition', 'facesDetected', 'faceConfidence', 'views'];
const filteredUpdates = Object.fromEntries(
Object.entries(updates).filter(([key]) => allowedUpdates.includes(key))
);
if (Object.keys(filteredUpdates).length === 0) {
throw new Error("Only face detection and view updates are supported with Bunny.net integration");
}
// For admin edits, allow all metadata updates
// Face detection and views require special handling but metadata can be updated
try {
// Try to update in database first
try {
await db.update(videos).set(filteredUpdates as UpdateVideo).where(eq(videos.id, id));
await db.update(videos).set(updates as UpdateVideo).where(eq(videos.id, id));
} catch (dbError) {
console.warn(`Database update failed for video ${id}, using cache:`, dbError);
}
// Update face detection data in cache (always reliable)
const { views, ...faceData } = filteredUpdates;
// Update face detection data in cache if present
const faceFields = ['faceCenterPosition', 'facesDetected', 'faceConfidence'];
const faceData = Object.fromEntries(
Object.entries(updates).filter(([key]) => faceFields.includes(key))
);
if (Object.keys(faceData).length > 0) {
const existing = this.faceDataCache.get(id) || {};
this.faceDataCache.set(id, { ...existing, ...faceData });
}
// Update views cache
if (views !== undefined && typeof views === 'number') {
this.viewsCache.set(id, views);
// Update views cache if present
if (updates.views !== undefined && typeof updates.views === 'number') {
this.viewsCache.set(id, updates.views);
}
// Return updated video