Timothy J. Baek 9 months ago
parent
commit
c2732a0990

+ 5 - 0
backend/open_webui/migrations/versions/6a39f3d8e55c_add_project_table.py

@@ -9,6 +9,8 @@ Create Date: 2024-10-01 14:02:35.241684
 from alembic import op
 import sqlalchemy as sa
 from sqlalchemy.sql import table, column, select
+import json
+
 
 revision = "6a39f3d8e55c"
 down_revision = "c0fbf31ca0db"
@@ -39,6 +41,7 @@ def upgrade():
         column("user_id", sa.String()),
         column("name", sa.String()),
         column("title", sa.Text()),
+        column("content", sa.Text()),
         column("timestamp", sa.BigInteger()),
     )
 
@@ -49,6 +52,7 @@ def upgrade():
             document_table.c.user_id,
             document_table.c.name,
             document_table.c.title,
+            document_table.c.content,
             document_table.c.timestamp,
         )
     )
@@ -62,6 +66,7 @@ def upgrade():
                 description=doc.name,
                 meta={
                     "legacy": True,
+                    "tags": json.loads(doc.content or "{}").get("tags", []),
                 },
                 name=doc.title,
                 created_at=doc.timestamp,

+ 0 - 9
src/lib/components/chat/MessageInput/Commands/Projects.svelte

@@ -29,15 +29,6 @@
 		selectedIdx = 0;
 	}
 
-	type ObjectWithName = {
-		name: string;
-	};
-
-	const findByName = (obj: ObjectWithName, command: string) => {
-		const name = obj.name.toLowerCase();
-		return name.includes(command.toLowerCase().split(' ')?.at(0)?.substring(1) ?? '');
-	};
-
 	export const selectUp = () => {
 		selectedIdx = Math.max(0, selectedIdx - 1);
 	};