feat: add reset progress and flagged media analysis

This commit is contained in:
Jamie Brunton committed 2026-01-03 13:08:23 +00:00
1 parent a7e29682c1
commit 7e686c147a
15 files changed
+1049 -215

No files matched your search

+39
View File
@@ -0,0 +1,39 @@
import { getOpenAI, getModel } from '../client';
export async function describeImage(imageBase64OrUrl: string): Promise<string> {
const openai = getOpenAI();
const model = getModel('describe_image');
// If it's a data URL or http URL, use it as is.
// If it's raw base64, prepend the data URI scheme.
let imageUrl = imageBase64OrUrl;
if (!imageBase64OrUrl.startsWith('http') && !imageBase64OrUrl.startsWith('data:')) {
imageUrl = `data:image/jpeg;base64,${imageBase64OrUrl}`;
}
try {
const response = await openai.chat.completions.create({
model: model,
messages: [
{
role: 'user',
content: [
{ type: 'text', text: 'Describe this image in detail. Focus on any potentially inappropriate content or safety concerns.' },
{
type: 'image_url',
image_url: {
"url": imageUrl,
},
},
],
},
],
max_tokens: 300,
});
return response.choices[0].message.content || 'No description available.';
} catch (error) {
console.error('Error describing image:', error);
throw error;
}
}
+2
View File
@@ -71,6 +71,8 @@ export function getModel(purpose?: ModelPurpose): string {
return remoteConfig?.model_fix || import.meta.env.VITE_AI_MODEL_FIX || fallback;
case 'polish':
return remoteConfig?.model_polish || import.meta.env.VITE_AI_MODEL_POLISH || fallback;
case 'describe_image':
return remoteConfig?.classifier_model || 'gpt-4o';
default:
return fallback;
}
+1 -1
View File
@@ -4,7 +4,7 @@
// =============================================================================
// Model purpose for selecting appropriate model
export type ModelPurpose = 'generate' | 'fix' | 'polish';
export type ModelPurpose = 'generate' | 'fix' | 'polish' | 'describe_image';
// =============================================================================
// COUNCIL CONFIGURATION TYPES