mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-05-25 19:15:18 +02:00
SurfSense v3 - Highlight: Local LLM Support
This commit is contained in:
parent
04df919cf9
commit
7f38091d3d
13 changed files with 692 additions and 1345 deletions
|
|
@ -1,6 +1,7 @@
|
|||
from datetime import datetime
|
||||
from typing import List
|
||||
from database import Base, engine
|
||||
from sqlalchemy import Column, ForeignKey, Integer, String, create_engine
|
||||
from sqlalchemy import Column, DateTime, ForeignKey, Integer, String, create_engine
|
||||
from sqlalchemy.orm import relationship
|
||||
|
||||
class BaseModel(Base):
|
||||
|
|
@ -10,12 +11,12 @@ class BaseModel(Base):
|
|||
id = Column(Integer, primary_key=True, index=True)
|
||||
|
||||
|
||||
class Notification(BaseModel):
|
||||
__tablename__ = "notifications"
|
||||
# class Notification(BaseModel):
|
||||
# __tablename__ = "notifications"
|
||||
|
||||
text = Column(String)
|
||||
user_id = Column(ForeignKey('users.id'))
|
||||
user = relationship('User')
|
||||
# text = Column(String)
|
||||
# user_id = Column(ForeignKey('users.id'))
|
||||
# user = relationship('User')
|
||||
|
||||
|
||||
class Chat(BaseModel):
|
||||
|
|
@ -24,18 +25,44 @@ class Chat(BaseModel):
|
|||
type = Column(String)
|
||||
title = Column(String)
|
||||
chats_list = Column(String)
|
||||
|
||||
user_id = Column(ForeignKey('users.id'))
|
||||
user = relationship('User')
|
||||
|
||||
|
||||
class Documents(BaseModel):
|
||||
__tablename__ = "documents"
|
||||
|
||||
title = Column(String)
|
||||
|
||||
created_at = Column(DateTime, default=datetime.now)
|
||||
file_type = Column(String)
|
||||
document_metadata = Column(String)
|
||||
page_content = Column(String)
|
||||
desc_vector_start = Column(Integer, default=0)
|
||||
desc_vector_end = Column(Integer, default=0)
|
||||
|
||||
search_space_id = Column(ForeignKey('searchspaces.id'))
|
||||
search_space = relationship('SearchSpace')
|
||||
|
||||
user_id = Column(ForeignKey('users.id'))
|
||||
user = relationship('User')
|
||||
|
||||
class SearchSpace(BaseModel):
|
||||
__tablename__ = "searchspaces"
|
||||
|
||||
search_space = Column(String, unique=True)
|
||||
|
||||
documents = relationship(Documents)
|
||||
|
||||
class User(BaseModel):
|
||||
__tablename__ = "users"
|
||||
|
||||
username = Column(String, unique=True, index=True)
|
||||
hashed_password = Column(String)
|
||||
graph_config = Column(String)
|
||||
llm_config = Column(String)
|
||||
chats = relationship(Chat)
|
||||
notifications = relationship(Notification)
|
||||
chats = relationship(Chat, order_by="Chat.id")
|
||||
documents = relationship(Documents, order_by="Documents.id")
|
||||
|
||||
|
||||
# Create the database tables if they don't exist
|
||||
User.metadata.create_all(bind=engine)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue