mirror of
				https://github.com/SillyTavern/SillyTavern.git
				synced 2025-06-05 21:59:27 +02:00 
			
		
		
		
	Add types for SillyTavern.getContext
This commit is contained in:
		@@ -18,13 +18,6 @@ import { getCurrentDreamGenModelTokenizer, getCurrentOpenRouterModelTokenizer }
 | 
			
		||||
import { ENCODE_TOKENIZERS, TEXTGEN_TOKENIZERS, getTextTokens, tokenizers } from './tokenizers.js';
 | 
			
		||||
import { getSortableDelay, onlyUnique } from './utils.js';
 | 
			
		||||
 | 
			
		||||
export {
 | 
			
		||||
    settings as textgenerationwebui_settings,
 | 
			
		||||
    loadTextGenSettings,
 | 
			
		||||
    generateTextGenWithStreaming,
 | 
			
		||||
    formatTextGenURL,
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
export const textgen_types = {
 | 
			
		||||
    OOBA: 'ooba',
 | 
			
		||||
    MANCER: 'mancer',
 | 
			
		||||
@@ -197,6 +190,10 @@ const settings = {
 | 
			
		||||
    featherless_model: '',
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
export {
 | 
			
		||||
    settings as textgenerationwebui_settings,
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
export let textgenerationwebui_banned_in_macros = [];
 | 
			
		||||
 | 
			
		||||
export let textgenerationwebui_presets = [];
 | 
			
		||||
@@ -327,7 +324,7 @@ async function selectPreset(name) {
 | 
			
		||||
    saveSettingsDebounced();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function formatTextGenURL(value) {
 | 
			
		||||
export function formatTextGenURL(value) {
 | 
			
		||||
    try {
 | 
			
		||||
        const noFormatTypes = [MANCER, TOGETHERAI, INFERMATICAI, DREAMGEN, OPENROUTER];
 | 
			
		||||
        if (noFormatTypes.includes(settings.type)) {
 | 
			
		||||
@@ -465,7 +462,7 @@ function calculateLogitBias() {
 | 
			
		||||
    return result;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function loadTextGenSettings(data, loadedSettings) {
 | 
			
		||||
export function loadTextGenSettings(data, loadedSettings) {
 | 
			
		||||
    textgenerationwebui_presets = convertPresets(data.textgenerationwebui_presets);
 | 
			
		||||
    textgenerationwebui_preset_names = data.textgenerationwebui_preset_names ?? [];
 | 
			
		||||
    Object.assign(settings, loadedSettings.textgenerationwebui_settings ?? {});
 | 
			
		||||
@@ -889,7 +886,7 @@ function setSettingByName(setting, value, trigger) {
 | 
			
		||||
 * @returns {Promise<(function(): AsyncGenerator<{swipes: [], text: string, toolCalls: [], logprobs: {token: string, topLogprobs: Candidate[]}|null}, void, *>)|*>}
 | 
			
		||||
 * @throws {Error} - If the response status is not OK, or from within the generator
 | 
			
		||||
 */
 | 
			
		||||
async function generateTextGenWithStreaming(generate_data, signal) {
 | 
			
		||||
export async function generateTextGenWithStreaming(generate_data, signal) {
 | 
			
		||||
    generate_data.stream = true;
 | 
			
		||||
 | 
			
		||||
    const response = await fetch('/api/backends/text-completions/generate', {
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user