Move NovelAI endpoints to separate file

This commit is contained in:
Cohee
2023-09-15 17:54:13 +03:00
parent 0f1a0963fd
commit 599904d589
7 changed files with 440 additions and 418 deletions

View File

@@ -11,6 +11,7 @@ import { getTextTokens, tokenizers } from "./tokenizers.js";
import {
getSortableDelay,
getStringHash,
onlyUnique,
uuidv4,
} from "./utils.js";
@@ -87,7 +88,7 @@ export function getNovelUnlimitedImageGeneration() {
}
export async function loadNovelSubscriptionData() {
const result = await fetch('/getstatus_novelai', {
const result = await fetch('/api/novelai/status', {
method: 'POST',
headers: getRequestHeaders(),
});
@@ -402,7 +403,7 @@ function getBadWordPermutations(text) {
// Ditto + leading space
result.push(` ${text.toLowerCase()}`);
return result;
return result.filter(onlyUnique);
}
export function getNovelGenerationData(finalPrompt, this_settings, this_amount_gen, isImpersonate, cfgValues) {
@@ -679,7 +680,7 @@ function tryParseStreamingError(decoded) {
export async function generateNovelWithStreaming(generate_data, signal) {
generate_data.streaming = nai_settings.streaming_novel;
const response = await fetch('/generate_novelai', {
const response = await fetch('/api/novelai/generate', {
headers: getRequestHeaders(),
body: JSON.stringify(generate_data),
method: 'POST',