AI Config: default to Gemini and filter providers by API key
This commit is contained in:
@@ -81,7 +81,16 @@ class CandidateController extends Controller
|
|||||||
|
|
||||||
return \Inertia\Inertia::render('Admin/Candidates/Show', [
|
return \Inertia\Inertia::render('Admin/Candidates/Show', [
|
||||||
'candidate' => $candidate,
|
'candidate' => $candidate,
|
||||||
'jobPositions' => \App\Models\JobPosition::all()
|
'jobPositions' => \App\Models\JobPosition::all(),
|
||||||
|
'ai_config' => [
|
||||||
|
'default' => env('AI_DEFAULT_PROVIDER', 'ollama'),
|
||||||
|
'enabled_providers' => array_filter([
|
||||||
|
'ollama' => true, // Toujours dispo car local ou simulé
|
||||||
|
'openai' => !empty(env('OPENAI_API_KEY')),
|
||||||
|
'anthropic' => !empty(env('ANTHROPIC_API_KEY')),
|
||||||
|
'gemini' => !empty(env('GEMINI_API_KEY')),
|
||||||
|
], function($v) { return $v; })
|
||||||
|
]
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -12,7 +12,8 @@ import InputError from '@/Components/InputError.vue';
|
|||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
candidate: Object,
|
candidate: Object,
|
||||||
jobPositions: Array
|
jobPositions: Array,
|
||||||
|
ai_config: Object
|
||||||
});
|
});
|
||||||
|
|
||||||
const page = usePage();
|
const page = usePage();
|
||||||
@@ -123,7 +124,7 @@ const updateAnswerScore = (answerId, score) => {
|
|||||||
|
|
||||||
const aiAnalysis = ref(props.candidate.ai_analysis || null);
|
const aiAnalysis = ref(props.candidate.ai_analysis || null);
|
||||||
const isAnalyzing = ref(false);
|
const isAnalyzing = ref(false);
|
||||||
const selectedProvider = ref('ollama');
|
const selectedProvider = ref(props.ai_config?.default || 'ollama');
|
||||||
|
|
||||||
const runAI = async () => {
|
const runAI = async () => {
|
||||||
if (!props.candidate.job_position_id) {
|
if (!props.candidate.job_position_id) {
|
||||||
@@ -384,9 +385,9 @@ const runAI = async () => {
|
|||||||
|
|
||||||
<div class="flex flex-wrap items-center gap-4">
|
<div class="flex flex-wrap items-center gap-4">
|
||||||
<!-- Provider Selector -->
|
<!-- Provider Selector -->
|
||||||
<div class="flex items-center bg-slate-100 dark:bg-slate-900/50 p-1.5 rounded-2xl border border-slate-200 dark:border-slate-800">
|
<div v-if="props.ai_config?.enabled_providers" class="flex items-center bg-slate-100 dark:bg-slate-900/50 p-1.5 rounded-2xl border border-slate-200 dark:border-slate-800">
|
||||||
<button
|
<button
|
||||||
v-for="provider in ['ollama', 'openai', 'anthropic', 'gemini']"
|
v-for="provider in Object.keys(props.ai_config.enabled_providers)"
|
||||||
:key="provider"
|
:key="provider"
|
||||||
@click="selectedProvider = provider"
|
@click="selectedProvider = provider"
|
||||||
class="px-4 py-2 text-[10px] font-black uppercase tracking-widest rounded-xl transition-all"
|
class="px-4 py-2 text-[10px] font-black uppercase tracking-widest rounded-xl transition-all"
|
||||||
|
|||||||
Reference in New Issue
Block a user