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

@@ -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 {