v2.0.0 大模型驱动版:移除智能体,直接调用大模型接口

- 核心改造:不再使用 openclaw 智能体执行处理步骤,改为直接调用大模型接口
- 新增 services/llm_client.py:OpenAI 兼容接口客户端,支持多模型配置管理
- 步骤4/5 由大模型直接完成(提取产品数据、填充字段)
- 步骤6 改为直接调用 ParamHub API 提交审核
- 新增 llm_configs 数据库表,默认配置 unsloth/Qwen3.6-27B-Q4_K_M (262144上下文)
- 新增 /api/llm 配置管理 API:增删改查、切换激活、测试连接
- 前端首页新增「大模型配置」面板,可随时新增/切换模型
- 处理步骤名称更新为「大模型」版
This commit is contained in:
2026-08-13 17:15:53 +08:00
parent 6abd3389f3
commit 23991c3552
12 changed files with 1187 additions and 151 deletions
+78
View File
@@ -207,6 +207,40 @@
</div>
</div>
</div>
<!-- 大模型配置 -->
<div class="panel full-width">
<div class="panel-header">
<h2><i class="ri-openai-line"></i> 大模型配置</h2>
<div class="panel-actions">
<span class="active-model-badge" id="active-model-badge">
<span class="status-dot green"></span>
<span id="active-model-name">加载中...</span>
</span>
<button onclick="showAddLlmModal()" class="btn btn-primary btn-sm">
<i class="ri-add-line"></i> 新增大模型
</button>
</div>
</div>
<div class="panel-body">
<p class="llm-tip"><i class="ri-information-line"></i> 系统所有智能体任务(提取数据、填充字段等)均由当前激活的大模型直接完成,可在下方随时切换或新增。</p>
<table class="data-table">
<thead>
<tr>
<th>名称</th>
<th>接口地址</th>
<th>模型名称</th>
<th>上下文窗口</th>
<th>状态</th>
<th>操作</th>
</tr>
</thead>
<tbody id="llm-config-table">
<tr><td colspan="6" class="empty-text">暂无大模型配置</td></tr>
</tbody>
</table>
</div>
</div>
</div>
<!-- 添加产品模态框 -->
@@ -357,6 +391,50 @@
</div>
</div>
<!-- 新增大模型模态框 -->
<div id="add-llm-modal" class="modal">
<div class="modal-content">
<div class="modal-header">
<h3><i class="ri-openai-line"></i> 新增大模型配置</h3>
<button onclick="closeModal('add-llm-modal')" class="close-btn">
<i class="ri-close-line"></i>
</button>
</div>
<div class="modal-body">
<form id="add-llm-form">
<div class="form-group">
<label>配置名称 *</label>
<input type="text" id="llm-name" required placeholder="例如:本地Qwen3.6">
</div>
<div class="form-group">
<label>接口地址 Base URL *</label>
<input type="text" id="llm-base-url" required placeholder="http://192.168.2.7:18003/v1">
<small class="hint">OpenAI 兼容接口地址,以 /v1 结尾</small>
</div>
<div class="form-group">
<label>API Key</label>
<input type="text" id="llm-api-key" placeholder="sk-xxxx">
</div>
<div class="form-group">
<label>模型名称 *</label>
<input type="text" id="llm-model-name" required placeholder="unsloth/Qwen3.6-27B-Q4_K_M">
</div>
<div class="form-group">
<label>最大上下文窗口</label>
<input type="number" id="llm-max-context" value="262144" min="4096" step="1024">
</div>
</form>
</div>
<div class="modal-footer">
<button onclick="testLlmConnection()" class="btn btn-secondary" id="llm-test-btn">
<i class="ri-connection-line"></i> 测试连接
</button>
<button onclick="closeModal('add-llm-modal')" class="btn btn-secondary">取消</button>
<button onclick="addLlmConfig()" class="btn btn-primary">添加</button>
</div>
</div>
</div>
<!-- 提示消息 -->
<div id="toast" class="toast"></div>
+9 -10
View File
@@ -49,10 +49,10 @@
</div>
</div>
<!-- 智能体任务模板区域 -->
<!-- 大模型任务模板区域 -->
<div class="panel template-section">
<div class="panel-header">
<h2><i class="ri-robot-line"></i> 步骤4:提取产品数据 - 智能体任务模板</h2>
<h2><i class="ri-robot-line"></i> 步骤4:提取产品数据 - 大模型任务模板</h2>
<div class="template-actions">
<button onclick="previewTemplate()" class="btn btn-secondary btn-sm">
<i class="ri-eye-line"></i> 预览
@@ -64,7 +64,7 @@
</div>
<div class="panel-body">
<div class="template-info">
<p><strong>说明:</strong>此模板用于步骤4「提取产品数据」中调用智能体 <code>hz4th_editor</code> 的任务文本。</p>
<p><strong>说明:</strong>此模板用于步骤4「提取产品数据」中调用大模型的任务文本。</p>
<p><strong>可用变量:</strong>
<code>{{product_name}}</code> 产品名称、
<code>{{category}}</code> 类别、
@@ -72,7 +72,7 @@
<code>{{library_results}}</code> 内容库搜索结果、
<code>{{internet_results}}</code> 互联网抓取内容
</p>
<p><strong>调用命令</strong><code>openclaw agent --agent hz4th_editor --message "[填充后的任务文本]"</code></p>
<p><strong>调用方式</strong>直接调用系统当前激活的大模型接口(见系统设置)</p>
</div>
<textarea id="agent-template-editor" class="template-editor" rows="15" placeholder="加载模板中..."></textarea>
</div>
@@ -81,7 +81,7 @@
<!-- 步骤5填充字段模板区域 -->
<div class="panel template-section">
<div class="panel-header">
<h2><i class="ri-edit-box-line"></i> 步骤5:填充字段 - 智能体任务模板</h2>
<h2><i class="ri-edit-box-line"></i> 步骤5:填充字段 - 大模型任务模板</h2>
<div class="template-actions">
<button onclick="previewFillFieldsTemplate()" class="btn btn-secondary btn-sm">
<i class="ri-eye-line"></i> 预览
@@ -93,14 +93,14 @@
</div>
<div class="panel-body">
<div class="template-info">
<p><strong>说明:</strong>此模板用于步骤5「填充字段」中调用智能体 <code>hz4th_editor</code> 的任务文本。</p>
<p><strong>说明:</strong>此模板用于步骤5「填充字段」中调用大模型的任务文本。</p>
<p><strong>可用变量:</strong>
<code>{{product_name}}</code> 产品名称、
<code>{{category}}</code> 类别、
<code>{{subcategory}}</code> 子类别、
<code>{{relevant_content_ids}}</code> 上一步筛选的相关内容数据ID
</p>
<p><strong>任务目标:</strong>智能体根据API文档获取字段定义,整理产品参数,并进行格式检查。</p>
<p><strong>任务目标:</strong>大模型根据API文档获取字段定义,整理产品参数,并进行格式检查。</p>
</div>
<textarea id="fill-fields-template-editor" class="template-editor" rows="15" placeholder="加载模板中..."></textarea>
</div>
@@ -109,7 +109,7 @@
<!-- 步骤6提交审核模板区域 -->
<div class="panel template-section">
<div class="panel-header">
<h2><i class="ri-upload-cloud-line"></i> 步骤6:提交审核 - 智能体任务模板</h2>
<h2><i class="ri-upload-cloud-line"></i> 步骤6:提交审核 - 模板</h2>
<div class="template-actions">
<button onclick="previewSubmitTemplate()" class="btn btn-secondary btn-sm">
<i class="ri-eye-line"></i> 预览
@@ -121,14 +121,13 @@
</div>
<div class="panel-body">
<div class="template-info">
<p><strong>说明:</strong>此模板用于步骤6「提交审核」中调用智能体 <code>hz4th_editor</code> 的任务文本</p>
<p><strong>说明:</strong>步骤6「提交审核」已改为直接调用 ParamHub API 提交,不再经过智能体/大模型</p>
<p><strong>可用变量:</strong>
<code>{{product_name}}</code> 产品名称、
<code>{{category}}</code> 类别、
<code>{{subcategory}}</code> 子类别、
<code>{{product_data}}</code> 上一步生成的产品数据(JSON格式)
</p>
<p><strong>任务目标:</strong>智能体将产品数据提交到ParamHub审核系统,获取review_id。</p>
</div>
<textarea id="submit-template-editor" class="template-editor" rows="15" placeholder="加载模板中..."></textarea>
</div>