feat: add configurable watermark text in API settings

This commit is contained in:
hmo
2026-04-27 20:14:17 +08:00
parent 1c9d539653
commit c8d77187d1
3 changed files with 13 additions and 4 deletions
+9 -1
View File
@@ -57,6 +57,12 @@
<small class="text-muted">控制输出的随机性,值越大越有创造性</small>
</div>
<div class="mb-3">
<label class="form-label">PDF水印文本</label>
<input type="text" class="form-control" id="watermarkText" placeholder="留空则不显示水印">
<small class="text-muted">PDF每页中央显示的斜向水印文字</small>
</div>
<div class="d-flex gap-2">
<button type="button" class="btn btn-primary" onclick="saveApiConfig()">
<i class="bi bi-save"></i> 保存配置
@@ -171,7 +177,8 @@ async function saveApiConfig(silent = false, overrideProvider = null) {
model: document.getElementById('apiModel').value,
api_key: document.getElementById('apiKey').value,
base_url: document.getElementById('apiEndpoint').value,
temperature: parseFloat(document.getElementById('apiTemperature').value)
temperature: parseFloat(document.getElementById('apiTemperature').value),
watermark_text: document.getElementById('watermarkText').value.trim()
};
const r = await fetch('/api/config', {
@@ -199,6 +206,7 @@ async function loadApiConfig() {
document.getElementById('apiKey').value = config.api_key || '';
document.getElementById('apiEndpoint').value = config.base_url || '';
document.getElementById('apiTemperature').value = config.temperature || 0.7;
document.getElementById('watermarkText').value = config.watermark_text || '';
if (config.api_key_preview) {
document.getElementById('apiKeyPreview').textContent = '当前: ' + config.api_key_preview;