mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-02-07 23:58:42 +01:00
Add NanoGPT as chat completions provider
This commit is contained in:
parent
0882fb2d15
commit
4b5f485bd5
@ -48,6 +48,7 @@ const API_MAKERSUITE = 'https://generativelanguage.googleapis.com';
|
||||
const API_01AI = 'https://api.01.ai/v1';
|
||||
const API_BLOCKENTROPY = 'https://api.blockentropy.ai/v1';
|
||||
const API_AI21 = 'https://api.ai21.com/studio/v1';
|
||||
const API_NANOGPT = 'https://nano-gpt.com/api/v1';
|
||||
|
||||
/**
|
||||
* Applies a post-processing step to the generated messages.
|
||||
@ -656,6 +657,10 @@ router.post('/status', jsonParser, async function (request, response_getstatus_o
|
||||
api_url = API_BLOCKENTROPY;
|
||||
api_key_openai = readSecret(request.user.directories, SECRET_KEYS.BLOCKENTROPY);
|
||||
headers = {};
|
||||
} else if (request.body.chat_completion_source === CHAT_COMPLETION_SOURCES.NANOGPT) {
|
||||
api_url = API_NANOGPT;
|
||||
api_key_openai = readSecret(request.user.directories, SECRET_KEYS.NANOGPT);
|
||||
headers = {};
|
||||
} else {
|
||||
console.log('This chat completion source is not supported yet.');
|
||||
return response_getstatus_openai.status(400).send({ error: true });
|
||||
@ -906,6 +911,11 @@ router.post('/generate', jsonParser, function (request, response) {
|
||||
apiKey = readSecret(request.user.directories, SECRET_KEYS.GROQ);
|
||||
headers = {};
|
||||
bodyParams = {};
|
||||
} else if (request.body.chat_completion_source === CHAT_COMPLETION_SOURCES.NANOGPT) {
|
||||
apiUrl = API_NANOGPT;
|
||||
apiKey = readSecret(request.user.directories, SECRET_KEYS.NANOGPT);
|
||||
headers = {};
|
||||
bodyParams = {};
|
||||
} else if (request.body.chat_completion_source === CHAT_COMPLETION_SOURCES.ZEROONEAI) {
|
||||
apiUrl = API_01AI;
|
||||
apiKey = readSecret(request.user.directories, SECRET_KEYS.ZEROONEAI);
|
||||
|
@ -48,6 +48,7 @@ export const SECRET_KEYS = {
|
||||
BLOCKENTROPY: 'api_key_blockentropy',
|
||||
CUSTOM_OPENAI_TTS: 'api_key_custom_openai_tts',
|
||||
TAVILY: 'api_key_tavily',
|
||||
NANOGPT: 'api_key_nanogpt',
|
||||
};
|
||||
|
||||
// These are the keys that are safe to expose, even if allowKeysExposure is false
|
||||
|
Loading…
x
Reference in New Issue
Block a user