mirror of
https://github.com/Cinnamon/kotaemon.git
synced 2026-02-23 19:49:37 +01:00
fix: user_id to string in models
This commit is contained in:
@@ -29,7 +29,7 @@ class BaseConversation(SQLModel):
|
||||
datetime.datetime.now(get_localzone()).strftime("%Y-%m-%d %H:%M:%S")
|
||||
)
|
||||
)
|
||||
user: int = Field(default=0) # For now we only have one user
|
||||
user: str = Field(default="") # For now we only have one user
|
||||
|
||||
is_public: bool = Field(default=False)
|
||||
|
||||
@@ -76,7 +76,7 @@ class BaseSettings(SQLModel):
|
||||
id: str = Field(
|
||||
default_factory=lambda: uuid.uuid4().hex, primary_key=True, index=True
|
||||
)
|
||||
user: int = Field(default=0)
|
||||
user: str = Field(default="")
|
||||
setting: dict = Field(default={}, sa_column=Column(JSON))
|
||||
|
||||
|
||||
@@ -97,4 +97,4 @@ class BaseIssueReport(SQLModel):
|
||||
issues: dict = Field(default={}, sa_column=Column(JSON))
|
||||
chat: Optional[dict] = Field(default=None, sa_column=Column(JSON))
|
||||
settings: Optional[dict] = Field(default=None, sa_column=Column(JSON))
|
||||
user: Optional[int] = Field(default=None)
|
||||
user: Optional[str] = Field(default=None)
|
||||
|
||||
@@ -17,6 +17,10 @@ from kotaemon.storages import BaseDocumentStore, BaseVectorStore
|
||||
from .base import BaseFileIndexIndexing, BaseFileIndexRetriever
|
||||
|
||||
|
||||
def generate_uuid():
|
||||
return str(uuid.uuid4())
|
||||
|
||||
|
||||
class FileIndex(BaseIndex):
|
||||
"""
|
||||
File index to store and allow retrieval of files
|
||||
@@ -76,7 +80,7 @@ class FileIndex(BaseIndex):
|
||||
"date_created": Column(
|
||||
DateTime(timezone=True), default=datetime.now(get_localzone())
|
||||
),
|
||||
"user": Column(Integer, default=1),
|
||||
"user": Column(String, default=""),
|
||||
"note": Column(
|
||||
MutableDict.as_mutable(JSON), # type: ignore
|
||||
default={},
|
||||
@@ -101,7 +105,7 @@ class FileIndex(BaseIndex):
|
||||
"date_created": Column(
|
||||
DateTime(timezone=True), default=datetime.now(get_localzone())
|
||||
),
|
||||
"user": Column(Integer, default=1),
|
||||
"user": Column(String, default=""),
|
||||
"note": Column(
|
||||
MutableDict.as_mutable(JSON), # type: ignore
|
||||
default={},
|
||||
@@ -125,7 +129,12 @@ class FileIndex(BaseIndex):
|
||||
(Base,),
|
||||
{
|
||||
"__tablename__": f"index__{self.id}__group",
|
||||
"id": Column(Integer, primary_key=True, autoincrement=True),
|
||||
"id": Column(
|
||||
String,
|
||||
primary_key=True,
|
||||
default=lambda: str(uuid.uuid4()),
|
||||
unique=True,
|
||||
),
|
||||
"date_created": Column(
|
||||
DateTime(timezone=True), default=datetime.now(get_localzone())
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user