mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
Add custom caption source
This commit is contained in:
@@ -24,7 +24,11 @@ router.post('/caption-image', jsonParser, async (request, response) => {
|
||||
key = request.body.proxy_password;
|
||||
}
|
||||
|
||||
if (!key && !request.body.reverse_proxy) {
|
||||
if (request.body.api === 'custom') {
|
||||
key = readSecret(SECRET_KEYS.CUSTOM);
|
||||
}
|
||||
|
||||
if (!key && !request.body.reverse_proxy && request.body.api !== 'custom') {
|
||||
console.log('No key found for API', request.body.api);
|
||||
return response.sendStatus(400);
|
||||
}
|
||||
@@ -69,6 +73,10 @@ router.post('/caption-image', jsonParser, async (request, response) => {
|
||||
apiUrl = `${request.body.reverse_proxy}/chat/completions`;
|
||||
}
|
||||
|
||||
if (request.body.api === 'custom') {
|
||||
apiUrl = `${request.body.server_url}/chat/completions`;
|
||||
}
|
||||
|
||||
const result = await fetch(apiUrl, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
|
Reference in New Issue
Block a user