* Split Pollinations into two separate API providers: (Key) and (No Key)
- Replaces the single "Pollinations" source with two distinct entries:
- "Pollinations (Key)": uses gen.pollinations.ai/v1 with Bearer token auth,
supports BYOP OAuth flow with app key pk_Gu8Ta8q6QhS67hSg and manual key entry
- "Pollinations (No Key)": uses text.pollinations.ai/v1, no authentication required
- Renames CHAT_COMPLETION_SOURCES.POLLINATIONS to POLLINATIONS_KEY/POLLINATIONS_NOKEY
throughout the codebase (constants, endpoints, frontend scripts)
- Adds BYOP authorize button and OAuth callback handler for key-based source
- Updates all data-source attributes, secret key mappings, model selectors,
tool-calling, reasoning, slash-commands, caption, and SD extension references
https://claude.ai/code/session_01T57Cm84cv2GiSL4DPCccBj
* Fix POLLINATIONS_NOKEY: exempt from API key check, fix placeholder text
- Add POLLINATIONS_NOKEY to the keyless providers exemption in the
/generate endpoint's API key guard (was hitting the 400 check)
- Remove 'pk_...' from the key input placeholder since pk_ is the
app key used in the BYOP auth link, not the user's secret key
https://claude.ai/code/session_01T57Cm84cv2GiSL4DPCccBj
* Add Pollinations anonymous/authenticated endpoint selector
Implements reviewer feedback to use a single Pollinations provider with
an endpoint dropdown (similar to Z.AI) rather than two separate sources.
- Add POLLINATIONS_ENDPOINT enum (anonymous / authenticated)
- Anonymous uses text.pollinations.ai/v1, no API key required
- Authenticated uses gen.pollinations.ai/v1, requires sk_... key with BYOP OAuth support
- Key input and BYOP button are hidden when anonymous endpoint is selected
- Backend skips key guard for anonymous requests
- Reasoning effort and JSON schema only sent for authenticated mode
- Connection status check passes for anonymous without a saved key
https://claude.ai/code/session_01T57Cm84cv2GiSL4DPCccBj
* Fix broken Pollinations references after resolving merge conflicts
- Replace POLLINATIONS_KEY/NOKEY in CHAT_COMPLETION_SOURCES with POLLINATIONS
- Fix SECRET_KEYS.POLLINATIONS → SECRET_KEYS.POLLINATIONS_KEY in backend
- Update all chat_completion_sources references in openai.js to use unified POLLINATIONS
- Consolidate duplicate model select/change handlers into single pollinations_model
- Keep backward compat in caption-image handler for pollinations_key/nokey multimodal API
- Fix openai.js inline handler to route pollinations to correct endpoint based on endpoint field
https://claude.ai/code/session_01T57Cm84cv2GiSL4DPCccBj
* Complete Pollinations unification: remove all pollinations_key/nokey splits
- Fix committed merge conflict in openai.js (Wolfsblvt review)
- Replace POLLINATIONS_KEY/NOKEY in chat_completion_source dropdown with single POLLINATIONS option
- Replace pollinations_key,pollinations_nokey in all data-source attributes with pollinations
- Merge duplicate /pollinations_key and /pollinations_nokey multimodal routes into single /pollinations
- Update caption extension: single "Pollinations" option using pollinations_endpoint from oai_settings
- Update slash-commands.js model selector to single pollinations entry
- Clean up caption-image handler (openai.js) to use only 'pollinations' api type
- Pass pollinations_endpoint in caption request body (shared.js)
- Add settings migration: pollinations_key → pollinations, pollinations_nokey → pollinations (anonymous)
https://claude.ai/code/session_01T57Cm84cv2GiSL4DPCccBj
* Address Cohee review: named constants, mock key, revert POLLINATIONS_KEY rename, default to authenticated
- Use POLLINATIONS_ENDPOINT named constants throughout (no magic 'anonymous' strings)
- Use mock key pattern (set key to POLLINATIONS_ENDPOINT.ANONYMOUS value) so no guard exception needed
- Revert POLLINATIONS_KEY rename back to POLLINATIONS in secrets.js files
- Default pollinations_endpoint to AUTHENTICATED so saved keys aren't bypassed
- Remove redundant isPollinationsAnon check from getReasoningEffort() (backend handles it)
- Unify tool-calling.js, caption, shared, stable-diffusion to single POLLINATIONS source
https://claude.ai/code/session_01T57Cm84cv2GiSL4DPCccBj
* Fix ESLint padded-blocks error in BYOP OAuth callback
https://claude.ai/code/session_01T57Cm84cv2GiSL4DPCccBj
* fix: regression in caption API validation
* fix: remove unneeded migration
* fix: remove duplicate keyless check in apiSourceConfig
* fix: regression in extractReasoningFromData
* refactor: simplify UI unhide logic
* fix: remove BYOP flow due to security concerns
* fix: use a string instead of a constant reference for placeholder key
* fix: reconnect when switching endpoints
* feat: support pollinations in /api-url command
* fix: remove endpoint check from image generation (it always uses authenticated)
* fix: default to authenticated
* fix: use a named constant in auto-connect logic
* fix: filter by modality in anon models list
* fix: remove bespoke model loading logic for anon endpoint
---------
Co-authored-by: Cohee <18619528+Cohee1207@users.noreply.github.com>
Co-authored-by: Claude <noreply@anthropic.com>
578 lines
11 KiB
JavaScript
578 lines
11 KiB
JavaScript
export const PUBLIC_DIRECTORIES = {
|
|
images: 'public/img/',
|
|
backups: 'backups/',
|
|
sounds: 'public/sounds',
|
|
extensions: 'public/scripts/extensions',
|
|
globalExtensions: 'public/scripts/extensions/third-party',
|
|
};
|
|
|
|
export const SETTINGS_FILE = 'settings.json';
|
|
|
|
/**
|
|
* @type {import('./users.js').UserDirectoryList}
|
|
* @readonly
|
|
* @enum {string}
|
|
*/
|
|
export const USER_DIRECTORY_TEMPLATE = Object.freeze({
|
|
root: '',
|
|
thumbnails: 'thumbnails',
|
|
thumbnailsBg: 'thumbnails/bg',
|
|
thumbnailsAvatar: 'thumbnails/avatar',
|
|
thumbnailsPersona: 'thumbnails/persona',
|
|
worlds: 'worlds',
|
|
user: 'user',
|
|
avatars: 'User Avatars',
|
|
userImages: 'user/images',
|
|
groups: 'groups',
|
|
groupChats: 'group chats',
|
|
chats: 'chats',
|
|
characters: 'characters',
|
|
backgrounds: 'backgrounds',
|
|
novelAI_Settings: 'NovelAI Settings',
|
|
koboldAI_Settings: 'KoboldAI Settings',
|
|
openAI_Settings: 'OpenAI Settings',
|
|
textGen_Settings: 'TextGen Settings',
|
|
themes: 'themes',
|
|
movingUI: 'movingUI',
|
|
extensions: 'extensions',
|
|
instruct: 'instruct',
|
|
context: 'context',
|
|
quickreplies: 'QuickReplies',
|
|
assets: 'assets',
|
|
comfyWorkflows: 'user/workflows',
|
|
files: 'user/files',
|
|
vectors: 'vectors',
|
|
backups: 'backups',
|
|
sysprompt: 'sysprompt',
|
|
reasoning: 'reasoning',
|
|
});
|
|
|
|
/**
|
|
* @type {import('./users.js').User}
|
|
* @readonly
|
|
*/
|
|
export const DEFAULT_USER = Object.freeze({
|
|
handle: 'default-user',
|
|
name: 'User',
|
|
created: Date.now(),
|
|
password: '',
|
|
admin: true,
|
|
enabled: true,
|
|
salt: '',
|
|
});
|
|
|
|
export const UNSAFE_EXTENSIONS = [
|
|
'.php',
|
|
'.exe',
|
|
'.com',
|
|
'.dll',
|
|
'.pif',
|
|
'.application',
|
|
'.gadget',
|
|
'.msi',
|
|
'.jar',
|
|
'.cmd',
|
|
'.bat',
|
|
'.reg',
|
|
'.sh',
|
|
'.py',
|
|
'.js',
|
|
'.jse',
|
|
'.jsp',
|
|
'.pdf',
|
|
'.html',
|
|
'.htm',
|
|
'.hta',
|
|
'.vb',
|
|
'.vbs',
|
|
'.vbe',
|
|
'.cpl',
|
|
'.msc',
|
|
'.scr',
|
|
'.sql',
|
|
'.iso',
|
|
'.img',
|
|
'.dmg',
|
|
'.ps1',
|
|
'.ps1xml',
|
|
'.ps2',
|
|
'.ps2xml',
|
|
'.psc1',
|
|
'.psc2',
|
|
'.msh',
|
|
'.msh1',
|
|
'.msh2',
|
|
'.mshxml',
|
|
'.msh1xml',
|
|
'.msh2xml',
|
|
'.scf',
|
|
'.lnk',
|
|
'.inf',
|
|
'.reg',
|
|
'.doc',
|
|
'.docm',
|
|
'.docx',
|
|
'.dot',
|
|
'.dotm',
|
|
'.dotx',
|
|
'.xls',
|
|
'.xlsm',
|
|
'.xlsx',
|
|
'.xlt',
|
|
'.xltm',
|
|
'.xltx',
|
|
'.xlam',
|
|
'.ppt',
|
|
'.pptm',
|
|
'.pptx',
|
|
'.pot',
|
|
'.potm',
|
|
'.potx',
|
|
'.ppam',
|
|
'.ppsx',
|
|
'.ppsm',
|
|
'.pps',
|
|
'.ppam',
|
|
'.sldx',
|
|
'.sldm',
|
|
'.ws',
|
|
];
|
|
|
|
export const GEMINI_SAFETY = [
|
|
{
|
|
category: 'HARM_CATEGORY_HARASSMENT',
|
|
threshold: 'OFF',
|
|
},
|
|
{
|
|
category: 'HARM_CATEGORY_HATE_SPEECH',
|
|
threshold: 'OFF',
|
|
},
|
|
{
|
|
category: 'HARM_CATEGORY_SEXUALLY_EXPLICIT',
|
|
threshold: 'OFF',
|
|
},
|
|
{
|
|
category: 'HARM_CATEGORY_DANGEROUS_CONTENT',
|
|
threshold: 'OFF',
|
|
},
|
|
{
|
|
category: 'HARM_CATEGORY_CIVIC_INTEGRITY',
|
|
threshold: 'OFF',
|
|
},
|
|
];
|
|
|
|
export const VERTEX_SAFETY = [
|
|
{
|
|
category: 'HARM_CATEGORY_IMAGE_HATE',
|
|
threshold: 'OFF',
|
|
},
|
|
{
|
|
category: 'HARM_CATEGORY_IMAGE_DANGEROUS_CONTENT',
|
|
threshold: 'OFF',
|
|
},
|
|
{
|
|
category: 'HARM_CATEGORY_IMAGE_HARASSMENT',
|
|
threshold: 'OFF',
|
|
},
|
|
{
|
|
category: 'HARM_CATEGORY_IMAGE_SEXUALLY_EXPLICIT',
|
|
threshold: 'OFF',
|
|
},
|
|
{
|
|
category: 'HARM_CATEGORY_JAILBREAK',
|
|
threshold: 'OFF',
|
|
},
|
|
];
|
|
|
|
export const CHAT_COMPLETION_SOURCES = {
|
|
OPENAI: 'openai',
|
|
CLAUDE: 'claude',
|
|
OPENROUTER: 'openrouter',
|
|
AI21: 'ai21',
|
|
MAKERSUITE: 'makersuite',
|
|
VERTEXAI: 'vertexai',
|
|
MISTRALAI: 'mistralai',
|
|
CUSTOM: 'custom',
|
|
COHERE: 'cohere',
|
|
PERPLEXITY: 'perplexity',
|
|
GROQ: 'groq',
|
|
CHUTES: 'chutes',
|
|
ELECTRONHUB: 'electronhub',
|
|
NANOGPT: 'nanogpt',
|
|
DEEPSEEK: 'deepseek',
|
|
AIMLAPI: 'aimlapi',
|
|
XAI: 'xai',
|
|
POLLINATIONS: 'pollinations',
|
|
MOONSHOT: 'moonshot',
|
|
FIREWORKS: 'fireworks',
|
|
COMETAPI: 'cometapi',
|
|
AZURE_OPENAI: 'azure_openai',
|
|
ZAI: 'zai',
|
|
SILICONFLOW: 'siliconflow',
|
|
MINIMAX: 'minimax',
|
|
WORKERS_AI: 'workers_ai',
|
|
};
|
|
|
|
/**
|
|
* Path to multer file uploads under the data root.
|
|
*/
|
|
export const UPLOADS_DIRECTORY = '_uploads';
|
|
|
|
// TODO: this is copied from the client code; there should be a way to de-duplicate it eventually
|
|
export const TEXTGEN_TYPES = {
|
|
OOBA: 'ooba',
|
|
MANCER: 'mancer',
|
|
VLLM: 'vllm',
|
|
APHRODITE: 'aphrodite',
|
|
TABBY: 'tabby',
|
|
KOBOLDCPP: 'koboldcpp',
|
|
TOGETHERAI: 'togetherai',
|
|
LLAMACPP: 'llamacpp',
|
|
OLLAMA: 'ollama',
|
|
INFERMATICAI: 'infermaticai',
|
|
DREAMGEN: 'dreamgen',
|
|
OPENROUTER: 'openrouter',
|
|
FEATHERLESS: 'featherless',
|
|
HUGGINGFACE: 'huggingface',
|
|
GENERIC: 'generic',
|
|
};
|
|
|
|
export const INFERMATICAI_KEYS = [
|
|
'model',
|
|
'prompt',
|
|
'max_tokens',
|
|
'temperature',
|
|
'top_p',
|
|
'top_k',
|
|
'repetition_penalty',
|
|
'stream',
|
|
'stop',
|
|
'presence_penalty',
|
|
'frequency_penalty',
|
|
'min_p',
|
|
'seed',
|
|
'ignore_eos',
|
|
'n',
|
|
'best_of',
|
|
'min_tokens',
|
|
'spaces_between_special_tokens',
|
|
'skip_special_tokens',
|
|
'logprobs',
|
|
];
|
|
|
|
export 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://docs.together.ai/reference/completions
|
|
export const TOGETHERAI_KEYS = [
|
|
'model',
|
|
'prompt',
|
|
'max_tokens',
|
|
'temperature',
|
|
'top_p',
|
|
'top_k',
|
|
'repetition_penalty',
|
|
'min_p',
|
|
'presence_penalty',
|
|
'frequency_penalty',
|
|
'stream',
|
|
'stop',
|
|
];
|
|
|
|
// https://github.com/ollama/ollama/blob/main/docs/api.md#request-8
|
|
export const OLLAMA_KEYS = [
|
|
'num_predict',
|
|
'num_ctx',
|
|
'num_batch',
|
|
'stop',
|
|
'temperature',
|
|
'repeat_penalty',
|
|
'presence_penalty',
|
|
'frequency_penalty',
|
|
'top_k',
|
|
'top_p',
|
|
'tfs_z',
|
|
'typical_p',
|
|
'seed',
|
|
'repeat_last_n',
|
|
'min_p',
|
|
];
|
|
|
|
// https://platform.openai.com/docs/api-reference/completions
|
|
export const OPENAI_KEYS = [
|
|
'model',
|
|
'prompt',
|
|
'stream',
|
|
'temperature',
|
|
'top_p',
|
|
'frequency_penalty',
|
|
'presence_penalty',
|
|
'stop',
|
|
'seed',
|
|
'logit_bias',
|
|
'logprobs',
|
|
'max_tokens',
|
|
'n',
|
|
'best_of',
|
|
];
|
|
|
|
export const AVATAR_WIDTH = 512;
|
|
export const AVATAR_HEIGHT = 768;
|
|
export const DEFAULT_AVATAR_PATH = './public/img/ai4.png';
|
|
|
|
export const OPENROUTER_HEADERS = {
|
|
'HTTP-Referer': 'https://sillytavern.app',
|
|
'X-Title': 'SillyTavern',
|
|
};
|
|
|
|
export const AIMLAPI_HEADERS = {
|
|
'HTTP-Referer': 'https://sillytavern.app',
|
|
'X-Title': 'SillyTavern',
|
|
};
|
|
|
|
export const FEATHERLESS_HEADERS = {
|
|
'HTTP-Referer': 'https://sillytavern.app',
|
|
'X-Title': 'SillyTavern',
|
|
};
|
|
|
|
export const OPENROUTER_KEYS = [
|
|
'max_tokens',
|
|
'temperature',
|
|
'top_k',
|
|
'top_p',
|
|
'presence_penalty',
|
|
'frequency_penalty',
|
|
'repetition_penalty',
|
|
'min_p',
|
|
'top_a',
|
|
'seed',
|
|
'logit_bias',
|
|
'model',
|
|
'stream',
|
|
'prompt',
|
|
'stop',
|
|
'provider',
|
|
'include_reasoning',
|
|
];
|
|
|
|
// https://github.com/vllm-project/vllm/blob/0f8a91401c89ac0a8018def3756829611b57727f/vllm/entrypoints/openai/protocol.py#L220
|
|
export const VLLM_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',
|
|
];
|
|
|
|
export const AZURE_OPENAI_KEYS = [
|
|
'messages',
|
|
'temperature',
|
|
'frequency_penalty',
|
|
'presence_penalty',
|
|
'top_p',
|
|
'max_tokens',
|
|
'max_completion_tokens',
|
|
'stream',
|
|
'logit_bias',
|
|
'stop',
|
|
'n',
|
|
'logprobs',
|
|
'seed',
|
|
'tools',
|
|
'tool_choice',
|
|
'reasoning_effort',
|
|
];
|
|
|
|
export const OPENAI_VERBOSITY_MODELS = /^gpt-5/;
|
|
|
|
export const OPENAI_REASONING_EFFORT_MODELS = [
|
|
'o1',
|
|
'o3-mini',
|
|
'o3-mini-2025-01-31',
|
|
'o4-mini',
|
|
'o4-mini-2025-04-16',
|
|
'o3',
|
|
'o3-2025-04-16',
|
|
'gpt-5',
|
|
'gpt-5-2025-08-07',
|
|
'gpt-5-mini',
|
|
'gpt-5-mini-2025-08-07',
|
|
'gpt-5-nano',
|
|
'gpt-5-nano-2025-08-07',
|
|
'gpt-5.1',
|
|
'gpt-5.1-2025-11-13',
|
|
'gpt-5.1-chat-latest',
|
|
'gpt-5.2',
|
|
'gpt-5.2-2025-12-11',
|
|
'gpt-5.2-chat-latest',
|
|
'gpt-5.3-chat-latest',
|
|
'gpt-5.4',
|
|
'gpt-5.4-2026-03-05',
|
|
'gpt-5.4-mini',
|
|
'gpt-5.4-mini-2026-03-17',
|
|
'gpt-5.4-nano',
|
|
'gpt-5.4-nano-2026-03-17',
|
|
'gpt-5.5',
|
|
'gpt-5.5-2026-04-23',
|
|
];
|
|
|
|
export const OPENAI_REASONING_EFFORT_MAP = {
|
|
min: 'minimal',
|
|
};
|
|
|
|
/**
|
|
* Models that only accept a single fixed reasoning effort value.
|
|
* @type {Record<string, string>}
|
|
*/
|
|
export const OPENAI_FIXED_REASONING_EFFORT = {
|
|
'gpt-5.3-chat-latest': 'medium',
|
|
};
|
|
|
|
export const NANOGPT_REASONING_EFFORT_MAP = {
|
|
min: 'none',
|
|
low: 'minimal',
|
|
medium: 'low',
|
|
high: 'medium',
|
|
max: 'high',
|
|
};
|
|
|
|
export const LOG_LEVELS = {
|
|
DEBUG: 0,
|
|
INFO: 1,
|
|
WARN: 2,
|
|
ERROR: 3,
|
|
};
|
|
|
|
/**
|
|
* An array of supported media file extensions.
|
|
* This is used to validate file uploads and ensure that only supported media types are processed.
|
|
*/
|
|
export const MEDIA_EXTENSIONS = [
|
|
'bmp',
|
|
'png',
|
|
'jpg',
|
|
'webp',
|
|
'jpeg',
|
|
'jfif',
|
|
'gif',
|
|
'mp4',
|
|
'avi',
|
|
'mov',
|
|
'wmv',
|
|
'flv',
|
|
'webm',
|
|
'3gp',
|
|
'mkv',
|
|
'mpg',
|
|
'mp3',
|
|
'wav',
|
|
'ogg',
|
|
'flac',
|
|
'aac',
|
|
'm4a',
|
|
'aiff',
|
|
];
|
|
|
|
/**
|
|
* Bitwise flag-style media request types.
|
|
*/
|
|
export const MEDIA_REQUEST_TYPE = {
|
|
IMAGE: 0b001,
|
|
VIDEO: 0b010,
|
|
AUDIO: 0b100,
|
|
};
|
|
|
|
|
|
export const ZAI_ENDPOINT = {
|
|
COMMON: 'common',
|
|
CODING: 'coding',
|
|
};
|
|
|
|
export const POLLINATIONS_ENDPOINT = {
|
|
AUTHENTICATED: 'authenticated',
|
|
ANONYMOUS: 'anonymous',
|
|
};
|
|
|
|
export const SILICONFLOW_ENDPOINT = {
|
|
GLOBAL: 'global',
|
|
CN: 'cn',
|
|
};
|
|
|
|
export const MINIMAX_ENDPOINT = {
|
|
GLOBAL: 'global',
|
|
CN: 'cn',
|
|
};
|