feat: 添加 AI 补货建议功能,优化相关设置和界面

This commit is contained in:
2026-03-11 18:44:59 +08:00
parent 6f4a8d82f3
commit f7a82528e7
7 changed files with 819 additions and 0 deletions

View File

@@ -0,0 +1,62 @@
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>AI参数设置</title>
<link rel="stylesheet" href="{{ url_for('static', filename='css/style.css') }}">
</head>
<body>
<header class="hero slim">
<div>
<h1>AI参数设置</h1>
<p>在此修改硅基流动 API 和补货建议参数</p>
</div>
<div class="hero-actions">
<a class="btn btn-light" href="{{ url_for('types_page') }}">返回仓库概览</a>
</div>
</header>
<main class="container">
{% if error %}
<p class="alert">{{ error }}</p>
{% endif %}
{% if notice %}
<p class="notice">{{ notice }}</p>
{% endif %}
<section class="panel">
<form class="form-grid" method="post">
<label>
API URL *
<input type="text" name="api_url" required value="{{ settings.api_url }}" placeholder="https://api.siliconflow.cn/v1/chat/completions">
</label>
<label>
模型名称 *
<input type="text" name="model" required value="{{ settings.model }}" placeholder="Qwen/Qwen2.5-7B-Instruct">
</label>
<label class="full">
API Key *
<input type="text" name="api_key" required value="{{ settings.api_key }}" placeholder="sk-...">
</label>
<label>
超时(秒)
<input type="number" name="timeout" min="5" value="{{ settings.timeout }}">
</label>
<label>
低库存阈值
<input type="number" name="restock_threshold" min="0" value="{{ settings.restock_threshold }}">
</label>
<label>
建议条目上限
<input type="number" name="restock_limit" min="1" value="{{ settings.restock_limit }}">
</label>
<div class="actions full">
<button class="btn" type="submit">保存参数</button>
<a class="btn btn-light" href="{{ url_for('types_page') }}">取消</a>
</div>
</form>
</section>
</main>
</body>
</html>