Use admin-configured AI model and add GPT-5/o-series options
- Add getConfiguredModel() that reads ai_model from SystemSettings - AI assignment and mentor matching now use the admin-selected model - Remove duplicate OpenAI client in mentor-matching (use shared singleton) - Add GPT-5, GPT-5 Mini, o3, o3 Mini, o4 Mini to model dropdown Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -107,3 +107,18 @@ export const AI_MODELS = {
|
||||
ASSIGNMENT: 'gpt-4o', // Best for complex reasoning
|
||||
QUICK: 'gpt-4o-mini', // Faster, cheaper for simple tasks
|
||||
} as const
|
||||
|
||||
/**
|
||||
* Get the admin-configured AI model from SystemSettings.
|
||||
* Falls back to the provided default if not configured.
|
||||
*/
|
||||
export async function getConfiguredModel(fallback: string = AI_MODELS.ASSIGNMENT): Promise<string> {
|
||||
try {
|
||||
const setting = await prisma.systemSettings.findUnique({
|
||||
where: { key: 'ai_model' },
|
||||
})
|
||||
return setting?.value || process.env.OPENAI_MODEL || fallback
|
||||
} catch {
|
||||
return process.env.OPENAI_MODEL || fallback
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user