@extends('admin.general.index')

@section('setting_content')
    <form method="POST" action="{{ route('admin.setting.ai.config.update') }}" class="profile-settings style-lg">
        @csrf
        <div class="row c-gx-4 gy-4">
            <div class="col-xl-4 col-sm-6">
                <div class="form-group">
                    <label class="required form--label style-two">@lang('Select Default Engine')</label>
                    <select class="select2 form-control" name="default_engine" data-minimum-results-for-search="-1" required>
                        <option value="">@lang('Select one model')</option>
                        <option value="{{ \App\Constants\Status::GEMINI_MODEL }}" @selected(gs('default_engine') == \App\Constants\Status::GEMINI_MODEL)>
                            @lang('Gemini Model')
                        </option>
                        <option value="{{ \App\Constants\Status::OPENAI_MODEL }}" @selected(gs('default_engine') == \App\Constants\Status::OPENAI_MODEL)>
                            @lang('OpenAI Model')
                        </option>
                    </select>
                </div>
            </div>

            <div class="col-xl-4 col-sm-6">
                <div class="form-group">
                    <div class="d-flex justify-content-between align-items-center flex-wrap gap-3">
                        <label class="form--label style-two">@lang('Gemini API Key')
                            <i class="las la-info-circle"
                                title="@lang('API key used to connect with the engine provider.')"></i>
                        </label>
                        <a href="https://ai.google.dev/gemini-api/docs/text-generation" target="_blank">@lang('Get API Key')</a>
                    </div>
                    <input class="form-control" type="text" name="gemini_api_key" value="{{ gs('gemini_api_key') }}">
                </div>
            </div>

            <div class="col-xl-4 col-sm-6">
                <div class="form-group">
                    <div class="d-flex justify-content-between align-items-center flex-wrap gap-3">
                        <label class="form--label style-two">@lang('OpenAI API Key')
                            <i class="las la-info-circle"
                                title="@lang('API key used to connect with the engine provider.')"></i>
                        </label>
                        <a href="https://platform.openai.com/settings/organization/api-keys" target="_blank">@lang('Get API Key')</a>
                    </div>
                    <input class="form-control" type="text" name="openai_api_key" value="{{ gs('openai_api_key') }}">
                </div>
            </div>

            <div class="col-xl-4 col-sm-6">
                <div class="form-group">
                    <label class="form--label style-two">@lang('OpenAI Model')</label>
                    <select class="select2 form-control" name="openai_api_model" data-minimum-results-for-search="-1">
                        <option value="">@lang('Select one model')</option>
                        <option value="gpt-3.5-turbo" @selected(gs('openai_api_model') == 'gpt-3.5-turbo')>@lang('GPT-3.5 Turbo')</option>
                        <option value="gpt-3.5-turbo-0125" @selected(gs('openai_api_model') == 'gpt-3.5-turbo-0125')>@lang('GPT-3.5 Turbo (0125)')</option>
                        <option value="gpt-3.5-turbo-1106" @selected(gs('openai_api_model') == 'gpt-3.5-turbo-1106')>@lang('GPT-3.5 Turbo (1106)')</option>
                        <option value="gpt-3.5-turbo-16k" @selected(gs('openai_api_model') == 'gpt-3.5-turbo-16k')>@lang('GPT-3.5 Turbo 16K')</option>
                        <option value="gpt-3.5-turbo-instruct" @selected(gs('openai_api_model') == 'gpt-3.5-turbo-instruct')>@lang('GPT-3.5 Turbo Instruct')</option>
                        <option value="gpt-3.5-turbo-instruct-0914" @selected(gs('openai_api_model') == 'gpt-3.5-turbo-instruct-0914')>@lang('GPT-3.5 Turbo Instruct (0914)')</option>
                        <option value="gpt-4.1" @selected(gs('openai_api_model') == 'gpt-4.1')>@lang('GPT-4.1')</option>
                        <option value="gpt-4.1-2025-04-14" @selected(gs('openai_api_model') == 'gpt-4.1-2025-04-14')>@lang('GPT-4.1 (2025-04-14)')</option>
                        <option value="gpt-4.1-mini" @selected(gs('openai_api_model') == 'gpt-4.1-mini')>@lang('GPT-4.1 Mini')</option>
                        <option value="gpt-4.1-mini-2025-04-14" @selected(gs('openai_api_model') == 'gpt-4.1-mini-2025-04-14')>@lang('GPT-4.1 Mini (2025-04-14)')</option>
                        <option value="gpt-4.1-nano" @selected(gs('openai_api_model') == 'gpt-4.1-nano')>@lang('GPT-4.1 Nano')</option>
                        <option value="gpt-4.1-nano-2025-04-14" @selected(gs('openai_api_model') == 'gpt-4.1-nano-2025-04-14')>@lang('GPT-4.1 Nano (2025-04-14)')</option>
                        <option value="gpt-4o" @selected(gs('openai_api_model') == 'gpt-4o')>@lang('GPT-4o')</option>
                        <option value="gpt-4o-2024-05-13" @selected(gs('openai_api_model') == 'gpt-4o-2024-05-13')>@lang('GPT-4o (2024-05-13)')</option>
                        <option value="gpt-4o-2024-08-06" @selected(gs('openai_api_model') == 'gpt-4o-2024-08-06')>@lang('GPT-4o (2024-08-06)')</option>
                        <option value="gpt-4o-2024-11-20" @selected(gs('openai_api_model') == 'gpt-4o-2024-11-20')>@lang('GPT-4o (2024-11-20)')</option>
                        <option value="gpt-4o-mini" @selected(gs('openai_api_model') == 'gpt-4o-mini')>@lang('GPT-4o Mini')</option>
                        <option value="gpt-4o-mini-2024-07-18" @selected(gs('openai_api_model') == 'gpt-4o-mini-2024-07-18')>@lang('GPT-4o Mini (2024-07-18)')</option>
                        <option value="o4-mini" @selected(gs('openai_api_model') == 'o4-mini')>@lang('O4 Mini')</option>
                        <option value="o4-mini-2025-04-16" @selected(gs('openai_api_model') == 'o4-mini-2025-04-16')>@lang('O4 Mini (2025-04-16)')</option>
                        <option value="gpt-5" @selected(gs('openai_api_model') == 'gpt-5')>@lang('GPT-5')</option>
                        <option value="gpt-5-mini" @selected(gs('openai_api_model') == 'gpt-5-mini')>@lang('GPT-5 Mini')</option>
                        <option value="gpt-5-nano" @selected(gs('openai_api_model') == 'gpt-5-nano')>@lang('GPT-5 Nano')</option>
                        <option value="gpt-5-pro" @selected(gs('openai_api_model') == 'gpt-5-pro')>@lang('GPT-5 Pro')</option>
                    </select>
                </div>
            </div>
        </div>

        <div class="profile-settings-submit">
            <button class="btn btn--base btn--md w-100">@lang('Submit')</button>
        </div>
    </form>
@endsection
