File size: 6,869 Bytes
c001f24
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
{% extends "base.html" %}

{% block title %}Settings{% endblock %}

{% block content %}
<div class="container mt-5">
    <div class="row justify-content-center">
        <div class="col-md-8">
            <div class="card bg-dark text-white">
                <div class="card-header">
                    <h2 class="mb-0">Application Settings</h2>
                </div>
                <div class="card-body">
                    {% with messages = get_flashed_messages(with_categories=true) %}
                        {% if messages %}
                            {% for category, message in messages %}
                                <div class="alert alert-{{ category }} alert-dismissible fade show" role="alert">
                                    {{ message }}
                                    <button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
                                </div>
                            {% endfor %}
                        {% endif %}
                    {% endwith %}

                    <form method="POST" enctype="multipart/form-data">
                        <fieldset>
                            <legend class="h5 mb-3">Google Drive Integration</legend>
                            <div class="mb-3">
                                <label for="client_secret" class="form-label">Client Secret JSON</label>
                                <div class="input-group">
                                    <input type="file" class="form-control" id="client_secret" name="client_secret" accept=".json">
                                    <button class="btn btn-outline-secondary" type="submit">Upload</button>
                                </div>
                                <div class="form-text">
                                    Status: 
                                    {% if client_secret_exists %}
                                        <span class="text-success"><i class="bi bi-check-circle-fill"></i> Configured</span>
                                    {% else %}
                                        <span class="text-danger"><i class="bi bi-x-circle-fill"></i> Not Found</span>
                                    {% endif %}
                                    <br>
                                    Upload the <code>client_secret.json</code> file from Google Cloud Console to enable Drive integration.
                                    <br>
                                    <div class="mt-2 p-2 bg-dark border rounded">
                                        <strong>Required Redirect URI:</strong><br>
                                        <code class="user-select-all">{{ drive_redirect_uri }}</code>
                                    </div>
                                    <span class="text-muted small">Ensure this URI is exactly listed in your Google Cloud Console "Authorized redirect URIs".</span>
                                </div>
                            </div>
                        </fieldset>
                        <hr>
                        <fieldset>
                            <legend class="h5 mb-3">NeetPrep Settings</legend>
                            <div class="mb-3 form-check">
                                <input type="checkbox" class="form-check-input" id="neetprep_enabled" name="neetprep_enabled" {% if current_user.neetprep_enabled %}checked{% endif %}>
                                <label class="form-check-label" for="neetprep_enabled">
                                    Enable NeetPrep Sync
                                </label>
                                <div class="form-text">
                                    Enable synchronization with NeetPrep for question data.
                                </div>
                            </div>
                        </fieldset>
                        <hr>
                        <fieldset>
                            <legend class="h5 mb-3">Classifier Settings</legend>
                            <div class="mb-3">
                                <label for="classifier_model" class="form-label">Question Classifier Model</label>
                                <select class="form-select" id="classifier_model" name="classifier_model">
                                    <option value="gemini" {% if current_user.classifier_model == 'gemini' %}selected{% endif %}>Gemini Classifier (Default)</option>
                                    <option value="gemma" {% if current_user.classifier_model == 'gemma' %}selected{% endif %}>NVIDIA Gemma</option>
                                    <option value="nova" {% if current_user.classifier_model == 'nova' %}selected{% endif %}>Amazon Nova Lite</option>
                                </select>
                                <div class="form-text">
                                    Choose the AI model for automatic question classification. Gemini uses Google's Gemini API, while Nova uses Amazon's Nova model via OpenRouter. Requires relevant API keys to be set.
                                </div>
                            </div>
                        </fieldset>
                        <hr>
                        <fieldset>
                            <legend class="h5 mb-3">PDF & Image Settings</legend>
                            <div class="mb-3">
                                <label for="dpi" class="form-label">Rendering DPI</label>
                                <input type="number" class="form-control" id="dpi" name="dpi" min="72" max="900" value="{{ current_user.dpi }}">
                                <div class="form-text">
                                    Set the resolution for converting PDF pages to images. Higher values (e.g., 300) are better for quality and OCR but create larger files. Lower values (e.g., 150) are faster. Default: 300, Max: 900.
                                </div>
                            </div>
                            <div class="mb-3">
                                <label for="color_rm_dpi" class="form-label">Color Removal Output DPI</label>
                                <input type="number" class="form-control" id="color_rm_dpi" name="color_rm_dpi" min="72" max="600" value="{{ current_user.color_rm_dpi }}">
                                <div class="form-text">
                                    Set the output resolution (DPI) for processed images from the Color Removal tool when generating PDFs. Default: 200, Max: 600.
                                </div>
                            </div>
                        </fieldset>
                        <hr>
                        <button type="submit" class="btn btn-primary">Save Settings</button>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>
{% endblock %}