mirror of
https://github.com/open-webui/open-webui.git
synced 2025-12-11 20:05:19 +00:00
Merge pull request #16249 from silentoplayz/fix-richtext-getwordatdocpos
fix(frontend): Attempt to resolve TypeError in RichTextInput.svelte
This commit is contained in:
commit
ae2de6b09c
7 changed files with 20 additions and 20 deletions
|
|
@ -465,7 +465,7 @@ export const executeToolServer = async (
|
|||
...(token && { authorization: `Bearer ${token}` })
|
||||
};
|
||||
|
||||
let requestOptions: RequestInit = {
|
||||
const requestOptions: RequestInit = {
|
||||
method: httpMethod.toUpperCase(),
|
||||
headers
|
||||
};
|
||||
|
|
@ -818,7 +818,7 @@ export const generateQueries = async (
|
|||
model: string,
|
||||
messages: object[],
|
||||
prompt: string,
|
||||
type?: string = 'web_search'
|
||||
type: string = 'web_search'
|
||||
) => {
|
||||
let error = null;
|
||||
|
||||
|
|
@ -1014,7 +1014,7 @@ export const getPipelinesList = async (token: string = '') => {
|
|||
throw error;
|
||||
}
|
||||
|
||||
let pipelines = res?.data ?? [];
|
||||
const pipelines = res?.data ?? [];
|
||||
return pipelines;
|
||||
};
|
||||
|
||||
|
|
@ -1157,7 +1157,7 @@ export const getPipelines = async (token: string, urlIdx?: string) => {
|
|||
throw error;
|
||||
}
|
||||
|
||||
let pipelines = res?.data ?? [];
|
||||
const pipelines = res?.data ?? [];
|
||||
return pipelines;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -331,7 +331,7 @@ export const generateTextCompletion = async (token: string = '', model: string,
|
|||
};
|
||||
|
||||
export const generateChatCompletion = async (token: string = '', body: object) => {
|
||||
let controller = new AbortController();
|
||||
const controller = new AbortController();
|
||||
let error = null;
|
||||
|
||||
const res = await fetch(`${OLLAMA_API_BASE_URL}/api/chat`, {
|
||||
|
|
|
|||
|
|
@ -126,7 +126,7 @@ export const getUsers = async (
|
|||
let error = null;
|
||||
let res = null;
|
||||
|
||||
let searchParams = new URLSearchParams();
|
||||
const searchParams = new URLSearchParams();
|
||||
|
||||
searchParams.set('page', `${page}`);
|
||||
|
||||
|
|
|
|||
|
|
@ -38,10 +38,10 @@ const createIsLoadingStore = (i18n: i18nType) => {
|
|||
};
|
||||
|
||||
export const initI18n = (defaultLocale?: string | undefined) => {
|
||||
let detectionOrder = defaultLocale
|
||||
const detectionOrder = defaultLocale
|
||||
? ['querystring', 'localStorage']
|
||||
: ['querystring', 'localStorage', 'navigator'];
|
||||
let fallbackDefaultLocale = defaultLocale ? [defaultLocale] : ['en-US'];
|
||||
const fallbackDefaultLocale = defaultLocale ? [defaultLocale] : ['en-US'];
|
||||
|
||||
const loadResource = (language: string, namespace: string) =>
|
||||
import(`./locales/${language}/${namespace}.json`);
|
||||
|
|
|
|||
|
|
@ -74,15 +74,15 @@ const readPngChunks = (data) => {
|
|||
|
||||
if (!isValidPng) throw new Error('Invalid PNG file');
|
||||
|
||||
let chunks = [];
|
||||
const chunks = [];
|
||||
let offset = 8; // Skip PNG signature
|
||||
|
||||
while (offset < data.length) {
|
||||
let length =
|
||||
const length =
|
||||
(data[offset] << 24) | (data[offset + 1] << 16) | (data[offset + 2] << 8) | data[offset + 3];
|
||||
let type = String.fromCharCode.apply(null, data.slice(offset + 4, offset + 8));
|
||||
let chunkData = data.slice(offset + 8, offset + 8 + length);
|
||||
let crc =
|
||||
const type = String.fromCharCode.apply(null, data.slice(offset + 4, offset + 8));
|
||||
const chunkData = data.slice(offset + 8, offset + 8 + length);
|
||||
const crc =
|
||||
(data[offset + 8 + length] << 24) |
|
||||
(data[offset + 8 + length + 1] << 16) |
|
||||
(data[offset + 8 + length + 2] << 8) |
|
||||
|
|
|
|||
|
|
@ -23,8 +23,8 @@ const ALLOWED_SURROUNDING_CHARS =
|
|||
// const inlineRule = /^(\${1,2})(?!\$)((?:\\.|[^\\\n])*?(?:\\.|[^\\\n\$]))\1(?=[\s?!\.,:?!。,:]|$)/;
|
||||
// const blockRule = /^(\${1,2})\n((?:\\[^]|[^\\])+?)\n\1(?:\n|$)/;
|
||||
|
||||
let inlinePatterns = [];
|
||||
let blockPatterns = [];
|
||||
const inlinePatterns = [];
|
||||
const blockPatterns = [];
|
||||
|
||||
function escapeRegex(string) {
|
||||
return string.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&');
|
||||
|
|
@ -69,7 +69,7 @@ export default function (options = {}) {
|
|||
}
|
||||
|
||||
function katexStart(src, displayMode: boolean) {
|
||||
let ruleReg = displayMode ? blockRule : inlineRule;
|
||||
const ruleReg = displayMode ? blockRule : inlineRule;
|
||||
|
||||
let indexSrc = src;
|
||||
|
||||
|
|
@ -78,7 +78,7 @@ function katexStart(src, displayMode: boolean) {
|
|||
let startIndex = -1;
|
||||
let startDelimiter = '';
|
||||
let endDelimiter = '';
|
||||
for (let delimiter of DELIMITER_LIST) {
|
||||
for (const delimiter of DELIMITER_LIST) {
|
||||
if (delimiter.display !== displayMode) {
|
||||
continue;
|
||||
}
|
||||
|
|
@ -115,8 +115,8 @@ function katexStart(src, displayMode: boolean) {
|
|||
}
|
||||
|
||||
function katexTokenizer(src, tokens, displayMode: boolean) {
|
||||
let ruleReg = displayMode ? blockRule : inlineRule;
|
||||
let type = displayMode ? 'blockKatex' : 'inlineKatex';
|
||||
const ruleReg = displayMode ? blockRule : inlineRule;
|
||||
const type = displayMode ? 'blockKatex' : 'inlineKatex';
|
||||
|
||||
const match = src.match(ruleReg);
|
||||
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ async function loadPyodideAndPackages(packages: string[] = []) {
|
|||
packages: ['micropip']
|
||||
});
|
||||
|
||||
let mountDir = '/mnt';
|
||||
const mountDir = '/mnt';
|
||||
self.pyodide.FS.mkdirTree(mountDir);
|
||||
// self.pyodide.FS.mount(self.pyodide.FS.filesystems.IDBFS, {}, mountDir);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue