Files
2026-moving-helper/app/templates/settings/form.html
T

70 lines
2.8 KiB
HTML
Raw Normal View History

2026-06-01 20:06:22 +02:00
{% extends "base.html" %}
{% block content %}
<div class="breadcrumb">
<a href="/boxes">箱子</a>
<span>/</span>
<strong>设置</strong>
</div>
<div class="page-header">
<div>
<h1>设置</h1>
<p class="muted">配置 LLM 连接参数。未配置时,整站行为不受影响。</p>
</div>
</div>
{% if test_result %}
<section class="card" style="margin-bottom: 16px; border-color: {% if test_result.success %}#2f6b1f{% else %}#b42318{% endif %};">
<p style="margin:0; color: {% if test_result.success %}#2f6b1f{% else %}#b42318{% endif %};">
<strong>{{ "✓ " if test_result.success else "✗ " }}{{ test_result.message }}</strong>
</p>
</section>
{% endif %}
<form method="post" action="/settings" class="stack form-panel">
<label class="form-field checkbox-row">
<input type="checkbox" name="enabled" {% if config.enabled %}checked{% endif %}>
启用 LLM
</label>
<p class="checkbox-help">开启后,AI 相关功能将使用下方配置连接 LLM 服务。</p>
<label class="form-field">
Base URL
<input type="text" name="base_url" value="{{ config.base_url }}" placeholder="https://api.openai.com/v1">
</label>
<label class="form-field">
模型名称
<input type="text" name="model" value="{{ config.model }}" placeholder="例如 gpt-4o-mini">
</label>
<label class="form-field">
API Key
{% if api_key_configured %}
<input type="password" name="api_key" value="" placeholder="已配置,留空=不修改">
{% else %}
<input type="password" name="api_key" value="" placeholder="输入 API Key">
{% endif %}
</label>
2026-06-01 21:28:29 +02:00
<hr style="border:none;border-top:1px solid #ddd;margin:16px 0;">
<label class="form-field checkbox-row">
<input type="checkbox" name="ai_search_enabled" {% if config.ai_search_enabled %}checked{% endif %}>
启用 AI 智能搜索
</label>
<p class="checkbox-help">开启后,搜索页将显示「AI 智能搜索」按钮,通过查询词扩展增强搜索结果。</p>
<label class="form-field">
额外领域提示(可选)
<textarea name="ai_search_extra_hints" rows="3" placeholder="例如:用户物品主要涉及厨房用品和电子产品">{% if config.ai_search_extra_hints %}{{ config.ai_search_extra_hints }}{% endif %}</textarea>
</label>
<p class="checkbox-help">追加到 AI 搜索提示词末尾,帮助模型理解你的物品领域。留空则使用默认提示词。</p>
2026-06-01 20:06:22 +02:00
<div class="form-actions">
<button type="submit" class="button button-primary">保存设置</button>
<button type="submit" class="button button-secondary" formaction="/settings/test" formmethod="post">测试连接</button>
</div>
</form>
{% endblock %}