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:
parent
82fd6bed09
commit
e948249a96
BIN
attached_assets/image_1756818219543.png
Normal file
BIN
attached_assets/image_1756818219543.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 26 KiB |
BIN
attached_assets/image_1756818234927.png
Normal file
BIN
attached_assets/image_1756818234927.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 35 KiB |
@ -57,7 +57,6 @@ Odgovori samo z opisom, brez dodatnih pojasnil.`;
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
max_completion_tokens: Math.ceil(maxCharacters / 2), // Rough estimate: 2 characters per token
|
max_completion_tokens: Math.ceil(maxCharacters / 2), // Rough estimate: 2 characters per token
|
||||||
temperature: 0.7,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
const description = response.choices[0].message.content?.trim() || "";
|
const description = response.choices[0].message.content?.trim() || "";
|
||||||
|
|||||||
@ -837,34 +837,30 @@ class BunnyStorage implements IStorage {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async updateVideo(id: string, updates: UpdateVideo): Promise<Video | undefined> {
|
async updateVideo(id: string, updates: UpdateVideo): Promise<Video | undefined> {
|
||||||
// Allow updating face detection data and views even with Bunny.net integration
|
// For admin edits, allow all metadata updates
|
||||||
const allowedUpdates = ['faceCenterPosition', 'facesDetected', 'faceConfidence', 'views'];
|
// Face detection and views require special handling but metadata can be updated
|
||||||
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");
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// Try to update in database first
|
// Try to update in database first
|
||||||
try {
|
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) {
|
} catch (dbError) {
|
||||||
console.warn(`Database update failed for video ${id}, using cache:`, dbError);
|
console.warn(`Database update failed for video ${id}, using cache:`, dbError);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update face detection data in cache (always reliable)
|
// Update face detection data in cache if present
|
||||||
const { views, ...faceData } = filteredUpdates;
|
const faceFields = ['faceCenterPosition', 'facesDetected', 'faceConfidence'];
|
||||||
|
const faceData = Object.fromEntries(
|
||||||
|
Object.entries(updates).filter(([key]) => faceFields.includes(key))
|
||||||
|
);
|
||||||
if (Object.keys(faceData).length > 0) {
|
if (Object.keys(faceData).length > 0) {
|
||||||
const existing = this.faceDataCache.get(id) || {};
|
const existing = this.faceDataCache.get(id) || {};
|
||||||
this.faceDataCache.set(id, { ...existing, ...faceData });
|
this.faceDataCache.set(id, { ...existing, ...faceData });
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update views cache
|
// Update views cache if present
|
||||||
if (views !== undefined && typeof views === 'number') {
|
if (updates.views !== undefined && typeof updates.views === 'number') {
|
||||||
this.viewsCache.set(id, views);
|
this.viewsCache.set(id, updates.views);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Return updated video
|
// Return updated video
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user