mirror of
https://github.com/snailyp/gemini-balance.git
synced 2026-08-25 02:00:36 +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:
@@ -13,7 +13,7 @@ const SHOW_CLASS = "show"; // For modals
|
||||
const API_KEY_REGEX = /AIzaSy\S{33}/g;
|
||||
const PROXY_REGEX =
|
||||
/(?:https?|socks5):\/\/(?:[^:@\/]+(?::[^@\/]+)?@)?(?:[^:\/\s]+)(?::\d+)?/g;
|
||||
const VERTEX_API_KEY_REGEX = /AQ\.[a-zA-Z0-9_]{50}/g; // 新增 Vertex Express API Key 正则
|
||||
const VERTEX_API_KEY_REGEX = /AQ\.[a-zA-Z0-9_\-]{50}/g; // 新增 Vertex Express API Key 正则
|
||||
const MASKED_VALUE = "••••••••";
|
||||
|
||||
// DOM Elements - Global Scope for frequently accessed elements
|
||||
@@ -713,7 +713,13 @@ async function initConfig() {
|
||||
config.SAFETY_SETTINGS = []; // 默认为空数组
|
||||
}
|
||||
// --- 结束:处理 SAFETY_SETTINGS 默认值 ---
|
||||
|
||||
if (typeof config.URL_CONTEXT_ENABLED === "undefined") {
|
||||
config.URL_CONTEXT_ENABLED = true;
|
||||
}
|
||||
if (!config.URL_CONTEXT_MODELS || !Array.isArray(config.URL_CONTEXT_MODELS)) {
|
||||
config.URL_CONTEXT_MODELS = [];
|
||||
}
|
||||
|
||||
// --- 新增:处理自动删除错误日志配置的默认值 ---
|
||||
if (typeof config.AUTO_DELETE_ERROR_LOGS_ENABLED === "undefined") {
|
||||
config.AUTO_DELETE_ERROR_LOGS_ENABLED = false;
|
||||
|
||||
Reference in New Issue
Block a user