ci: auto build & obfuscate [2026-05-16 19:16:28] (Jenkins #21)

This commit is contained in:
Jenkins CI
2026-05-16 19:16:28 +08:00
parent 4bc6e0a047
commit d9fa3072a2
46 changed files with 4154 additions and 1584 deletions

View File

@@ -3,11 +3,12 @@ import { getRequestHeaders } from "/script.js";
import { extensionName } from "../../utils/settings.js";
import { getSlotProfile, providerToApiMode } from './api-resolver.js';
import { configManager } from '../../utils/config/ConfigManager.js';
import { detectVendor } from '../../utils/api-vendor.js';
async function getConcurrentApiSettings() {
const s = extension_settings[extensionName] || {};
// 优先读取槽位分配的 Profile仅接管连接参数
// 优先读取槽位分配的 Profileprofile 一旦分配即权威slider 残值不再覆盖
const profile = await getSlotProfile('plotOptConc');
if (profile) {
return {
@@ -15,8 +16,7 @@ async function getConcurrentApiSettings() {
apiUrl: profile.apiUrl,
apiKey: profile.apiKey ?? '',
model: profile.model,
// MaxTokens 读面板值
maxTokens: s.plotOpt_concurrentMaxTokens ?? profile.maxTokens ?? 8100,
maxTokens: profile.maxTokens ?? 8100,
temperature: profile.temperature ?? 1,
};
}
@@ -47,7 +47,7 @@ export async function callConcurrentAI(messages, options = {}) {
if (!finalOptions.apiUrl || !finalOptions.model || !finalOptions.apiKey) {
console.warn("[Amily2-Concurrent外交部] API配置不完整无法调用AI");
toastr.error("并发API配置不完整请检查URL、Key和模型配置。", "Concurrent-外交部");
toastr.error("并发剧情优化plotOptConc未配置 API 连接配置,请前往 API 连接配置面板分配 profile 或填写并发优化独立设置。", "Amily2-并发优化未配置");
return null;
}
@@ -97,7 +97,7 @@ export async function callConcurrentAI(messages, options = {}) {
}
async function callConcurrentOpenAITest(messages, options) {
const isGoogleApi = options.apiUrl.includes('googleapis.com');
const isGoogleApi = (await detectVendor(options.apiUrl)) === 'google';
const body = {
chat_completion_source: 'openai',

View File

@@ -4,6 +4,7 @@ import { extensionName } from "../../utils/settings.js";
import { amilyHelper } from '../../core/tavern-helper/main.js';
import { getSlotProfile, providerToApiMode } from './api-resolver.js';
import { configManager } from '../../utils/config/ConfigManager.js';
import { detectVendor } from '../../utils/api-vendor.js';
let ChatCompletionService = undefined;
try {
@@ -47,7 +48,7 @@ function normalizeApiResponse(responseData) {
export async function getJqyhApiSettings() {
const s = extension_settings[extensionName] || {};
// JQYH 与剧情优化互斥,共用 'plotOpt' 槽位
// JQYH 与剧情优化互斥,共用 'plotOpt' 槽位profile 一旦分配即权威slider 残值不再覆盖)
const profile = await getSlotProfile('plotOpt');
if (profile) {
return {
@@ -55,9 +56,9 @@ export async function getJqyhApiSettings() {
apiUrl: profile.apiUrl,
apiKey: profile.apiKey ?? '',
model: profile.model,
// 温度 / MaxTokens 读面板值
maxTokens: s.jqyhMaxTokens ?? profile.maxTokens ?? 65500,
temperature: s.jqyhTemperature ?? profile.temperature ?? 1.0,
maxTokens: profile.maxTokens ?? 65500,
temperature: profile.temperature ?? 1.0,
customParams: profile.customParams ?? {},
tavernProfile: '',
};
}
@@ -70,6 +71,7 @@ export async function getJqyhApiSettings() {
model: s.jqyhModel || '',
maxTokens: s.jqyhMaxTokens || 4000,
temperature: s.jqyhTemperature || 0.7,
customParams: {},
tavernProfile: s.jqyhTavernProfile || '',
};
}
@@ -96,7 +98,7 @@ export async function callJqyhAI(messages, options = {}) {
if (finalOptions.apiMode !== 'sillytavern_preset') {
if (!finalOptions.apiUrl || !finalOptions.model || !finalOptions.apiKey) {
console.warn("[Amily2-Jqyh外交部] API配置不完整无法调用AI");
toastr.error("API配置不完整请检查URL、Key和模型配置。", "Jqyh-外交部");
toastr.error("剧情优化前置JQYH未配置 API 连接配置,请前往 API 连接配置面板分配 profile 或填写 JQYH 独立设置。", "Amily2-JQYH 未配置");
return null;
}
}
@@ -160,9 +162,11 @@ export async function callJqyhAI(messages, options = {}) {
}
async function callJqyhOpenAITest(messages, options) {
const isGoogleApi = options.apiUrl.includes('googleapis.com');
const isGoogleApi = (await detectVendor(options.apiUrl)) === 'google';
const body = {
top_p: options.top_p || 1,
...(options.customParams || {}),
chat_completion_source: 'openai',
messages: messages,
model: options.model,
@@ -171,7 +175,6 @@ async function callJqyhOpenAITest(messages, options) {
stream: false,
max_tokens: options.maxTokens || 30000,
temperature: options.temperature || 1,
top_p: options.top_p || 1,
};
if (!isGoogleApi) {
@@ -245,7 +248,8 @@ async function callJqyhSillyTavernPreset(messages, options) {
responsePromise = context.ConnectionManagerRequestService.sendRequest(
targetProfile.id,
messages,
options.maxTokens || 4000
options.maxTokens || 4000,
options.customParams || {}
);
} finally {

View File

@@ -4,6 +4,7 @@ import { extensionName } from "../../utils/settings.js";
import { amilyHelper } from '../../core/tavern-helper/main.js';
import { getSlotProfile, providerToApiMode } from './api-resolver.js';
import { configManager } from '../../utils/config/ConfigManager.js';
import { detectVendor } from '../../utils/api-vendor.js';
let ChatCompletionService = undefined;
try {
@@ -41,7 +42,7 @@ if (window.Amily2Bus) {
export async function getNccsApiSettings() {
const s = extension_settings[extensionName] || {};
// 优先读取 'nccs' 槽位分配的 Profile仅接管连接参数
// 优先读取 'nccs' 槽位分配的 Profileprofile 一旦分配即权威,旧 slider 残值不再覆盖
const profile = await getSlotProfile('nccs');
if (profile) {
return {
@@ -50,9 +51,9 @@ export async function getNccsApiSettings() {
apiUrl: profile.apiUrl,
apiKey: profile.apiKey ?? '',
model: profile.model,
// 温度 / MaxTokens / FakeStream 读面板值profile-sync 保留了这些输入框)
maxTokens: s.nccsMaxTokens ?? profile.maxTokens ?? 65500,
temperature: s.nccsTemperature ?? profile.temperature ?? 1.0,
maxTokens: profile.maxTokens ?? 65500,
temperature: profile.temperature ?? 1.0,
customParams: profile.customParams ?? {},
tavernProfile: '',
useFakeStream: s.nccsFakeStreamEnabled ?? false,
};
@@ -67,6 +68,7 @@ export async function getNccsApiSettings() {
model: s.nccsModel || '',
maxTokens: s.nccsMaxTokens ?? 8192,
temperature: s.nccsTemperature ?? 1,
customParams: {},
tavernProfile: s.nccsTavernProfile || '',
useFakeStream: s.nccsFakeStreamEnabled || false,
};
@@ -94,7 +96,7 @@ export async function callNccsAI(messages, options = {}) {
if (finalOptions.apiMode !== 'sillytavern_preset') {
if (!finalOptions.apiUrl || !finalOptions.model || !finalOptions.apiKey) {
console.warn("[Amily2-Nccs外交部] API配置不完整无法调用AI");
toastr.error("API配置不完整请检查URL、Key和模型配置。", "Nccs-外交部");
toastr.error("并发模块NCCS未配置 API 连接配置,请前往 API 连接配置面板分配 profile 或填写 NCCS 独立设置。", "Amily2-NCCS 未配置");
return null;
}
} else {
@@ -187,8 +189,10 @@ function normalizeApiResponse(responseData) {
}
async function callNccsOpenAITest(messages, options) {
const isGoogleApi = options.apiUrl.includes('googleapis.com');
const isGoogleApi = (await detectVendor(options.apiUrl)) === 'google';
const body = {
top_p: options.top_p || 1,
...(options.customParams || {}),
chat_completion_source: 'openai',
messages: messages,
model: options.model,
@@ -197,7 +201,6 @@ async function callNccsOpenAITest(messages, options) {
stream: !!options.stream,
max_tokens: 8192,
temperature: 1,
top_p: options.top_p || 1,
};
if (!isGoogleApi) {
@@ -244,7 +247,8 @@ async function callNccsSillyTavernPreset(messages, options) {
const result = await context.ConnectionManagerRequestService.sendRequest(
targetProfile.id,
messages,
8192
8192,
options.customParams || {}
);
return normalizeApiResponse(result);

View File

@@ -4,6 +4,7 @@ import { extensionName } from "../../utils/settings.js";
import { amilyHelper } from '../../core/tavern-helper/main.js';
import { getSlotProfile, providerToApiMode } from './api-resolver.js';
import { configManager } from '../../utils/config/ConfigManager.js';
import { detectVendor } from '../../utils/api-vendor.js';
let ChatCompletionService = undefined;
try {
@@ -47,7 +48,7 @@ function normalizeApiResponse(responseData) {
export async function getNgmsApiSettings() {
const s = extension_settings[extensionName] || {};
// 优先读取 'ngms' 槽位分配的 Profile仅接管连接参数
// 优先读取 'ngms' 槽位分配的 Profileprofile 一旦分配即权威,旧 slider 残值不再覆盖
const profile = await getSlotProfile('ngms');
if (profile) {
return {
@@ -55,9 +56,9 @@ export async function getNgmsApiSettings() {
apiUrl: profile.apiUrl,
apiKey: profile.apiKey ?? '',
model: profile.model,
// 温度 / MaxTokens / FakeStream 读面板值
maxTokens: s.ngmsMaxTokens ?? profile.maxTokens ?? 65500,
temperature: s.ngmsTemperature ?? profile.temperature ?? 1.0,
maxTokens: profile.maxTokens ?? 65500,
temperature: profile.temperature ?? 1.0,
customParams: profile.customParams ?? {},
tavernProfile: '',
useFakeStream: s.ngmsFakeStreamEnabled ?? false,
};
@@ -71,6 +72,7 @@ export async function getNgmsApiSettings() {
model: s.ngmsModel || '',
maxTokens: s.ngmsMaxTokens ?? 30000,
temperature: s.ngmsTemperature ?? 1.0,
customParams: {},
tavernProfile: s.ngmsTavernProfile || '',
useFakeStream: s.ngmsFakeStreamEnabled || false,
};
@@ -101,7 +103,7 @@ export async function callNgmsAI(messages, options = {}) {
if (finalOptions.apiMode !== 'sillytavern_preset') {
if (!finalOptions.apiUrl || !finalOptions.model || !finalOptions.apiKey) {
console.warn("[Amily2-Ngms外交部] API配置不完整无法调用AI");
toastr.error("API配置不完整请检查URL、Key和模型配置。", "Ngms-外交部");
toastr.error("总结模块NGMS未配置 API 连接配置,请前往 API 连接配置面板分配 profile 或填写 NGMS 独立设置。", "Amily2-NGMS 未配置");
return null;
}
} else {
@@ -221,9 +223,11 @@ async function fetchFakeStream(url, opts) {
}
async function callNgmsOpenAITest(messages, options) {
const isGoogleApi = options.apiUrl.includes('googleapis.com');
const isGoogleApi = (await detectVendor(options.apiUrl)) === 'google';
const body = {
top_p: options.top_p || 1,
...(options.customParams || {}),
chat_completion_source: 'openai',
messages: messages,
model: options.model,
@@ -232,7 +236,6 @@ async function callNgmsOpenAITest(messages, options) {
stream: !!options.stream,
max_tokens: options.maxTokens || 30000,
temperature: options.temperature || 1,
top_p: options.top_p || 1,
};
if (!isGoogleApi) {
@@ -312,7 +315,8 @@ async function callNgmsSillyTavernPreset(messages, options) {
responsePromise = context.ConnectionManagerRequestService.sendRequest(
targetProfile.id,
messages,
options.maxTokens || 4000
options.maxTokens || 4000,
options.customParams || {}
);
} finally {

View File

@@ -4,6 +4,7 @@ import { extensionName } from "../../utils/settings.js";
import { amilyHelper } from '../../core/tavern-helper/main.js';
import { getSlotProfile, providerToApiMode } from './api-resolver.js';
import { configManager } from '../../utils/config/ConfigManager.js';
import { detectVendor } from '../../utils/api-vendor.js';
let ChatCompletionService = undefined;
try {
@@ -47,7 +48,7 @@ function normalizeApiResponse(responseData) {
export async function getSybdApiSettings() {
const s = extension_settings[extensionName] || {};
// 优先读取 'sybd' 槽位分配的 Profile
// 优先读取 'sybd' 槽位分配的 Profileprofile 一旦分配即权威slider 残值不再覆盖)
const profile = await getSlotProfile('sybd');
if (profile) {
return {
@@ -55,8 +56,9 @@ export async function getSybdApiSettings() {
apiUrl: profile.apiUrl,
apiKey: profile.apiKey ?? '',
model: profile.model,
maxTokens: s.sybdMaxTokens ?? profile.maxTokens ?? 4000,
temperature: s.sybdTemperature ?? profile.temperature ?? 0.7,
maxTokens: profile.maxTokens ?? 4000,
temperature: profile.temperature ?? 0.7,
customParams: profile.customParams ?? {},
tavernProfile: '',
};
}
@@ -69,6 +71,7 @@ export async function getSybdApiSettings() {
model: s.sybdModel || '',
maxTokens: s.sybdMaxTokens || 4000,
temperature: s.sybdTemperature || 0.7,
customParams: {},
tavernProfile: s.sybdTavernProfile || '',
};
}
@@ -95,7 +98,7 @@ export async function callSybdAI(messages, options = {}) {
if (finalOptions.apiMode !== 'sillytavern_preset') {
if (!finalOptions.apiUrl || !finalOptions.model || !finalOptions.apiKey) {
console.warn("[Amily2-Sybd外交部] API配置不完整无法调用AI");
toastr.error("API配置不完整请检查URL、Key和模型配置。", "Sybd-外交部");
toastr.error("术语表填写SYBD未配置 API 连接配置,请前往 API 连接配置面板分配 profile 或填写 SYBD 独立设置。", "Amily2-SYBD 未配置");
return null;
}
}
@@ -159,9 +162,11 @@ export async function callSybdAI(messages, options = {}) {
}
async function callSybdOpenAITest(messages, options) {
const isGoogleApi = options.apiUrl.includes('googleapis.com');
const isGoogleApi = (await detectVendor(options.apiUrl)) === 'google';
const body = {
top_p: options.top_p || 1,
...(options.customParams || {}),
chat_completion_source: 'openai',
messages: messages,
model: options.model,
@@ -170,7 +175,6 @@ async function callSybdOpenAITest(messages, options) {
stream: false,
max_tokens: options.maxTokens || 30000,
temperature: options.temperature || 1,
top_p: options.top_p || 1,
};
if (!isGoogleApi) {
@@ -244,7 +248,8 @@ async function callSybdSillyTavernPreset(messages, options) {
responsePromise = context.ConnectionManagerRequestService.sendRequest(
targetProfile.id,
messages,
options.maxTokens || 4000
options.maxTokens || 4000,
options.customParams || {}
);
} finally {