mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
Added featherless, connect button not working
This commit is contained in:
@ -2038,6 +2038,7 @@
|
||||
<option value="tabby">TabbyAPI</option>
|
||||
<option value="togetherai">TogetherAI</option>
|
||||
<option value="vllm">vLLM</option>
|
||||
<option value="featherless">Featherless</option>
|
||||
</select>
|
||||
</div>
|
||||
<div data-tg-type="togetherai" class="flex-container flexFlowColumn">
|
||||
@ -2182,6 +2183,39 @@
|
||||
</div>
|
||||
<input id="custom_model_textgenerationwebui" class="text_pole wide100p" maxlength="500" placeholder="Custom model (optional)" data-i18n="[placeholder]Custom model (optional)" type="text">
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<div data-tg-type="featherless" class="flex-container flexFlowColumn">
|
||||
<div class="flex-container flexFlowColumn">
|
||||
<a href="https://featherless.ai/models/" target="_blank">
|
||||
featherless.ai
|
||||
</a>
|
||||
|
||||
</div>
|
||||
<h4 data-i18n="API key (optional)">API key</h4>
|
||||
<div class="flex-container">
|
||||
<input id="api_key_featherless" name="api_key_featherless" class="text_pole flex1 wide100p" maxlength="500" size="35" type="text" autocomplete="off">
|
||||
<div title="Clear your API key" data-i18n="[title]Clear your API key" class="menu_button fa-solid fa-circle-xmark clear-api-key" data-key="api_key_featherless">
|
||||
</div>
|
||||
</div>
|
||||
<div data-for="api_key_featherless" class="neutral_warning" data-i18n="For privacy reasons, your API key will be hidden after you reload the page.">
|
||||
For privacy reasons, your API key will be hidden after you reload the page.
|
||||
</div>
|
||||
<div class="flex1">
|
||||
<h4 data-i18n="Server url">Server URL</h4>
|
||||
<small data-i18n="Example: 127.0.0.1:5000">Try: Api.Featherless.ai/v1</small>
|
||||
<input id="featherless_api_url_text" name="featherless_api_url" class="text_pole wide100p" maxlength="500" value="" autocomplete="off" data-server-history="ooba_blocking">
|
||||
</div>
|
||||
<input id="custom_model_featherless" class="text_pole wide100p" maxlength="500" placeholder="Custom model (optional)" data-i18n="[placeholder]Custom model (optional)" type="text">
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div data-tg-type="vllm">
|
||||
<div class="flex-container flexFlowColumn">
|
||||
<a href="https://github.com/vllm-project/vllm" target="_blank" data-i18n="vllm-project/vllm">
|
||||
|
@ -22,7 +22,7 @@ import {
|
||||
parseTabbyLogprobs,
|
||||
} from './scripts/textgen-settings.js';
|
||||
|
||||
const { MANCER, TOGETHERAI, OOBA, VLLM, APHRODITE, TABBY, OLLAMA, INFERMATICAI, DREAMGEN, OPENROUTER } = textgen_types;
|
||||
const { MANCER, TOGETHERAI, OOBA, VLLM, APHRODITE, TABBY, OLLAMA, INFERMATICAI, DREAMGEN, OPENROUTER, FEATHERLESS} = textgen_types;
|
||||
|
||||
import {
|
||||
world_info,
|
||||
@ -222,7 +222,7 @@ import {
|
||||
import { getBackgrounds, initBackgrounds, loadBackgroundSettings, background_settings } from './scripts/backgrounds.js';
|
||||
import { hideLoader, showLoader } from './scripts/loader.js';
|
||||
import { BulkEditOverlay, CharacterContextMenu } from './scripts/BulkEditOverlay.js';
|
||||
import { loadMancerModels, loadOllamaModels, loadTogetherAIModels, loadInfermaticAIModels, loadOpenRouterModels, loadVllmModels, loadAphroditeModels, loadDreamGenModels } from './scripts/textgen-models.js';
|
||||
import { loadFeatherlessModels, loadMancerModels, loadOllamaModels, loadTogetherAIModels, loadInfermaticAIModels, loadOpenRouterModels, loadVllmModels, loadAphroditeModels, loadDreamGenModels } from './scripts/textgen-models.js';
|
||||
import { appendFileContent, hasPendingFileAttachment, populateFileAttachment, decodeStyleTags, encodeStyleTags, isExternalMediaAllowed, getCurrentEntityId } from './scripts/chats.js';
|
||||
import { initPresetManager } from './scripts/preset-manager.js';
|
||||
import { evaluateMacros } from './scripts/macros.js';
|
||||
@ -1122,6 +1122,8 @@ async function getStatusTextgen() {
|
||||
} else if (textgen_settings.type === APHRODITE) {
|
||||
loadAphroditeModels(data?.data);
|
||||
online_status = textgen_settings.aphrodite_model;
|
||||
} else if (textgen_settings.type === FEATHERLESS) {
|
||||
loadFeatherlessModels(data?.data);
|
||||
} else {
|
||||
online_status = data?.result;
|
||||
}
|
||||
@ -9322,6 +9324,7 @@ jQuery(async function () {
|
||||
{ id: 'api_key_openrouter-tg', secret: SECRET_KEYS.OPENROUTER },
|
||||
{ id: 'api_key_koboldcpp', secret: SECRET_KEYS.KOBOLDCPP },
|
||||
{ id: 'api_key_llamacpp', secret: SECRET_KEYS.LLAMACPP },
|
||||
{ id: 'api_key_featherless', secret: SECRET_KEYS.FEATHERLESS },
|
||||
];
|
||||
|
||||
for (const key of keys) {
|
||||
|
@ -28,6 +28,7 @@ export const SECRET_KEYS = {
|
||||
PERPLEXITY: 'api_key_perplexity',
|
||||
GROQ: 'api_key_groq',
|
||||
AZURE_TTS: 'api_key_azure_tts',
|
||||
FEATHERLESS: 'api_key_featherless',
|
||||
};
|
||||
|
||||
const INPUT_MAP = {
|
||||
|
@ -9,6 +9,7 @@ let infermaticAIModels = [];
|
||||
let dreamGenModels = [];
|
||||
let vllmModels = [];
|
||||
let aphroditeModels = [];
|
||||
let featherlessModels = [];
|
||||
export let openRouterModels = [];
|
||||
|
||||
/**
|
||||
@ -231,6 +232,35 @@ export async function loadAphroditeModels(data) {
|
||||
}
|
||||
}
|
||||
|
||||
export async function loadFeatherlessModels(data) {
|
||||
if (!Array.isArray(data)) {
|
||||
console.error('Invalid Featherless models data', data);
|
||||
return;
|
||||
}
|
||||
|
||||
featherlessModels = data;
|
||||
|
||||
if (!data.find(x => x.id === textgen_settings.featherless_model)) {
|
||||
textgen_settings.featherless_model = data[0]?.id || '';
|
||||
}
|
||||
|
||||
$('#featherless_model').empty();
|
||||
for (const model of data) {
|
||||
const option = document.createElement('option');
|
||||
option.value = model.id;
|
||||
option.text = model.id;
|
||||
option.selected = model.id === textgen_settings.featherless_model;
|
||||
$('#featherless_model').append(option);
|
||||
}
|
||||
}
|
||||
|
||||
function onFeatherlessModelSelect() {
|
||||
const modelId = String($('#featherless_model').val());
|
||||
textgen_settings.featherless_model = modelId;
|
||||
$('#api_button_textgenerationwebui').trigger('click');
|
||||
}
|
||||
|
||||
|
||||
function onMancerModelSelect() {
|
||||
const modelId = String($('#mancer_model').val());
|
||||
textgen_settings.mancer_model = modelId;
|
||||
@ -505,6 +535,7 @@ jQuery(function () {
|
||||
$('#ollama_download_model').on('click', downloadOllamaModel);
|
||||
$('#vllm_model').on('change', onVllmModelSelect);
|
||||
$('#aphrodite_model').on('change', onAphroditeModelSelect);
|
||||
$('#featherless_model').on('change', onFeatherlessModelSelect);
|
||||
|
||||
const providersSelect = $('.openrouter_providers');
|
||||
for (const provider of OPENROUTER_PROVIDERS) {
|
||||
|
@ -38,9 +38,10 @@ export const textgen_types = {
|
||||
INFERMATICAI: 'infermaticai',
|
||||
DREAMGEN: 'dreamgen',
|
||||
OPENROUTER: 'openrouter',
|
||||
FEATHERLESS: 'featherless',
|
||||
};
|
||||
|
||||
const { MANCER, VLLM, APHRODITE, TABBY, TOGETHERAI, OOBA, OLLAMA, LLAMACPP, INFERMATICAI, DREAMGEN, OPENROUTER, KOBOLDCPP } = textgen_types;
|
||||
const { MANCER, VLLM, APHRODITE, TABBY, TOGETHERAI, OOBA, OLLAMA, LLAMACPP, INFERMATICAI, DREAMGEN, OPENROUTER, KOBOLDCPP, FEATHERLESS } = textgen_types;
|
||||
|
||||
const LLAMACPP_DEFAULT_ORDER = [
|
||||
'top_k',
|
||||
@ -75,6 +76,7 @@ let TOGETHERAI_SERVER = 'https://api.together.xyz';
|
||||
let INFERMATICAI_SERVER = 'https://api.totalgpt.ai';
|
||||
let DREAMGEN_SERVER = 'https://dreamgen.com';
|
||||
let OPENROUTER_SERVER = 'https://openrouter.ai/api';
|
||||
let FEATHERLESS_SERVER = 'https://api.featherless.ai/v1';
|
||||
|
||||
const SERVER_INPUTS = {
|
||||
[textgen_types.OOBA]: '#textgenerationwebui_api_url_text',
|
||||
@ -84,6 +86,7 @@ const SERVER_INPUTS = {
|
||||
[textgen_types.KOBOLDCPP]: '#koboldcpp_api_url_text',
|
||||
[textgen_types.LLAMACPP]: '#llamacpp_api_url_text',
|
||||
[textgen_types.OLLAMA]: '#ollama_api_url_text',
|
||||
[textgen_types.FEATHERLESS]: '#featherless_api_url_text',
|
||||
};
|
||||
|
||||
const KOBOLDCPP_ORDER = [6, 0, 1, 3, 4, 2, 5];
|
||||
@ -265,6 +268,8 @@ export function validateTextGenUrl() {
|
||||
|
||||
export function getTextGenServer() {
|
||||
switch (settings.type) {
|
||||
case FEATHERLESS:
|
||||
return FEATHERLESS_SERVER;
|
||||
case MANCER:
|
||||
return MANCER_SERVER;
|
||||
case TOGETHERAI:
|
||||
|
@ -212,6 +212,7 @@ const TEXTGEN_TYPES = {
|
||||
INFERMATICAI: 'infermaticai',
|
||||
DREAMGEN: 'dreamgen',
|
||||
OPENROUTER: 'openrouter',
|
||||
FEATHERLESS: 'featherless',
|
||||
};
|
||||
|
||||
const INFERMATICAI_KEYS = [
|
||||
@ -226,6 +227,49 @@ const INFERMATICAI_KEYS = [
|
||||
'stop',
|
||||
];
|
||||
|
||||
const FEATHERLESS_KEYS = [
|
||||
'model',
|
||||
'prompt',
|
||||
'best_of',
|
||||
'echo',
|
||||
'frequency_penalty',
|
||||
'logit_bias',
|
||||
'logprobs',
|
||||
'max_tokens',
|
||||
'n',
|
||||
'presence_penalty',
|
||||
'seed',
|
||||
'stop',
|
||||
'stream',
|
||||
'suffix',
|
||||
'temperature',
|
||||
'top_p',
|
||||
'user',
|
||||
|
||||
'use_beam_search',
|
||||
'top_k',
|
||||
'min_p',
|
||||
'repetition_penalty',
|
||||
'length_penalty',
|
||||
'early_stopping',
|
||||
'stop_token_ids',
|
||||
'ignore_eos',
|
||||
'min_tokens',
|
||||
'skip_special_tokens',
|
||||
'spaces_between_special_tokens',
|
||||
'truncate_prompt_tokens',
|
||||
|
||||
'include_stop_str_in_output',
|
||||
'response_format',
|
||||
'guided_json',
|
||||
'guided_regex',
|
||||
'guided_choice',
|
||||
'guided_grammar',
|
||||
'guided_decoding_backend',
|
||||
'guided_whitespace_pattern',
|
||||
];
|
||||
|
||||
|
||||
// https://dreamgen.com/docs/api#openai-text
|
||||
const DREAMGEN_KEYS = [
|
||||
'model',
|
||||
@ -366,4 +410,5 @@ module.exports = {
|
||||
OPENROUTER_HEADERS,
|
||||
OPENROUTER_KEYS,
|
||||
VLLM_KEYS,
|
||||
FEATHERLESS_KEYS,
|
||||
};
|
||||
|
@ -126,6 +126,9 @@ router.post('/status', jsonParser, async function (request, response) {
|
||||
case TEXTGEN_TYPES.OLLAMA:
|
||||
url += '/api/tags';
|
||||
break;
|
||||
case TEXTGEN_TYPES.FEATHERLESS:
|
||||
url += '/v1/models';
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -135,7 +138,7 @@ router.post('/status', jsonParser, async function (request, response) {
|
||||
console.log('Models endpoint is offline.');
|
||||
return response.status(400);
|
||||
}
|
||||
|
||||
console.log("url for models", url)
|
||||
let data = await modelsReply.json();
|
||||
|
||||
if (request.body.legacy_api) {
|
||||
|
Reference in New Issue
Block a user