mirror of
https://github.com/open-webui/open-webui
synced 2024-11-24 04:54:12 +00:00
refac
This commit is contained in:
parent
9a2dd5b126
commit
12c8257c92
@ -893,10 +893,7 @@ def process_file(
|
|||||||
# Update the content in the file
|
# Update the content in the file
|
||||||
# Usage: /files/{file_id}/data/content/update
|
# Usage: /files/{file_id}/data/content/update
|
||||||
|
|
||||||
VECTOR_DB_CLIENT.delete(
|
VECTOR_DB_CLIENT.delete(collection_name=f"file-{file.id}")
|
||||||
collection_name=f"file-{file.id}",
|
|
||||||
filter={"file_id": file.id},
|
|
||||||
)
|
|
||||||
|
|
||||||
docs = [
|
docs = [
|
||||||
Document(
|
Document(
|
||||||
@ -1001,7 +998,7 @@ def process_file(
|
|||||||
collection_name=collection_name,
|
collection_name=collection_name,
|
||||||
metadata={
|
metadata={
|
||||||
"file_id": file.id,
|
"file_id": file.id,
|
||||||
"name": file.meta.get("name", file.filename),
|
"name": file.filename,
|
||||||
"hash": hash,
|
"hash": hash,
|
||||||
},
|
},
|
||||||
add=(True if form_data.collection_name else False),
|
add=(True if form_data.collection_name else False),
|
||||||
|
@ -36,6 +36,10 @@
|
|||||||
let element;
|
let element;
|
||||||
let editor;
|
let editor;
|
||||||
|
|
||||||
|
const options = {
|
||||||
|
throwOnError: false
|
||||||
|
};
|
||||||
|
|
||||||
// Function to find the next template in the document
|
// Function to find the next template in the document
|
||||||
function findNextTemplate(doc, from = 0) {
|
function findNextTemplate(doc, from = 0) {
|
||||||
const patterns = [
|
const patterns = [
|
||||||
@ -113,6 +117,7 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
onMount(() => {
|
onMount(() => {
|
||||||
|
const content = marked.parse(value);
|
||||||
editor = new Editor({
|
editor = new Editor({
|
||||||
element: element,
|
element: element,
|
||||||
extensions: [
|
extensions: [
|
||||||
@ -124,7 +129,7 @@
|
|||||||
Typography,
|
Typography,
|
||||||
Placeholder.configure({ placeholder })
|
Placeholder.configure({ placeholder })
|
||||||
],
|
],
|
||||||
content: marked.parse(value),
|
content: content,
|
||||||
autofocus: true,
|
autofocus: true,
|
||||||
onTransaction: () => {
|
onTransaction: () => {
|
||||||
// force re-render so `editor.isActive` works as expected
|
// force re-render so `editor.isActive` works as expected
|
||||||
|
Loading…
Reference in New Issue
Block a user