mirror of
https://github.com/Wx-2025/ST-Amily2-Chat-Optimisation.git
synced 2026-06-06 12:45:51 +00:00
Update cwb_apiService.js
This commit is contained in:
@@ -607,28 +607,18 @@ export function updateApiStatusDisplay($panel) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function callCustomOpenAI(systemPrompt, userPromptContent) {
|
export async function callCustomOpenAI(messages) {
|
||||||
const apiSettings = getCwbApiSettings();
|
const apiSettings = getCwbApiSettings();
|
||||||
|
|
||||||
if (apiSettings.apiMode === 'sillytavern_preset') {
|
if (apiSettings.apiMode === 'sillytavern_preset') {
|
||||||
const combinedSystemPrompt = `${state.currentBreakArmorPrompt}\n\n${systemPrompt}`;
|
|
||||||
const messages = [
|
|
||||||
{ role: 'system', content: combinedSystemPrompt },
|
|
||||||
{ role: 'user', content: userPromptContent },
|
|
||||||
];
|
|
||||||
return await callCwbSillyTavernPreset(messages, { tavernProfile: apiSettings.tavernProfile, maxTokens: 65000 });
|
return await callCwbSillyTavernPreset(messages, { tavernProfile: apiSettings.tavernProfile, maxTokens: 65000 });
|
||||||
} else {
|
} else {
|
||||||
if (!state.customApiConfig.url || !state.customApiConfig.model) {
|
if (!state.customApiConfig.url || !state.customApiConfig.model) {
|
||||||
throw new Error('API URL/Model未配置。');
|
throw new Error('API URL/Model未配置。');
|
||||||
}
|
}
|
||||||
|
|
||||||
const combinedSystemPrompt = `${state.currentBreakArmorPrompt}\n\n${systemPrompt}`;
|
|
||||||
|
|
||||||
const requestBody = {
|
const requestBody = {
|
||||||
messages: [
|
messages: messages,
|
||||||
{ role: 'system', content: combinedSystemPrompt },
|
|
||||||
{ role: 'user', content: userPromptContent },
|
|
||||||
],
|
|
||||||
model: state.customApiConfig.model,
|
model: state.customApiConfig.model,
|
||||||
temperature: 1,
|
temperature: 1,
|
||||||
frequency_penalty: 0,
|
frequency_penalty: 0,
|
||||||
|
|||||||
Reference in New Issue
Block a user