fix(tailscale, ai): исправить скрытие полей Tailscale-сервера и добавить готовый пресет провайдера OpenRouter

This commit is contained in:
Dushnilin
2026-08-17 11:18:36 +03:00
parent bca948947e
commit c35380200f
9 changed files with 699 additions and 683 deletions
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+7 -4
View File
@@ -7,8 +7,8 @@ msgid ""
msgstr ""
"Project-Id-Version: TACHYON\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2026-08-17 10:26+0300\n"
"PO-Revision-Date: 2026-08-17 10:26+0300\n"
"POT-Creation-Date: 2026-08-17 11:15+0300\n"
"PO-Revision-Date: 2026-08-17 11:15+0300\n"
"Last-Translator: Dushnilin\n"
"Language-Team: none\n"
"Language: ru\n"
@@ -605,8 +605,8 @@ msgstr "Пользовательские заголовки устройства
msgid "Custom DNS Records (Hosts)"
msgstr "Пользовательские DNS-записи (Hosts)"
msgid "Custom OpenAI-Compatible API (OpenRouter)"
msgstr "Пользовательский OpenAI-совместимый API (OpenRouter)"
msgid "Custom OpenAI-Compatible API"
msgstr ""
msgid "Custom OpenAI-compatible API endpoint URL (e.g. http://192.168.1.100:11434/v1/chat/completions)"
msgstr "Пользовательский URL эндпоинта OpenAI-совместимого API (напр. http://192.168.1.100:11434/v1/chat/completions)"
@@ -3524,6 +3524,9 @@ msgstr "sing-box outbound для Zapret2 настроен"
msgid "Zapret2 sing-box outbound is not configured"
msgstr "sing-box outbound для Zapret2 не настроен"
msgid "Custom OpenAI-Compatible API (OpenRouter)"
msgstr "Пользовательский OpenAI-совместимый API (OpenRouter)"
msgid "Reloading page in"
msgstr "Перезагрузка страницы через"
@@ -803,6 +803,14 @@ function renderAiWatchdogSection(state: AdvancedSettingsState) {
},
'DeepSeek API',
),
E(
'option',
{
value: 'openrouter',
selected: state.aiDoctorProvider === 'openrouter',
},
'OpenRouter (openrouter.ai)',
),
E(
'option',
{
@@ -842,6 +850,7 @@ function renderAiWatchdogSection(state: AdvancedSettingsState) {
openai: 'gpt-4o-mini',
anthropic: 'claude-3-5-haiku-20241022',
deepseek: 'deepseek-chat',
openrouter: 'openai/gpt-4o-mini',
ollama: 'llama3:latest',
lmstudio: 'local-model',
}[state.aiDoctorProvider] ?? 'gpt-4o-mini',
@@ -2470,11 +2470,8 @@ function addRealityDepends(option) {
option.depends({ protocol: "vless", security: "reality" });
}
function addTailscaleDepends(option, singBoxTailscale) {
option.depends(
"protocol",
singBoxTailscale ? "tailscale" : "__unsupported_tailscale__",
);
function addTailscaleDepends(option) {
option.depends("protocol", "tailscale");
}
function addMtprotoDepends(option) {
@@ -3228,7 +3225,7 @@ function createServerContent(section, options = {}) {
o.modalonly = true;
o.rmempty = false;
o.validate = validateRequired;
addTailscaleDepends(o, singBoxTailscale);
addTailscaleDepends(o);
o = section.option(
form.Value,
@@ -3239,7 +3236,7 @@ function createServerContent(section, options = {}) {
o.modalonly = true;
o.rmempty = false;
o.validate = validateHttpUrl;
addTailscaleDepends(o, singBoxTailscale);
addTailscaleDepends(o);
o = section.option(form.Value, "tailscale_hostname", _("Tailscale hostname"));
o.modalonly = true;
@@ -3254,7 +3251,7 @@ function createServerContent(section, options = {}) {
uci.set(UCI_PACKAGE, sectionId, "tailscale_hostname", value);
return value;
};
addTailscaleDepends(o, singBoxTailscale);
addTailscaleDepends(o);
o = section.option(
form.Flag,
@@ -3264,7 +3261,7 @@ function createServerContent(section, options = {}) {
o.default = "1";
o.modalonly = true;
o.rmempty = false;
addTailscaleDepends(o, singBoxTailscale);
addTailscaleDepends(o);
o = section.option(
form.DynamicList,
@@ -3274,13 +3271,13 @@ function createServerContent(section, options = {}) {
o.modalonly = true;
o.rmempty = true;
o.validate = (_sectionId, value) => validateOptionalCidrOrIp(value);
addTailscaleDepends(o, singBoxTailscale);
addTailscaleDepends(o);
o = section.option(form.Flag, "tailscale_accept_routes", _("Accept routes"));
o.default = "0";
o.modalonly = true;
o.rmempty = true;
addTailscaleDepends(o, singBoxTailscale);
addTailscaleDepends(o);
// AWG Server Options
o = section.option(
@@ -1646,9 +1646,10 @@ function createSettingsContent(section, capabilities) {
o.value("openai", "OpenAI (ChatGPT)");
o.value("anthropic", "Anthropic (Claude API)");
o.value("deepseek", "DeepSeek API");
o.value("openrouter", "OpenRouter (openrouter.ai)");
o.value("ollama", _("Ollama (Local PC / Server)"));
o.value("lmstudio", _("LM Studio (Local PC / Server)"));
o.value("custom", _("Custom OpenAI-Compatible API (OpenRouter)"));
o.value("custom", _("Custom OpenAI-Compatible API"));
o.default = "openai";
o = section.taboption(
+7 -4
View File
@@ -7,8 +7,8 @@ msgid ""
msgstr ""
"Project-Id-Version: TACHYON\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2026-08-17 10:26+0300\n"
"PO-Revision-Date: 2026-08-17 10:26+0300\n"
"POT-Creation-Date: 2026-08-17 11:15+0300\n"
"PO-Revision-Date: 2026-08-17 11:15+0300\n"
"Last-Translator: Dushnilin\n"
"Language-Team: none\n"
"Language: ru\n"
@@ -605,8 +605,8 @@ msgstr "Пользовательские заголовки устройства
msgid "Custom DNS Records (Hosts)"
msgstr "Пользовательские DNS-записи (Hosts)"
msgid "Custom OpenAI-Compatible API (OpenRouter)"
msgstr "Пользовательский OpenAI-совместимый API (OpenRouter)"
msgid "Custom OpenAI-Compatible API"
msgstr ""
msgid "Custom OpenAI-compatible API endpoint URL (e.g. http://192.168.1.100:11434/v1/chat/completions)"
msgstr "Пользовательский URL эндпоинта OpenAI-совместимого API (напр. http://192.168.1.100:11434/v1/chat/completions)"
@@ -3524,6 +3524,9 @@ msgstr "sing-box outbound для Zapret2 настроен"
msgid "Zapret2 sing-box outbound is not configured"
msgstr "sing-box outbound для Zapret2 не настроен"
msgid "Custom OpenAI-Compatible API (OpenRouter)"
msgstr "Пользовательский OpenAI-совместимый API (OpenRouter)"
msgid "Reloading page in"
msgstr "Перезагрузка страницы через"
File diff suppressed because it is too large Load Diff
@@ -3015,6 +3015,9 @@ function query_llm(provider, api_key, custom_url, prompt_text, model_override) {
if (provider == "deepseek") {
api_url = "https://api.deepseek.com/chat/completions";
model = model_override || "deepseek-chat";
} else if (provider == "openrouter") {
api_url = "https://openrouter.ai/api/v1/chat/completions";
model = model_override || "openai/gpt-4o-mini";
} else if (provider == "ollama") {
api_url = custom_url != "" ? custom_url : "http://192.168.1.100:11434/v1/chat/completions";
model = model_override || "llama3:latest";