fix(frontend): Attempt to resolve TypeError in RichTextInput.svelte
Fixes an issue where `ue.getWordAtDocPos is not a function` would be thrown in `MessageInput.svelte`. The error was caused by a timing issue where the `getWordAtDocPos` method on the `RichTextInput` component was not available when called from an event handler within the same component. This change refactors the code to pass the `getWordAtDocPos` function as a callback prop from `RichTextInput` to `MessageInput`, ensuring it's available when needed.
This commit is contained in:
@@ -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}`);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user