1. HTML 设置面板 (index.html:55-63)
新增 API格式 下拉选择框:
- raw - 原始API格式(使用 /v1/images/generations 端点)
- openai - OpenAI格式(使用 /v1/chat/completions 端点)
2. JavaScript 核心逻辑 (script.js)
设置字段 (script.js:10)
- currentSettings 新增 apiFormat: 'raw' 字段
API 服务 (script.js:685-916)
- testConnection: 根据 API 格式选择 /models 或 /v1/models 端点
- generateImage:
- 原始格式: 使用 prompt 请求体,端点 /v1/images/generations
- OpenAI格式: 使用 messages 请求体,端点 /v1/chat/completions
- extractImagesFromContent: 新增方法,支持从 Chat 响应中提取图像:
- ✅ Markdown 图片语法 
- ✅ Base64 图像数据
- ✅ 通用图像 URL(放宽限制)
- ✅ JSON 格式内容(包括代码块)
- ✅ 多模态内容数组
设置持久化 (script.js:1591, 1771, 1909)
- loadSettings / saveSettings 支持 apiFormat
- 自动保存监听器包含 apiFormat
连接测试 (script.js:2027, 2037)
- app.testConnection 传递 apiFormat 参数
This commit is contained in:
@@ -52,6 +52,15 @@
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
<div class="mb-3">
|
||||
<label for="apiFormat" class="form-label">API格式</label>
|
||||
<select class="form-select" id="apiFormat">
|
||||
<option value="raw">原始API格式</option>
|
||||
<option value="openai">OpenAI格式</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
<div class="mb-3">
|
||||
<label for="responseFormat" class="form-label">响应格式</label>
|
||||
|
||||
Reference in New Issue
Block a user