Merge pull request #2634 from splitclover/staging
Add events for chat completion import/export
This commit is contained in:
commit
218416010f
|
@ -425,6 +425,8 @@ export const event_types = {
|
||||||
CHATCOMPLETION_MODEL_CHANGED: 'chatcompletion_model_changed',
|
CHATCOMPLETION_MODEL_CHANGED: 'chatcompletion_model_changed',
|
||||||
OAI_PRESET_CHANGED_BEFORE: 'oai_preset_changed_before',
|
OAI_PRESET_CHANGED_BEFORE: 'oai_preset_changed_before',
|
||||||
OAI_PRESET_CHANGED_AFTER: 'oai_preset_changed_after',
|
OAI_PRESET_CHANGED_AFTER: 'oai_preset_changed_after',
|
||||||
|
OAI_PRESET_EXPORT_READY: 'oai_preset_export_ready',
|
||||||
|
OAI_PRESET_IMPORT_READY: 'oai_preset_import_ready',
|
||||||
WORLDINFO_SETTINGS_UPDATED: 'worldinfo_settings_updated',
|
WORLDINFO_SETTINGS_UPDATED: 'worldinfo_settings_updated',
|
||||||
WORLDINFO_UPDATED: 'worldinfo_updated',
|
WORLDINFO_UPDATED: 'worldinfo_updated',
|
||||||
CHARACTER_EDITED: 'character_edited',
|
CHARACTER_EDITED: 'character_edited',
|
||||||
|
|
|
@ -3597,6 +3597,8 @@ async function onPresetImportFileChange(e) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
await eventSource.emit(event_types.OAI_PRESET_IMPORT_READY, { data: presetBody, presetName: name });
|
||||||
|
|
||||||
const savePresetSettings = await fetch(`/api/presets/save-openai?name=${name}`, {
|
const savePresetSettings = await fetch(`/api/presets/save-openai?name=${name}`, {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: getRequestHeaders(),
|
headers: getRequestHeaders(),
|
||||||
|
@ -3652,6 +3654,7 @@ async function onExportPresetClick() {
|
||||||
sensitiveFields.forEach(field => delete preset[field]);
|
sensitiveFields.forEach(field => delete preset[field]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
await eventSource.emit(event_types.OAI_PRESET_EXPORT_READY, preset);
|
||||||
const presetJsonString = JSON.stringify(preset, null, 4);
|
const presetJsonString = JSON.stringify(preset, null, 4);
|
||||||
const presetFileName = `${oai_settings.preset_settings_openai}.json`;
|
const presetFileName = `${oai_settings.preset_settings_openai}.json`;
|
||||||
download(presetJsonString, presetFileName, 'application/json');
|
download(presetJsonString, presetFileName, 'application/json');
|
||||||
|
|
Loading…
Reference in New Issue