Pass app headers to featherless
| @@ -1,4 +1,4 @@ | |||
| 1 | const { TEXTGEN_TYPES, OPENROUTER_HEADERS } = require('./constants'); | 1 | const { TEXTGEN_TYPES, OPENROUTER_HEADERS, FEATHERLESS_HEADERS } = require('./constants'); |
| 2 | const { SECRET_KEYS, readSecret } = require('./endpoints/secrets'); | 2 | const { SECRET_KEYS, readSecret } = require('./endpoints/secrets'); |
| 3 | const { getConfigValue } = require('./util'); | 3 | const { getConfigValue } = require('./util'); |
| 4 | 4 | ||
| @@ -154,10 +154,9 @@ function getKoboldCppHeaders(directories) { | |||
| 154 | */ | 154 | */ |
| 155 | function getFeatherlessHeaders(directories) { | 155 | function getFeatherlessHeaders(directories) { |
| 156 | const apiKey = readSecret(directories, SECRET_KEYS.FEATHERLESS); | 156 | const apiKey = readSecret(directories, SECRET_KEYS.FEATHERLESS); |
| 157 | const baseHeaders = { ...FEATHERLESS_HEADERS }; | ||
| 157 | 158 | ||
| 158 | return apiKey ? ({ | 159 | return apiKey ? Object.assign(baseHeaders, { 'Authorization': `Bearer ${apiKey}` }) : baseHeaders; |
| 159 | 'Authorization': `Bearer ${apiKey}`, | ||
| 160 | }) : {}; | ||
| 161 | } | 160 | } |
| 162 | 161 | ||
| 163 | /** | 162 | /** |
| @@ -348,6 +348,11 @@ const OPENROUTER_HEADERS = { | |||
| 348 | 'X-Title': 'SillyTavern', | 348 | 'X-Title': 'SillyTavern', |
| 349 | }; | 349 | }; |
| 350 | 350 | ||
| 351 | const FEATHERLESS_HEADERS = { | ||
| 352 | 'HTTP-Referer': 'https://sillytavern.app', | ||
| 353 | 'X-Title': 'SillyTavern', | ||
| 354 | }; | ||
| 355 | |||
| 351 | const OPENROUTER_KEYS = [ | 356 | const OPENROUTER_KEYS = [ |
| 352 | 'max_tokens', | 357 | 'max_tokens', |
| 353 | 'temperature', | 358 | 'temperature', |
| @@ -432,4 +437,5 @@ module.exports = { | |||
| 432 | OPENROUTER_KEYS, | 437 | OPENROUTER_KEYS, |
| 433 | VLLM_KEYS, | 438 | VLLM_KEYS, |
| 434 | FEATHERLESS_KEYS, | 439 | FEATHERLESS_KEYS, |
| 440 | FEATHERLESS_HEADERS, | ||
| 435 | }; | 441 | }; |