mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-05-06 05:11:05 +02: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_01AI = 'https://api.01.ai/v1';
|
||||||
const API_BLOCKENTROPY = 'https://api.blockentropy.ai/v1';
|
const API_BLOCKENTROPY = 'https://api.blockentropy.ai/v1';
|
||||||
const API_AI21 = 'https://api.ai21.com/studio/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.
|
* 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_url = API_BLOCKENTROPY;
|
||||||
api_key_openai = readSecret(request.user.directories, SECRET_KEYS.BLOCKENTROPY);
|
api_key_openai = readSecret(request.user.directories, SECRET_KEYS.BLOCKENTROPY);
|
||||||
headers = {};
|
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 {
|
} else {
|
||||||
console.log('This chat completion source is not supported yet.');
|
console.log('This chat completion source is not supported yet.');
|
||||||
return response_getstatus_openai.status(400).send({ error: true });
|
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);
|
apiKey = readSecret(request.user.directories, SECRET_KEYS.GROQ);
|
||||||
headers = {};
|
headers = {};
|
||||||
bodyParams = {};
|
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) {
|
} else if (request.body.chat_completion_source === CHAT_COMPLETION_SOURCES.ZEROONEAI) {
|
||||||
apiUrl = API_01AI;
|
apiUrl = API_01AI;
|
||||||
apiKey = readSecret(request.user.directories, SECRET_KEYS.ZEROONEAI);
|
apiKey = readSecret(request.user.directories, SECRET_KEYS.ZEROONEAI);
|
||||||
|
@ -48,6 +48,7 @@ export const SECRET_KEYS = {
|
|||||||
BLOCKENTROPY: 'api_key_blockentropy',
|
BLOCKENTROPY: 'api_key_blockentropy',
|
||||||
CUSTOM_OPENAI_TTS: 'api_key_custom_openai_tts',
|
CUSTOM_OPENAI_TTS: 'api_key_custom_openai_tts',
|
||||||
TAVILY: 'api_key_tavily',
|
TAVILY: 'api_key_tavily',
|
||||||
|
NANOGPT: 'api_key_nanogpt',
|
||||||
};
|
};
|
||||||
|
|
||||||
// These are the keys that are safe to expose, even if allowKeysExposure is false
|
// These are the keys that are safe to expose, even if allowKeysExposure is false
|
||||||
|
Loading…
x
Reference in New Issue
Block a user