mirror of
https://github.com/snailyp/gemini-balance.git
synced 2026-09-05 07:26:39 +08:00
feat: 增加URL上下文理解功能
本次提交引入了一项新功能,允许模型在对话中理解所提供URL的上下文。 主要变更: - **配置**:新增了 `URL_CONTEXT_ENABLED` 和 `URL_CONTEXT_MODELS` 两个配置项,用于控制此功能的开关和支持的模型列表。 - **后端服务**:在 `gemini_chat_service`、`openai_chat_service` 和 `vertex_express_chat_service` 中,为支持的模型动态添加 `urlContext` 工具。 - **前端界面**:在配置编辑器页面增加了相应的UI控件,方便用户启用/禁用该功能并管理支持的模型列表。 - **文档**:更新了 `.env.example`、`README.md` 和 `README_ZH.md`,包含了新配置项的说明。
This commit is contained in:
@@ -1421,6 +1421,59 @@ endblock %} {% block head_extra_styles %}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 启用网址上下文 -->
|
||||
<div class="mb-6 flex items-center justify-between">
|
||||
<label for="URL_CONTEXT_ENABLED" class="font-semibold text-gray-700"
|
||||
>启用网址上下文</label
|
||||
>
|
||||
<div
|
||||
class="relative inline-block w-10 mr-2 align-middle select-none transition duration-200 ease-in"
|
||||
>
|
||||
<input
|
||||
type="checkbox"
|
||||
name="URL_CONTEXT_ENABLED"
|
||||
id="URL_CONTEXT_ENABLED"
|
||||
class="toggle-checkbox absolute block w-6 h-6 rounded-full bg-white border-4 appearance-none cursor-pointer"
|
||||
/>
|
||||
<label
|
||||
for="URL_CONTEXT_ENABLED"
|
||||
class="toggle-label block overflow-hidden h-6 rounded-full bg-gray-300 cursor-pointer"
|
||||
></label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 网址上下文模型列表 -->
|
||||
<div class="mb-6">
|
||||
<label
|
||||
for="URL_CONTEXT_MODELS"
|
||||
class="block font-semibold mb-2 text-gray-700"
|
||||
>网址上下文模型列表</label
|
||||
>
|
||||
<div class="array-container" id="URL_CONTEXT_MODELS_container">
|
||||
<!-- 数组项将在这里动态添加 -->
|
||||
</div>
|
||||
<div class="flex justify-end gap-2 mt-2">
|
||||
<button
|
||||
type="button"
|
||||
title="从列表选择模型添加到下方"
|
||||
class="model-helper-trigger-btn p-2 rounded-md text-violet-300 hover:bg-violet-700 transition-colors"
|
||||
data-target-array-key="URL_CONTEXT_MODELS"
|
||||
>
|
||||
<i class="fas fa-list-ul"></i>
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
class="bg-violet-600 hover:bg-violet-700 text-white px-4 py-2 rounded-lg font-medium transition-all duration-200 flex items-center gap-2"
|
||||
onclick="addArrayItem('URL_CONTEXT_MODELS')"
|
||||
>
|
||||
<i class="fas fa-plus"></i> 添加模型
|
||||
</button>
|
||||
</div>
|
||||
<small class="text-gray-500 mt-1 block"
|
||||
>支持网址上下文功能的模型列表</small
|
||||
>
|
||||
</div>
|
||||
|
||||
<!-- 显示搜索链接 -->
|
||||
<div class="mb-6 flex items-center justify-between">
|
||||
<label for="SHOW_SEARCH_LINK" class="font-semibold text-gray-700"
|
||||
|
||||
Reference in New Issue
Block a user